From 58a240a99834782c71f9d7a83e0c3a510a86fd0c Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Sat, 22 Dec 2007 20:35:43 +0000 Subject: [PATCH] Added tray tooltip. Increased client cache time to 1.5 seconds. --- TODO | 3 +-- deluge/ui/client.py | 4 ++-- deluge/ui/gtkui/systemtray.py | 18 ++++++++++++++++++ setup.py | 2 +- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index c55352416..c6faf383f 100644 --- a/TODO +++ b/TODO @@ -3,14 +3,12 @@ * Figure out easy way for user-made plugins to add i18n support. * Restart daemon function * Docstrings! -* Implement caching in client.py * Create a new add torrent dialog * Implement open folder * Maybe add pop-up menus to the status bar items * Address issue where torrents will redownload if the storage is moved outside of deluge. * Implement 'Classic' mode -* Tray tooltip * Add autoload folder * Add wizard * Add a health indication to the statusbar @@ -21,3 +19,4 @@ * 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 +* Create asynchronous batch torrent status method diff --git a/deluge/ui/client.py b/deluge/ui/client.py index 9520cf3e1..bbbf4d272 100644 --- a/deluge/ui/client.py +++ b/deluge/ui/client.py @@ -43,7 +43,7 @@ import deluge.xmlrpclib as xmlrpclib import deluge.common from deluge.log import LOG as log -CACHE_TTL = 0.5 # seconds +CACHE_TTL = 1.5 # seconds class cache: def __init__(self, func): @@ -119,7 +119,7 @@ class cache_dict: ret = self.func(*__args, **__kw) self.cache_values[__args[0]] = [time.time(), ret] return ret - + class CoreProxy(gobject.GObject): __gsignals__ = { "new_core" : ( diff --git a/deluge/ui/gtkui/systemtray.py b/deluge/ui/gtkui/systemtray.py index e93e0a91c..3d313af2e 100644 --- a/deluge/ui/gtkui/systemtray.py +++ b/deluge/ui/gtkui/systemtray.py @@ -114,7 +114,25 @@ class SystemTray(component.Component): self.tray_glade.get_widget(widget).hide() except Exception, e: log.debug("Unable to hide system tray menu widgets: %s", e) + + def update(self): + # Set the tool tip text + max_download_speed = client.get_config_value("max_download_speed") + max_upload_speed = client.get_config_value("max_upload_speed") + + if max_download_speed == -1: + max_download_speed = _("Unlimited") + if max_upload_speed == -1: + max_upload_speed = _("Unlimited") + msg = '%s\n%s: %s (%s)\n%s: %s (%s)' % (\ + _("Deluge Bittorrent Client"), _("Down Speed"), \ + client.get_download_rate(), max_download_speed, _("Up Speed"), \ + client.get_upload_rate(), max_upload_speed) + + # Set the tooltip + self.tray.set_tooltip(msg) + def build_tray_bwsetsubmenu(self): # Create the Download speed list sub-menu submenu_bwdownset = self.build_menu_radio_list( diff --git a/setup.py b/setup.py index 51a3a913c..c9a29caa4 100644 --- a/setup.py +++ b/setup.py @@ -56,7 +56,7 @@ _extra_compile_args = [ "-O2" ] -removals = ["-Wstrict-prototypes"] +removals = ["-g", "-p", "-Wstrict-prototypes"] if python_version == '2.5': cv_opt = sysconfig.get_config_vars()["CFLAGS"]