1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-22 14:07:59 +01:00

Lowered minimum GUI height to 400.

Added support for the GUI to remember when its resized.
This commit is contained in:
imdano
2007-12-17 11:42:16 +00:00
parent 216175b138
commit 4dadeefdd6
3 changed files with 43 additions and 2 deletions

View File

@@ -1045,6 +1045,40 @@ class ConnectionWizard(dbus.service.Object):
return "500: Profile Not Found"
#end function ReadWirelessNetworkProfile
@dbus.service.method('org.wicd.daemon.config')
def WriteWindowSize(self, width, height):
"""Write the desired default window size"""
config = ConfigParser.ConfigParser()
config.read(self.app_conf)
if config.has_section("Settings"):
config.set("Settings", "window_width", width)
config.set("Settings", "window_height", height)
config.write(open(self.app_conf, "w"))
@dbus.service.method('org.wicd.daemon.config')
def ReadWindowSize(self):
"""Returns a list containing the desired default window size
Attempts to read the default size from the config file,
and if that fails, returns a default of 605 x 400.
"""
config = ConfigParser.ConfigParser()
config.read(self.app_conf)
if config.has_section("Settings"):
if config.has_option("Settings", "window_width"):
width = config.get("Settings", "window_width")
else:
width = 605
if config.has_option("Settings", "window_height"):
height = config.get("Settings", "window_height")
else:
height = 400
size = []
size.append(int(width))
size.append(int(height))
return size
#############################################
########## INTERNAL FUNCTIONS ###############
#############################################

View File

@@ -3,8 +3,8 @@
<!--Generated with glade3 3.2.2 on Sun Jul 1 23:19:18 2007 by adam@adam-->
<glade-interface>
<widget class="GtkWindow" id="window1">
<property name="width_request">580</property>
<property name="height_request">600</property>
<property name="width_request">605</property>
<property name="height_request">400</property>
<property name="visible">True</property>
<property name="title" translatable="yes">Wicd Manager</property>
<property name="window_position">GTK_WIN_POS_CENTER_ALWAYS</property>

7
gui.py
View File

@@ -928,6 +928,11 @@ class appGui:
self.is_visible = True
self.window.connect('delete_event', self.exit)
size = config.ReadWindowSize()
width = size[0]
height = size[1]
if width > -1 and height > -1:
self.window.resize(int(width), int(height))
gobject.timeout_add(600, self.update_statusbar)
gobject.timeout_add(100, self.pulse_progress_bar)
@@ -1330,6 +1335,8 @@ class appGui:
def exit(self, widget=None, event=None):
self.window.hide()
self.is_visible = False
[width, height] = self.window.get_size()
config.WriteWindowSize(width, height)
while gtk.events_pending():
gtk.main_iteration()
return True