Author: andar
Revision: 5460
Log:
Fix restoring vpaned position when window is maximized
Fix stopping gtkui with ctrl+c
Fix showing the connection manager window in the certain of the window if
maximized on start-up
Diff:
Modified: trunk/deluge/ui/gtkui/gtkui.py
===================================================================
--- trunk/deluge/ui/gtkui/gtkui.py 2009-07-06 05:18:18 UTC (rev 5459)
+++ trunk/deluge/ui/gtkui/gtkui.py 2009-07-06 06:29:45 UTC (rev 5460)
@@ -146,10 +146,6 @@
except:
pass
- # Twisted catches signals to terminate, so just have it call the
shutdown
- # method.
- reactor.addSystemEventTrigger("after", "shutdown", self.shutdown)
-
if deluge.common.windows_check():
from win32api import SetConsoleCtrlHandler
from win32con import CTRL_CLOSE_EVENT
@@ -201,16 +197,11 @@
self.connectionmanager = ConnectionManager()
reactor.callWhenRunning(self._on_reactor_start)
-
# Start the gtk main loop
- try:
- gtk.gdk.threads_enter()
- reactor.run()
- gtk.gdk.threads_leave()
- except KeyboardInterrupt:
- self.shutdown()
- else:
- self.shutdown()
+ gtk.gdk.threads_enter()
+ reactor.run()
+ self.shutdown()
+ gtk.gdk.threads_leave()
def shutdown(self, *args, **kwargs):
log.debug("gtkui shutting down..")
@@ -223,6 +214,7 @@
# Shutdown all components
component.shutdown()
+
if self.started_in_classic:
try:
client.daemon.shutdown()
@@ -232,13 +224,10 @@
# Make sure the config is saved.
self.config.save()
- try:
- gtk.main_quit()
- except RuntimeError:
- pass
-
def _on_reactor_start(self):
log.debug("_on_reactor_start")
+ self.mainwindow.first_show()
+
if self.config["classic_mode"]:
try:
client.start_classic_mode()
Modified: trunk/deluge/ui/gtkui/mainwindow.py
===================================================================
--- trunk/deluge/ui/gtkui/mainwindow.py 2009-07-06 05:18:18 UTC (rev 5459)
+++ trunk/deluge/ui/gtkui/mainwindow.py 2009-07-06 06:29:45 UTC (rev 5460)
@@ -72,6 +72,7 @@
except:
self.window.set_icon(common.get_logo(32))
self.vpaned = self.main_glade.get_widget("vpaned")
+ self.initial_vpaned_position = self.config["window_pane_position"]
# Load the window state
self.load_window_state()
@@ -93,15 +94,19 @@
self.config.register_set_function("show_rate_in_title",
self._on_set_show_rate_in_title, apply_now=False)
+ client.register_event_handler("NewVersionAvailableEvent",
self.on_newversionavailable_event)
+ client.register_event_handler("TorrentFinishedEvent",
self.on_torrentfinished_event)
+
+ def first_show(self):
if not(self.config["start_in_tray"] and \
self.config["enable_system_tray"]) and not \
self.window.get_property("visible"):
log.debug("Showing window")
self.show()
+ while gtk.events_pending():
+ gtk.main_iteration(False)
+ self.vpaned.set_position(self.initial_vpaned_position)
- client.register_event_handler("NewVersionAvailableEvent",
self.on_newversionavailable_event)
- client.register_event_handler("TorrentFinishedEvent",
self.on_torrentfinished_event)
-
def show(self):
try:
component.resume("TorrentView")
@@ -112,6 +117,7 @@
self.window.show()
+
def hide(self):
component.pause("TorrentView")
component.pause("StatusBar")
@@ -162,8 +168,6 @@
self.window.resize(w, h)
if self.config["window_maximized"]:
self.window.maximize()
- self.vpaned.set_position(
- self.config["window_height"] - self.config["window_pane_position"])
def on_window_configure_event(self, widget, event):
if not self.config["window_maximized"] and self.visible:
@@ -204,7 +208,7 @@
return True
def on_vpaned_position_event(self, obj, param):
- self.config["window_pane_position"] = self.config["window_height"] -
self.vpaned.get_position()
+ self.config["window_pane_position"] = self.vpaned.get_position()
def on_drag_data_received_event(self, widget, drag_context, x, y,
selection_data, info, timestamp):
args = []
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---