mirror of
https://github.com/gryf/wicd.git
synced 2025-12-22 14:07:59 +01:00
Added support for resizing the preferences window to any size. Also added support for remembing the size of the preferences window.
This commit is contained in:
38
daemon.py
38
daemon.py
@@ -1206,34 +1206,52 @@ class ConnectionWizard(dbus.service.Object):
|
|||||||
return "100: Loaded Profile"
|
return "100: Loaded Profile"
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon.config')
|
@dbus.service.method('org.wicd.daemon.config')
|
||||||
def WriteWindowSize(self, width, height):
|
def WriteWindowSize(self, width, height, win_name):
|
||||||
"""Write the desired default window size"""
|
"""Write the desired default window size"""
|
||||||
|
if win_name == "main":
|
||||||
|
height_str = "window_height"
|
||||||
|
width_str = "window_width"
|
||||||
|
else:
|
||||||
|
height_str = "pref_height"
|
||||||
|
width_str = "pref_width"
|
||||||
config = ConfigParser.ConfigParser()
|
config = ConfigParser.ConfigParser()
|
||||||
config.read(self.app_conf)
|
config.read(self.app_conf)
|
||||||
if config.has_section("Settings"):
|
if config.has_section("Settings"):
|
||||||
config.set("Settings", "window_width", width)
|
config.set("Settings", width_str, width)
|
||||||
config.set("Settings", "window_height", height)
|
config.set("Settings", height_str, height)
|
||||||
config.write(open(self.app_conf, "w"))
|
config.write(open(self.app_conf, "w"))
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon.config')
|
@dbus.service.method('org.wicd.daemon.config')
|
||||||
def ReadWindowSize(self):
|
def ReadWindowSize(self, win_name):
|
||||||
"""Returns a list containing the desired default window size
|
"""Returns a list containing the desired default window size
|
||||||
|
|
||||||
Attempts to read the default size from the config file,
|
Attempts to read the default size from the config file,
|
||||||
and if that fails, returns a default of 605 x 400.
|
and if that fails, returns a default of 605 x 400.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
if win_name == "main":
|
||||||
|
default_width = 605
|
||||||
|
default_height = 400
|
||||||
|
width_str = "window_width"
|
||||||
|
height_str = "window_height"
|
||||||
|
else:
|
||||||
|
default_width = 125
|
||||||
|
default_height = 590
|
||||||
|
width_str = "pref_width"
|
||||||
|
height_str = "pref_height"
|
||||||
|
|
||||||
|
|
||||||
config = ConfigParser.ConfigParser()
|
config = ConfigParser.ConfigParser()
|
||||||
config.read(self.app_conf)
|
config.read(self.app_conf)
|
||||||
if config.has_section("Settings"):
|
if config.has_section("Settings"):
|
||||||
if config.has_option("Settings", "window_width"):
|
if config.has_option("Settings", width_str):
|
||||||
width = config.get("Settings", "window_width")
|
width = config.get("Settings", width_str)
|
||||||
else:
|
else:
|
||||||
width = 605
|
width = default_width
|
||||||
if config.has_option("Settings", "window_height"):
|
if config.has_option("Settings", height_str):
|
||||||
height = config.get("Settings", "window_height")
|
height = config.get("Settings", height_str)
|
||||||
else:
|
else:
|
||||||
height = 400
|
height = default_height
|
||||||
size = []
|
size = []
|
||||||
size.append(int(width))
|
size.append(int(width))
|
||||||
size.append(int(height))
|
size.append(int(height))
|
||||||
|
|||||||
1149
data/wicd.glade
1149
data/wicd.glade
File diff suppressed because it is too large
Load Diff
16
gui.py
16
gui.py
@@ -392,7 +392,7 @@ class AdvancedSettingsDialog(gtk.Dialog):
|
|||||||
def toggle_ip_checkbox(self, widget=None):
|
def toggle_ip_checkbox(self, widget=None):
|
||||||
"""Toggle entries/checkboxes based on the static IP checkbox. """
|
"""Toggle entries/checkboxes based on the static IP checkbox. """
|
||||||
# Should disable the static IP text boxes, and also enable the DNS
|
# Should disable the static IP text boxes, and also enable the DNS
|
||||||
#checkbox when disabled and disable when enabled.
|
# checkbox when disabled and disable when enabled.
|
||||||
if self.chkbox_static_ip.get_active():
|
if self.chkbox_static_ip.get_active():
|
||||||
self.chkbox_static_dns.set_active(True)
|
self.chkbox_static_dns.set_active(True)
|
||||||
self.chkbox_static_dns.set_sensitive(False)
|
self.chkbox_static_dns.set_sensitive(False)
|
||||||
@@ -1167,6 +1167,7 @@ class appGui:
|
|||||||
self.is_visible = True
|
self.is_visible = True
|
||||||
self.pulse_active = False
|
self.pulse_active = False
|
||||||
self.standalone = standalone
|
self.standalone = standalone
|
||||||
|
self.wpadrivercombo = None
|
||||||
|
|
||||||
self.window.connect('delete_event', self.exit)
|
self.window.connect('delete_event', self.exit)
|
||||||
|
|
||||||
@@ -1179,7 +1180,7 @@ class appGui:
|
|||||||
else:
|
else:
|
||||||
self.wTree.get_widget("iface_menu_enable_wired").hide()
|
self.wTree.get_widget("iface_menu_enable_wired").hide()
|
||||||
|
|
||||||
size = config.ReadWindowSize()
|
size = config.ReadWindowSize("main")
|
||||||
width = size[0]
|
width = size[0]
|
||||||
height = size[1]
|
height = size[1]
|
||||||
if width > -1 and height > -1:
|
if width > -1 and height > -1:
|
||||||
@@ -1255,6 +1256,11 @@ class appGui:
|
|||||||
""" Displays a general settings dialog. """
|
""" Displays a general settings dialog. """
|
||||||
dialog = self.wTree.get_widget("pref_dialog")
|
dialog = self.wTree.get_widget("pref_dialog")
|
||||||
dialog.set_title(language['preferences'])
|
dialog.set_title(language['preferences'])
|
||||||
|
size = config.ReadWindowSize("pref")
|
||||||
|
width = size[0]
|
||||||
|
height = size[1]
|
||||||
|
if width > -1 and height > -1:
|
||||||
|
dialog.resize(int(width), int(height))
|
||||||
wiredcheckbox = self.wTree.get_widget("pref_always_check")
|
wiredcheckbox = self.wTree.get_widget("pref_always_check")
|
||||||
wiredcheckbox.set_label(language['wired_always_on'])
|
wiredcheckbox.set_label(language['wired_always_on'])
|
||||||
wiredcheckbox.set_active(wired.GetAlwaysShowWiredInterface())
|
wiredcheckbox.set_active(wired.GetAlwaysShowWiredInterface())
|
||||||
@@ -1442,8 +1448,10 @@ class appGui:
|
|||||||
else:
|
else:
|
||||||
flush_tool = misc.ROUTE
|
flush_tool = misc.ROUTE
|
||||||
daemon.SetFlushTool(flush_tool)
|
daemon.SetFlushTool(flush_tool)
|
||||||
|
|
||||||
dialog.hide()
|
dialog.hide()
|
||||||
|
[width, height] = dialog.get_size()
|
||||||
|
config.WriteWindowSize(width, height, "pref")
|
||||||
|
|
||||||
def set_label(self, glade_str, label):
|
def set_label(self, glade_str, label):
|
||||||
""" Sets the label for the given widget in wicd.glade. """
|
""" Sets the label for the given widget in wicd.glade. """
|
||||||
@@ -1903,7 +1911,7 @@ class appGui:
|
|||||||
"""
|
"""
|
||||||
self.window.hide()
|
self.window.hide()
|
||||||
[width, height] = self.window.get_size()
|
[width, height] = self.window.get_size()
|
||||||
config.WriteWindowSize(width, height)
|
config.WriteWindowSize(width, height, "main")
|
||||||
|
|
||||||
if self.standalone:
|
if self.standalone:
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|||||||
Reference in New Issue
Block a user