The branch, twofactorauth has been updated via 7211b53e3c828f3778d16210e3e9ff262d35543b (commit) from acaeaf5df8984dc7e822101e23793f1935c25c2a (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/menus_taskbar.py | 59 ++++++++++++++++++++++++++++++++-------- pyhoca/wxgui/profilemanager.py | 2 +- pyhoca/wxgui/taskbar.py | 4 +-- 3 files changed, 51 insertions(+), 14 deletions(-) The diff of changes is: diff --git a/pyhoca/wxgui/menus_taskbar.py b/pyhoca/wxgui/menus_taskbar.py index b3156f0..346d767 100644 --- a/pyhoca/wxgui/menus_taskbar.py +++ b/pyhoca/wxgui/menus_taskbar.py @@ -88,7 +88,8 @@ class PyHocaGUI_Menu_TaskbarOptionsManager(wx.Menu): submenu=PyHocaGUI_Menu_TaskbarProfileNames(self._PyHocaGUI, caller=self, disabled_profiles=self._PyHocaGUI.client_connected_profiles(return_profile_names=True), - submenu=PyHocaGUI_Menu_TaskbarManageProfile + submenu=PyHocaGUI_Menu_TaskbarManageProfile, + group_menus=False, ) ) if self._PyHocaGUI.profilemanager_disabled: @@ -246,7 +247,7 @@ class PyHocaGUI_Menu_TaskbarProfileNames(wx.Menu): STILL UNDOCUMENTED """ - def __init__(self, _PyHocaGUI, caller=None, filter_profiles=None, disabled_profiles=None, bind_method=None, submenu=None): + def __init__(self, _PyHocaGUI, caller=None, group_name='', sub_profile_items=[], filter_profiles=[], disabled_profiles=[], bind_method=None, submenu=None, group_menus=True): """\ STILL UNDOCUMENTED @@ -254,7 +255,6 @@ class PyHocaGUI_Menu_TaskbarProfileNames(wx.Menu): self._PyHocaGUI = _PyHocaGUI self._pyhoca_logger = self._PyHocaGUI._pyhoca_logger - wx.Menu.__init__(self) if type(caller) == PyHocaGUI_Menu_TaskbarOptionsManager: @@ -264,24 +264,61 @@ class PyHocaGUI_Menu_TaskbarProfileNames(wx.Menu): self.AppendSeparator() - _profile_names = self._PyHocaGUI.session_profiles.profile_names + if sub_profile_items: + _profile_names = sub_profile_items + else: + _profile_names = self._PyHocaGUI.session_profiles.profile_names _profile_names.sort() + + if group_menus: + + # grouping of session profile menus + _profile_groups = [] + for profile_name in _profile_names: + if len(profile_name.split('/')) >= 2: + _group_name = profile_name.split('/')[0] + if not _group_name in _profile_groups: + _profile_groups.append(_group_name) + + _profile_groups.sort() + + for profile_group in _profile_groups: + _sub_profile_items = [] + for profile_name in [ p for p in _profile_names if p.startswith('%s/' % profile_group) ]: + _sub_profile_name = "/".join(profile_name.split('/')[1:]) + _sub_profile_items.append(_sub_profile_name) + filter_profiles.append(profile_name) + + _this_id = wx.NewId() + _group = self.AppendMenu(text=profile_group, id=_this_id, + submenu=PyHocaGUI_Menu_TaskbarProfileNames(self._PyHocaGUI, + caller=self, + sub_profile_items=_sub_profile_items, + bind_method=bind_method, + group_name=profile_group, + group_menus=False) + ) + if filter_profiles: _profile_names = [ p for p in _profile_names if p not in filter_profiles ] - _profile_names.sort() - for profile_name in _profile_names: + if group_name: + _real_profile_name = '%s/%s' % (group_name, profile_name) + _show_profile_name = profile_name + else: + _real_profile_name = profile_name + _show_profile_name = profile_name _this_id = wx.NewId() - 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 + self._PyHocaGUI._eventid_profilenames_map[_this_id] = _real_profile_name + _menu_profile_name = self._PyHocaGUI.show_profile_metatypes and '%s (%s)' % (_show_profile_name, self._PyHocaGUI.get_profile_metatype(_real_profile_name)) or _show_profile_name if submenu is not None: - _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 = self.AppendMenu(text=_menu_profile_name, id=_this_id, submenu=submenu(self._PyHocaGUI, caller=self, profile_name=_show_profile_name)) + if disabled_profiles and _real_profile_name in disabled_profiles: _sub.Enable(False) else: _item = self.Append(text=_menu_profile_name, id=_this_id) - if disabled_profiles and profile_name in disabled_profiles: + if disabled_profiles and _real_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) diff --git a/pyhoca/wxgui/profilemanager.py b/pyhoca/wxgui/profilemanager.py index bb1fd3b..d8b521b 100644 --- a/pyhoca/wxgui/profilemanager.py +++ b/pyhoca/wxgui/profilemanager.py @@ -1373,7 +1373,7 @@ 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']: + elif self.profile_config['usesshproxy'] and self.profile_config['name'] == self.profile_config_bak['name']: print self.profile_config['sshproxytunnel'].split(':')[0:2] try: (from_host, from_port) = self.profile_config['sshproxytunnel'].split(':')[0:2] diff --git a/pyhoca/wxgui/taskbar.py b/pyhoca/wxgui/taskbar.py index a770a3b..d4b3c50 100644 --- a/pyhoca/wxgui/taskbar.py +++ b/pyhoca/wxgui/taskbar.py @@ -94,7 +94,7 @@ class PyHocaGUI_TaskBarIcon(wx.TaskBarIcon): STILL UNDOCUMENTED """ - self.menu_sessionmanager = self.PopupMenu(menus_taskbar.PyHocaGUI_Menu_TaskbarSessionManager(self._PyHocaGUI, caller=self)) + self.menu_sessionmanager = self.PopupMenu(menus_taskbar.PyHocaGUI_Menu_TaskbarSessionManager(self._PyHocaGUI, caller=self,)) return self.menu_sessionmanager def CreatePopupMenu(self): @@ -107,7 +107,7 @@ class PyHocaGUI_TaskBarIcon(wx.TaskBarIcon): return self.CreateProfileManagerPopupMenu() def CreateProfileManagerPopupMenu(self): - self.menu_optionsmanager = self.PopupMenu(menus_taskbar.PyHocaGUI_Menu_TaskbarOptionsManager(self._PyHocaGUI, caller=self)) + self.menu_optionsmanager = self.PopupMenu(menus_taskbar.PyHocaGUI_Menu_TaskbarOptionsManager(self._PyHocaGUI, caller=self,)) return self.menu_optionsmanager def MakeIcon(self, icon_name): 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)).