mirror of
https://github.com/gryf/wicd.git
synced 2025-12-22 22:27: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))
|
||||||
|
|||||||
@@ -446,16 +446,31 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<widget class="GtkDialog" id="pref_dialog">
|
<widget class="GtkDialog" id="pref_dialog">
|
||||||
<property name="title" translatable="yes">Preferences</property>
|
<property name="title" translatable="yes">Preferences</property>
|
||||||
|
<property name="default_width">125</property>
|
||||||
|
<property name="default_height">590</property>
|
||||||
|
<property name="icon">.</property>
|
||||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||||
<child internal-child="vbox">
|
<child internal-child="vbox">
|
||||||
<widget class="GtkVBox" id="dialog-vbox4">
|
<widget class="GtkVBox" id="dialog-vbox4">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkScrolledWindow" id="scrolledwindow1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
|
||||||
|
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkViewport" id="viewport2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="resize_mode">GTK_RESIZE_QUEUE</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkNotebook" id="notebook2">
|
<widget class="GtkNotebook" id="notebook2">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkVBox" id="vbox6">
|
<widget class="GtkVBox" id="vbox5">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
<property name="spacing">5</property>
|
<property name="spacing">5</property>
|
||||||
@@ -480,7 +495,7 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkHBox" id="hbox16">
|
<widget class="GtkHBox" id="hbox10">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="pref_wifi_label">
|
<widget class="GtkLabel" id="pref_wifi_label">
|
||||||
@@ -510,7 +525,7 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkHBox" id="hbox18">
|
<widget class="GtkHBox" id="hbox11">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="pref_wired_label">
|
<widget class="GtkLabel" id="pref_wired_label">
|
||||||
@@ -554,7 +569,7 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkHBox" id="hbox20">
|
<widget class="GtkHBox" id="hbox12">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="pref_dns1_label">
|
<widget class="GtkLabel" id="pref_dns1_label">
|
||||||
@@ -588,7 +603,7 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkHBox" id="hbox22">
|
<widget class="GtkHBox" id="hbox13">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="pref_dns2_label">
|
<widget class="GtkLabel" id="pref_dns2_label">
|
||||||
@@ -622,7 +637,7 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkHBox" id="hbox24">
|
<widget class="GtkHBox" id="hbox14">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="pref_dns3_label">
|
<widget class="GtkLabel" id="pref_dns3_label">
|
||||||
@@ -715,7 +730,7 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkHSeparator" id="hseparator5">
|
<widget class="GtkHSeparator" id="hseparator3">
|
||||||
<property name="width_request">2</property>
|
<property name="width_request">2</property>
|
||||||
<property name="height_request">8</property>
|
<property name="height_request">8</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
@@ -797,11 +812,11 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkVBox" id="vbox7">
|
<widget class="GtkVBox" id="vbox6">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkVBox" id="vbox8">
|
<widget class="GtkVBox" id="vbox7">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
<property name="spacing">5</property>
|
<property name="spacing">5</property>
|
||||||
@@ -878,7 +893,7 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkHSeparator" id="hseparator6">
|
<widget class="GtkHSeparator" id="hseparator4">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
</widget>
|
</widget>
|
||||||
@@ -889,7 +904,7 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkVBox" id="vbox9">
|
<widget class="GtkVBox" id="vbox8">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
<property name="spacing">5</property>
|
<property name="spacing">5</property>
|
||||||
@@ -952,7 +967,7 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkHSeparator" id="hseparator7">
|
<widget class="GtkHSeparator" id="hseparator5">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
</widget>
|
</widget>
|
||||||
@@ -963,7 +978,7 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkVBox" id="vbox10">
|
<widget class="GtkVBox" id="vbox9">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
<child>
|
<child>
|
||||||
@@ -1041,6 +1056,10 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="position">2</property>
|
<property name="position">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
@@ -1050,7 +1069,7 @@
|
|||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkButton" id="cancelbutton1">
|
<widget class="GtkButton" id="cancelbutton">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="can_default">True</property>
|
<property name="can_default">True</property>
|
||||||
@@ -1060,7 +1079,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkButton" id="okbutton1">
|
<widget class="GtkButton" id="okbutton">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="can_default">True</property>
|
<property name="can_default">True</property>
|
||||||
|
|||||||
14
gui.py
14
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())
|
||||||
@@ -1444,6 +1450,8 @@ class appGui:
|
|||||||
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