commit 8e74e50a7adaec6d1f786248f2600658328292da Author: Damian Johnson atagar@torproject.org Date: Sat Jul 9 18:03:14 2011 -0700
Wizard option to use the last configuration --- src/cli/wizard.py | 23 ++++++++++++++++++----- src/settings.cfg | 2 ++ 2 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/src/cli/wizard.py b/src/cli/wizard.py index 8a5a138..e2419e8 100644 --- a/src/cli/wizard.py +++ b/src/cli/wizard.py @@ -20,7 +20,7 @@ from util import connections, enum, log, torConfig, torTools, uiTools TORRC_TEMPLATE = "resources/torrcTemplate.txt"
# basic configuration types we can run as -RelayType = enum.Enum("RELAY", "EXIT", "BRIDGE", "CLIENT") +RelayType = enum.Enum("RESUME", "RELAY", "EXIT", "BRIDGE", "CLIENT")
# all options that can be configured Options = enum.Enum("DIVIDER", "CONTROL", "NICKNAME", "CONTACT", "NOTIFY", "BANDWIDTH", "LIMIT", "CLIENT", "LOWPORTS", "PORTFORWARD", "STARTUP", "NOTICE", "POLICY", "WEBSITES", "EMAIL", "IM", "MISC", "PLAINTEXT", "DISTRIBUTE", "BRIDGED", "BRIDGE1", "BRIDGE2", "BRIDGE3", "REUSE") @@ -252,15 +252,20 @@ def showWizard(): _toggleEnabledAction(bridgeEntries, useBridgeOpt, useBridgeOpt.getValue())
# remembers the last selection made on the type prompt page - relaySelection = RelayType.RELAY controller = cli.controller.getController() manager = controller.getTorManager() + relaySelection = RelayType.RESUME if manager.isTorrcAvailable() else RelayType.RELAY
while True: if relayType == None: selection = promptRelayType(relaySelection)
if selection == CANCEL: break + elif selection == RelayType.RESUME: + if not manager.isManaged(torTools.getConn()): + manager.startManagedInstance() + + break else: relayType, relaySelection = selection, selection else: selection = promptConfigOptions(relayType, config) @@ -310,12 +315,20 @@ def promptRelayType(initialSelection): dialog was canceled. """
- popup, _, _ = cli.popups.init(25, 58) - if not popup: return - control = cli.controller.getController() options = [ConfigOption(opt, "role", opt) for opt in RelayType.values()] options.append(ConfigOption(CANCEL, "general", CANCEL)) selection = RelayType.indexOf(initialSelection) + height = 28 + + # drops the resume option if it isn't applicable + control = cli.controller.getController() + if not control.getTorManager().isTorrcAvailable(): + options.pop(0) + height -= 3 + selection -= 1 + + popup, _, _ = cli.popups.init(height, 58) + if not popup: return
try: popup.win.box() diff --git a/src/settings.cfg b/src/settings.cfg index f15aa49..4551b43 100644 --- a/src/settings.cfg +++ b/src/settings.cfg @@ -397,6 +397,7 @@ wizard.blankValue Bridge3 => <ip address>:<port> wizard.label.general Cancel => Cancel wizard.label.general Back => Previous wizard.label.general Next => Next +wizard.label.role Resume => Use Last Configuration wizard.label.role Relay => Internal Relay wizard.label.role Exit => Exit Relay wizard.label.role Bridge => Bridge @@ -425,6 +426,7 @@ wizard.label.opt Bridge3 => Third Bridge wizard.label.opt Reuse => Circuit Duration
wizard.description.general Cancel => Close without starting Tor. +wizard.description.role Resume => Start Tor with the last configuration you made. wizard.description.role Relay => Provides interconnections with other Tor relays. This is a safe and easy of making the network better. wizard.description.role Exit => Connects between Tor network and the outside Internet. This is a vital role, but can lead to abuse complaints. wizard.description.role Bridge => Non-public relay specifically for helping censored users.
tor-commits@lists.torproject.org