[X2Go-Commits] pyhoca-gui.git - twofactorauth (branch) updated: c8eb7fe97d34098e3ed188944d5f34676522c7a8

X2Go dev team git-admin at x2go.org
Sat Sep 14 15:54:29 CEST 2013


The branch, twofactorauth has been updated
       via  c8eb7fe97d34098e3ed188944d5f34676522c7a8 (commit)
      from  c9c0d31051ce335870cdb5119ae91896fb741d5d (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       |   16 ++++++++++++++
 pyhoca/wxgui/menus_taskbar.py  |   21 ++++++++++++++----
 pyhoca/wxgui/profilemanager.py |   48 +++++++++++++++++++++++++++++++++++-----
 3 files changed, 76 insertions(+), 9 deletions(-)

The diff of changes is:
diff --git a/pyhoca/wxgui/frontend.py b/pyhoca/wxgui/frontend.py
index ba61743..299b12f 100644
--- a/pyhoca/wxgui/frontend.py
+++ b/pyhoca/wxgui/frontend.py
@@ -441,6 +441,15 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
         self._pyhoca_logger('editing session profile %s' % self.current_profile_name, loglevel=x2go.log.loglevel_INFO, )
         profilemanager.PyHocaGUI_ProfileManager(self, 'EDIT', profile_name=self.current_profile_name)
 
+    def OnProfileEditWhileConnected(self, evt):
+        """\
+        STILL UNDOCUMENTED
+
+        """
+        self.current_profile_name = self._eventid_profilenames_map[evt.GetId()]
+        self._pyhoca_logger('editing session profile %s' % self.current_profile_name, loglevel=x2go.log.loglevel_INFO, )
+        profilemanager.PyHocaGUI_ProfileManager(self, 'EDIT_CONNECTED', profile_name=self.current_profile_name)
+
     def OnProfileDelete(self, evt):
         """\
         STILL UNDOCUMENTED
@@ -454,6 +463,13 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
         except:
             pass
 
+    def OnShareLocalFolder(self, evt):
+        """\
+        STILL UNDOCUMENTED
+
+        """
+        self._pyhoca_logger('The ,,Share Local Folder\'\' menu item is not implemented yet', loglevel=x2go.log.loglevel_WARN, )
+
     def OnListSessions(self, evt):
         """\
         STILL UNDOCUMENTED
diff --git a/pyhoca/wxgui/menus_taskbar.py b/pyhoca/wxgui/menus_taskbar.py
index e067127..bb1c491 100644
--- a/pyhoca/wxgui/menus_taskbar.py
+++ b/pyhoca/wxgui/menus_taskbar.py
@@ -86,6 +86,7 @@ class PyHocaGUI_Menu_TaskbarOptionsManager(wx.Menu):
                         text="Profile Manager", 
                         submenu=PyHocaGUI_Menu_TaskbarProfileNames(self._PyHocaGUI, 
                                                                    caller=self,
+                                                                   disabled_profiles=self._PyHocaGUI.client_connected_profiles(return_profile_names=True),
                                                                    submenu=PyHocaGUI_Menu_TaskbarManageProfile))
         if self._PyHocaGUI.profilemanager_disabled:
             _maintain_profiles_item.Enable(False)
@@ -163,21 +164,25 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu):
 
         ID_SESSIONSTART=wx.NewId()
         ID_CLEANSESSIONS = wx.NewId()
+        ID_EDITPROFILEWHILECONNECTED = wx.NewId()
+        ID_SHARELOCALFOLDER = wx.NewId()
         ID_DISCONNECT = wx.NewId()
 
         # preparing profile_name information for the main PyHocaGUI instance
         self._PyHocaGUI._eventid_profilenames_map[ID_SESSIONSTART] = \
             self._PyHocaGUI._eventid_profilenames_map[ID_CLEANSESSIONS] = \
+            self._PyHocaGUI._eventid_profilenames_map[ID_EDITPROFILEWHILECONNECTED] = \
+            self._PyHocaGUI._eventid_profilenames_map[ID_SHARELOCALFOLDER] = \
             self._PyHocaGUI._eventid_profilenames_map[ID_DISCONNECT] = profile_name
 
         self.Append(id=ID_SESSIONSTART, text="Start &new Session")
+        self.AppendSeparator()
 
         _query_session_uuid = self._PyHocaGUI.client_connected_sessions_of_profile_name(profile_name)[0]
         _session_list = self._PyHocaGUI.list_sessions(_query_session_uuid)
 
         if _session_list:
 
-            self.AppendSeparator()
             for session_name in _session_list.keys():
 
                 _s_id = wx.NewId()
@@ -194,14 +199,18 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu):
                                                                             )
                                )
 
+        self.Append(id=ID_CLEANSESSIONS, text="&Clean all sessions")
         self.AppendSeparator()
-        self.Append(id=ID_CLEANSESSIONS, text="&Clean sessions")
+        self.Append(id=ID_EDITPROFILEWHILECONNECTED, text="&Customize session profile (while connected)")
+        self.Append(id=ID_SHARELOCALFOLDER, text="Share local &folder")
         self.AppendSeparator()
         self.Append(id=ID_DISCONNECT, text="&Disconnect from Server")
 
         self._PyHocaGUI.current_profile_name = profile_name
         self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnSessionStart, id=ID_SESSIONSTART)
         self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnCleanSessions, id=ID_CLEANSESSIONS)
+        self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnProfileEditWhileConnected, id=ID_EDITPROFILEWHILECONNECTED)
+        self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnShareLocalFolder, id=ID_SHARELOCALFOLDER)
         self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnSessionDisconnect, id=ID_DISCONNECT)
 
 
@@ -237,9 +246,13 @@ class PyHocaGUI_Menu_TaskbarProfileNames(wx.Menu):
             self._PyHocaGUI._eventid_profilenames_map[_this_id] = profile_name
             _menu_profile_name = self._PyHocaGUI.show_profile_metatypes and '%s (%s)' % (profile_name, self._PyHocaGUI.get_profile_metatype(profile_name)) or profile_name
             if submenu is not None:
-                self.AppendMenu(text=_menu_profile_name, id=_this_id, submenu=submenu(self._PyHocaGUI, caller=self, profile_name=profile_name))
+                _sub = self.AppendMenu(text=_menu_profile_name, id=_this_id, submenu=submenu(self._PyHocaGUI, caller=self, profile_name=profile_name))
+                if disabled_profiles and profile_name in disabled_profiles:
+                    _sub.Enable(False)
             else:
-                self.Append(text=_menu_profile_name, id=_this_id)
+                _item = self.Append(text=_menu_profile_name, id=_this_id)
+                if disabled_profiles and profile_name in disabled_profiles:
+                    _item.Enable(False)
                 if bind_method is not None:
                     self._PyHocaGUI.Bind(wx.EVT_MENU, bind_method, id=_this_id)
                     self._PyHocaGUI.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI, id=_this_id)
diff --git a/pyhoca/wxgui/profilemanager.py b/pyhoca/wxgui/profilemanager.py
index 84cb4df..8371078 100644
--- a/pyhoca/wxgui/profilemanager.py
+++ b/pyhoca/wxgui/profilemanager.py
@@ -81,7 +81,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
         self.session_profiles = self._PyHocaGUI.session_profiles
         self.action = action
 
-        if self.action == 'EDIT':
+        if self.action in ('EDIT', 'EDIT_CONNECTED'):
             if profile_id is not None:
                 self.profile_id = profile_id
             elif profile_name is not None:
@@ -127,7 +127,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
             path_to_icon = '%s/icons/PyHoca/128x128/pyhoca-session.png' % _share_location
         self.IconPath = path_to_icon
         path_to_icon = path_to_icon.replace('icons/128x128/x2gosession.png', 'icons/PyHoca/128x128/pyhoca-session.png')
-        self.IconLabel = wx.StaticText(self.tab_Session, -1, "Profile icon:")
+        self.IconButtonLabel = wx.StaticText(self.tab_Session, -1, "Profile icon:")
         self.IconButton = wx.BitmapButton(self.tab_Session, -1, wx.Bitmap(path_to_icon, wx.BITMAP_TYPE_ANY))
         self.SessionTypeLabel = wx.StaticText(self.tab_Session, -1, "Session type:")
         self.SessionType = wx.ComboBox(self.tab_Session, -1, choices=self.sessionChoices.values(), style=wx.CB_DROPDOWN|wx.CB_READONLY)
@@ -239,7 +239,12 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
         self.Show(True)
 
     def __set_properties(self):
-        self.SetTitle("PyHoca-GUI Profile Manager")
+        if self.action == 'ADD':
+            self.SetTitle("PyHoca-GUI Profile Manager - new profile")
+        elif self.action == 'EDIT_CONNECTED':
+            self.SetTitle("PyHoca-GUI Profile Manager - %s (connected)" % self.profile_config['name'])
+        else:
+            self.SetTitle("PyHoca-GUI Profile Manager - %s" % self.profile_config['name'])
         self.SetFont(wx.Font(9, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
         _textfield_height = self.SSHKeyFileBrowseButton.GetBestSize().GetHeight()-2
         self.ProfileNameLabel.SetMinSize((120, 16))
@@ -316,7 +321,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
         sizer_1_1_1 = wx.FlexGridSizer(1, 2, 7, 9)
         sizer_1_1_1.Add(self.ProfileNameLabel, 0, wx.ALIGN_CENTRE_VERTICAL, 0)
         sizer_1_1_1.Add(self.ProfileName, 0, 0, 0)
-        sizer_1_1_1.Add(self.IconLabel, 0, wx.TOP, 0)
+        sizer_1_1_1.Add(self.IconButtonLabel, 0, wx.TOP, 0)
         sizer_1_1_1.Add(self.IconButton, 0, 0, 0)
         sizer_1_1.Add(sizer_1_1_1, 0, wx.EXPAND, 0)
 
@@ -697,6 +702,35 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
                 _item.SetText(_shared_folder_path)
                 self.SharedFoldersList.InsertItem(_item)
 
+        self.disable_EditConnected_options()
+
+    def disable_EditConnected_options(self):
+        # disable widgets when editing connected sessions
+        if self.action == 'EDIT_CONNECTED':
+
+            self.staticbox_Profile.Enable(False)
+            self.ProfileNameLabel.Enable(False)
+            self.ProfileName.Enable(False)
+            self.IconButton.Enable(False)
+            self.IconButtonLabel.Enable(False)
+            self.HostLabel.Enable(False)
+            self.Host.Enable(False)
+            self.UserNameLabel.Enable(False)
+            self.UserName.Enable(False)
+            self.staticbox_Server.Enable(False)
+            self.SSHPortLabel.Enable(False)
+            self.SSHPort.Enable(False)
+            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.tab_SharedFolders.Enable(False)
+
     def __update_from_screen(self):
         self.profile_config['name'] = self.ProfileName.GetValue()
         self.profile_config['icon'] = self.IconPath
@@ -810,6 +844,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
         self.tab_Settings.Enable(False)
         self.tab_SharedFolders.Enable(False)
 
+
     def disable_DirectRDP(self):
         self.HostLabel.Enable(True)
         self.Host.Enable(True)
@@ -838,7 +873,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
             self.ApplicationLabel.Enable(True)
             self.Application.Enable(True)
             if not self.Application.GetValue():
-                self.Application.SetValue('TERMINAL')
+                self.Application.SetValue(self.applicationChoices['TERMINAL'])
         else:
             self.ApplicationLabel.Enable(False)
             self.Application.Enable(False)
@@ -870,6 +905,9 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
         else:
             self.disable_DirectRDP()
 
+        self.disable_EditConnected_options()
+
+
     def OnSSHPublicKeyBrowse(self, event):
         sshdir = os.path.expanduser('~/.ssh')
         if not os.path.exists(sshdir):


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