[X2Go-Commits] [pyhoca-gui] 05/09: Menu.Append{, Menu}() calls: Turn arguments into positional arguments. Makes the code run on wx3 and wx4.
git-admin at x2go.org
git-admin at x2go.org
Mon Dec 2 17:16:16 CET 2019
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository pyhoca-gui.
commit f18a811d966b78dbd1efce2dd544d15fe7f983bf
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Mon Dec 2 10:37:31 2019 +0100
Menu.Append{,Menu}() calls: Turn arguments into positional arguments. Makes the code run on wx3 and wx4.
---
pyhoca/wxgui/menus_taskbar.py | 263 ++++++++++++++++++++++--------------------
1 file changed, 135 insertions(+), 128 deletions(-)
diff --git a/pyhoca/wxgui/menus_taskbar.py b/pyhoca/wxgui/menus_taskbar.py
index a5f20a4..c0b1519 100644
--- a/pyhoca/wxgui/menus_taskbar.py
+++ b/pyhoca/wxgui/menus_taskbar.py
@@ -63,9 +63,9 @@ class PyHocaGUI_Menu_TaskbarManageProfile(wx.Menu):
self._PyHocaGUI._eventid_profilenames_map[ID_DELETEPROFILE] = profile_name
if self._PyHocaGUI.session_profiles.is_mutable(profile_name):
- self.Append(text=_("Edit Profile"), id=ID_EDITPROFILE)
+ self.Append(ID_EDITPROFILE, _("Edit Profile"))
else:
- self.Append(text=_("View Profile"), id=ID_EDITPROFILE)
+ self.Append(ID_EDITPROFILE, _("View Profile"))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnProfileEdit, id=ID_EDITPROFILE)
if not self._PyHocaGUI.args.single_session_profile:
@@ -73,15 +73,15 @@ class PyHocaGUI_Menu_TaskbarManageProfile(wx.Menu):
self.AppendSeparator()
if self._PyHocaGUI.session_profiles.is_mutable(profile_name):
- self.Append(text=_("Use as Template for New Profile"), id=ID_COPYPROFILE)
+ self.Append(ID_COPYPROFILE, _("Use as Template for New Profile"))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnProfileCopy, id=ID_COPYPROFILE)
self.AppendSeparator()
- self.Append(text=_("Export Profile"), id=ID_EXPORTPROFILE)
+ self.Append(ID_EXPORTPROFILE, _("Export Profile"))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnProfileExport, id=ID_EXPORTPROFILE)
if self._PyHocaGUI.session_profiles.is_mutable(profile_name):
- self.Append(text=_("Delete Profile"), id=ID_DELETEPROFILE)
+ self.Append(ID_DELETEPROFILE, _("Delete Profile"))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnProfileDelete, id=ID_DELETEPROFILE)
@@ -107,8 +107,8 @@ class PyHocaGUI_Menu_TaskbarOptionsManager(wx.Menu):
ID_ABOUT = wx.NewId()
ID_ABOUT_PYTHONX2GO = wx.NewId()
- self.Append(id=ID_ABOUT, text=_("About %s (%s)...") % (self._PyHocaGUI.appname, self._PyHocaGUI.version))
- self.Append(id=ID_ABOUT_PYTHONX2GO, text=_("About %s (%s)...") % ("Python X2Go", x2go.__VERSION__))
+ self.Append(ID_ABOUT, _("About %s (%s)...") % (self._PyHocaGUI.appname, self._PyHocaGUI.version))
+ self.Append(ID_ABOUT_PYTHONX2GO, _("About %s (%s)...") % ("Python X2Go", x2go.__VERSION__))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnAbout, id=ID_ABOUT)
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnAboutPythonX2Go, id=ID_ABOUT_PYTHONX2GO)
@@ -119,15 +119,15 @@ class PyHocaGUI_Menu_TaskbarOptionsManager(wx.Menu):
if not self._PyHocaGUI.args.single_session_profile:
ID_PROFILEMANAGER = wx.NewId()
- _maintain_profiles_item = self.AppendMenu(id=ID_PROFILEMANAGER,
- text=_("Profile Manager"),
- submenu=PyHocaGUI_Menu_TaskbarProfileNames(self._PyHocaGUI,
- caller=self,
- filter_profiles=[],
- disabled_profiles=self._PyHocaGUI.client_connected_profiles(return_profile_names=True) + self._PyHocaGUI._temp_disabled_profile_names,
- submenu=PyHocaGUI_Menu_TaskbarManageProfile,
- group_menus=True,
- )
+ _maintain_profiles_item = self.AppendMenu(ID_PROFILEMANAGER,
+ _("Profile Manager"),
+ PyHocaGUI_Menu_TaskbarProfileNames(self._PyHocaGUI,
+ caller=self,
+ filter_profiles=[],
+ disabled_profiles=self._PyHocaGUI.client_connected_profiles(return_profile_names=True) + self._PyHocaGUI._temp_disabled_profile_names,
+ submenu=PyHocaGUI_Menu_TaskbarManageProfile,
+ group_menus=True,
+ )
)
if self._PyHocaGUI.profilemanager_disabled:
_maintain_profiles_item.Enable(False)
@@ -136,9 +136,9 @@ class PyHocaGUI_Menu_TaskbarOptionsManager(wx.Menu):
elif self._PyHocaGUI.session_profiles.has_profile_name(self._PyHocaGUI.args.session_profile):
ID_SINGLEPROFILEMANAGER = wx.NewId()
- _maintain_profile_item = self.AppendMenu(id=ID_SINGLEPROFILEMANAGER,
- text=_('Manage Session Profile'),
- submenu=PyHocaGUI_Menu_TaskbarManageProfile(self._PyHocaGUI, caller=self, profile_name=self._PyHocaGUI.args.session_profile),
+ _maintain_profile_item = self.AppendMenu(ID_SINGLEPROFILEMANAGER,
+ _('Manage Session Profile'),
+ PyHocaGUI_Menu_TaskbarManageProfile(self._PyHocaGUI, caller=self, profile_name=self._PyHocaGUI.args.session_profile),
)
if self._PyHocaGUI.args.session_profile in self._PyHocaGUI.client_connected_profiles(return_profile_names=True):
_maintain_profile_item.Enable(False)
@@ -146,12 +146,12 @@ class PyHocaGUI_Menu_TaskbarOptionsManager(wx.Menu):
if self._PyHocaGUI.with_brokerage and self._PyHocaGUI.session_profiles.is_broker_authenticated():
ID_BROKER_DISCONNECT = wx.NewId()
- self.Append(id=ID_BROKER_DISCONNECT, text=_("Disconnect from session broker"))
+ self.Append(ID_BROKER_DISCONNECT, _("Disconnect from session broker"))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnBrokerDisconnect, id=ID_BROKER_DISCONNECT)
self.AppendSeparator()
ID_PRINTINGPREFS = wx.NewId()
- _printingprefs_item = self.Append(id=ID_PRINTINGPREFS, text=_("Printing Preferences"))
+ _printingprefs_item = self.Append(ID_PRINTINGPREFS, _("Printing Preferences"))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnPrintingPreferences, id=ID_PRINTINGPREFS)
if self._PyHocaGUI.printingprefs_disabled:
_printingprefs_item.Enable(False)
@@ -159,7 +159,7 @@ class PyHocaGUI_Menu_TaskbarOptionsManager(wx.Menu):
if not self._PyHocaGUI.restricted_trayicon:
ID_OPTIONS = wx.NewId()
- _options_item = self.Append(id=ID_OPTIONS, text=_("Client Options"))
+ _options_item = self.Append(ID_OPTIONS, _("Client Options"))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnOptions, id=ID_OPTIONS)
if self._PyHocaGUI.options_disabled:
_options_item.Enable(False)
@@ -167,7 +167,7 @@ class PyHocaGUI_Menu_TaskbarOptionsManager(wx.Menu):
self.AppendSeparator()
ID_EXIT = wx.NewId()
- self.Append(id=ID_EXIT, text=_("E&xit"))
+ self.Append(ID_EXIT, _("E&xit"))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnTaskbarExit, id=ID_EXIT)
@@ -239,15 +239,15 @@ class PyHocaGUI_Menu_TaskbarSessionActions(wx.Menu):
_session_status == 'R' and \
not _s.is_published_applications_provider():
- self.Append(text=_("Window title") + ": " + _s.get_session_title(), id=wx.NewId())
+ self.Append(wx.NewId(), _("Window title") + ": " + _s.get_session_title())
self.AppendSeparator()
if _session_status == 'S':
if _s is not None and _s.is_color_depth_ok():
- _rs = self.Append(text=_("Resume Session"), id=ID_RESUMESESSION)
+ _rs = self.Append(ID_RESUMESESSION, _("Resume Session"))
else:
- _rs = self.Append(text=_("Resume Session (not possible)"), id=ID_RESUMESESSION_DISABLED)
+ _rs = self.Append(ID_RESUMESESSION_DISABLED, _("Resume Session (not possible)"))
_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'):
@@ -258,39 +258,39 @@ class PyHocaGUI_Menu_TaskbarSessionActions(wx.Menu):
if not session_name in self._PyHocaGUI.client_associated_sessions_of_profile_name(profile_name, return_session_names=True):
if _s is not None and _s.is_color_depth_ok():
- self.Append(text=_("Transfer Session"), id=ID_TRANSFERSESSION)
+ self.Append(ID_TRANSFERSESSION, _("Transfer Session"))
else:
- _ts = self.Append(text=_("Transfer Session (not possible)"), id=ID_TRANSFERSESSION_DISABLED)
+ _ts = self.Append(ID_TRANSFERSESSION_DISABLED, _("Transfer Session (not possible)"))
_ts.Enable(False)
if not _s.is_shadow_session():
if self._PyHocaGUI.disconnect_on_suspend and self._PyHocaGUI.exit_on_disconnect and _s.has_terminal_session():
- _ss = self.Append(text=_("Suspend Session (and disconnect/exit)"), id=ID_SUSPENDSESSION)
+ _ss = self.Append(ID_SUSPENDSESSION, _("Suspend Session (and disconnect/exit)"))
elif self._PyHocaGUI.disconnect_on_suspend and _s.has_terminal_session():
- _ss = self.Append(text=_("Suspend Session (and disconnect)"), id=ID_SUSPENDSESSION)
+ _ss = self.Append(ID_SUSPENDSESSION, _("Suspend Session (and disconnect)"))
else:
- _ss = self.Append(text=_("Suspend Session"), id=ID_SUSPENDSESSION)
+ _ss = self.Append(ID_SUSPENDSESSION, _("Suspend Session"))
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():
- self.Append(text=_("Terminate Session (and disconnect/exit)"), id=ID_SUSPENDSESSION)
+ self.Append(ID_SUSPENDSESSION, _("Terminate Session (and disconnect/exit)"))
elif self._PyHocaGUI.disconnect_on_terminate and _s.has_terminal_session():
- self.Append(text=_("Terminate Session (and disconnect)"), id=ID_TERMINATESESSION)
+ self.Append(ID_TERMINATESESSION, _("Terminate Session (and disconnect)"))
else:
- self.Append(text=_("Terminate Session"), id=ID_TERMINATESESSION)
+ self.Append(ID_TERMINATESESSION, _("Terminate Session"))
else:
if self._PyHocaGUI.disconnect_on_terminate and self._PyHocaGUI.exit_on_disconnect and _s.has_terminal_session():
- self.Append(text=_("End Desktop Sharing (and disconnect/exit)"), id=ID_SUSPENDSESSION)
+ self.Append(ID_SUSPENDSESSION, _("End Desktop Sharing (and disconnect/exit)"))
elif self._PyHocaGUI.disconnect_on_terminate and _s.has_terminal_session():
- self.Append(text=_("End Desktop Sharing (and disconnect)"), id=ID_TERMINATESESSION)
+ self.Append(ID_TERMINATESESSION, _("End Desktop Sharing (and disconnect)"))
else:
- self.Append(text=_("End Desktop Sharing"), id=ID_TERMINATESESSION)
+ self.Append(ID_TERMINATESESSION, _("End Desktop Sharing"))
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=_("Refresh menu tree"), id=ID_REFRESHMENU)
+ self.Append(ID_REFRESHMENU, _("Refresh menu tree"))
if _s is not None and \
_s.get_session_type() in ('D', 'S') and \
@@ -299,8 +299,8 @@ class PyHocaGUI_Menu_TaskbarSessionActions(wx.Menu):
_s in self._PyHocaGUI.client_associated_sessions_of_profile_name(profile_name, return_objects=True):
self.AppendSeparator()
- self.Append(text=_("Rename Session Window"), id=ID_RENAMESESSION)
- self.Append(text=_("Show Session Window"), id=ID_RAISESESSION)
+ self.Append(ID_RENAMESESSION, _("Rename Session Window"))
+ self.Append(ID_RAISESESSION, _("Show Session Window"))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnSessionFocus, id=ID_RAISESESSION)
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnSessionRename, id=ID_RENAMESESSION)
@@ -342,7 +342,7 @@ class PyHocaGUI_Menu_TaskbarProfileSharedFolders(wx.Menu):
self._PyHocaGUI._eventid_profilenames_map[ID_UNSHAREALLLOCALFOLDERS] = \
self._PyHocaGUI._eventid_profilenames_map[ID_REMEMBERSHAREDFOLDERS] = profile_name
- self.Append(id=ID_SHARECUSTOMLOCALFOLDER, text=_("&Share custom local folder"))
+ self.Append(ID_SHARECUSTOMLOCALFOLDER, _("&Share custom local folder"))
self.AppendSeparator()
self._PyHocaGUI._eventid_unshared_folders_map={}
@@ -354,25 +354,25 @@ class PyHocaGUI_Menu_TaskbarProfileSharedFolders(wx.Menu):
self._PyHocaGUI._eventid_unshared_folders_map = {}
if _unshared_folders:
- self.Append(id=wx.NewId(), text=_('Share:'))
+ self.Append(wx.NewId(), _('Share:'))
for _unshared_folder in _unshared_folders:
ID_THISFOLDER = wx.NewId()
- self.Append(id=ID_THISFOLDER, text=" %s" % _unshared_folder)
+ self.Append(ID_THISFOLDER, " %s" % _unshared_folder)
self._PyHocaGUI._eventid_profilenames_map[ID_THISFOLDER] = profile_name
self._PyHocaGUI._eventid_unshared_folders_map[ID_THISFOLDER] = _unshared_folder
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnShareLocalFolder, id=ID_THISFOLDER)
self._PyHocaGUI._eventid_shared_folders_map = {}
if _shared_folders:
- self.Append(id=wx.NewId(), text=_('Unshare:'))
+ self.Append(wx.NewId(), _('Unshare:'))
for _shared_folder in _shared_folders:
ID_THISFOLDER = wx.NewId()
- self.Append(id=ID_THISFOLDER, text=" %s" % _shared_folder)
+ self.Append(ID_THISFOLDER, " %s" % _shared_folder)
self._PyHocaGUI._eventid_profilenames_map[ID_THISFOLDER] = profile_name
self._PyHocaGUI._eventid_shared_folders_map[ID_THISFOLDER] = _shared_folder
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnUnshareLocalFolder, id=ID_THISFOLDER)
- _unshare_folders = self.Append(id=ID_UNSHAREALLLOCALFOLDERS, text=_("Unshare &all local folders"))
+ _unshare_folders = self.Append(ID_UNSHAREALLLOCALFOLDERS, _("Unshare &all local folders"))
if not _shared_folders:
_unshare_folders.Enable(False)
@@ -422,7 +422,7 @@ class PyHocaGUI_Menu_LaunchSingleApplication(wx.Menu):
_app_id = wx.NewId()
self._PyHocaGUI._eventid_profilenames_map[_app_id] = profile_name
self._PyHocaGUI._eventid_applications_map[_app_id] = application
- self.Append(id=_app_id, text=_available_applications[application])
+ self.Append(_app_id, _available_applications[application])
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnApplicationStart, id=_app_id)
@@ -552,11 +552,11 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu):
if self._PyHocaGUI.with_brokerage and not self._PyHocaGUI.session_profiles.is_broker_authenticated():
_auth_menu_text = _('Connect to') + self._PyHocaGUI.broker_name
- self.Append(id=ID_AUTHENTICATE_BROKER, text=_auth_menu_text)
+ self.Append(ID_AUTHENTICATE_BROKER, _auth_menu_text)
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnBrokerAuthenticate, id=ID_AUTHENTICATE_BROKER)
elif self._PyHocaGUI.args.single_session_profile and not self._PyHocaGUI.is_session_profile(profile_name):
- connect = self.Append(id=ID_CONNECT, text=_('Connect %s') % profile_name)
+ connect = self.Append(ID_CONNECT, _('Connect %s') % profile_name)
connect.Enable(False)
else:
_applications = self._PyHocaGUI.get_profile_config(profile_name, 'applications')
@@ -571,7 +571,7 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu):
elif self._PyHocaGUI.args.single_session_profile and \
not self._PyHocaGUI.is_profile_connected(profile_name=profile_name):
self._PyHocaGUI._eventid_profilenames_map[ID_CONNECT] = profile_name
- self.Append(id=ID_CONNECT, text=_('Connect %s') % profile_name)
+ self.Append(ID_CONNECT, _('Connect %s') % profile_name)
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnSessionAuthenticate, id=ID_CONNECT)
else:
@@ -580,27 +580,27 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu):
self._PyHocaGUI._eventid_profilenames_map[ID_SHADOWSESSIONSTART] = profile_name
if _command in x2go.defaults.X2GO_DESKTOPSESSIONS:
- self.Append(id=ID_SESSIONSTART, text='%s (%s)' % (_("Start &new Desktop Session"), _command))
+ self.Append(ID_SESSIONSTART, '%s (%s)' % (_("Start &new Desktop Session"), _command))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnSessionStart, id=ID_SESSIONSTART)
elif _command == 'SHADOW':
- self.Append(id=ID_SHADOWSESSIONSTART, text=_("Start Desktop Sharing Session"))
+ self.Append(ID_SHADOWSESSIONSTART, _("Start Desktop Sharing Session"))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnShadowSessionStart, id=ID_SHADOWSESSIONSTART)
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=_("Retrieving Application Menu..."))
+ _pub_app_start_item = self.Append(ID_PUBAPPSESSIONSTART, _("Retrieving Application Menu..."))
_pub_app_start_item.Enable(False)
elif not (self._PyHocaGUI.disconnect_on_suspend and self._PyHocaGUI.disconnect_on_terminate):
self._PyHocaGUI._eventid_profilenames_map[ID_PUBAPPSESSIONSTART] = profile_name
- _pub_app_start_item = self.Append(id=ID_PUBAPPSESSIONSTART, text=_("Retrieve Application Menu"))
+ _pub_app_start_item = self.Append(ID_PUBAPPSESSIONSTART, _("Retrieve Application Menu"))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnPubAppSessionStart, id=ID_PUBAPPSESSIONSTART)
elif _command == 'RDP':
- self.Append(id=ID_SESSIONSTART, text=_("Start &new RDP Session"))
+ self.Append(ID_SESSIONSTART, _("Start &new RDP Session"))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnSessionStart, id=ID_SESSIONSTART)
else:
- self.Append(id=ID_SESSIONSTART, text=_("Start &new Session"))
+ self.Append(ID_SESSIONSTART, _("Start &new Session"))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnSessionStart, id=ID_SESSIONSTART)
if _command == '' and _published:
@@ -617,7 +617,7 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu):
if (not self._PyHocaGUI.restricted_trayicon and not (self._PyHocaGUI.disconnect_on_suspend and self._PyHocaGUI.disconnect_on_terminate)) or (profile_name in self._PyHocaGUI._temp_launching_pubapp_profiles and _category_names):
self.AppendSeparator()
for cat_name in [ _cn for _cn in _category_names if _cn != 'TOP' ]:
- _submenu = self.AppendMenu(id=wx.NewId(), text=cat_name, submenu=_category_map[cat_name][0])
+ _submenu = self.AppendMenu(wx.NewId(), cat_name, _category_map[cat_name][0])
_submenu.SetBitmap(wx.Bitmap(_category_map[cat_name][1]))
if _session_name_disabled:
_submenu.Enable(False)
@@ -643,27 +643,27 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu):
self._PyHocaGUI._eventid_sessionnames_map[ID_TERMINATESESSION] = _pubapp_session.get_session_name()
if _pubapp_session.is_running():
- _refresh_menu_item = self.Append(text=_("Refresh menu tree"), id=ID_REFRESHMENU)
+ _refresh_menu_item = self.Append(ID_REFRESHMENU, _("Refresh menu tree"))
self.AppendSeparator()
if self._PyHocaGUI.disconnect_on_suspend and self._PyHocaGUI.exit_on_disconnect and _pubapp_session.has_terminal_session():
- _suspend_item = self.Append(text=_("Suspend Session (and disconnect/exit)"), id=ID_SUSPENDSESSION)
+ _suspend_item = self.Append(ID_SUSPENDSESSION, _("Suspend Session (and disconnect/exit)"))
elif self._PyHocaGUI.disconnect_on_suspend and _pubapp_session.has_terminal_session():
- _suspend_item = self.Append(text=_("Suspend Session (and disconnect)"), id=ID_SUSPENDSESSION)
+ _suspend_item = self.Append(ID_SUSPENDSESSION, _("Suspend Session (and disconnect)"))
else:
- _suspend_item = self.Append(text=_("Suspend Session"), id=ID_SUSPENDSESSION)
+ _suspend_item = self.Append(ID_SUSPENDSESSION, _("Suspend Session"))
if _session_name_disabled:
_refresh_menu_item.Enable(False)
_suspend_item.Enable(False)
elif _pubapp_session.is_suspended():
- _resume_item = self.Append(text=_("Resume Session"), id=ID_RESUMESESSION)
+ _resume_item = self.Append(ID_RESUMESESSION, _("Resume Session"))
if _session_name_disabled:
_resume_item.Enable(False)
if self._PyHocaGUI.disconnect_on_terminate and self._PyHocaGUI.exit_on_disconnect and _pubapp_session.has_terminal_session():
- _terminate_item = self.Append(text=_("Terminate Session (and disconnect/exit)"), id=ID_TERMINATESESSION)
+ _terminate_item = self.Append(ID_TERMINATESESSION, _("Terminate Session (and disconnect/exit)"))
elif self._PyHocaGUI.disconnect_on_terminate and _pubapp_session.has_terminal_session():
- _terminate_item = self.Append(text=_("Terminate Session (and disconnect)"), id=ID_TERMINATESESSION)
+ _terminate_item = self.Append(ID_TERMINATESESSION, _("Terminate Session (and disconnect)"))
else:
- _terminate_item = self.Append(text=_("Terminate Session"), id=ID_TERMINATESESSION)
+ _terminate_item = self.Append(ID_TERMINATESESSION, _("Terminate Session"))
if _session_name_disabled:
_terminate_item.Enable(False)
@@ -680,11 +680,12 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu):
if _applications and _command in list(x2go.defaults.X2GO_DESKTOPSESSIONS.keys()) and not _published:
self.AppendSeparator()
- self.AppendMenu(id=ID_LAUNCHAPPLICATION, text=_("Launch Single Application"),
- submenu=PyHocaGUI_Menu_LaunchSingleApplication(self._PyHocaGUI, caller=self, profile_name=profile_name)
+ self.AppendMenu(ID_LAUNCHAPPLICATION,
+ _("Launch Single Application"),
+ PyHocaGUI_Menu_LaunchSingleApplication(self._PyHocaGUI, caller=self, profile_name=profile_name)
)
if _command != 'SHADOW' and not self._PyHocaGUI.restricted_trayicon:
- self.Append(id=ID_SHADOWSESSIONSTART, text=_("Start Desktop Sharing Session"))
+ self.Append(ID_SHADOWSESSIONSTART, _("Start Desktop Sharing Session"))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnShadowSessionStart, id=ID_SHADOWSESSIONSTART)
if _published:
@@ -702,7 +703,7 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu):
_category_names = list(_category_map.keys())
_category_names.sort()
for cat_name in [ _cn for _cn in _category_names if _cn != 'TOP' ]:
- _submenu = self.AppendMenu(id=wx.NewId(), text=cat_name, submenu=_category_map[cat_name][0])
+ _submenu = self.AppendMenu(wx.NewId(), cat_name, _category_map[cat_name][0])
_submenu.SetBitmap(wx.Bitmap(_category_map[cat_name][1]))
if _session_name_disabled:
_submenu.Enable(False)
@@ -721,23 +722,24 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu):
elif _pubapp_session.is_suspended(): _status = 'S'
if _status:
- _submenu = self.AppendMenu(id=wx.NewId(), text=_('Manage Application Menu')+' %s' % _marker,
- submenu=PyHocaGUI_Menu_TaskbarSessionActions(self._PyHocaGUI, caller=self,
- profile_name=profile_name,
- session_name=_pubapp_session.get_session_name(),
- status=_status,
- )
- )
+ _submenu = self.AppendMenu(wx.NewId(),
+ _('Manage Application Menu')+' %s' % _marker,
+ PyHocaGUI_Menu_TaskbarSessionActions(self._PyHocaGUI, caller=self,
+ profile_name=profile_name,
+ session_name=_pubapp_session.get_session_name(),
+ status=_status,
+ )
+ )
if _session_name_disabled:
_submenu.Enable(False)
else:
self._PyHocaGUI._eventid_profilenames_map[ID_PUBAPPSESSIONSTART] = profile_name
if profile_name in self._PyHocaGUI._temp_launching_pubapp_profiles:
- _ram = self.Append(id=ID_PUBAPPSESSIONSTART, text=_("Retrieving Application Menu..."))
+ _ram = self.Append(ID_PUBAPPSESSIONSTART, _("Retrieving Application Menu..."))
_ram.Enable(False)
else:
- self.Append(id=ID_PUBAPPSESSIONSTART, text=_("Retrieve Application Menu"))
+ self.Append(ID_PUBAPPSESSIONSTART, _("Retrieve Application Menu"))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnPubAppSessionStart, id=ID_PUBAPPSESSIONSTART)
_query_session_uuid = self._PyHocaGUI.client_connected_sessions_of_profile_name(profile_name, return_objects=False)[0]
@@ -783,12 +785,13 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu):
if session and session.is_master_session():
_marker = '(*)'
if session:
- session_submenu = self.AppendMenu(id=_s_id, text='%s: »%s« %s' % (state, session_name, _marker),
- submenu=PyHocaGUI_Menu_TaskbarSessionActions(self._PyHocaGUI, caller=self,
- profile_name=profile_name,
- session_name=session_name,
- session_info=_session_list[session_name],
- )
+ session_submenu = self.Append(_s_id,
+ '%s: »%s« %s' % (state, session_name, _marker),
+ PyHocaGUI_Menu_TaskbarSessionActions(self._PyHocaGUI, caller=self,
+ profile_name=profile_name,
+ session_name=session_name,
+ session_info=_session_list[session_name],
+ )
)
if profile_name in self._PyHocaGUI._temp_disabled_session_names and session_name in self._PyHocaGUI._temp_disabled_session_names[profile_name]:
session_submenu.Enable(False)
@@ -797,16 +800,16 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu):
_session_list_names = [ _s.get_session_name() for _s in _session_list_matching_profile if not _session_list[_s.get_session_name()].is_published_applications_provider() ]
if _session_list_names:
- self.Append(id=ID_CLEANSESSIONS, text=_("&Clean all sessions"))
+ self.Append(ID_CLEANSESSIONS, _("&Clean all sessions"))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnCleanSessions, id=ID_CLEANSESSIONS)
if not self._PyHocaGUI.restricted_trayicon:
self.AppendSeparator()
if self._PyHocaGUI.session_profiles.is_mutable(profile_name):
- self.Append(id=ID_EDITPROFILEWHILECONNECTED, text=_("Customize &profile"))
+ self.Append(ID_EDITPROFILEWHILECONNECTED, _("Customize &profile"))
else:
- self.Append(id=ID_EDITPROFILEWHILECONNECTED, text=_("View &profile"))
+ self.Append(ID_EDITPROFILEWHILECONNECTED, _("View &profile"))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnProfileEditWhileConnected, id=ID_EDITPROFILEWHILECONNECTED)
self._PyHocaGUI._eventid_profilenames_map[ID_EDITPROFILEWHILECONNECTED] = \
@@ -821,9 +824,9 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu):
if self._PyHocaGUI.restricted_trayicon:
self.AppendSeparator()
- _shared_folders = self.AppendMenu(id=ID_SHARELOCALFOLDER, text=_("Shared &folders"),
- submenu=PyHocaGUI_Menu_TaskbarProfileSharedFolders(self._PyHocaGUI, caller=self,
- profile_name=profile_name)
+ _shared_folders = self.AppendMenu(ID_SHARELOCALFOLDER,
+ _("Shared &folders"),
+ PyHocaGUI_Menu_TaskbarProfileSharedFolders(self._PyHocaGUI, caller=self, profile_name=profile_name)
)
if not self._PyHocaGUI.get_master_session(profile_name=profile_name) or _foldersharing_disabled:
_shared_folders.Enable(False)
@@ -833,29 +836,29 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu):
self.AppendSeparator()
ID_SERVERINFO = wx.NewId()
self._PyHocaGUI._eventid_profilenames_map[ID_SERVERINFO] = profile_name
- self.Append(id=ID_SERVERINFO, text=_("Server Information"))
+ self.Append(ID_SERVERINFO, _("Server Information"))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnViewServerInformation, id=ID_SERVERINFO)
if profile_name in self._PyHocaGUI.client_connected_profiles(return_profile_names=True) and not self._PyHocaGUI.exit_on_disconnect:
self.AppendSeparator()
ID_DISCONNECT = wx.NewId()
self._PyHocaGUI._eventid_profilenames_map[ID_DISCONNECT] = profile_name
- self.Append(id=ID_DISCONNECT, text=_("&Disconnect from Server"))
+ self.Append(ID_DISCONNECT, _("&Disconnect from Server"))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnServerDisconnect, id=ID_DISCONNECT)
if self._PyHocaGUI.args.single_session_profile:
ID_EXIT = wx.NewId()
if self._PyHocaGUI.client_running_sessions_of_profile_name(profile_name=self._PyHocaGUI.args.session_profile) and self._PyHocaGUI.exit_on_disconnect and not self._PyHocaGUI.disconnect_on_suspend:
self.AppendSeparator()
- self.Append(id=ID_EXIT, text=_("Suspend Session and E&xit application"))
+ self.Append(ID_EXIT, _("Suspend Session and E&xit application"))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnTaskbarExit, id=ID_EXIT)
elif self._PyHocaGUI.is_profile_connected(profile_name=self._PyHocaGUI.args.session_profile) and self._PyHocaGUI.exit_on_disconnect and not self._PyHocaGUI.disconnect_on_suspend:
self.AppendSeparator()
- self.Append(id=ID_EXIT, text=_("Disconnect and E&xit application"))
+ self.Append(ID_EXIT, _("Disconnect and E&xit application"))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnTaskbarExit, id=ID_EXIT)
elif not self._PyHocaGUI.exit_on_disconnect and not (self._PyHocaGUI.disconnect_on_suspend or self._PyHocaGUI.disconnect_on_terminate):
self.AppendSeparator()
- self.Append(id=ID_EXIT, text=_("E&xit"))
+ self.Append(ID_EXIT, _("E&xit"))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnTaskbarExit, id=ID_EXIT)
@@ -905,7 +908,7 @@ class PyHocaGUI_Menu_TaskbarProfileNames(wx.Menu):
if type(caller) == PyHocaGUI_Menu_TaskbarOptionsManager and self._PyHocaGUI.session_profiles.supports_mutable_profiles():
ID_ADDPROFILE = wx.NewId()
- self.Append(id=ID_ADDPROFILE, text=_("Add Profile"))
+ self.Append(ID_ADDPROFILE, _("Add Profile"))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnProfileAdd, id=ID_ADDPROFILE)
self.AppendSeparator()
@@ -938,19 +941,20 @@ class PyHocaGUI_Menu_TaskbarProfileNames(wx.Menu):
filter_profiles.append(profile_name)
_this_id = wx.NewId()
- self.AppendMenu(text=profile_group, id=_this_id,
- submenu=PyHocaGUI_Menu_TaskbarProfileNames(self._PyHocaGUI,
- caller=self,
- sub_profile_items=_sub_profile_items,
- filter_profiles=[],
- disabled_profiles=disabled_profiles,
- submenu=submenu,
- bind_method=bind_method,
- group_name=profile_group,
- parent_group=_parent_group,
- group_menus=True)
-
- )
+ self.AppendMenu(_this_id,
+ profile_group,
+ PyHocaGUI_Menu_TaskbarProfileNames(self._PyHocaGUI,
+ caller=self,
+ sub_profile_items=_sub_profile_items,
+ filter_profiles=[],
+ disabled_profiles=disabled_profiles,
+ submenu=submenu,
+ bind_method=bind_method,
+ group_name=profile_group,
+ parent_group=_parent_group,
+ group_menus=True
+ )
+ )
if filter_profiles:
_profile_names = [ p for p in _profile_names if p not in filter_profiles ]
@@ -968,11 +972,11 @@ class PyHocaGUI_Menu_TaskbarProfileNames(wx.Menu):
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=_real_profile_name))
+ _sub = self.AppendMenu(_this_id, _menu_profile_name, submenu(self._PyHocaGUI, caller=self, profile_name=_real_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)
+ _item = self.Append(_this_id, _menu_profile_name)
if disabled_profiles and _real_profile_name in disabled_profiles:
_item.Enable(False)
@@ -982,9 +986,9 @@ class PyHocaGUI_Menu_TaskbarProfileNames(wx.Menu):
if not group_name and (not _profile_groups and not _profile_names) and not filter_profiles:
if self._PyHocaGUI.with_brokerage:
- _dummy = self.Append(text=_('Session broker is not connected'), id=wx.NewId())
+ _dummy = self.Append(wx.NewId(), _('Session broker is not connected'))
else:
- _dummy = self.Append(text=_('No session profiles defined'), id=wx.NewId())
+ _dummy = self.Append(wx.NewId(), _('No session profiles defined'))
_dummy.Enable(False)
else:
@@ -995,15 +999,15 @@ class PyHocaGUI_Menu_TaskbarProfileNames(wx.Menu):
_export_group_name = _export_group_name.strip("/")
self._PyHocaGUI._eventid_exportprofiles_map[_export_id] = _export_group_name
if not group_name:
- self.Append(text=_('Export all Profiles'), id=_export_id)
+ self.Append(_export_id, _('Export all Profiles'))
else:
- self.Append(text=_('Export Profile Group'), id=_export_id)
+ self.Append(_export_id, _('Export Profile Group'))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnProfileExport, id=_export_id)
if bind_method is None and not group_name and self._PyHocaGUI.session_profiles.supports_mutable_profiles():
_import_id = wx.NewId()
self.AppendSeparator()
- self.Append(text=_('Import Session Profiles'), id=_import_id)
+ self.Append(_import_id, _('Import Session Profiles'))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnProfileImport, id=_import_id)
def OnUpdateUI(self, evt):
@@ -1042,18 +1046,20 @@ class PyHocaGUI_Menu_TaskbarSessionManager(wx.Menu):
if self._PyHocaGUI.with_brokerage and not self._PyHocaGUI.session_profiles.is_broker_authenticated():
_auth_menu_text = _('Connect to') + ' ' + self._PyHocaGUI.broker_name
- self.Append(id=ID_AUTHENTICATE_BROKER, text=_auth_menu_text)
+ self.Append(ID_AUTHENTICATE_BROKER, _auth_menu_text)
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnBrokerAuthenticate, id=ID_AUTHENTICATE_BROKER)
self.AppendSeparator()
else:
_auth_menu_text = _('Connect Server')
- self.AppendMenu(id=ID_AUTHENTICATE_SESSION,
- text=_auth_menu_text,
- submenu=PyHocaGUI_Menu_TaskbarProfileNames(self._PyHocaGUI,
- caller=self,
- filter_profiles=[],
- disabled_profiles=self._PyHocaGUI.client_connected_profiles(return_profile_names=True) + self._PyHocaGUI._temp_disabled_profile_names,
- bind_method=self._PyHocaGUI.OnSessionAuthenticate))
+ self.AppendMenu(ID_AUTHENTICATE_SESSION,
+ _auth_menu_text,
+ PyHocaGUI_Menu_TaskbarProfileNames(self._PyHocaGUI,
+ caller=self,
+ filter_profiles=[],
+ disabled_profiles=self._PyHocaGUI.client_connected_profiles(return_profile_names=True) + self._PyHocaGUI._temp_disabled_profile_names,
+ bind_method=self._PyHocaGUI.OnSessionAuthenticate,
+ )
+ )
self.AppendSeparator()
_profile_names = self._PyHocaGUI.session_profiles.profile_names
@@ -1067,16 +1073,17 @@ class PyHocaGUI_Menu_TaskbarSessionManager(wx.Menu):
_menu_profile_name = self._PyHocaGUI.show_profile_metatypes and '%s (%s)' % (profile_name, self._PyHocaGUI.get_profile_metatype(profile_name)) or profile_name
try:
- self.AppendMenu(text=_menu_profile_name,
- id=_this_id,
- submenu=PyHocaGUI_Menu_TaskbarSessionProfile(self._PyHocaGUI, caller=self, profile_name=profile_name))
+ self.AppendMenu(_this_id,
+ _menu_profile_name,
+ PyHocaGUI_Menu_TaskbarSessionProfile(self._PyHocaGUI, caller=self, profile_name=profile_name)
+ )
except x2go.x2go_exceptions.X2GoSessionRegistryException:
pass
if _connected_sessions:
self.AppendSeparator()
- self.Append(id=ID_EXIT, text=_("E&xit"))
+ self.Append(ID_EXIT, _("E&xit"))
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnTaskbarExit, id=ID_EXIT)
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/pyhoca-gui.git
More information about the x2go-commits
mailing list