From a132c6a038f6e08e926199e2a6615d9e7162c93a Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Thu, 21 Jun 2007 00:45:34 +0000 Subject: [PATCH] Add 'max_upload_rate' and 'max_download_rate' to tray tooltip. Will now display 'Unlimited' if the max is -1 --- src/interface.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/interface.py b/src/interface.py index 7101bea91..981482185 100644 --- a/src/interface.py +++ b/src/interface.py @@ -836,8 +836,14 @@ class DelugeGTK: connections = core_state['num_peers'] dlrate = common.frate(core_state['download_rate']) ulrate = common.frate(core_state['upload_rate']) - dlrate_max = common.frate(self.config.get("max_download_rate_bps")) - ulrate_max = common.frate(self.config.get("max_upload_rate_bps")) + if self.config.get("max_download_rate") < 0: + dlrate_max = _("Unlimited") + else: + dlrate_max = common.frate(self.config.get("max_download_rate_bps")) + if self.config.get("max_upload_rate") < 0: + ulrate_max = _("Unlimited") + else: + ulrate_max = common.frate(self.config.get("max_upload_rate_bps")) self.statusbar_temp_msg = '%s: %s %s: %s (%s) %s: %s (%s)'%( _('Connections'), connections, _('Download'), @@ -853,7 +859,7 @@ class DelugeGTK: msg = _("Deluge Bittorrent Client") + "\n" + \ _("Connections") + ": " + str(connections) + "\n" + _("Download") + ": " + \ - dlrate + "\n" + _("Upload") + ": " + ulrate + dlrate + " (" + dlrate_max + ")" + "\n" + _("Upload") + ": " + ulrate + " (" + ulrate_max + ")" self.tray_icon.set_tooltip(msg)