[X2Go-Commits] pyhoca-gui.git - build-59a18b6e3b5d3f1dd8f07f26433d37fe5984a57d (branch) updated: 0.2.1.1-19-g737d6a3

X2Go dev team git-admin at x2go.org
Tue Aug 27 13:22:49 CEST 2013


The branch, build-59a18b6e3b5d3f1dd8f07f26433d37fe5984a57d has been updated
       via  737d6a3753e7cfbe5f6e426f7eaace93054f4bf8 (commit)
      from  f35e93e867eb8f1dbbee9ad80fe0380be012df7d (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/frontend.py       |    4 +-
 pyhoca/wxgui/profilemanager.py |  175 ++++++++++++++++++++++++++++++----------
 2 files changed, 136 insertions(+), 43 deletions(-)

The diff of changes is:
diff --git a/pyhoca/wxgui/frontend.py b/pyhoca/wxgui/frontend.py
index eedf85b..85d0dde 100644
--- a/pyhoca/wxgui/frontend.py
+++ b/pyhoca/wxgui/frontend.py
@@ -126,10 +126,10 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
         @param args: a class with properties representing the command-line options that are available to L{PyHocaGUI} instances.
         @type args: C{argparse.ArgumentParser} (or similar)
         @param logger: you can pass an L{X2goLogger} object to the
-            L{PyHocaGUI} constructor for logging application events
+            L{PyHocaCLI} constructor for logging application events
         @type logger: Python X2Go C{X2goLogger} instance
         @param liblogger: you can pass an L{X2goLogger} object to the
-            L{PyHocaGUI} constructor for logging application events, this object is forwarded to the C{X2goClient. class in Python X2Go.
+            L{PyHocaCLI} constructor for logging application events, this object is forwarded to the C{X2goClient. class in Python X2Go.
         @type liblogger: Python X2Go C{X2goLogger} instance
         @param appname: name of the application instance
         @type appname: C{str}
diff --git a/pyhoca/wxgui/profilemanager.py b/pyhoca/wxgui/profilemanager.py
index 0a05d91..0d3dde5 100644
--- a/pyhoca/wxgui/profilemanager.py
+++ b/pyhoca/wxgui/profilemanager.py
@@ -149,31 +149,19 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
             # allow localization of the default keyboard settings
             self.profile_name = self.profile_config['name'] = profile_name
 
-        # this code block is for compatibility of session profiles prior to 0.2.2.0:
-        _from_host = _from_port = _to_host = _to_port = None
-        if self.profile_config.has_key('sshproxytunnel'):
-            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['sshproxytunnel'].count(':') == 3:
-                _from_host, _from_port, _to_host, _to_port = self.profile_config['sshproxytunnel'].split(':')
-
-            if _to_host: self.profile_config['host'] = _to_host
-            if _to_port: self.profile_config['sshport'] = int(_to_port)
-
         # we create a backup dict of our profile_config immediately (for being able to reset erroneously made changes)
         self.profile_config_bak = copy.deepcopy(self.profile_config)
 
         self._last_rdpclient = self.profile_config['rdpclient']
         self._last_application = self.applicationChoices['TERMINAL']
 
-        self.X2GoTabs = wx.Notebook(self, -1, style=0)
-        self.tab_Profile = wx.Panel(self.X2GoTabs, -1)
-        self.tab_Session = wx.Panel(self.X2GoTabs, -1)
-        self.tab_Connection = wx.Panel(self.X2GoTabs, -1)
-        self.tab_LinkQuality = wx.Panel(self.X2GoTabs, -1)
-        self.tab_Settings = wx.Panel(self.X2GoTabs, -1)
-        self.tab_SharedResources = wx.Panel(self.X2GoTabs, -1)
+        self.X2goTabs = wx.Notebook(self, -1, style=0)
+        self.tab_Profile = wx.Panel(self.X2goTabs, -1)
+        self.tab_Session = wx.Panel(self.X2goTabs, -1)
+        self.tab_Connection = wx.Panel(self.X2goTabs, -1)
+        self.tab_LinkQuality = wx.Panel(self.X2goTabs, -1)
+        self.tab_Settings = wx.Panel(self.X2goTabs, -1)
+        self.tab_SharedResources = wx.Panel(self.X2goTabs, -1)
 
         # boxes for all tabs
         self.staticbox_Profile = wx.StaticBox(self.tab_Profile, -1, ' %s ' % _(u'Session Title'))
@@ -273,6 +261,12 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
         self.SSHProxyHost = wx.TextCtrl(self.tab_Connection, -1, "", size=wx.Size(80,20))
         self.SSHProxyPortLabel = wx.StaticText(self.tab_Connection, -1, _(u"Port")+": ")
         self.SSHProxyPort = wx.SpinCtrl(self.tab_Connection, -1, "22", min=1, max=65534)
+        self.SSHProxyTunnelLabel = wx.StaticText(self.tab_Connection, -1, _(u"SSH Proxy Tunnel")+": ")
+        self.SSHProxyTunnelFromHost = wx.TextCtrl(self.tab_Connection, -1, "", size=wx.Size(200,20))
+        self.SSHProxyTunnelFromPort = wx.SpinCtrl(self.tab_Connection, -1, "44444", min=1, max=65534)
+        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, "22", min=1, max=65534)
         self.SSHProxyAutoLogin = wx.CheckBox(self.tab_Connection, -1, _(u"Discover SSH keys or use SSH agent for proxy authentication"))
 
         self.LinkSpeed = wx.Slider(self.tab_LinkQuality, -1, 0, 0, 4)
@@ -373,6 +367,8 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
         self.Bind(wx.EVT_CHECKBOX, self.OnSSHProxySameUser, self.SSHProxySameUser)
         self.Bind(wx.EVT_CHECKBOX, self.OnSSHProxySamePassword, self.SSHProxySamePassword)
         self.Bind(wx.EVT_CHECKBOX, self.OnSSHProxyAutoLogin, self.SSHProxyAutoLogin)
+        self.Bind(wx.EVT_TEXT, self.OnUpdateSSHProxyTunnelFromHost, self.SSHProxyTunnelFromHost)
+        self.Bind(wx.EVT_TEXT, self.OnUpdateSSHProxyTunnelFromPort, self.SSHProxyTunnelFromPort)
         self.Bind(wx.EVT_COMBOBOX, self.OnCompressionSelected, self.Compression)
         self.Bind(wx.EVT_RADIOBUTTON, self.OnSetDisplayFullscreen, self.DisplayTypeFullscreen)
         self.Bind(wx.EVT_RADIOBUTTON, self.OnSetDisplayMaximize, self.DisplayTypeMaximize)
@@ -462,6 +458,11 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
         self.SSHProxyPortLabel.SetMinSize((-1, 16))
         self.SSHProxyPort.SetMinSize((65, self._textfield_height))
         self.SSHProxyKeyFile.SetMinSize((220, self._textfield_height))
+        self.SSHProxyTunnelLabel.SetMinSize((-1, 16))
+        self.SSHProxyTunnelFromPort.SetMinSize((65, self._textfield_height))
+        self.SSHProxyTunnelToPort.SetMinSize((65, self._textfield_height))
+        self.SSHProxyTunnelFromHost.SetMinSize((140, self._textfield_height))
+        self.SSHProxyTunnelToHost.SetMinSize((140, self._textfield_height))
         if X2GOCLIENT_OS == 'Windows':
             self.LinkSpeed.SetMinSize((425, self._textfield_height))
         else:
@@ -601,6 +602,18 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
         sizer_3_2_1.Add(self.SSHProxyPort, pos=(3,4), span=(1,2), flag=wx.ALIGN_CENTRE_VERTICAL)
         sizer_3_2_1.Add(self.SSHProxyAutoLogin, pos=(4,0), span=(1,6), flag=wx.ALIGN_CENTRE_VERTICAL)
         sizer_3_2_1_1 = wx.BoxSizer(wx.HORIZONTAL)
+        sizer_3_2_1_1.Add(self.SSHProxyTunnelLabel, flag=wx.ALIGN_CENTRE_VERTICAL)
+        sizer_3_2_1_1.Add(self.SSHProxyTunnelFromHost, flag=wx.ALIGN_CENTRE_VERTICAL)
+        sizer_3_2_1_1.Add((4, 0))
+        sizer_3_2_1_1.Add(self.SSHProxyTunnelFromPort, flag=wx.ALIGN_CENTRE_VERTICAL)
+        sizer_3_2_1_1.Add((8, 0))
+        sizer_3_2_1_1.Add(self.SSHProxyTunnelBetweenLabel, flag=wx.ALIGN_CENTRE_VERTICAL|wx.ALIGN_CENTRE_HORIZONTAL)
+        sizer_3_2_1_1.Add((8, 0))
+        sizer_3_2_1_1.Add(self.SSHProxyTunnelToHost, flag=wx.ALIGN_CENTRE_VERTICAL)
+        sizer_3_2_1_1.Add((4, 0))
+        sizer_3_2_1_1.Add(self.SSHProxyTunnelToPort, flag=wx.ALIGN_CENTRE_VERTICAL)
+        sizer_3_2_1_1.Add((0,32))
+        sizer_3_2_1.Add(sizer_3_2_1_1, pos=(5,0), span=(1,6))
         sizer_3_2.Add(sizer_3_2_1, flag=wx.EXPAND|wx.ALL, border=7)
 
         sizer_3.Add(sizer_3_1, flag=wx.EXPAND|wx.ALL, border=5)
@@ -781,12 +794,12 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
         self.tab_SharedResources.SetSizerAndFit(sizer_6)
         self.tab_SharedResources.Layout()
 
-        self.X2GoTabs.AddPage(self.tab_Profile, _(u"Profile"))
-        self.X2GoTabs.AddPage(self.tab_Session, _(u"Session"))
-        self.X2GoTabs.AddPage(self.tab_Connection, _(u"Connection"))
-        self.X2GoTabs.AddPage(self.tab_LinkQuality, _(u"Link Quality"))
-        self.X2GoTabs.AddPage(self.tab_Settings, _(u"Settings"))
-        self.X2GoTabs.AddPage(self.tab_SharedResources, _(u"Sharing"))
+        self.X2goTabs.AddPage(self.tab_Profile, _(u"Profile"))
+        self.X2goTabs.AddPage(self.tab_Session, _(u"Session"))
+        self.X2goTabs.AddPage(self.tab_Connection, _(u"Connection"))
+        self.X2goTabs.AddPage(self.tab_LinkQuality, _(u"Link Quality"))
+        self.X2goTabs.AddPage(self.tab_Settings, _(u"Settings"))
+        self.X2goTabs.AddPage(self.tab_SharedResources, _(u"Sharing"))
 
         # the bottom area with OK, Defaults and Cancel buttons
         sizer_B = wx.BoxSizer(wx.HORIZONTAL)
@@ -798,7 +811,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
 
         # put it all together...
         MainSizer = wx.BoxSizer(wx.VERTICAL)
-        MainSizer.Add(self.X2GoTabs, proportion=1, flag=wx.EXPAND|wx.FIXED_MINSIZE)
+        MainSizer.Add(self.X2goTabs, proportion=1, flag=wx.EXPAND|wx.FIXED_MINSIZE)
         MainSizer.Add(sizer_B, flag=wx.ALIGN_RIGHT)
         self.SetSizerAndFit(MainSizer)
 
@@ -809,7 +822,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
         max5_x, max5_y = self.tab_Settings.GetBestSize()
         max6_x, max6_y = self.tab_SharedResources.GetBestSize()
 
-        #self.SetSize(self.GetBestSize() + self.X2GoTabs.GetBestSize())
+        #self.SetSize(self.GetBestSize() + self.X2goTabs.GetBestSize())
 
         if X2GOCLIENT_OS == "Windows":
             self.SetSize((max(max1_x, max2_x, max3_x, max4_x, max5_x) * 1.05, max(max1_y, max2_y, max3_y, max4_y, max5_y) * 1.10 + 50))
@@ -868,6 +881,18 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
             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['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))
+
         self.UseSSHProxy.SetValue(_ssh_proxy)
         self.SSHProxySameUser.SetValue(self.profile_config['sshproxysameuser'])
         self.SSHProxySamePassword.SetValue(self.profile_config['sshproxysamepass'])
@@ -1221,12 +1246,12 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
             self.SSHProxyHost.Enable(False)
             self.SSHProxyPortLabel.Enable(False)
             self.SSHProxyPort.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.SSHProxyTunnelLabel.Enable(False)
+            self.SSHProxyTunnelFromHost.Enable(False)
+            self.SSHProxyTunnelFromPort.Enable(False)
+            self.SSHProxyTunnelBetweenLabel.Enable(False)
+            self.SSHProxyTunnelToHost.Enable(False)
+            self.SSHProxyTunnelToPort.Enable(False)
             self.SSHProxyAutoLogin.Enable(False)
 
 
@@ -1256,11 +1281,13 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
             self.profile_config['icon'] = ':icons/128x128/x2gosession.png'
         self.profile_config['user'] = self.UserName.GetValue()
         self.profile_config['key'] = self.SSHKeyFile.GetValue()
-        self.profile_config['host'] = self.Host.GetValue()
         if self.UseSSHProxy.GetValue():
             self.profile_config['usesshproxy'] = True
+            self.profile_config['host'] = self.SSHProxyTunnelFromHost.GetValue()
+            self.profile_config['sshport'] = self.SSHProxyTunnelFromPort.GetValue()
         else:
             self.profile_config['usesshproxy'] = False
+            self.profile_config['host'] = self.Host.GetValue()
             if _session_type != 'DirectRDP':
                 self.profile_config['sshport'] = self.SSHPort.GetValue()
         self.profile_config['sshproxysameuser'] = self.SSHProxySameUser.GetValue()
@@ -1268,7 +1295,11 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
 
         self.profile_config['sshproxyhost'] = self.SSHProxyHost.GetValue()
         self.profile_config['sshproxyport'] = self.SSHProxyPort.GetValue()
-        self.profile_config['sshproxytunnel'] = 'DEPRECATED_CAN_BE_REMOVED'
+        self.profile_config['sshproxytunnel'] = '%s:%s:%s:%s' % (self.SSHProxyTunnelFromHost.GetValue(),
+                                                                 self.SSHProxyTunnelFromPort.GetValue(),
+                                                                 self.SSHProxyTunnelToHost.GetValue(),
+                                                                 self.SSHProxyTunnelToPort.GetValue(),
+                                                                )
         self.profile_config['sshproxyautologin'] = self.SSHProxyAutoLogin.GetValue()
         if self.profile_config['sshproxysameuser']:
             self.profile_config['sshproxyuser'] = ''
@@ -1490,6 +1521,12 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
         self.SSHProxyHost.Enable(False)
         self.SSHProxyPortLabel.Enable(False)
         self.SSHProxyPort.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.SSHProxyAutoLogin.Enable(False)
         self.LinkSpeed.Enable(False)
         self.ModemLabel.Enable(False)
@@ -1529,11 +1566,14 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
         @type event: C{obj}
 
         """
-        self.HostLabel.Enable(True)
-        self.Host.Enable(True)
-        self.SSHPortLabel.Enable(True)
-        self.SSHPort.Enable(True)
-        self.SSHPort.SetValue(self.profile_config_bak['sshport'])
+        if not self.UseSSHProxy.GetValue():
+            self.HostLabel.Enable(True)
+            self.Host.Enable(True)
+            self.SSHPortLabel.Enable(True)
+            self.SSHPort.Enable(True)
+            self.SSHPort.SetValue(self.profile_config_bak['sshport'])
+        else:
+            self.SSHPort.SetValue(self.SSHProxyTunnelFromPort.GetValue())
         self.SSHAutoLogin.Enable(True)
         if PARAMIKO_FEATURE['forward-ssh-agent']:
             self.SSHForwardAuthAgent.Enable(True)
@@ -1916,6 +1956,18 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
             if self.SSHProxyAutoLogin.GetValue():
                 self.SSHProxyKeyFileLabel.Enable(False)
             self.SSHProxyAutoLogin.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)
+            self.Host.Enable(False)
+            self.HostLabel.Enable(False)
+            self.Host.SetValue(self.SSHProxyTunnelFromHost.GetValue())
+            self.SSHPort.Enable(False)
+            self.SSHPortLabel.Enable(False)
+            self.SSHPort.SetValue(self.SSHProxyTunnelFromPort.GetValue())
         else:
             self.staticbox_Proxy.Enable(False)
             self.SSHProxySameUser.Enable(False)
@@ -1936,6 +1988,32 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
             self.SSHProxyTunnelToHost.Enable(False)
             self.SSHProxyTunnelToPort.Enable(False)
             self.SSHProxyAutoLogin.Enable(False)
+            self.Host.Enable(True)
+            self.HostLabel.Enable(True)
+            self.Host.SetValue(self.profile_config_bak['host'])
+            self.SSHPort.Enable(True)
+            self.SSHPortLabel.Enable(True)
+            self.SSHPort.SetValue(self.profile_config_bak['sshport'])
+
+    def OnUpdateSSHProxyTunnelFromHost(self, event):
+        """\
+        Gets called whenever the ssh-proxy-tunnel-from-host gets modified.
+
+        @param event: event
+        @type event: C{obj}
+
+        """
+        self.Host.SetValue(self.SSHProxyTunnelFromHost.GetValue())
+
+    def OnUpdateSSHProxyTunnelFromPort(self, event):
+        """\
+        Gets called whenever the ssh-proxy-tunnel-from-port gets modified.
+
+        @param event: event
+        @type event: C{obj}
+
+        """
+        self.SSHPort.SetValue(self.SSHProxyTunnelFromPort.GetValue())
 
     def OnSetKeyboard(self, event):
         """\
@@ -1970,7 +2048,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
             self.KeyboardModel.Enable(False)
             self.KeyboardVariant.Enable(False)
 
-    def OnSoundEnable(self, event):
+    def OnSoundEnable(self, event): # wxGlade: X2goMaintProfile.<event_handler>
         """\
         Gets called whenever the enable-sound checkbox gets marked.
 
@@ -2274,6 +2352,21 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
         elif self.profile_config['name'].strip() != self.profile_config_bak['name'] and self.profile_config['name'] in self.session_profiles.profile_names:
             validateOk = False
             self._PyHocaGUI.notifier.send(title=_(u'Profile Manager'), text=_(u'Profile name %s already exists!!!') % self.profile_config['name'].strip(), icon='profile_error')
+        elif self.profile_config['usesshproxy'] and self.profile_config['name'] == self.profile_config_bak['name']:
+            try:
+                (from_host, from_port) = self.profile_config['sshproxytunnel'].split(':')[0:2]
+            except ValueError:
+                self._PyHocaGUI.notifier.send(title=_(u'Profile Manager'), text=_(u'The SSH proxy configuration is incomplete. Try again.'), icon='profile_error')
+            for profile_name in [ p for p in self._PyHocaGUI.profile_names if p != self.profile_config['name'] ]:
+                test_profile_config = self.session_profiles.get_profile_config(profile_name)
+                if test_profile_config['usesshproxy']:
+                    try:
+                        (test_from_host, test_from_port) = test_profile_config['sshproxytunnel'].split(':')[0:2]
+                    except ValueError:
+                        continue
+                    if (from_host, from_port) == (test_from_host, test_from_port):
+                        validateOk = False
+                        self._PyHocaGUI.notifier.send(title=_(u'Profile Manager'), text=_(u'Another session profile (%s) already uses [%s]:%s for binding a local SSH proxy to.\nPlease change the SSH proxy settings accordingly.' % (profile_name.strip(), from_host, from_port)), icon='profile_warning')
         return validateOk
 
     def OnOKButton(self, event):


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)).




More information about the x2go-commits mailing list