From 9a8f8ce2f9368ff4ec66cd521a025ed16f725ccd Mon Sep 17 00:00:00 2001 From: Martijn Voncken Date: Sat, 11 Oct 2008 08:44:45 +0000 Subject: [PATCH] sidebar-gtk:show/hide zero_hits+trackers --- deluge/ui/gtkui/filtertreeview.py | 13 +- deluge/ui/gtkui/glade/main_window.glade | 1218 ++++++++++++----------- deluge/ui/gtkui/gtkui.py | 6 +- deluge/ui/gtkui/menubar.py | 18 +- 4 files changed, 655 insertions(+), 600 deletions(-) diff --git a/deluge/ui/gtkui/filtertreeview.py b/deluge/ui/gtkui/filtertreeview.py index 1ac6b6d9a..476a9968a 100644 --- a/deluge/ui/gtkui/filtertreeview.py +++ b/deluge/ui/gtkui/filtertreeview.py @@ -40,6 +40,7 @@ import deluge.component as component import deluge.common from deluge.log import LOG as log from deluge.ui.client import aclient +from deluge.configmanager import ConfigManager STATE_PIX = { "Downloading":"downloading", @@ -74,7 +75,9 @@ class FilterTreeView(component.Component): self.hpaned = glade.get_widget("hpaned") self.scrolled = glade.get_widget("scrolledwindow_sidebar") self.sidebar = component.get("SideBar") - self.is_visible = True + self.config = ConfigManager("gtkui.conf") + + self.filters = {} self.label_view = gtk.TreeView() self.sidebar.add_tab(self.label_view, "filters", _("Filters")) @@ -248,7 +251,13 @@ class FilterTreeView(component.Component): def update(self): try: - aclient.get_filter_tree(self.cb_update_filter_tree) + log.debug("--") + log.debug(self.config["sidebar_show_trackers"]) + log.debug(self.config["sidebar_hide_zero"]) + hide_cat = [] + if not self.config["sidebar_show_trackers"]: + hide_cat = ["tracker_host"] + aclient.get_filter_tree(self.cb_update_filter_tree, self.config["sidebar_hide_zero"], hide_cat) except Exception, e: log.debug(e) diff --git a/deluge/ui/gtkui/glade/main_window.glade b/deluge/ui/gtkui/glade/main_window.glade index bf4369c8a..eca685f20 100644 --- a/deluge/ui/gtkui/glade/main_window.glade +++ b/deluge/ui/gtkui/glade/main_window.glade @@ -184,6 +184,38 @@ True + + + True + True + S_idebar + True + + + True + True + + + True + _Hide zero hits + True + True + + + + + + True + Show Trackers + True + True + + + + + + + @@ -659,191 +691,277 @@ - + True - 0 - - - 1 - 2 - GTK_FILL - - - - - True - 0 - - - 3 - 4 - GTK_FILL - - - - - True - 0 - - - 1 - 2 - 1 - 2 - GTK_FILL - - - - - True - 0 - - - 3 - 4 - 1 - 2 - GTK_FILL - - - - - True - 5 - - - True - 0 - <b>Downloaded:</b> - True - - - - - GTK_FILL - - - - - True - 5 - - - True - 0 - <b>Uploaded:</b> - True - - - - - 1 - 2 - GTK_FILL - - - - - True - 5 - - - True - 0 - <b>Share Ratio:</b> - True - - - - - 2 - 3 - GTK_FILL - - - - - True - 5 - - - True - 0 - <b>Next Announce:</b> - True - - + 5 + 6 3 4 GTK_FILL - + True - 15 - 5 - - - True - 0 - <b>Speed:</b> - True - - + 0 + <b>Auto Managed:</b> + True - 2 - 3 + 4 + 5 + 3 + 4 GTK_FILL - + True - 15 - 5 - - - True - 0 - <b>Speed:</b> - True - - - 2 - 3 + 7 + 8 + 2 + 3 + GTK_FILL + + + + + True + + + 7 + 8 1 2 GTK_FILL - + True - 15 - 5 - - - True - 0 - <b>ETA:</b> - True - - + 0 + <b>Seed Rank:</b> + True - 2 - 3 + 6 + 7 2 3 GTK_FILL + + + True + 0 + <b>Seeding Time:</b> + True + + + 6 + 7 + 1 + 2 + GTK_FILL + + + + + True + + + 7 + 8 + GTK_FILL + + + + + True + 0 + <b>Active Time:</b> + True + + + 6 + 7 + GTK_FILL + + + + + True + 0 + True + + + 1 + 2 + 3 + 4 + GTK_FILL + + + + + True + 0 + + + 3 + 4 + 3 + 4 + GTK_FILL + + + + + True + 0 + True + PANGO_WRAP_CHAR + True + + + 1 + 8 + 4 + 5 + GTK_FILL + + + + + True + 0 + 0 + <b>Tracker Status:</b> + True + + + 4 + 5 + GTK_FILL + GTK_FILL + + + + + True + 0 + True + PANGO_WRAP_WORD_CHAR + + + 5 + 6 + 2 + 3 + GTK_FILL + + + + + + True + 0 + 1 + <b>Availability:</b> + True + + + 4 + 5 + 2 + 3 + GTK_FILL + + + + + True + 0 + + + 3 + 4 + 2 + 3 + GTK_FILL + + + + + True + 0 + + + 1 + 2 + 2 + 3 + GTK_FILL + + + + + True + 0 + + + 5 + 6 + 1 + 2 + GTK_FILL + + + + + True + 0 + <b>Peers:</b> + True + + + 4 + 5 + 1 + 2 + GTK_FILL + + + + + True + 0 + + + 5 + 6 + GTK_FILL + + + + + True + 0 + <b>Seeders:</b> + True + + + 4 + 5 + GTK_FILL + + True @@ -867,274 +985,188 @@ - + True - 0 - <b>Seeders:</b> - True + 15 + 5 + + + True + 0 + <b>ETA:</b> + True + + - 4 - 5 - GTK_FILL - - - - - True - 0 - - - 5 - 6 - GTK_FILL - - - - - True - 0 - <b>Peers:</b> - True - - - 4 - 5 - 1 - 2 - GTK_FILL - - - - - True - 0 - - - 5 - 6 - 1 - 2 - GTK_FILL - - - - - True - 0 - - - 1 - 2 + 2 + 3 2 3 GTK_FILL - + + True + 15 + 5 + + + True + 0 + <b>Speed:</b> + True + + + + + 2 + 3 + 1 + 2 + GTK_FILL + + + + + True + 15 + 5 + + + True + 0 + <b>Speed:</b> + True + + + + + 2 + 3 + GTK_FILL + + + + + True + 5 + + + True + 0 + <b>Next Announce:</b> + True + + + + + 3 + 4 + GTK_FILL + + + + + True + 5 + + + True + 0 + <b>Share Ratio:</b> + True + + + + + 2 + 3 + GTK_FILL + + + + + True + 5 + + + True + 0 + <b>Uploaded:</b> + True + + + + + 1 + 2 + GTK_FILL + + + + + True + 5 + + + True + 0 + <b>Downloaded:</b> + True + + + + + GTK_FILL + + + + True 0 3 4 - 2 - 3 + 1 + 2 GTK_FILL - + True 0 - 1 - <b>Availability:</b> - True - - - 4 - 5 - 2 - 3 - GTK_FILL - - - - - True - 0 - True - PANGO_WRAP_WORD_CHAR - - - 5 - 6 - 2 - 3 - GTK_FILL - - - - - - True - 0 - 0 - <b>Tracker Status:</b> - True - - - 4 - 5 - GTK_FILL - GTK_FILL - - - - - True - 0 - True - PANGO_WRAP_CHAR - True 1 - 8 - 4 - 5 - GTK_FILL + 2 + 1 + 2 + GTK_FILL - + True 0 3 4 - 3 - 4 GTK_FILL - + True 0 - True 1 2 - 3 - 4 - GTK_FILL - - - - - True - 0 - <b>Active Time:</b> - True - - - 6 - 7 - GTK_FILL - - - - - True - - - 7 - 8 - GTK_FILL - - - - - True - 0 - <b>Seeding Time:</b> - True - - - 6 - 7 - 1 - 2 - GTK_FILL - - - - - True - 0 - <b>Seed Rank:</b> - True - - - 6 - 7 - 2 - 3 - GTK_FILL - - - - - True - - - 7 - 8 - 1 - 2 - GTK_FILL - - - - - True - - - 7 - 8 - 2 - 3 - GTK_FILL - - - - - True - 0 - <b>Auto Managed:</b> - True - - - 4 - 5 - 3 - 4 - GTK_FILL - - - - - True - - - 5 - 6 - 3 - 4 GTK_FILL @@ -1221,7 +1253,7 @@ - + True 0 True @@ -1229,43 +1261,28 @@ 1 2 - 3 - 4 + 4 + 5 - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - True - - - 1 - 4 - 5 - 6 - - - - - + True 0 1 - <b>Status:</b> + <b># of files:</b> True - 5 - 6 + 4 + 5 GTK_FILL - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 0 @@ -1276,66 +1293,53 @@ 1 4 - 2 - 3 + 1 + 2 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - <b>Path:</b> - True - - - - - 2 - 3 - GTK_FILL - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 - - - True - 0 - 0 - 1 - <b>Name:</b> - True - - - - - GTK_FILL - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_STRUCTURE_MASK 0 - True + <b>Hash:</b> + True + + + 1 + 2 + GTK_FILL + + + + + + True + 0 PANGO_WRAP_CHAR True 1 4 + 6 + 7 + + + + + + True + 0 + 1 + <b>Tracker:</b> + True + + + 6 + 7 + GTK_FILL @@ -1362,52 +1366,65 @@ - - True - 0 - 1 - <b>Tracker:</b> - True - - - 6 - 7 - GTK_FILL - - - - - + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_STRUCTURE_MASK 0 + True PANGO_WRAP_CHAR True 1 4 - 6 - 7 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - <b>Hash:</b> - True + 5 + + + True + 0 + 0 + 1 + <b>Name:</b> + True + + - 1 - 2 GTK_FILL - + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + <b>Path:</b> + True + + + + + 2 + 3 + GTK_FILL + + + + + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 0 @@ -1418,28 +1435,43 @@ 1 4 - 1 - 2 + 2 + 3 - + True 0 1 - <b># of files:</b> + <b>Status:</b> True - 4 - 5 + 5 + 6 GTK_FILL - + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + True + + + 1 + 4 + 5 + 6 + + + + + True 0 True @@ -1447,8 +1479,8 @@ 1 2 - 4 - 5 + 3 + 4 @@ -1631,7 +1663,7 @@ - + True True 6 @@ -1641,100 +1673,8 @@ 1 2 - 3 - 4 - - - - - - - True - 0 - Max Upload Slots: - - - 3 - 4 - GTK_FILL - - - - - - True - KiB/s - - - 2 - 3 - 1 - 2 - - - - - - - True - KiB/s - - - 2 - 3 - - - - - - - True - 0 - Max Download Speed: - - - GTK_FILL - - - - - - True - 0 - Max Upload Speed: - - - 1 - 2 - GTK_FILL - - - - - - True - 0 - Max Connections: - - 2 3 - GTK_FILL - - - - - - True - True - 6 - 1 - -1 -1 999999 1 10 10 - 1 - - - 1 - 2 @@ -1758,7 +1698,99 @@ - + + True + True + 6 + 1 + -1 -1 999999 1 10 10 + 1 + + + 1 + 2 + + + + + + + True + 0 + Max Connections: + + + 2 + 3 + GTK_FILL + + + + + + True + 0 + Max Upload Speed: + + + 1 + 2 + GTK_FILL + + + + + + True + 0 + Max Download Speed: + + + GTK_FILL + + + + + + True + KiB/s + + + 2 + 3 + + + + + + + True + KiB/s + + + 2 + 3 + 1 + 2 + + + + + + + True + 0 + Max Upload Slots: + + + 3 + 4 + GTK_FILL + + + + + True True 6 @@ -1768,8 +1800,8 @@ 1 2 - 2 - 3 + 3 + 4 @@ -1903,8 +1935,8 @@ True False - False GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER + False Select A Folder @@ -2407,23 +2439,14 @@ 10 2 - - True - 0 - <i>Current Version:</i> - True - - - GTK_FILL - - - - + True 1 2 + 1 + 2 @@ -2441,17 +2464,26 @@ - + True 1 2 - 1 - 2 + + + True + 0 + <i>Current Version:</i> + True + + + GTK_FILL + + diff --git a/deluge/ui/gtkui/gtkui.py b/deluge/ui/gtkui/gtkui.py index 265e18f1f..a9d5dd3fe 100644 --- a/deluge/ui/gtkui/gtkui.py +++ b/deluge/ui/gtkui/gtkui.py @@ -112,7 +112,9 @@ DEFAULT_PREFS = { "signal_port": 40000, "show_sidebar": True, "show_toolbar": True, - "show_statusbar": True + "show_statusbar": True, + "sidebar_hide_zero":False, + "sidebar_show_trackers":True } class GtkUI: @@ -198,7 +200,7 @@ class GtkUI: # Start the signal receiver self.signal_receiver = Signals() - + # Initialize various components of the gtkui self.mainwindow = MainWindow() self.menubar = MenuBar() diff --git a/deluge/ui/gtkui/menubar.py b/deluge/ui/gtkui/menubar.py index ce918afcc..9961846b2 100644 --- a/deluge/ui/gtkui/menubar.py +++ b/deluge/ui/gtkui/menubar.py @@ -108,6 +108,11 @@ class MenuBar(component.Component): self.config["show_sidebar"]) self.window.main_glade.get_widget("menuitem_statusbar").set_active( self.config["show_statusbar"]) + self.window.main_glade.get_widget("sidebar_hide_zero").set_active( + self.config["sidebar_hide_zero"]) + self.window.main_glade.get_widget("sidebar_show_trackers").set_active( + self.config["sidebar_show_trackers"]) + ### Connect Signals ### self.window.main_glade.signal_autoconnect({ @@ -136,7 +141,9 @@ class MenuBar(component.Component): "on_menuitem_faq_activate": self.on_menuitem_faq_activate, "on_menuitem_community_activate": \ self.on_menuitem_community_activate, - "on_menuitem_about_activate": self.on_menuitem_about_activate + "on_menuitem_about_activate": self.on_menuitem_about_activate, + "on_menuitem_sidebar_zero_toggled":self.on_menuitem_sidebar_zero_toggled, + "on_menuitem_sidebar_trackers_toggled":self.on_menuitem_sidebar_trackers_toggled }) self.torrentmenu_glade.signal_autoconnect({ @@ -162,8 +169,7 @@ class MenuBar(component.Component): "on_menuitem_queue_top_activate": self.on_menuitem_queue_top_activate, "on_menuitem_queue_up_activate": self.on_menuitem_queue_up_activate, "on_menuitem_queue_down_activate": self.on_menuitem_queue_down_activate, - "on_menuitem_queue_bottom_activate": self.on_menuitem_queue_bottom_activate, - + "on_menuitem_queue_bottom_activate": self.on_menuitem_queue_bottom_activate }) self.change_sensitivity = [ @@ -475,3 +481,9 @@ class MenuBar(component.Component): def on_menuitem_set_automanaged_off(self, widget): for torrent in component.get("TorrentView").get_selected_torrents(): client.set_torrent_auto_managed(torrent, False) + + def on_menuitem_sidebar_zero_toggled(self, widget): + self.config["sidebar_hide_zero"] = widget.get_active() + + def on_menuitem_sidebar_trackers_toggled(self, widget): + self.config["sidebar_show_trackers"] = widget.get_active()