[tor-commits] [arm/release] Filling blank wizard values when helpful

atagar at torproject.org atagar at torproject.org
Sun Jul 17 06:08:29 UTC 2011


commit 36f78676801ee57a4d875bc6114f365e1b324ad2
Author: Damian Johnson <atagar at torproject.org>
Date:   Fri Jul 1 15:46:27 2011 -0700

    Filling blank wizard values when helpful
    
    Some of the configuration values, like the nickname and bridge entries, can
    use their desplayed value when blank to indicate what should go there.
---
 src/cli/wizard.py |    5 ++++-
 src/settings.cfg  |    6 +++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/cli/wizard.py b/src/cli/wizard.py
index 79f548e..7c36598 100644
--- a/src/cli/wizard.py
+++ b/src/cli/wizard.py
@@ -73,6 +73,7 @@ CONFIG = {"wizard.message.role": "",
           "wizard.toggle": {},
           "wizard.suboptions": [],
           "wizard.default": {},
+          "wizard.blankValue": {},
           "wizard.label.general": {},
           "wizard.label.role": {},
           "wizard.label.opt": {},
@@ -113,7 +114,9 @@ class ConfigOption:
     return self.value
   
   def getDisplayValue(self):
-    return self.value
+    if not self.value and self.key in CONFIG["wizard.blankValue"]:
+      return CONFIG["wizard.blankValue"][self.key]
+    else: return self.value
   
   def getDisplayAttr(self):
     myColor = OPTION_COLOR if self.isEnabled() else DISABLED_COLOR
diff --git a/src/settings.cfg b/src/settings.cfg
index aacec0a..076299d 100644
--- a/src/settings.cfg
+++ b/src/settings.cfg
@@ -370,7 +370,6 @@ wizard.suboptions Bridge1
 wizard.suboptions Bridge2
 wizard.suboptions Bridge3
 
-wizard.default Nickname => Unnamed
 wizard.default Notify => true
 wizard.default Bandwidth => 5 MB/s
 wizard.default Startup => true
@@ -387,6 +386,11 @@ wizard.default Distribute => true
 wizard.default Bridged => false
 wizard.default Reuse => 10 minutes
 
+wizard.blankValue Nickname => Unnamed
+wizard.blankValue Bridge1 => <ip address>:<port>
+wizard.blankValue Bridge2 => <ip address>:<port>
+wizard.blankValue Bridge3 => <ip address>:<port>
+
 wizard.label.general Cancel => Cancel
 wizard.label.general Back => Previous
 wizard.label.general Next => Next





More information about the tor-commits mailing list