From 9f7b2bb4f6630e96dff5935076d8dcd0b4caac3e Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Tue, 18 Jan 2011 19:11:44 -0800 Subject: ui-macos: Notice when we've connected; make debug logs optional. --- client.py | 2 + ui-macos/MainMenu.xib | 109 +++++++++++++++++++++++++++++++++++++++++++++----- ui-macos/main.py | 13 +++++- 3 files changed, 113 insertions(+), 11 deletions(-) diff --git a/client.py b/client.py index daa1e6a..dbd11de 100644 --- a/client.py +++ b/client.py @@ -226,6 +226,8 @@ def _main(listener, fw, ssh_cmd, remotename, python, seed_hosts, auto_nets, raise Fatal('expected server init string %r; got %r' % (expected, initstring)) debug1('connected.\n') + print 'Connected.' + sys.stdout.flush() if daemon: daemonize() log('daemonizing (%s).\n' % _pidname) diff --git a/ui-macos/MainMenu.xib b/ui-macos/MainMenu.xib index 613eb9b..3414b17 100644 --- a/ui-macos/MainMenu.xib +++ b/ui-macos/MainMenu.xib @@ -12,7 +12,7 @@ YES - + YES @@ -68,7 +68,7 @@ 1 - + 256 YES @@ -683,7 +683,6 @@ {{10, 33}, {607, 327}} - 2 SSH Servers @@ -693,7 +692,7 @@ 2 - + 256 YES @@ -743,8 +742,32 @@ 25 + + + 268 + {{189, 225}, {270, 29}} + + 2 + YES + + 67239424 + 0 + Send debug information to log + + + 1211912703 + 2 + + + + + 200 + 25 + + {{10, 33}, {607, 327}} + 2 Options @@ -905,13 +928,13 @@ - + 0 YES YES - + @@ -956,6 +979,10 @@ SshuttleController + + YES + debug + YES @@ -1378,6 +1405,38 @@ 550 + + + autoReconnectField + + + + 551 + + + + value: values.debug + + + + + + value: values.debug + value + values.debug + 2 + + + 555 + + + + debugField + + + + 556 + @@ -1467,6 +1526,7 @@ YES + @@ -1871,6 +1931,20 @@ NetsArray + + 552 + + + YES + + + + + + 553 + + + @@ -1961,6 +2035,9 @@ 520.IBPluginDependency 521.IBPluginDependency 524.IBPluginDependency + 552.IBAttributePlaceholdersKey + 552.IBPluginDependency + 553.IBPluginDependency YES @@ -1968,9 +2045,9 @@ com.apple.InterfaceBuilder.CocoaPlugin - {{498, 387}, {611, 369}} + {{317, 387}, {611, 369}} com.apple.InterfaceBuilder.CocoaPlugin - {{498, 387}, {611, 369}} + {{317, 387}, {611, 369}} @@ -2128,6 +2205,16 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + + ToolTip + + ToolTip + + If your connection to the server dies, do you want Sshuttle to retry the connection right away? + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin @@ -2146,7 +2233,7 @@ - 550 + 556 @@ -2174,6 +2261,8 @@ YES YES + autoReconnectField + debugField logField prefsWindow routingField @@ -2187,6 +2276,8 @@ id id id + id + id diff --git a/ui-macos/main.py b/ui-macos/main.py index 4719826..8cbca15 100644 --- a/ui-macos/main.py +++ b/ui-macos/main.py @@ -2,9 +2,11 @@ import sys, os, pty from AppKit import * import my, models -def sshuttle_args(host, auto_nets, auto_hosts, nets): +def sshuttle_args(host, auto_nets, auto_hosts, nets, debug): argv = [my.bundle_path('sshuttle/sshuttle', ''), '-r', host] assert(argv[0]) + if debug: + argv.append('-v') if auto_nets: argv.append('--auto-nets') if auto_hosts: @@ -96,6 +98,8 @@ class Runner: if d: self.logfunc(d) self.buf = self.buf + d + if 'Connected.\r\n' in self.buf: + self.serverobj.setConnected_(True) self.buf = self.buf[-4096:] if self.buf.strip().endswith(':'): lastline = self.buf.rstrip().split('\n')[-1] @@ -118,6 +122,8 @@ class SshuttleApp(NSObject): class SshuttleController(NSObject): # Interface builder outlets startAtLoginField = objc.IBOutlet() + autoReconnectField = objc.IBOutlet() + debugField = objc.IBOutlet() routingField = objc.IBOutlet() prefsWindow = objc.IBOutlet() serversController = objc.IBOutlet() @@ -149,7 +155,8 @@ class SshuttleController(NSObject): conn = Runner(sshuttle_args(host, auto_nets = nets_mode == models.NET_AUTO, auto_hosts = server.autoHosts(), - nets = manual_nets), + nets = manual_nets, + debug = self.debugField.state()), logfunc=logfunc, promptfunc=promptfunc, serverobj=server) self.conns[host] = conn @@ -304,6 +311,8 @@ class SshuttleController(NSObject): # support this feature yet). self.startAtLoginField.setEnabled_(False) self.startAtLoginField.setState_(False) + self.autoReconnectField.setEnabled_(False) + self.autoReconnectField.setState_(False) self.load_servers() -- cgit v1.2.3