From fad6ba21936ddb4a34a05962dca080bc4b106994 Mon Sep 17 00:00:00 2001 From: John Garland Date: Sun, 20 Dec 2009 09:01:07 +0000 Subject: [PATCH] Fix blocklist status icon not opening proper preferences page. Show blocklist's file date using the locale's date / time representation. --- deluge/plugins/blocklist/blocklist/core.py | 4 ++-- deluge/plugins/blocklist/blocklist/gtkui.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/deluge/plugins/blocklist/blocklist/core.py b/deluge/plugins/blocklist/blocklist/core.py index 248288d73..7e1e890ff 100644 --- a/deluge/plugins/blocklist/blocklist/core.py +++ b/deluge/plugins/blocklist/blocklist/core.py @@ -174,7 +174,7 @@ class Core(CorePluginBase): status["file_progress"] = self.file_progress status["file_url"] = self.config["url"] status["file_size"] = self.config["list_size"] - status["file_date"] = datetime.fromtimestamp(self.config["last_update"]).strftime("%a, %d %b %Y %H:%M:%S") if self.config["last_update"] else "" + status["file_date"] = self.config["last_update"] status["file_type"] = self.config["list_type"] if self.config["list_compression"]: status["file_type"] += " (%s)" % self.config["list_compression"] @@ -330,7 +330,7 @@ class Core(CorePluginBase): self.reader = None try_again = True elif os.path.exists(blocklist) and not self.use_cache: - # If we have a backup and we haven't already used it + # If we have a backup and we haven't already used it e = f.trap(Exception) log.warning("Error reading blocklist: %s", e) self.use_cache = True diff --git a/deluge/plugins/blocklist/blocklist/gtkui.py b/deluge/plugins/blocklist/blocklist/gtkui.py index 7af53cd49..2c2ad0038 100644 --- a/deluge/plugins/blocklist/blocklist/gtkui.py +++ b/deluge/plugins/blocklist/blocklist/gtkui.py @@ -33,6 +33,7 @@ # # +from datetime import datetime import gtk from deluge.log import LOG as log @@ -115,7 +116,7 @@ class GtkUI(GtkPluginBase): self.glade.get_widget("label_filesize").set_text( deluge.common.fsize(status["file_size"])) self.glade.get_widget("label_modified").set_text( - str(status["file_date"])) + datetime.fromtimestamp(status["file_date"]).strftime("%c")) self.glade.get_widget("label_type").set_text(status["file_type"]) self.glade.get_widget("label_url").set_text( status["file_url"]) @@ -151,7 +152,7 @@ class GtkUI(GtkPluginBase): client.blocklist.check_import(force=True) def _on_status_item_clicked(self, widget, event): - component.get("Preferences").show("Blocklist") + component.get("Preferences").show(_("Blocklist")) def load_preferences_page(self): """Initializes the preferences page and adds it to the preferences dialog"""