Do not update UI when minimized or hidden.

This commit is contained in:
Andrew Resch 2008-01-30 12:56:50 +00:00
parent 2fba592e6c
commit 1653a72c7a
4 changed files with 35 additions and 13 deletions

1
TODO
View File

@ -13,7 +13,6 @@
* Add a health indication to the statusbar
* Fix up preferences for when using a remote host.. the download folders, etc..
* Add decay items to statusbar.. items that will disappear after X seconds
* Do not update UI when minimized or hidden
* Add command line option to change config dir.. --config
* Add method for plugins to add labels
* Add context menus for labels.. ie. setting options for all torrents in label

View File

@ -118,12 +118,15 @@ class ComponentRegistry:
def stop(self):
"""Stops all components"""
for component in self.components.keys():
if self.components[component].get_state != \
COMPONENT_STATE.index("Stopped"):
log.debug("Stopping component %s..", component)
self.components[component].stop()
self.components[component]._stop()
self.stop_component(component)
def stop_component(self, component):
if self.components[component].get_state != \
COMPONENT_STATE.index("Stopped"):
log.debug("Stopping component %s..", component)
self.components[component].stop()
self.components[component]._stop()
def update(self):
"""Updates all components"""
for component in self.components.keys():
@ -153,13 +156,19 @@ def register(name, obj, depend=None):
"""Registers a component with the registry"""
_ComponentRegistry.register(name, obj, depend)
def start():
def start(component=None):
"""Starts all components"""
_ComponentRegistry.start()
if component == None:
_ComponentRegistry.start()
else:
_ComponentRegistry.start_component(component)
def stop():
"""Stops all components"""
_ComponentRegistry.stop()
def stop(component=None):
"""Stops all or specified components"""
if component == None:
_ComponentRegistry.stop()
else:
_ComponentRegistry.stop_component(component)
def update():
"""Updates all components"""

View File

@ -1 +0,0 @@
2679

View File

@ -77,11 +77,19 @@ class MainWindow(component.Component):
self.show()
def show(self):
try:
component.get("TorrentView").start()
component.get("StatusBar").start()
except:
pass
# Load the state prior to showing
self.load_window_state()
self.window.show()
def hide(self):
component.stop("TorrentView")
component.stop("StatusBar")
self.window.hide()
def present(self):
@ -128,9 +136,16 @@ class MainWindow(component.Component):
if event.changed_mask & gtk.gdk.WINDOW_STATE_ICONIFIED:
if event.new_window_state & gtk.gdk.WINDOW_STATE_ICONIFIED:
log.debug("MainWindow is minimized..")
component.stop("TorrentView")
component.stop("StatusBar")
self.is_minimized = True
else:
log.debug("MainWindow is not minimized..")
try:
component.start("TorrentView")
component.start("StatusBar")
except:
pass
self.is_minimized = False
return False