[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [arm/master] Prepopulate filename confs.



commit a9250f9f4ec0459bf613759e74c3bfb6c10b0d42
Author: Kamran Riaz Khan <krkhan@xxxxxxxxxxxxxx>
Date:   Sat Jul 30 16:15:31 2011 +0500

    Prepopulate filename confs.
---
 src/gui/configPanel.py |   14 +++++++-------
 src/util/gtkTools.py   |   10 ++++++++--
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/src/gui/configPanel.py b/src/gui/configPanel.py
index efa9b71..b5ea6ab 100644
--- a/src/gui/configPanel.py
+++ b/src/gui/configPanel.py
@@ -39,13 +39,13 @@ def input_conf_value_bool(option, oldValue):
 
   return "1" if newValue else "0"
 
-def input_conf_value_dir(option):
+def input_conf_value_dir(option, oldValue):
   prompt = "Select value for %s" % option
-  return gtkTools.input_dir(prompt)
+  return gtkTools.input_dir(prompt, oldValue)
 
-def input_conf_value_filename(option):
+def input_conf_value_filename(option, oldValue):
   prompt = "Select value for %s" % option
-  return gtkTools.input_filename(prompt)
+  return gtkTools.input_filename(prompt, oldValue)
 
 class ConfContents(gtkTools.ListWrapper):
   def _create_row_from_value(self, entry):
@@ -118,11 +118,11 @@ class ConfigPanel(object, CliConfigPanel):
       newValue = input_conf_value_bool(configOption, oldValue)
     elif configType == 'Filename':
       if 'Directory' in configOption:
-        newValue = input_conf_value_dir(configOption)
+        newValue = input_conf_value_dir(configOption, oldValue)
       else:
-        newValue = input_conf_value_filename(configOption)
+        newValue = input_conf_value_filename(configOption, oldValue)
     else:
-      newValue = input_conf_value_text(configOption)
+      newValue = input_conf_value_string(configOption, oldValue)
 
     if newValue:
       try:
diff --git a/src/util/gtkTools.py b/src/util/gtkTools.py
index 435f694..b7cf082 100644
--- a/src/util/gtkTools.py
+++ b/src/util/gtkTools.py
@@ -318,7 +318,7 @@ def input_bool(prompt, default=None):
 
   return choice if response == gtk.RESPONSE_OK else None
 
-def input_dir(prompt):
+def input_dir(prompt, default):
   dialog = gtk.FileChooserDialog(prompt,
                                None,
                                gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
@@ -326,6 +326,9 @@ def input_dir(prompt):
                                 gtk.STOCK_OPEN, gtk.RESPONSE_OK))
   dialog.set_default_response(gtk.RESPONSE_OK)
 
+  if default:
+    dialog.set_filename(default)
+
   dialog.show_all()
   response = dialog.run()
 
@@ -335,7 +338,7 @@ def input_dir(prompt):
 
   return filename if response == gtk.RESPONSE_OK else None
 
-def input_filename(prompt):
+def input_filename(prompt, default):
   dialog = gtk.FileChooserDialog(prompt,
                                None,
                                gtk.FILE_CHOOSER_ACTION_SAVE,
@@ -343,6 +346,9 @@ def input_filename(prompt):
                                 gtk.STOCK_OPEN, gtk.RESPONSE_OK))
   dialog.set_default_response(gtk.RESPONSE_OK)
 
+  if default:
+    dialog.set_filename(default)
+
   dialog.show_all()
   response = dialog.run()
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits