[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [nyx/master] Change is_unset() to is_set()
commit 69376cc09ca3e6a8c60c6a46a038e89b7edf6a2b
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Sat Sep 26 00:31:27 2015 -0700
Change is_unset() to is_set()
Negative values are odd for getters, providing the inverse.
---
nyx/config_panel.py | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/nyx/config_panel.py b/nyx/config_panel.py
index 6d80234..cfa6e62 100644
--- a/nyx/config_panel.py
+++ b/nyx/config_panel.py
@@ -119,14 +119,12 @@ class ConfigEntry():
return self.label_cache
- def is_unset(self):
+ def is_set(self):
"""
- True if we have no value, false otherwise.
+ True if we have a custom value, false otherwise.
"""
- conf_value = tor_controller().get_conf(self.get(Field.OPTION), [], True)
-
- return not bool(conf_value)
+ return bool(tor_controller().get_conf(self.get(Field.OPTION), [], True))
def _get_value(self):
"""
@@ -299,7 +297,7 @@ class ConfigPanel(panel.Panel):
selection = self.get_selection()
config_option = selection.get(Field.OPTION)
- initial_value = '' if selection.is_unset() else selection.get(Field.VALUE)
+ initial_value = '' if not selection.is_set() else selection.get(Field.VALUE)
prompt_msg = '%s Value (esc to cancel): ' % config_option
is_prepopulated = CONFIG['features.config.prepopulateEditValues']
new_value = nyx.popups.input_prompt(prompt_msg, initial_value if is_prepopulated else '')
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits