rename hide_zero* to show_zero* because double negatives are not intuitive
This commit is contained in:
parent
9a8f8ce2f9
commit
7b52f7fa97
|
@ -494,12 +494,12 @@ class Core(
|
|||
# Emit the torrent_status signal to the clients
|
||||
return status_dict
|
||||
|
||||
def export_get_filter_tree(self , hide_zero_hits=False, hide_cat=None):
|
||||
def export_get_filter_tree(self , show_zero_hits=True, hide_cat=None):
|
||||
"""
|
||||
returns {field: [(value,count)] }
|
||||
for use in sidebar(s)
|
||||
"""
|
||||
return self.filtermanager.get_filter_tree(hide_zero_hits, hide_cat)
|
||||
return self.filtermanager.get_filter_tree(show_zero_hits, hide_cat)
|
||||
|
||||
def export_get_session_state(self):
|
||||
"""Returns a list of torrent_ids in the session."""
|
||||
|
|
|
@ -117,7 +117,7 @@ class FilterManager(component.Component):
|
|||
|
||||
return torrent_ids
|
||||
|
||||
def get_filter_tree(self, hide_zero_hits=False, hide_cat=None):
|
||||
def get_filter_tree(self, show_zero_hits=True, hide_cat=None):
|
||||
"""
|
||||
returns {field: [(value,count)] }
|
||||
for use in sidebar.
|
||||
|
@ -138,7 +138,7 @@ class FilterManager(component.Component):
|
|||
value = status[field]
|
||||
items[field][value] = items[field].get(value, 0) + 1
|
||||
|
||||
if "state" in tree_keys and hide_zero_hits:
|
||||
if "state" in tree_keys and not show_zero_hits:
|
||||
self._hide_state_items(items["state"])
|
||||
|
||||
#return a dict of tuples:
|
||||
|
@ -177,7 +177,7 @@ class FilterManager(component.Component):
|
|||
def filter_state_active(self, torrent_ids):
|
||||
get_status = self.core.export_get_torrent_status
|
||||
for torrent_id in list(torrent_ids):
|
||||
status = get_status(torrent_id, ["download_payload_rate","upload_payload_rate"])
|
||||
status = get_status(torrent_id, ["download_payload_rate", "upload_payload_rate"])
|
||||
if status["download_payload_rate"] or status["upload_payload_rate"]:
|
||||
pass #ok
|
||||
else:
|
||||
|
@ -185,7 +185,7 @@ class FilterManager(component.Component):
|
|||
return torrent_ids
|
||||
|
||||
def _hide_state_items(self, state_items):
|
||||
"for hide_zero hits"
|
||||
"for hide(show)-zero hits"
|
||||
for (value, count) in state_items.items():
|
||||
if value != "All" and count == 0:
|
||||
del state_items[value]
|
||||
|
|
|
@ -49,8 +49,8 @@ for field, items in sclient.get_filter_tree().iteritems():
|
|||
for value, count in items:
|
||||
print "-",value,count
|
||||
|
||||
print "#tree: Hide_zero"
|
||||
for field, items in sclient.get_filter_tree(True).iteritems():
|
||||
print "#tree: Hide_zero (show=False)"
|
||||
for field, items in sclient.get_filter_tree(False).iteritems():
|
||||
print "*",field
|
||||
for value, count in items:
|
||||
print "-",value,count
|
||||
|
|
|
@ -251,13 +251,10 @@ class FilterTreeView(component.Component):
|
|||
|
||||
def update(self):
|
||||
try:
|
||||
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)
|
||||
aclient.get_filter_tree(self.cb_update_filter_tree, self.config["sidebar_show_zero"], hide_cat)
|
||||
except Exception, e:
|
||||
log.debug(e)
|
||||
|
||||
|
|
|
@ -195,9 +195,9 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="no_show_all">True</property>
|
||||
<child>
|
||||
<widget class="GtkCheckMenuItem" id="sidebar_hide_zero">
|
||||
<widget class="GtkCheckMenuItem" id="sidebar_show_zero">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Hide zero hits</property>
|
||||
<property name="label" translatable="yes">Show _zero hits</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<signal name="toggled" handler="on_menuitem_sidebar_zero_toggled"/>
|
||||
|
@ -206,7 +206,7 @@
|
|||
<child>
|
||||
<widget class="GtkCheckMenuItem" id="sidebar_show_trackers">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Show Trackers</property>
|
||||
<property name="label" translatable="yes">Show _Trackers</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<signal name="toggled" handler="on_menuitem_sidebar_trackers_toggled"/>
|
||||
|
|
|
@ -113,7 +113,7 @@ DEFAULT_PREFS = {
|
|||
"show_sidebar": True,
|
||||
"show_toolbar": True,
|
||||
"show_statusbar": True,
|
||||
"sidebar_hide_zero":False,
|
||||
"sidebar_show_zero":True,
|
||||
"sidebar_show_trackers":True
|
||||
}
|
||||
|
||||
|
|
|
@ -108,8 +108,8 @@ 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_zero").set_active(
|
||||
self.config["sidebar_show_zero"])
|
||||
self.window.main_glade.get_widget("sidebar_show_trackers").set_active(
|
||||
self.config["sidebar_show_trackers"])
|
||||
|
||||
|
@ -483,7 +483,7 @@ class MenuBar(component.Component):
|
|||
client.set_torrent_auto_managed(torrent, False)
|
||||
|
||||
def on_menuitem_sidebar_zero_toggled(self, widget):
|
||||
self.config["sidebar_hide_zero"] = widget.get_active()
|
||||
self.config["sidebar_show_zero"] = widget.get_active()
|
||||
|
||||
def on_menuitem_sidebar_trackers_toggled(self, widget):
|
||||
self.config["sidebar_show_trackers"] = widget.get_active()
|
||||
|
|
Loading…
Reference in New Issue