[X2Go-Commits] [pyhoca-gui] 01/03: Optimize menu rendering. Reduce accessing session profile data as best as is possible.
git-admin at x2go.org
git-admin at x2go.org
Wed Mar 19 14:55:14 CET 2014
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository pyhoca-gui.
commit 2cf0128d643be62239bd38f1a6660714eefa067e
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Wed Mar 19 14:42:29 2014 +0100
Optimize menu rendering. Reduce accessing session profile data as best as is possible.
---
debian/changelog | 2 ++
pyhoca/wxgui/menus_taskbar.py | 37 +++++++++++++++++++------------------
2 files changed, 21 insertions(+), 18 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index cf15a3c..a1f6272 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -28,6 +28,8 @@ pyhoca-gui (0.5.0.0-0x2go1) UNRELEASED; urgency=low
- Focus the user name field on logon if no user name is stored in the
session profile.
- Re-order cmdline sections (man page, defaults.py).
+ - Optimize menu rendering. Reduce accessing session profile data as best
+ as is possible.
- Update English / German translation.
-- Mike Gabriel <mike.gabriel at das-netzwerkteam.de> Wed, 08 Jan 2014 21:28:37 +0100
diff --git a/pyhoca/wxgui/menus_taskbar.py b/pyhoca/wxgui/menus_taskbar.py
index e9a7e96..5a5239e 100644
--- a/pyhoca/wxgui/menus_taskbar.py
+++ b/pyhoca/wxgui/menus_taskbar.py
@@ -260,7 +260,7 @@ class PyHocaGUI_Menu_TaskbarSessionActions(wx.Menu):
_rs = self.Append(text=_(u"Resume Session (not possible)"), id=ID_RESUMESESSION_DISABLED)
_rs.Enable(False)
- if session_info is not None and session_info.is_published_applications_provider() and not self._PyHocaGUI.get_profile_config(profile_name)['published']:
+ if session_info is not None and session_info.is_published_applications_provider() and not self._PyHocaGUI.get_profile_config(profile_name, 'published'):
_rs.Enable(False)
elif _session_status == 'R':
@@ -281,7 +281,7 @@ class PyHocaGUI_Menu_TaskbarSessionActions(wx.Menu):
else:
_ss = self.Append(text=_(u"Suspend Session"), id=ID_SUSPENDSESSION)
- if _s.is_published_applications_provider() and not self._PyHocaGUI.get_profile_config(profile_name)['published']:
+ if _s.is_published_applications_provider() and not self._PyHocaGUI.get_profile_config(profile_name, 'published'):
_ss.Enable(False)
if not _s.is_shadow_session():
if self._PyHocaGUI.disconnect_on_terminate and self._PyHocaGUI.exit_on_disconnect and _s.has_terminal_session():
@@ -298,7 +298,7 @@ class PyHocaGUI_Menu_TaskbarSessionActions(wx.Menu):
else:
self.Append(text=_(u"End Desktop Sharing"), id=ID_TERMINATESESSION)
- if _s is not None and _s.is_published_applications_provider() and self._PyHocaGUI.get_profile_config(profile_name)['published']:
+ if _s is not None and _s.is_published_applications_provider() and self._PyHocaGUI.get_profile_config(profile_name, 'published'):
self.AppendSeparator()
self.Append(text=_(u"Refresh menu tree"), id=ID_REFRESHMENU)
@@ -418,8 +418,6 @@ class PyHocaGUI_Menu_LaunchSingleApplication(wx.Menu):
wx.Menu.__init__(self)
- current_profile_config = self._PyHocaGUI.get_profile_config(profile_name)
-
_available_applications = {
'WWWBROWSER': _(u'Internet Browser'),
'MAILCLIENT': _(u'Email Client'),
@@ -427,7 +425,7 @@ class PyHocaGUI_Menu_LaunchSingleApplication(wx.Menu):
'TERMINAL': _(u'Terminal'),
}
- for application in current_profile_config['applications']:
+ for application in self._PyHocaGUI.get_profile_config(profile_name, 'applications'):
_app_id = wx.NewId()
self._PyHocaGUI._eventid_profilenames_map[_app_id] = profile_name
@@ -560,7 +558,10 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu):
connect = self.Append(id=ID_CONNECT, text=_(u'Connect %s') % profile_name)
connect.Enable(False)
else:
- current_profile_config = self._PyHocaGUI.get_profile_config(profile_name)
+ _applications = self._PyHocaGUI.get_profile_config(profile_name, 'applications')
+ _command = self._PyHocaGUI.get_profile_config(profile_name, 'command')
+ _published = self._PyHocaGUI.get_profile_config(profile_name, 'published')
+ _useexports = self._PyHocaGUI.get_profile_config(profile_name, 'useexports')
if profile_name in self._PyHocaGUI._temp_disabled_profile_names:
_connecting_info = self.Append(wx.NewId(), text=_(u'Currently connecting...'))
@@ -577,15 +578,15 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu):
self._PyHocaGUI._eventid_profilenames_map[ID_SESSIONSTART] = \
self._PyHocaGUI._eventid_profilenames_map[ID_SHADOWSESSIONSTART] = profile_name
- if current_profile_config['command'] in x2go.defaults.X2GO_DESKTOPSESSIONS:
- self.Append(id=ID_SESSIONSTART, text='%s (%s)' % (_(u"Start &new Desktop Session"), current_profile_config['command']))
+ if _command in x2go.defaults.X2GO_DESKTOPSESSIONS:
+ self.Append(id=ID_SESSIONSTART, text='%s (%s)' % (_(u"Start &new Desktop Session"), _command))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnSessionStart, id=ID_SESSIONSTART)
- elif current_profile_config['command'] == 'SHADOW':
+ elif _command == 'SHADOW':
start_shadow_session = self.Append(id=ID_SHADOWSESSIONSTART, text=_(u"Start Desktop Sharing Session"))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnShadowSessionStart, id=ID_SHADOWSESSIONSTART)
- elif current_profile_config['command'] == '' and current_profile_config['published']:
+ elif _command == '' and _published:
_pub_app_start_item = None
if profile_name in self._PyHocaGUI._temp_launching_pubapp_profiles:
_pub_app_start_item = self.Append(id=ID_PUBAPPSESSIONSTART, text=_(u"Retrieving Application Menu..."))
@@ -594,14 +595,14 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu):
self._PyHocaGUI._eventid_profilenames_map[ID_PUBAPPSESSIONSTART] = profile_name
_pub_app_start_item = self.Append(id=ID_PUBAPPSESSIONSTART, text=_(u"Retrieve Application Menu"))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnPubAppSessionStart, id=ID_PUBAPPSESSIONSTART)
- elif current_profile_config['command'] == 'RDP':
+ elif _command == 'RDP':
self.Append(id=ID_SESSIONSTART, text=_(u"Start &new RDP Session"))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnSessionStart, id=ID_SESSIONSTART)
else:
self.Append(id=ID_SESSIONSTART, text=_(u"Start &new Session"))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnSessionStart, id=ID_SESSIONSTART)
- if current_profile_config['command'] == '' and current_profile_config['published']:
+ if _command == '' and _published:
_pubapp_sessions = [ _pas for _pas in self._PyHocaGUI.client_pubapp_sessions_of_profile_name(profile_name, return_objects=True) if _pas.is_running() ]
if _pubapp_sessions:
@@ -676,16 +677,16 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu):
self._PyHocaGUI._eventid_profilenames_map[ID_LAUNCHAPPLICATION] = \
self._PyHocaGUI._eventid_profilenames_map[ID_CLEANSESSIONS] = profile_name
- if current_profile_config['applications'] and current_profile_config['command'] in x2go.defaults.X2GO_DESKTOPSESSIONS.keys() and not current_profile_config['published']:
+ if _applications and _command in x2go.defaults.X2GO_DESKTOPSESSIONS.keys() and not _published:
self.AppendSeparator()
self.AppendMenu(id=ID_LAUNCHAPPLICATION, text=_(u"Launch Single Application"),
submenu=PyHocaGUI_Menu_LaunchSingleApplication(self._PyHocaGUI, caller=self, profile_name=profile_name)
)
- if current_profile_config['command'] != 'SHADOW' and not self._PyHocaGUI.restricted_trayicon:
+ if _command != 'SHADOW' and not self._PyHocaGUI.restricted_trayicon:
self.Append(id=ID_SHADOWSESSIONSTART, text=_(u"Start Desktop Sharing Session"))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnShadowSessionStart, id=ID_SHADOWSESSIONSTART)
- if current_profile_config['published']:
+ if _published:
if not self._PyHocaGUI.restricted_trayicon:
self.AppendSeparator()
@@ -745,7 +746,7 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu):
if _session_list:
# newest sessions at the top
- if current_profile_config['published']:
+ if _published:
_session_list_names = [ _s_name for _s_name in _session_list.keys() if not _session_list[_s_name].is_published_applications_provider() ]
else:
_session_list_names = _session_list.keys()
@@ -811,7 +812,7 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu):
self._PyHocaGUI._eventid_profilenames_map[ID_SHARELOCALFOLDER] = \
self._PyHocaGUI._eventid_profilenames_map[ID_UNSHAREFOLDERS] = profile_name
- if current_profile_config['useexports'] and \
+ if _useexports and \
self._PyHocaGUI._X2GoClient__profile_is_folder_sharing_available(profile_name=profile_name) and \
self._PyHocaGUI.get_master_session(profile_name) is not None and \
self._PyHocaGUI.is_session_name_enabled(profile_name, self._PyHocaGUI.get_master_session(profile_name).get_session_name()):
--
Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/pyhoca-gui.git
More information about the x2go-commits
mailing list