Fix showing th...
Content-type: text/plain
Author: andar
Revision: 5383
Log:
Fix turning off Classic mode dialog
Fix showing the connection manager icon on the toolbar depending on classic
mode setting
Diff:
Modified: trunk/deluge/ui/gtkui/gtkui.py
===================================================================
--- trunk/deluge/ui/gtkui/gtkui.py 2009-06-10 22:43:43 UTC (rev 5382)
+++ trunk/deluge/ui/gtkui/gtkui.py 2009-06-10 22:50:57 UTC (rev 5383)
@@ -237,36 +237,44 @@
try:
client.start_classic_mode()
except deluge.error.DaemonRunningError:
- response = dialogs.YesNoDialog(
+ d = dialogs.YesNoDialog(
_("Turn off Classic Mode?"),
_("It appears that a Deluge daemon process (deluged) is
already running.\n\n\
You will either need to stop the daemon or turn off Classic Mode to
continue.")).run()
self.started_in_classic = False
- if response != gtk.RESPONSE_YES:
- # The user does not want to turn Classic Mode off, so just
quit
- reactor.stop()
- return
- # Turning off classic_mode
- self.config["classic_mode"] = False
+ def on_dialog_response(response):
+ if response != gtk.RESPONSE_YES:
+ # The user does not want to turn Classic Mode off, so
just quit
+ reactor.stop()
+ return
+ # Turning off classic_mode
+ self.config["classic_mode"] = False
+ self.__start_non_classic()
+
+ d.addCallback(on_dialog_response)
else:
component.start()
return
- # Autoconnect to a host
- if self.config["autoconnect"]:
- for host in self.connectionmanager.config["hosts"]:
- if host[0] == self.config["autoconnect_host_id"]:
- def on_connect(connector):
- component.start()
- client.connect(*host[1:]).addCallback(on_connect)
+ else:
+ self.__start_non_classic()
- if self.config["show_connection_manager_on_start"]:
- # XXX: We need to call a simulate() here, but this could be a bug
in twisted
- reactor.simulate()
- self.connectionmanager.show()
+ def __start_non_classic(self):
+ # Autoconnect to a host
+ if self.config["autoconnect"]:
+ for host in self.connectionmanager.config["hosts"]:
+ if host[0] == self.config["autoconnect_host_id"]:
+ def on_connect(connector):
+ component.start()
+ client.connect(*host[1:]).addCallback(on_connect)
+ if self.config["show_connection_manager_on_start"]:
+ # XXX: We need to call a simulate() here, but this could be a
bug in twisted
+ reactor.simulate()
+ self.connectionmanager.show()
+
def __on_disconnect(self):
"""
Called when disconnected from the daemon. We basically just stop all
Modified: trunk/deluge/ui/gtkui/toolbar.py
===================================================================
--- trunk/deluge/ui/gtkui/toolbar.py 2009-06-10 22:43:43 UTC (rev 5382)
+++ trunk/deluge/ui/gtkui/toolbar.py 2009-06-10 22:50:57 UTC (rev 5383)
@@ -74,13 +74,15 @@
"toolbutton_queue_down"
]
- if self.config["classic_mode"]:
-
self.window.main_glade.get_widget("toolbutton_connectionmanager").hide()
+ self.config.register_set_function("classic_mode",
self._on_classic_mode, True)
# Hide if necessary
self.visible(self.config["show_toolbar"])
def start(self):
+ if not self.config["classic_mode"]:
+
self.window.main_glade.get_widget("toolbutton_connectionmanager").show()
+
for widget in self.change_sensitivity:
self.window.main_glade.get_widget(widget).set_sensitive(True)
@@ -176,3 +178,10 @@
def on_toolbutton_queue_down_clicked(self, data):
log.debug("on_toolbutton_queue_down_clicked")
component.get("MenuBar").on_menuitem_queue_down_activate(data)
+
+ def _on_classic_mode(self, key, value):
+ w = self.window.main_glade.get_widget("toolbutton_connectionmanager")
+ if value:
+ w.hide()
+ else:
+ w.show()
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---