mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-11 19:08:40 +00:00
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
This commit is contained in:
parent
efa125ac83
commit
2909e285fc
2 changed files with 17 additions and 24 deletions
|
@ -146,10 +146,6 @@ class GtkUI:
|
||||||
except:
|
except:
|
||||||
pass
|
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():
|
if deluge.common.windows_check():
|
||||||
from win32api import SetConsoleCtrlHandler
|
from win32api import SetConsoleCtrlHandler
|
||||||
from win32con import CTRL_CLOSE_EVENT
|
from win32con import CTRL_CLOSE_EVENT
|
||||||
|
@ -201,16 +197,11 @@ class GtkUI:
|
||||||
self.connectionmanager = ConnectionManager()
|
self.connectionmanager = ConnectionManager()
|
||||||
|
|
||||||
reactor.callWhenRunning(self._on_reactor_start)
|
reactor.callWhenRunning(self._on_reactor_start)
|
||||||
|
|
||||||
# Start the gtk main loop
|
# Start the gtk main loop
|
||||||
try:
|
|
||||||
gtk.gdk.threads_enter()
|
gtk.gdk.threads_enter()
|
||||||
reactor.run()
|
reactor.run()
|
||||||
|
self.shutdown()
|
||||||
gtk.gdk.threads_leave()
|
gtk.gdk.threads_leave()
|
||||||
except KeyboardInterrupt:
|
|
||||||
self.shutdown()
|
|
||||||
else:
|
|
||||||
self.shutdown()
|
|
||||||
|
|
||||||
def shutdown(self, *args, **kwargs):
|
def shutdown(self, *args, **kwargs):
|
||||||
log.debug("gtkui shutting down..")
|
log.debug("gtkui shutting down..")
|
||||||
|
@ -223,6 +214,7 @@ class GtkUI:
|
||||||
|
|
||||||
# Shutdown all components
|
# Shutdown all components
|
||||||
component.shutdown()
|
component.shutdown()
|
||||||
|
|
||||||
if self.started_in_classic:
|
if self.started_in_classic:
|
||||||
try:
|
try:
|
||||||
client.daemon.shutdown()
|
client.daemon.shutdown()
|
||||||
|
@ -232,13 +224,10 @@ class GtkUI:
|
||||||
# Make sure the config is saved.
|
# Make sure the config is saved.
|
||||||
self.config.save()
|
self.config.save()
|
||||||
|
|
||||||
try:
|
|
||||||
gtk.main_quit()
|
|
||||||
except RuntimeError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def _on_reactor_start(self):
|
def _on_reactor_start(self):
|
||||||
log.debug("_on_reactor_start")
|
log.debug("_on_reactor_start")
|
||||||
|
self.mainwindow.first_show()
|
||||||
|
|
||||||
if self.config["classic_mode"]:
|
if self.config["classic_mode"]:
|
||||||
try:
|
try:
|
||||||
client.start_classic_mode()
|
client.start_classic_mode()
|
||||||
|
|
|
@ -72,6 +72,7 @@ class MainWindow(component.Component):
|
||||||
except:
|
except:
|
||||||
self.window.set_icon(common.get_logo(32))
|
self.window.set_icon(common.get_logo(32))
|
||||||
self.vpaned = self.main_glade.get_widget("vpaned")
|
self.vpaned = self.main_glade.get_widget("vpaned")
|
||||||
|
self.initial_vpaned_position = self.config["window_pane_position"]
|
||||||
|
|
||||||
# Load the window state
|
# Load the window state
|
||||||
self.load_window_state()
|
self.load_window_state()
|
||||||
|
@ -93,14 +94,18 @@ class MainWindow(component.Component):
|
||||||
|
|
||||||
self.config.register_set_function("show_rate_in_title", self._on_set_show_rate_in_title, apply_now=False)
|
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 \
|
if not(self.config["start_in_tray"] and \
|
||||||
self.config["enable_system_tray"]) and not \
|
self.config["enable_system_tray"]) and not \
|
||||||
self.window.get_property("visible"):
|
self.window.get_property("visible"):
|
||||||
log.debug("Showing window")
|
log.debug("Showing window")
|
||||||
self.show()
|
self.show()
|
||||||
|
while gtk.events_pending():
|
||||||
client.register_event_handler("NewVersionAvailableEvent", self.on_newversionavailable_event)
|
gtk.main_iteration(False)
|
||||||
client.register_event_handler("TorrentFinishedEvent", self.on_torrentfinished_event)
|
self.vpaned.set_position(self.initial_vpaned_position)
|
||||||
|
|
||||||
def show(self):
|
def show(self):
|
||||||
try:
|
try:
|
||||||
|
@ -112,6 +117,7 @@ class MainWindow(component.Component):
|
||||||
|
|
||||||
self.window.show()
|
self.window.show()
|
||||||
|
|
||||||
|
|
||||||
def hide(self):
|
def hide(self):
|
||||||
component.pause("TorrentView")
|
component.pause("TorrentView")
|
||||||
component.pause("StatusBar")
|
component.pause("StatusBar")
|
||||||
|
@ -162,8 +168,6 @@ class MainWindow(component.Component):
|
||||||
self.window.resize(w, h)
|
self.window.resize(w, h)
|
||||||
if self.config["window_maximized"]:
|
if self.config["window_maximized"]:
|
||||||
self.window.maximize()
|
self.window.maximize()
|
||||||
self.vpaned.set_position(
|
|
||||||
self.config["window_height"] - self.config["window_pane_position"])
|
|
||||||
|
|
||||||
def on_window_configure_event(self, widget, event):
|
def on_window_configure_event(self, widget, event):
|
||||||
if not self.config["window_maximized"] and self.visible:
|
if not self.config["window_maximized"] and self.visible:
|
||||||
|
@ -204,7 +208,7 @@ class MainWindow(component.Component):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def on_vpaned_position_event(self, obj, param):
|
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):
|
def on_drag_data_received_event(self, widget, drag_context, x, y, selection_data, info, timestamp):
|
||||||
args = []
|
args = []
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue