X2Go dev team | 11 Jan 12:41 2013

pyhoca-gui.git - master (branch) updated: 0.2.1.1-20-gad6f58f

The branch, master has been updated
       via  ad6f58f4462ebd6acb1852da0f92cfaa8d750689 (commit)
       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 -----------------------------------------------------------------
commit ad6f58f4462ebd6acb1852da0f92cfaa8d750689
Author: Mike Gabriel <mike.gabriel@...>
Date:   Fri Jan 11 12:42:26 2013 +0100

    fix __doc__ strings

commit 737d6a3753e7cfbe5f6e426f7eaace93054f4bf8
Author: Mike Gabriel <mike.gabriel@...>
Date:   Fri Jan 11 12:40:40 2013 +0100

    Revert "fix __doc__ strings"

    This reverts commit a28643bee58961bbe0e21e3f48351647a3d343eb.

-----------------------------------------------------------------------

Summary of changes:
 pyhoca/wxgui/frontend.py       |    2 +-
 pyhoca/wxgui/profilemanager.py |  175 ++++++++++++++++++++++++++++++----------
 2 files changed, 135 insertions(+), 42 deletions(-)

The diff of changes is:
diff --git a/pyhoca/wxgui/frontend.py b/pyhoca/wxgui/frontend.py
index eedf85b..0eadf94 100644
--- a/pyhoca/wxgui/frontend.py
+++ b/pyhoca/wxgui/frontend.py
 <at>  <at>  -129,7 +129,7  <at>  <at>  class PyHocaGUI(wx.App, x2go.X2goClient):
             L{PyHocaGUI} constructor for logging application events
          <at> type logger: Python X2Go C{X2goLogger} instance
          <at> 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{PyHocaGUI} constructor for logging application events, this object is forwarded to the
C{X2goClient}. class in Python X2Go.
          <at> type liblogger: Python X2Go C{X2goLogger} instance
          <at> param appname: name of the application instance
          <at> 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
 <at>  <at>  -149,31 +149,19  <at>  <at>  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'))
 <at>  <at>  -273,6 +261,12  <at>  <at>  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)
 <at>  <at>  -373,6 +367,8  <at>  <at>  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)
 <at>  <at>  -462,6 +458,11  <at>  <at>  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:
 <at>  <at>  -601,6 +602,18  <at>  <at>  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)
 <at>  <at>  -781,12 +794,12  <at>  <at>  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)
 <at>  <at>  -798,7 +811,7  <at>  <at>  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)

 <at>  <at>  -809,7 +822,7  <at>  <at>  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))
 <at>  <at>  -868,6 +881,18  <at>  <at>  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'])
 <at>  <at>  -1221,12 +1246,12  <at>  <at>  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)

 
 <at>  <at>  -1256,11 +1281,13  <at>  <at>  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()
 <at>  <at>  -1268,7 +1295,11  <at>  <at>  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'] = ''
 <at>  <at>  -1490,6 +1521,12  <at>  <at>  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)
 <at>  <at>  -1529,11 +1566,14  <at>  <at>  class PyHocaGUI_ProfileManager(wx.Dialog):
          <at> 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)
 <at>  <at>  -1916,6 +1956,18  <at>  <at>  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)
 <at>  <at>  -1936,6 +1988,32  <at>  <at>  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.
+
+         <at> param event: event
+         <at> 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.
+
+         <at> param event: event
+         <at> type event: C{obj}
+
+        """
+        self.SSHPort.SetValue(self.SSHProxyTunnelFromPort.GetValue())

     def OnSetKeyboard(self, event):
         """\
 <at>  <at>  -1970,7 +2048,7  <at>  <at>  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.

 <at>  <at>  -2274,6 +2352,21  <at>  <at>  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

Gmane