The branch, twofactorauth has been updated via f905cc552072465b02c8f2299f7cc3bbeadabde3 (commit) from 66bcf0cd5872b3df0a13c53a5825aefcd17f47fd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: pyhoca/wxgui/profilemanager.py | 224 +++++++++++++++++++++++++++------------- 1 file changed, 152 insertions(+), 72 deletions(-) The diff of changes is: diff --git a/pyhoca/wxgui/profilemanager.py b/pyhoca/wxgui/profilemanager.py index 8371078..bd1a17f 100644 --- a/pyhoca/wxgui/profilemanager.py +++ b/pyhoca/wxgui/profilemanager.py @@ -153,13 +153,20 @@ class PyHocaGUI_ProfileManager(wx.Dialog): self.SSHKeyFileLabel = wx.StaticText(self.tab_Connection, -1, "RSA/DSA private key:") self.SSHKeyFile = wx.TextCtrl(self.tab_Connection, -1, style=wx.TE_PROCESS_ENTER) self.SSHKeyFileBrowseButton = wx.BitmapButton(self.tab_Connection, -1, wx.Bitmap('/%s/PyHoca/16x16/system-search.png' % _icons_location, wx.BITMAP_TYPE_ANY)) - self.UseSSHProxy = wx.CheckBox(self.tab_Connection, -1, "Use SSH proxy to connect to server") - self.SSHProxyLabel = wx.StaticText(self.tab_Connection, -1, "SSH Proxy:") - self.SSHProxyFromHost = wx.TextCtrl(self.tab_Connection, -1, "", size=wx.Size(200,20)) - self.SSHProxyFromPort = wx.SpinCtrl(self.tab_Connection, -1, "0", min=22, max=64000) - self.SSHProxyBetweenLabel = wx.StaticText(self.tab_Connection, -1, " -> ") - self.SSHProxyToHost = wx.TextCtrl(self.tab_Connection, -1, "", size=wx.Size(200,20)) - self.SSHProxyToPort = wx.SpinCtrl(self.tab_Connection, -1, "0", min=22, max=64000) + self.UseSSHProxy = wx.CheckBox(self.tab_Connection, -1, "Server behind SSH proxy") + self.SSHProxyHostLabel = wx.StaticText(self.tab_Connection, -1, "Host:") + self.SSHProxyHost = wx.TextCtrl(self.tab_Connection, -1, "", size=wx.Size(80,20)) + self.SSHProxyUserLabel = wx.StaticText(self.tab_Connection, -1, "User:") + self.SSHProxyUser = wx.TextCtrl(self.tab_Connection, -1, "", size=wx.Size(80,20)) + self.SSHProxyKeyFileLabel = wx.StaticText(self.tab_Connection, -1, "Key file:") + self.SSHProxyKeyFile = wx.TextCtrl(self.tab_Connection, -1, style=wx.TE_PROCESS_ENTER) + self.SSHProxyKeyFileBrowseButton = wx.BitmapButton(self.tab_Connection, -1, wx.Bitmap('/%s/PyHoca/16x16/system-search.png' % _icons_location, wx.BITMAP_TYPE_ANY)) + self.SSHProxyTunnelLabel = wx.StaticText(self.tab_Connection, -1, "SSH Proxy Tunnel:") + self.SSHProxyTunnelFromHost = wx.TextCtrl(self.tab_Connection, -1, "", size=wx.Size(200,20)) + self.SSHProxyTunnelFromPort = wx.SpinCtrl(self.tab_Connection, -1, "0", min=22, max=64000) + self.SSHProxyTunnelBetweenLabel = wx.StaticText(self.tab_Connection, -1, " -> ") + self.SSHProxyTunnelToHost = wx.TextCtrl(self.tab_Connection, -1, "", size=wx.Size(200,20)) + self.SSHProxyTunnelToPort = wx.SpinCtrl(self.tab_Connection, -1, "0", min=22, max=64000) self.LinkSpeed = wx.Slider(self.tab_Connection, -1, 0, 0, 4) self.ModemLabel = wx.StaticText(self.tab_Connection, -1, " |\nModem", style=wx.ALIGN_LEFT) @@ -220,7 +227,8 @@ class PyHocaGUI_ProfileManager(wx.Dialog): self.Bind(wx.EVT_BUTTON, self.OnIconChange, self.IconButton) self.Bind(wx.EVT_COMBOBOX, self.OnSessionTypeSelected, self.SessionType) - self.Bind(wx.EVT_BUTTON, self.OnSSHPublicKeyBrowse, self.SSHKeyFileBrowseButton) + self.Bind(wx.EVT_BUTTON, self.OnSSHKeyFileBrowse, self.SSHKeyFileBrowseButton) + self.Bind(wx.EVT_BUTTON, self.OnSSHProxyKeyFileBrowse, self.SSHProxyKeyFileBrowseButton) self.Bind(wx.EVT_CHECKBOX, self.OnUseSSHProxy, self.UseSSHProxy) self.Bind(wx.EVT_RADIOBUTTON, self.OnSetDisplayFullscreen, self.DisplayTypeFullscreen) self.Bind(wx.EVT_RADIOBUTTON, self.OnSetDisplayCustom, self.DisplayTypeCustom) @@ -270,11 +278,15 @@ class PyHocaGUI_ProfileManager(wx.Dialog): self.SSHKeyFileLabel.SetMinSize((120, 16)) self.SSHKeyFile.SetMinSize((152, _textfield_height)) self.SSHKeyFileBrowseButton.SetSize(self.SSHKeyFileBrowseButton.GetBestSize()) - self.SSHProxyLabel.SetMinSize((120, 16)) - self.SSHProxyFromPort.SetMinSize((60, _textfield_height)) - self.SSHProxyToPort.SetMinSize((60, _textfield_height)) - self.SSHProxyFromHost.SetMinSize((120, _textfield_height)) - self.SSHProxyToHost.SetMinSize((120, _textfield_height)) + self.SSHProxyHost.SetMinSize((120, _textfield_height)) + self.SSHProxyUser.SetMinSize((92, _textfield_height)) + self.SSHProxyKeyFile.SetMinSize((124, _textfield_height)) + self.SSHProxyKeyFileBrowseButton.SetSize(self.SSHProxyKeyFileBrowseButton.GetBestSize()) + self.SSHProxyTunnelLabel.SetMinSize((120, 16)) + self.SSHProxyTunnelFromPort.SetMinSize((60, _textfield_height)) + self.SSHProxyTunnelToPort.SetMinSize((60, _textfield_height)) + self.SSHProxyTunnelFromHost.SetMinSize((120, _textfield_height)) + self.SSHProxyTunnelToHost.SetMinSize((120, _textfield_height)) self.LinkSpeed.SetMinSize((454, _textfield_height)) self.ModemLabel.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "")) self.ISDNLabel.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "")) @@ -359,33 +371,45 @@ class PyHocaGUI_ProfileManager(wx.Dialog): sizer_2_1_2.Add(self.Host, 0, 0, 0) sizer_2_1_2.Add((0,32)) sizer_2_1_3 = wx.BoxSizer(wx.HORIZONTAL) - sizer_2_1_3.Add(self.SSHPortLabel, 0, wx.ALIGN_CENTRE_VERTICAL|wx.RIGHT, 0) + sizer_2_1_3.Add(self.SSHPortLabel, 0, wx.ALIGN_CENTRE_VERTICAL, 0) sizer_2_1_3.Add(self.SSHPort, 0, 0, 0) + sizer_2_1_3.Add((16,0)) + sizer_2_1_3.Add(self.SSHKeyFileLabel, 0, wx.ALIGN_CENTRE_VERTICAL, 0) + sizer_2_1_3.Add(self.SSHKeyFile, 0, wx.ALIGN_CENTRE_VERTICAL, 0) + sizer_2_1_3.Add(self.SSHKeyFileBrowseButton, 0, wx.ALIGN_CENTRE_VERTICAL, 0) sizer_2_1_3.Add((0,32)) sizer_2_1_4 = wx.BoxSizer(wx.HORIZONTAL) - sizer_2_1_4.Add(self.SSHKeyFileLabel, 0, wx.ALIGN_CENTRE_VERTICAL, 0) - sizer_2_1_4.Add(self.SSHKeyFile, 0, wx.ALIGN_CENTRE_VERTICAL, 0) - sizer_2_1_4.Add(self.SSHKeyFileBrowseButton, 0, wx.ALIGN_CENTRE_VERTICAL, 0) - sizer_2_1_4.Add((0,32)) + sizer_2_1_4.Add(self.UseSSHProxy, 0, wx.ALIGN_CENTRE_VERTICAL, 0) sizer_2_1_5 = wx.BoxSizer(wx.HORIZONTAL) - sizer_2_1_5.Add(self.UseSSHProxy, 0, wx.ALIGN_BOTTOM, 0) + sizer_2_1_5.Add(self.SSHProxyHostLabel, 0, wx.ALIGN_CENTRE_VERTICAL, 0) + sizer_2_1_5.Add((8,0)) + sizer_2_1_5.Add(self.SSHProxyHost, 0, wx.ALIGN_CENTRE_VERTICAL, 0) + sizer_2_1_5.Add((16,0)) + sizer_2_1_5.Add(self.SSHProxyUserLabel, 0, wx.ALIGN_CENTRE_VERTICAL, 0) + sizer_2_1_5.Add((8,0)) + sizer_2_1_5.Add(self.SSHProxyUser, 0, wx.ALIGN_CENTRE_VERTICAL, 0) + sizer_2_1_5.Add((16,0)) + sizer_2_1_5.Add(self.SSHProxyKeyFileLabel, 0, wx.ALIGN_CENTRE_VERTICAL, 0) + sizer_2_1_5.Add((8,0)) + sizer_2_1_5.Add(self.SSHProxyKeyFile, 0, wx.ALIGN_CENTRE_VERTICAL, 0) + sizer_2_1_5.Add(self.SSHProxyKeyFileBrowseButton, 0, wx.ALIGN_CENTRE_VERTICAL, 0) sizer_2_1_5.Add((0,32)) sizer_2_1_6 = wx.BoxSizer(wx.HORIZONTAL) - sizer_2_1_6.Add(self.SSHProxyLabel, 0, wx.ALIGN_CENTRE_VERTICAL, 0) - sizer_2_1_6.Add(self.SSHProxyFromHost, 0, wx.ALIGN_CENTRE_VERTICAL, 0) + sizer_2_1_6.Add(self.SSHProxyTunnelLabel, 0, wx.ALIGN_CENTRE_VERTICAL, 0) + sizer_2_1_6.Add(self.SSHProxyTunnelFromHost, 0, wx.ALIGN_CENTRE_VERTICAL, 0) sizer_2_1_6.Add((4, 0)) - sizer_2_1_6.Add(self.SSHProxyFromPort, 0, wx.ALIGN_CENTRE_VERTICAL, 0) + sizer_2_1_6.Add(self.SSHProxyTunnelFromPort, 0, wx.ALIGN_CENTRE_VERTICAL, 0) sizer_2_1_6.Add((8, 0)) - sizer_2_1_6.Add(self.SSHProxyBetweenLabel, 0, wx.ALIGN_CENTRE_VERTICAL|wx.ALIGN_CENTRE_HORIZONTAL, 0) + sizer_2_1_6.Add(self.SSHProxyTunnelBetweenLabel, 0, wx.ALIGN_CENTRE_VERTICAL|wx.ALIGN_CENTRE_HORIZONTAL, 0) sizer_2_1_6.Add((8, 0)) - sizer_2_1_6.Add(self.SSHProxyToHost, 0, wx.ALIGN_CENTRE_VERTICAL, 0) + sizer_2_1_6.Add(self.SSHProxyTunnelToHost, 0, wx.ALIGN_CENTRE_VERTICAL, 0) sizer_2_1_6.Add((4, 0)) - sizer_2_1_6.Add(self.SSHProxyToPort, 0, wx.ALIGN_CENTRE_VERTICAL, 0) + sizer_2_1_6.Add(self.SSHProxyTunnelToPort, 0, wx.ALIGN_CENTRE_VERTICAL, 0) sizer_2_1.Add(sizer_2_1_1, 0, wx.EXPAND, 0) sizer_2_1.Add(sizer_2_1_2, 0, wx.EXPAND, 0) sizer_2_1.Add(sizer_2_1_3, 0, wx.EXPAND, 0) sizer_2_1.Add(sizer_2_1_4, 0, wx.EXPAND, 0) - sizer_2_1.Add(sizer_2_1_5, 0, wx.EXPAND, 0) + sizer_2_1.Add(sizer_2_1_5, 0, wx.EXPAND|wx.ALIGN_BOTTOM, 0) sizer_2_1.Add(sizer_2_1_6, 0, wx.EXPAND, 0) sizer_2_2 = wx.StaticBoxSizer(self.staticbox_LinkSpeed, wx.VERTICAL) @@ -545,30 +569,48 @@ class PyHocaGUI_ProfileManager(wx.Dialog): self.UseSSHProxy.SetValue(self.profile_config['usesshproxy']) _ssh_proxy = self.profile_config['usesshproxy'] - if self.profile_config['sshproxy'].count(':') == 2: - _from_port, _to_host, _to_port = self.profile_config['sshproxy'].split(':') + self.SSHProxyHost.SetValue(self.profile_config['sshproxyhost']) + self.SSHProxyUser.SetValue(self.profile_config['sshproxyuser']) + self.SSHProxyKeyFile.SetValue(self.profile_config['sshproxykeyfile']) + _from_host = _from_port = _to_host = _to_port = None + if self.profile_config['sshproxytunnel'].count(':') == 2: + _from_port, _to_host, _to_port = self.profile_config['sshproxytunnel'].split(':') _from_host = 'localhost' - elif self.profile_config['sshproxy'].count(':') == 3: - _from_host, _from_port, _to_host, _to_port = self.profile_config['sshproxy'].split(':') + elif self.profile_config['sshproxytunnel'].count(':') == 3: + _from_host, _from_port, _to_host, _to_port = self.profile_config['sshproxytunnel'].split(':') + if _from_host: self.SSHProxyTunnelFromHost.SetValue(_from_host) + if _from_port: self.SSHProxyTunnelFromPort.SetValue(int(_from_port)) + if _to_host: self.SSHProxyTunnelToHost.SetValue(_to_host) + if _to_port: self.SSHProxyTunnelToPort.SetValue(int(_to_port)) if _ssh_proxy: - self.SSHProxyFromHost.SetValue(_from_host) - self.SSHProxyFromPort.SetValue(int(_from_port)) - self.SSHProxyToHost.SetValue(_to_host) - self.SSHProxyToPort.SetValue(int(_to_port)) - self.SSHProxyLabel.Enable(True) - self.SSHProxyFromHost.Enable(True) - self.SSHProxyFromPort.Enable(True) - self.SSHProxyBetweenLabel.Enable(True) - self.SSHProxyToHost.Enable(True) - self.SSHProxyToPort.Enable(True) + self.SSHProxyHostLabel.Enable(True) + self.SSHProxyHost.Enable(True) + self.SSHProxyUserLabel.Enable(True) + self.SSHProxyUser.Enable(True) + self.SSHProxyKeyFileLabel.Enable(True) + self.SSHProxyKeyFile.Enable(True) + self.SSHProxyKeyFileBrowseButton.Enable(True) + self.SSHProxyTunnelLabel.Enable(True) + self.SSHProxyTunnelFromHost.Enable(True) + self.SSHProxyTunnelFromPort.Enable(True) + self.SSHProxyTunnelBetweenLabel.Enable(True) + self.SSHProxyTunnelToHost.Enable(True) + self.SSHProxyTunnelToPort.Enable(True) else: - self.SSHProxyLabel.Enable(False) - self.SSHProxyFromHost.Enable(False) - self.SSHProxyFromPort.Enable(False) - self.SSHProxyBetweenLabel.Enable(False) - self.SSHProxyToHost.Enable(False) - self.SSHProxyToPort.Enable(False) + self.SSHProxyHostLabel.Enable(False) + self.SSHProxyHost.Enable(False) + self.SSHProxyUserLabel.Enable(False) + self.SSHProxyUser.Enable(False) + self.SSHProxyKeyFileLabel.Enable(False) + self.SSHProxyKeyFile.Enable(False) + self.SSHProxyKeyFileBrowseButton.Enable(False) + self.SSHProxyTunnelLabel.Enable(False) + self.SSHProxyTunnelFromHost.Enable(False) + self.SSHProxyTunnelFromPort.Enable(False) + self.SSHProxyTunnelBetweenLabel.Enable(False) + self.SSHProxyTunnelToHost.Enable(False) + self.SSHProxyTunnelToPort.Enable(False) _command = self.profile_config['command'] @@ -589,7 +631,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog): self.Application.SetValue(self.applicationChoices[_command]) self.Command.SetValue('') else: - self.SessionTyp.SetValue(self.sessionChoices['CUSTOM']) + self.SessionType.SetValue(self.sessionChoices['CUSTOM']) self.Command.Enable(True) self.Command.SetValue(_command) @@ -723,12 +765,19 @@ class PyHocaGUI_ProfileManager(wx.Dialog): self.SSHKeyFileLabel.Enable(False) self.SSHKeyFile.Enable(False) self.UseSSHProxy.Enable(False) - self.SSHProxyLabel.Enable(False) - self.SSHProxyFromHost.Enable(False) - self.SSHProxyFromPort.Enable(False) - self.SSHProxyBetweenLabel.Enable(False) - self.SSHProxyToHost.Enable(False) - self.SSHProxyToPort.Enable(False) + self.SSHProxyHostLabel.Enable(False) + self.SSHProxyHost.Enable(False) + self.SSHProxyUserLabel.Enable(False) + self.SSHProxyUser.Enable(False) + self.SSHProxyKeyFileLabel.Enable(False) + self.SSHProxyKeyFile.Enable(False) + self.SSHProxyKeyFileBrowseButton.Enable(False) + self.SSHProxyTunnelLabel.Enable(False) + self.SSHProxyTunnelFromHost.Enable(False) + self.SSHProxyTunnelFromPort.Enable(False) + self.SSHProxyTunnelBetweenLabel.Enable(False) + self.SSHProxyTunnelToHost.Enable(False) + self.SSHProxyTunnelToPort.Enable(False) self.tab_SharedFolders.Enable(False) def __update_from_screen(self): @@ -742,11 +791,14 @@ class PyHocaGUI_ProfileManager(wx.Dialog): self.profile_config['usesshproxy'] = True else: self.profile_config['usesshproxy'] = False - self.profile_config['sshproxy'] = '%s:%s:%s:%s' % (self.SSHProxyFromHost.GetValue(), - self.SSHProxyFromPort.GetValue(), - self.SSHProxyToHost.GetValue(), - self.SSHProxyToPort.GetValue(), - ) + self.profile_config['sshproxyhost'] = self.SSHProxyHost.GetValue() + self.profile_config['sshproxyuser'] = self.SSHProxyUser.GetValue() + self.profile_config['sshproxytunnel'] = '%s:%s:%s:%s' % (self.SSHProxyTunnelFromHost.GetValue(), + self.SSHProxyTunnelFromPort.GetValue(), + self.SSHProxyTunnelToHost.GetValue(), + self.SSHProxyTunnelToPort.GetValue(), + ) + self.profile_config['sshproxykeyfile'] = self.SSHProxyKeyFile.GetValue() _session_type = [ s for s in self.sessionChoices.keys() if self.sessionChoices[s] == self.SessionType.GetValue() ][0] if _session_type == 'APPLICATION': @@ -907,8 +959,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog): self.disable_EditConnected_options() - - def OnSSHPublicKeyBrowse(self, event): + def OnSSHKeyFileBrowse(self, event): sshdir = os.path.expanduser('~/.ssh') if not os.path.exists(sshdir): sshdir = os.getcwd() @@ -923,21 +974,50 @@ class PyHocaGUI_ProfileManager(wx.Dialog): path = dlg.GetPath() self.SSHKeyFile.SetValue(path) + def OnSSHProxyKeyFileBrowse(self, event): + sshdir = os.path.expanduser('~/.ssh') + if not os.path.exists(sshdir): + sshdir = os.getcwd() + wildcard = "All files (*.*)|*" + dlg = wx.FileDialog( + self, message="Choose a public SSH key", defaultDir=sshdir, + defaultFile="", wildcard=wildcard, style=wx.OPEN | wx.CHANGE_DIR ) + # Show the dialog and retrieve the user response. If it is the OK response, + # process the data. + if dlg.ShowModal() == wx.ID_OK: + # This returns a Python list of files that were selected. + path = dlg.GetPath() + self.SSHProxyKeyFile.SetValue(path) + def OnUseSSHProxy(self, event): if self.UseSSHProxy.GetValue(): - self.SSHProxyLabel.Enable(True) - self.SSHProxyFromHost.Enable(True) - self.SSHProxyBetweenLabel.Enable(True) - self.SSHProxyFromPort.Enable(True) - self.SSHProxyToHost.Enable(True) - self.SSHProxyToPort.Enable(True) + self.SSHProxyHostLabel.Enable(True) + self.SSHProxyHost.Enable(True) + self.SSHProxyUserLabel.Enable(True) + self.SSHProxyUser.Enable(True) + self.SSHProxyKeyFileLabel.Enable(True) + self.SSHProxyKeyFile.Enable(True) + self.SSHProxyKeyFileBrowseButton.Enable(True) + self.SSHProxyTunnelLabel.Enable(True) + self.SSHProxyTunnelFromHost.Enable(True) + self.SSHProxyTunnelBetweenLabel.Enable(True) + self.SSHProxyTunnelFromPort.Enable(True) + self.SSHProxyTunnelToHost.Enable(True) + self.SSHProxyTunnelToPort.Enable(True) else: - self.SSHProxyLabel.Enable(False) - self.SSHProxyFromHost.Enable(False) - self.SSHProxyFromPort.Enable(False) - self.SSHProxyBetweenLabel.Enable(False) - self.SSHProxyToHost.Enable(False) - self.SSHProxyToPort.Enable(False) + self.SSHProxyHostLabel.Enable(False) + self.SSHProxyHost.Enable(False) + self.SSHProxyUserLabel.Enable(False) + self.SSHProxyUser.Enable(False) + self.SSHProxyKeyFileLabel.Enable(False) + self.SSHProxyKeyFile.Enable(False) + self.SSHProxyKeyFileBrowseButton.Enable(False) + self.SSHProxyTunnelLabel.Enable(False) + self.SSHProxyTunnelFromHost.Enable(False) + self.SSHProxyTunnelFromPort.Enable(False) + self.SSHProxyTunnelBetweenLabel.Enable(False) + self.SSHProxyTunnelToHost.Enable(False) + self.SSHProxyTunnelToPort.Enable(False) def OnKeepKeyboard(self, event): if self.CurrentKeyBoard.GetValue(): hooks/post-receive -- pyhoca-gui.git (Python X2Go Client (wxPython GUI)) This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "pyhoca-gui.git" (Python X2Go Client (wxPython GUI)).