rename hide_zero* to show_zero* because double negatives are not intuitive

This commit is contained in:
Martijn Voncken 2008-10-11 08:56:13 +00:00
parent 9a8f8ce2f9
commit 7b52f7fa97
7 changed files with 16 additions and 19 deletions

View File

@ -494,12 +494,12 @@ class Core(
# Emit the torrent_status signal to the clients # Emit the torrent_status signal to the clients
return status_dict 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)] } returns {field: [(value,count)] }
for use in sidebar(s) 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): def export_get_session_state(self):
"""Returns a list of torrent_ids in the session.""" """Returns a list of torrent_ids in the session."""

View File

@ -117,7 +117,7 @@ class FilterManager(component.Component):
return torrent_ids 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)] } returns {field: [(value,count)] }
for use in sidebar. for use in sidebar.
@ -138,7 +138,7 @@ class FilterManager(component.Component):
value = status[field] value = status[field]
items[field][value] = items[field].get(value, 0) + 1 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"]) self._hide_state_items(items["state"])
#return a dict of tuples: #return a dict of tuples:
@ -177,7 +177,7 @@ class FilterManager(component.Component):
def filter_state_active(self, torrent_ids): def filter_state_active(self, torrent_ids):
get_status = self.core.export_get_torrent_status get_status = self.core.export_get_torrent_status
for torrent_id in list(torrent_ids): 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"]: if status["download_payload_rate"] or status["upload_payload_rate"]:
pass #ok pass #ok
else: else:
@ -185,7 +185,7 @@ class FilterManager(component.Component):
return torrent_ids return torrent_ids
def _hide_state_items(self, state_items): def _hide_state_items(self, state_items):
"for hide_zero hits" "for hide(show)-zero hits"
for (value, count) in state_items.items(): for (value, count) in state_items.items():
if value != "All" and count == 0: if value != "All" and count == 0:
del state_items[value] del state_items[value]

View File

@ -49,8 +49,8 @@ for field, items in sclient.get_filter_tree().iteritems():
for value, count in items: for value, count in items:
print "-",value,count print "-",value,count
print "#tree: Hide_zero" print "#tree: Hide_zero (show=False)"
for field, items in sclient.get_filter_tree(True).iteritems(): for field, items in sclient.get_filter_tree(False).iteritems():
print "*",field print "*",field
for value, count in items: for value, count in items:
print "-",value,count print "-",value,count

View File

@ -251,13 +251,10 @@ class FilterTreeView(component.Component):
def update(self): def update(self):
try: try:
log.debug("--")
log.debug(self.config["sidebar_show_trackers"])
log.debug(self.config["sidebar_hide_zero"])
hide_cat = [] hide_cat = []
if not self.config["sidebar_show_trackers"]: if not self.config["sidebar_show_trackers"]:
hide_cat = ["tracker_host"] 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: except Exception, e:
log.debug(e) log.debug(e)

View File

@ -195,9 +195,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="no_show_all">True</property> <property name="no_show_all">True</property>
<child> <child>
<widget class="GtkCheckMenuItem" id="sidebar_hide_zero"> <widget class="GtkCheckMenuItem" id="sidebar_show_zero">
<property name="visible">True</property> <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="use_underline">True</property>
<property name="active">True</property> <property name="active">True</property>
<signal name="toggled" handler="on_menuitem_sidebar_zero_toggled"/> <signal name="toggled" handler="on_menuitem_sidebar_zero_toggled"/>
@ -206,7 +206,7 @@
<child> <child>
<widget class="GtkCheckMenuItem" id="sidebar_show_trackers"> <widget class="GtkCheckMenuItem" id="sidebar_show_trackers">
<property name="visible">True</property> <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="use_underline">True</property>
<property name="active">True</property> <property name="active">True</property>
<signal name="toggled" handler="on_menuitem_sidebar_trackers_toggled"/> <signal name="toggled" handler="on_menuitem_sidebar_trackers_toggled"/>

View File

@ -113,7 +113,7 @@ DEFAULT_PREFS = {
"show_sidebar": True, "show_sidebar": True,
"show_toolbar": True, "show_toolbar": True,
"show_statusbar": True, "show_statusbar": True,
"sidebar_hide_zero":False, "sidebar_show_zero":True,
"sidebar_show_trackers":True "sidebar_show_trackers":True
} }

View File

@ -108,8 +108,8 @@ class MenuBar(component.Component):
self.config["show_sidebar"]) self.config["show_sidebar"])
self.window.main_glade.get_widget("menuitem_statusbar").set_active( self.window.main_glade.get_widget("menuitem_statusbar").set_active(
self.config["show_statusbar"]) self.config["show_statusbar"])
self.window.main_glade.get_widget("sidebar_hide_zero").set_active( self.window.main_glade.get_widget("sidebar_show_zero").set_active(
self.config["sidebar_hide_zero"]) self.config["sidebar_show_zero"])
self.window.main_glade.get_widget("sidebar_show_trackers").set_active( self.window.main_glade.get_widget("sidebar_show_trackers").set_active(
self.config["sidebar_show_trackers"]) self.config["sidebar_show_trackers"])
@ -483,7 +483,7 @@ class MenuBar(component.Component):
client.set_torrent_auto_managed(torrent, False) client.set_torrent_auto_managed(torrent, False)
def on_menuitem_sidebar_zero_toggled(self, widget): 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): def on_menuitem_sidebar_trackers_toggled(self, widget):
self.config["sidebar_show_trackers"] = widget.get_active() self.config["sidebar_show_trackers"] = widget.get_active()