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

[tor-commits] [arm/release] Quiting wizard when the user presses 'q'



commit 30fc358c617ebd075119e20fd6e532150b432e24
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sat Sep 24 13:14:54 2011 -0700

    Quiting wizard when the user presses 'q'
    
    Users could cancel the wizard by prssing esc, but it's also intuitive to expect
    'q' to do the same (since that's the keybinding to quit arm entirely).
    Respecting this option too. This was requested by monochromec on...
    https://trac.torproject.org/projects/tor/ticket/3995
    
    This also fixes a minor bug where the config options dialog wouldn't respect a
    cancel signal (instead looping on that dialog).
---
 src/cli/wizard.py |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/cli/wizard.py b/src/cli/wizard.py
index 40cf632..4cb65ad 100644
--- a/src/cli/wizard.py
+++ b/src/cli/wizard.py
@@ -351,6 +351,7 @@ def showWizard():
       selection = promptConfigOptions(relayType, config, disabledOpt)
       
       if selection == BACK: relayType = None
+      elif selection == CANCEL: break
       elif selection == NEXT:
         generatedTorrc = getTorrc(relayType, config, disabledOpt)
         
@@ -536,7 +537,7 @@ def promptRelayType(initialSelection):
       if key == curses.KEY_UP: selection = (selection - 1) % len(options)
       elif key == curses.KEY_DOWN: selection = (selection + 1) % len(options)
       elif uiTools.isSelectionKey(key): return options[selection].getValue()
-      elif key == 27: return CANCEL # esc - cancel
+      elif key in (27, ord('q'), ord('Q')): return CANCEL # esc or q - cancel
   finally:
     cli.popups.finalize()
 
@@ -635,7 +636,7 @@ def promptConfigOptions(relayType, config, disabledOpt):
             except ValueError, exc:
               cli.popups.showMsg(str(exc), 3)
               cli.controller.getController().redraw()
-      elif key == 27: selection, key = -1, curses.KEY_ENTER # esc - cancel
+      elif key in (27, ord('q'), ord('Q')): return CANCEL
   finally:
     cli.popups.finalize()
 
@@ -857,7 +858,7 @@ def showConfirmationDialog(torrcContents, torrcLocation):
         if selection == 0: return CANCEL
         elif selection == 1: return BACK
         else: return NEXT
-      elif key == 27: return CANCEL
+      elif key in (27, ord('q'), ord('Q')): return CANCEL
   finally:
     cli.popups.finalize()
 



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