This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch master in repository pyhoca-gui. from 38554ad Continue development new dd61684 PyHocaGUI.OnExit(): Return an exitcode. new 69ea6d8 run 2to3 on this project new a093f28 More porting to Python 3 (manually). new c836207 wxgui/profilemanager.py: Capture failures that might occur when writing session profile configs back to disk. new f18a811 Menu.Append{,Menu}() calls: Turn arguments into positional arguments. Makes the code run on wx3 and wx4. new fa352bc Port to wxPython 4.0.x. new d0f9cc3 pyhoca/wxgui/{logon.py,passphrase.py}: Merge code of both files into one, break up circular import dependency. new 7025cd8 debian/changelog: update from Git history new da3d33a debian/control: Switch from Py2 to Py3 (B-Ds and Ds). The 9 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: debian/changelog | 20 +- debian/control | 22 +-- icon2exe.py | 36 ++-- nsis_template.py | 2 +- pyhoca-gui | 2 +- pyhoca/wxgui/about.py | 13 +- pyhoca/wxgui/basepath.py | 2 +- pyhoca/wxgui/brokerlogon.py | 24 +-- pyhoca/wxgui/frontend.py | 297 ++++++++++++++-------------- pyhoca/wxgui/launcher.py | 49 +++-- pyhoca/wxgui/listdesktops.py | 16 +- pyhoca/wxgui/logon.py | 429 ++++++++++++++++++++++++++++++++++++----- pyhoca/wxgui/menus_taskbar.py | 365 +++++++++++++++++++---------------- pyhoca/wxgui/messages.py | 16 +- pyhoca/wxgui/notify.py | 11 +- pyhoca/wxgui/passphrase.py | 375 ----------------------------------- pyhoca/wxgui/printingprefs.py | 60 +++--- pyhoca/wxgui/profilemanager.py | 385 ++++++++++++++++++------------------ pyhoca/wxgui/serverinfo.py | 26 +-- pyhoca/wxgui/sessiontitle.py | 10 +- pyhoca/wxgui/splash.py | 28 ++- pyhoca/wxgui/taskbar.py | 32 ++- setup.py | 14 +- 23 files changed, 1145 insertions(+), 1089 deletions(-) delete mode 100644 pyhoca/wxgui/passphrase.py -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/pyhoca-gui.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository pyhoca-gui. commit dd61684fa65297fd5a45bad92b33b415a60abfa4 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Mon Dec 2 16:35:27 2019 +0100 PyHocaGUI.OnExit(): Return an exitcode. --- pyhoca/wxgui/frontend.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyhoca/wxgui/frontend.py b/pyhoca/wxgui/frontend.py index 46edfb8..05eea1c 100644 --- a/pyhoca/wxgui/frontend.py +++ b/pyhoca/wxgui/frontend.py @@ -477,6 +477,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): x2go.x2go_cleanup() self.about.Close() self.taskbar.Close() + return 0 # the taskbar's OnExit method... def OnTaskbarExit(self, evt): -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/pyhoca-gui.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository pyhoca-gui. commit c836207e54446d6f935e6918da424ff7533b7d69 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Mon Dec 2 16:30:38 2019 +0100 wxgui/profilemanager.py: Capture failures that might occur when writing session profile configs back to disk. --- pyhoca/wxgui/profilemanager.py | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/pyhoca/wxgui/profilemanager.py b/pyhoca/wxgui/profilemanager.py index 3cf6281..2155421 100644 --- a/pyhoca/wxgui/profilemanager.py +++ b/pyhoca/wxgui/profilemanager.py @@ -2526,20 +2526,25 @@ class PyHocaGUI_ProfileManager(wx.Dialog): self.session_profiles.update_value(self.profile_id, k, self.profile_config[k]) self.session_profiles.write_user_config = True - self.session_profiles.write() - self.profile_id = self.session_profiles.to_profile_id(self.profile_config['name']) - - if self.action == 'ADD': - self._PyHocaGUI.notifier.send(title=_('%s - profile added') % self.profile_config['name'], - text=_('A new session profile has been added.'), - icon='profile_add', - ) - elif self.action == 'EDIT': - self._PyHocaGUI.notifier.send(title=_('%s - modified') % self.profile_config['name'], - text=_('Changes to profile have been saved.'), - icon='profile_save', + if self.session_profiles.write(): + self.profile_id = self.session_profiles.to_profile_id(self.profile_config['name']) + + if self.action == 'ADD': + self._PyHocaGUI.notifier.send(title=_('%s - profile added') % self.profile_config['name'], + text=_('A new session profile has been added.'), + icon='profile_add', + ) + elif self.action == 'EDIT': + self._PyHocaGUI.notifier.send(title=_('%s - modified') % self.profile_config['name'], + text=_('Changes to profile have been saved.'), + icon='profile_save', + ) + self._PyHocaGUI.register_available_server_sessions_by_profile_name(profile_name=self.profile_config['name'], re_register=True) + else: + self._PyHocaGUI.notifier.send(title=_('%s - failed writing session profile') % self.profile_config['name'], + text=_('There was a failure while saving the session profile configuration.'), + icon='profile_error', ) - self._PyHocaGUI.register_available_server_sessions_by_profile_name(profile_name=self.profile_config['name'], re_register=True) try: wx.EndBusyCursor() except: pass -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/pyhoca-gui.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository pyhoca-gui. commit a093f28f80a25b67523a654e99f954c3e0448d01 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Mon Dec 2 10:28:06 2019 +0100 More porting to Python 3 (manually). --- pyhoca/wxgui/launcher.py | 9 +++++++-- setup.py | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pyhoca/wxgui/launcher.py b/pyhoca/wxgui/launcher.py index 0c8e5d4..91e2d94 100644 --- a/pyhoca/wxgui/launcher.py +++ b/pyhoca/wxgui/launcher.py @@ -112,7 +112,12 @@ VERSION: %s p = subprocess.Popen(['ps', '-U', CURRENT_LOCAL_USER, '-u', CURRENT_LOCAL_USER], stdout=subprocess.PIPE) psA_out = p.communicate() - if psA_out[0].count(_executable) <= 1: + if sys.version_info[0] < 3: + num_of_processes = psA_out[0].count(_executable) + else: + num_of_processes = psA_out[0].count(_executable.encode()) + + if num_of_processes <= 1: if os.path.isdir(os.path.expanduser("~/.x2go/{progname}/".format(progname=_executable))): shutil.rmtree(os.path.expanduser("~/.x2go/{progname}/".format(progname=_executable))) @@ -383,7 +388,7 @@ VERSION: %s lang = gettext.translation('PyHoca-GUI', localedir=basepath.locale_basepath, languages=['en'], ) lang.install(str=True) else: - gettext.install('PyHoca-GUI', localedir=basepath.locale_basepath, str=True) + gettext.install('PyHoca-GUI', localedir=basepath.locale_basepath) if self.check_running(): sys.stderr.write("\n###############################\n### %s: already running for user %s\n###############################\n" % (self.PROG_NAME, CURRENT_LOCAL_USER)) diff --git a/setup.py b/setup.py index 1ca7b1e..1b72992 100755 --- a/setup.py +++ b/setup.py @@ -26,6 +26,8 @@ import os import platform import datetime +from __future__ import print_function + PROGRAM_NAME = 'PyHoca-GUI' # Windows: UNINSTALL_NAME is for add/remove programs UNINSTALL_NAME = 'PyHoca-GUI (A graphical X2Go client)' -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/pyhoca-gui.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository pyhoca-gui. commit 69ea6d8e1d7eafed9a763a9d83d3616ea0b91b5f Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Mon Dec 2 08:37:44 2019 +0100 run 2to3 on this project --- icon2exe.py | 36 ++-- nsis_template.py | 2 +- pyhoca-gui | 2 +- pyhoca/wxgui/about.py | 6 +- pyhoca/wxgui/basepath.py | 2 +- pyhoca/wxgui/brokerlogon.py | 24 +-- pyhoca/wxgui/frontend.py | 252 ++++++++++++++-------------- pyhoca/wxgui/launcher.py | 36 ++-- pyhoca/wxgui/listdesktops.py | 16 +- pyhoca/wxgui/logon.py | 88 +++++----- pyhoca/wxgui/menus_taskbar.py | 204 +++++++++++------------ pyhoca/wxgui/messages.py | 16 +- pyhoca/wxgui/notify.py | 11 +- pyhoca/wxgui/passphrase.py | 72 ++++---- pyhoca/wxgui/printingprefs.py | 60 +++---- pyhoca/wxgui/profilemanager.py | 362 ++++++++++++++++++++--------------------- pyhoca/wxgui/serverinfo.py | 26 +-- pyhoca/wxgui/sessiontitle.py | 10 +- pyhoca/wxgui/splash.py | 2 +- pyhoca/wxgui/taskbar.py | 12 +- setup.py | 12 +- 21 files changed, 625 insertions(+), 626 deletions(-) diff --git a/icon2exe.py b/icon2exe.py index d0fdf9b..2c3c75a 100644 --- a/icon2exe.py +++ b/icon2exe.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python2 +#! /usr/bin/env python3 # Copyright (C) 2005, Giovanni Bajo # Based on previous work under copyright (c) 2002 McMillan Enterprises, Inc. # @@ -26,7 +26,7 @@ LOAD_LIBRARY_AS_DATAFILE = 2 import struct import types try: - StringTypes = types.StringTypes + StringTypes = (str,) except AttributeError: StringTypes = [ type("") ] @@ -38,11 +38,11 @@ class Structure: for i in range (len (self._names_)): indexes[self._names_[i]] = i def dump (self): - print "I: DUMP of", self + print(("I: DUMP of", self)) for name in self._names_: if name[0] != '_': - print "I: %20s = %s" % (name, getattr (self, name)) - print + print(("I: %20s = %s" % (name, getattr (self, name)))) + print() def __getattr__ (self, name): if name in self._names_: index = self._indexes_[name] @@ -50,7 +50,7 @@ class Structure: try: return self.__dict__[name] except KeyError: - raise AttributeError, name + raise AttributeError(name) def __setattr__ (self, name, value): if name in self._names_: index = self._indexes_[name] @@ -58,7 +58,7 @@ class Structure: else: self.__dict__[name] = value def tostring (self): - return apply (struct.pack, [self._format_,] + self._fields_) + return struct.pack(*[self._format_,] + self._fields_) def fromfile (self, file): data = file.read (self._sizeInBytes) self._fields_ = list (struct.unpack (self._format_, data)) @@ -112,8 +112,8 @@ class IconFile: def CopyIcons_FromIco (dstpath, srcpath, id=1): import win32api #, win32con - icons = map(IconFile, srcpath) - print "I: Updating icons from", srcpath, "to", dstpath + icons = list(map(IconFile, srcpath)) + print(("I: Updating icons from", srcpath, "to", dstpath)) hdst = win32api.BeginUpdateResource (dstpath, 0) @@ -123,10 +123,10 @@ def CopyIcons_FromIco (dstpath, srcpath, id=1): data = f.grp_icon_dir() data = data + f.grp_icondir_entries(iconid) win32api.UpdateResource (hdst, RT_GROUP_ICON, i, data) - print "I: Writing RT_GROUP_ICON %d resource with %d bytes" % (i, len(data)) + print(("I: Writing RT_GROUP_ICON %d resource with %d bytes" % (i, len(data)))) for data in f.images: win32api.UpdateResource (hdst, RT_ICON, iconid, data) - print "I: Writing RT_ICON %d resource with %d bytes" % (iconid, len (data)) + print(("I: Writing RT_ICON %d resource with %d bytes" % (iconid, len (data)))) iconid = iconid + 1 win32api.EndUpdateResource (hdst, 0) @@ -139,13 +139,13 @@ def CopyIcons (dstpath, srcpath): def splitter(s): try: - srcpath, index = map(string.strip, string.split(s, ',')) + srcpath, index = list(map(string.strip, string.split(s, ','))) return srcpath, int(index) except ValueError: return s, None - srcpath = map(splitter, srcpath) - print "I: SRCPATH", srcpath + srcpath = list(map(splitter, srcpath)) + print(("I: SRCPATH", srcpath)) if len(srcpath) > 1: # At the moment, we support multiple icons only from .ico files @@ -153,9 +153,9 @@ def CopyIcons (dstpath, srcpath): for s in srcpath: e = os.path.splitext(s[0])[1] if string.lower(e) != '.ico': - raise ValueError, "multiple icons supported only from .ico files" + raise ValueError("multiple icons supported only from .ico files") if s[1] is not None: - raise ValueError, "index not allowed for .ico files" + raise ValueError("index not allowed for .ico files") srcs.append(s[0]) return CopyIcons_FromIco(dstpath, srcs) @@ -164,9 +164,9 @@ def CopyIcons (dstpath, srcpath): if string.lower (srcext) == '.ico': return CopyIcons_FromIco (dstpath, [srcpath]) if index is not None: - print "I: Updating icons from", srcpath, ", %d to" % index, dstpath + print(("I: Updating icons from", srcpath, ", %d to" % index, dstpath)) else: - print "I: Updating icons from", srcpath, "to", dstpath + print(("I: Updating icons from", srcpath, "to", dstpath)) import win32api #, win32con hdst = win32api.BeginUpdateResource (dstpath, 0) hsrc = win32api.LoadLibraryEx (srcpath, 0, LOAD_LIBRARY_AS_DATAFILE) diff --git a/nsis_template.py b/nsis_template.py index 83d792c..216afb4 100644 --- a/nsis_template.py +++ b/nsis_template.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # vim:fenc=utf-8 diff --git a/pyhoca-gui b/pyhoca-gui index 879376d..50cfd9f 100755 --- a/pyhoca-gui +++ b/pyhoca-gui @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # vim:fenc=utf-8 diff --git a/pyhoca/wxgui/about.py b/pyhoca/wxgui/about.py index 87071e0..ceadb65 100644 --- a/pyhoca/wxgui/about.py +++ b/pyhoca/wxgui/about.py @@ -30,7 +30,7 @@ import x2go import wx # PyHoca-GUI modules -import basepath +from . import basepath class PyHocaGUI_AboutFrame(wx.Frame): """\ @@ -76,9 +76,9 @@ class PyHocaGUI_AboutFrame(wx.Frame): about_what = self._PyHocaGUI.appname if x2go.X2GOCLIENT_OS == 'Windows': - wx.Frame.__init__(self, None, -1, _(u'About %s ...') % about_what, size=(403,340)) + wx.Frame.__init__(self, None, -1, _('About %s ...') % about_what, size=(403,340)) else: - wx.Frame.__init__(self, None, -1, _(u'About %s ...') % about_what, size=(400,298)) + wx.Frame.__init__(self, None, -1, _('About %s ...') % about_what, size=(400,298)) self.Bind(wx.EVT_CLOSE, self.OnHide) panel = wx.Panel(self, -1, pos=(0,0), size=(0,0), ) diff --git a/pyhoca/wxgui/basepath.py b/pyhoca/wxgui/basepath.py index 73a8149..85ffc0f 100644 --- a/pyhoca/wxgui/basepath.py +++ b/pyhoca/wxgui/basepath.py @@ -23,7 +23,7 @@ import os from x2go import X2GOCLIENT_OS as _X2GOCLIENT_OS def reload_base_paths(): - if os.environ.has_key('PYHOCAGUI_DEVELOPMENT') and os.environ['PYHOCAGUI_DEVELOPMENT'] == '1': + if 'PYHOCAGUI_DEVELOPMENT' in os.environ and os.environ['PYHOCAGUI_DEVELOPMENT'] == '1': _base_location = os.path.abspath(os.path.curdir) _icons_location = os.path.join(_base_location, 'icons') _images_location = os.path.join(_base_location, 'img') diff --git a/pyhoca/wxgui/brokerlogon.py b/pyhoca/wxgui/brokerlogon.py index 64c045a..2ff8906 100644 --- a/pyhoca/wxgui/brokerlogon.py +++ b/pyhoca/wxgui/brokerlogon.py @@ -27,9 +27,9 @@ import x2go import wx import os -import messages +from . import messages -if os.environ.has_key('DESKTOP_SESSION'): +if 'DESKTOP_SESSION' in os.environ: WINDOW_MANAGER = os.environ['DESKTOP_SESSION'] else: WINDOW_MANAGER = 'generic' @@ -52,16 +52,16 @@ class PyHocaGUI_BrokerDialogBoxPassword(wx.Dialog): self._pyhoca_logger = self._PyHocaGUI._pyhoca_logger self._pyhoca_logger('password dialog box started', loglevel=x2go.loglevel_INFO, ) - wx.Dialog.__init__(self, None, id=-1, title=self._PyHocaGUI.broker_name + ' ' + _(u'Logon'), style=wx.DEFAULT_FRAME_STYLE, ) + wx.Dialog.__init__(self, None, id=-1, title=self._PyHocaGUI.broker_name + ' ' + _('Logon'), style=wx.DEFAULT_FRAME_STYLE, ) self._PyHocaGUI._sub_windows.append(self) - self.brokerLbl = wx.StaticText(self, wx.ID_ANY, _(u'Broker URL')+':', size=(-1, -1)) + self.brokerLbl = wx.StaticText(self, wx.ID_ANY, _('Broker URL')+':', size=(-1, -1)) self.brokerTxt = wx.TextCtrl(self, wx.ID_ANY, '', style=wx.TE_PROCESS_ENTER, size=(240, -1)) - self.userLbl = wx.StaticText(self, wx.ID_ANY, _(u'Username')+':', size=(-1, -1)) + self.userLbl = wx.StaticText(self, wx.ID_ANY, _('Username')+':', size=(-1, -1)) self.userTxt = wx.TextCtrl(self, wx.ID_ANY, '', style=wx.TE_PROCESS_ENTER, size=(240, -1)) - self.passwordLbl = wx.StaticText(self, wx.ID_ANY, _(u'Password')+':', size=(-1, -1)) + self.passwordLbl = wx.StaticText(self, wx.ID_ANY, _('Password')+':', size=(-1, -1)) self.passwordTxt = wx.TextCtrl(self, wx.ID_ANY, '', style=wx.TE_PROCESS_ENTER|wx.TE_PASSWORD, size=(240, -1)) self.passwordTxt.SetFocus() @@ -82,9 +82,9 @@ class PyHocaGUI_BrokerDialogBoxPassword(wx.Dialog): else: self.brokerTxt.SetValue(self._PyHocaGUI.session_profiles.get_broker_url()) - self.loginBtn = wx.Button(self, wx.ID_OK, _(u'Authenticate'), ) + self.loginBtn = wx.Button(self, wx.ID_OK, _('Authenticate'), ) self.loginBtn.SetDefault() - self.cancelBtn = wx.Button(self, wx.ID_CANCEL, _(u'Cancel'), ) + self.cancelBtn = wx.Button(self, wx.ID_CANCEL, _('Cancel'), ) _tab_order = [self.userTxt, self.passwordTxt, self.loginBtn, self.cancelBtn, ] self.Bind(wx.EVT_BUTTON, self.OnLogin, self.loginBtn) @@ -116,7 +116,7 @@ class PyHocaGUI_BrokerDialogBoxPassword(wx.Dialog): self.SetSizerAndFit(mainSizer) self.Layout() - for i in xrange(len(_tab_order) - 1): + for i in range(len(_tab_order) - 1): _tab_order[i+1].MoveAfterInTabOrder(_tab_order[i]) maxX, maxY = wx.GetDisplaySize() @@ -163,13 +163,13 @@ class PyHocaGUI_BrokerDialogBoxPassword(wx.Dialog): self._PyHocaGUI.session_profiles.set_broker_url(broker_url) try: if self._PyHocaGUI.session_profiles.broker_simpleauth(username, password): - self._PyHocaGUI.notifier.send(_(u"%s - success") % self._PyHocaGUI.broker_name, _(u"Authentication to session broker has been\nsuccessful."), icon='auth_success', timeout=10000) + self._PyHocaGUI.notifier.send(_("%s - success") % self._PyHocaGUI.broker_name, _("Authentication to session broker has been\nsuccessful."), icon='auth_success', timeout=10000) else: - self._PyHocaGUI.notifier.send(_(u"%s - failure") % self._PyHocaGUI.broker_name, _(u"Authentication to session broker failed."), icon='auth_failed', timeout=10000) + self._PyHocaGUI.notifier.send(_("%s - failure") % self._PyHocaGUI.broker_name, _("Authentication to session broker failed."), icon='auth_failed', timeout=10000) self.Close() self.Destroy() except x2go.x2go_exceptions.X2GoBrokerConnectionException: - m = messages.PyHoca_MessageWindow_YesNo(self._PyHocaGUI, title=_(u'%s: Connection refused error') % self._PyHocaGUI.appname, msg=_(u'Connection to %s failed. Retry?') % self._PyHocaGUI.broker_name, icon='connect_error') + m = messages.PyHoca_MessageWindow_YesNo(self._PyHocaGUI, title=_('%s: Connection refused error') % self._PyHocaGUI.appname, msg=_('Connection to %s failed. Retry?') % self._PyHocaGUI.broker_name, icon='connect_error') m.ShowModal() if m.No(): self.Close() diff --git a/pyhoca/wxgui/frontend.py b/pyhoca/wxgui/frontend.py index 05eea1c..e65b227 100644 --- a/pyhoca/wxgui/frontend.py +++ b/pyhoca/wxgui/frontend.py @@ -36,20 +36,20 @@ import threading import locale # PyHoca-GUI modules -import about -import logon -import brokerlogon -import passphrase -import taskbar -import profilemanager -import printingprefs -import notify -import basepath -import messages -import splash -import sessiontitle -import listdesktops -import serverinfo +from . import about +from . import logon +from . import brokerlogon +from . import passphrase +from . import taskbar +from . import profilemanager +from . import printingprefs +from . import notify +from . import basepath +from . import messages +from . import splash +from . import sessiontitle +from . import listdesktops +from . import serverinfo wx.SetDefaultPyEncoding("utf-8") @@ -198,7 +198,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): _x2goclient_kwargs['start_xserver'] = self.args.start_xserver _x2goclient_kwargs['start_pulseaudio'] = self.args.start_pulseaudio - if x2go.X2GOCLIENT_OS == 'Windows' and self.args.start_pulseaudio and os.environ.has_key('PYHOCAGUI_DEVELOPMENT') and os.environ['PYHOCAGUI_DEVELOPMENT'] == '1': + if x2go.X2GOCLIENT_OS == 'Windows' and self.args.start_pulseaudio and 'PYHOCAGUI_DEVELOPMENT' in os.environ and os.environ['PYHOCAGUI_DEVELOPMENT'] == '1': _x2goclient_kwargs['pulseaudio_installdir'] = os.path.dirname(basepath.pulseaudio_binary) self.broker_autoconnect = self.args.broker_autoconnect @@ -353,7 +353,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): ### ### disable functionality for release versions ### - if os.environ.has_key('PYHOCAGUI_DEVELOPMENT') and os.environ['PYHOCAGUI_DEVELOPMENT'] == '1': + if 'PYHOCAGUI_DEVELOPMENT' in os.environ and os.environ['PYHOCAGUI_DEVELOPMENT'] == '1': self.options_disabled = self.args.disable_options else: self._pyhoca_logger('the current release of %s does not support client configuration' % self.appname, loglevel=x2go.log.loglevel_WARN) @@ -469,7 +469,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): _win.Close() for session_obj in [ _s for _s in self._X2GoClient__client_running_sessions(return_objects=True) if _s.is_associated() ]: profile_name = session_obj.get_profile_name() - if not self._hide_notifications_map.has_key(profile_name): + if profile_name not in self._hide_notifications_map: self._hide_notifications_map[profile_name] = [] self._hide_notifications_map[profile_name].append(session_obj.get_session_name()) try: session_obj.suspend() @@ -492,12 +492,12 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): if self.args.single_session_profile: if not x2go.defaults.X2GOCLIENT_OS == 'Windows': if self.client_running_sessions_of_profile_name(self.args.session_profile): - self.notifier.send(self.appname, _(u'Suspending sessions and exiting application...'), icon='application-exit', timeout=10000) + self.notifier.send(self.appname, _('Suspending sessions and exiting application...'), icon='application-exit', timeout=10000) else: if self.is_profile_connected(profile_name=self.args.session_profile): - self.notifier.send(self.appname, _(u'Disconnecting %s and exiting application...') % str(self.args.session_profile), icon='application-exit', timeout=10000) + self.notifier.send(self.appname, _('Disconnecting %s and exiting application...') % str(self.args.session_profile), icon='application-exit', timeout=10000) else: - self.notifier.send(self.appname, _(u'Exiting application...'), icon='application-exit', timeout=10000) + self.notifier.send(self.appname, _('Exiting application...'), icon='application-exit', timeout=10000) self._eventid_profilenames_map[evt.GetId()] = self.args.session_profile self.WakeUpIdle() self.ExitMainLoop() @@ -517,7 +517,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): if profile_name is None and session_uuid: profile_name = self._X2GoClient__get_session_profile_name(session_uuid) - if not self._temp_launching_pubapp_locks.has_key(profile_name): + if profile_name not in self._temp_launching_pubapp_locks: self._temp_launching_pubapp_locks[profile_name] = threading.Lock() if not self._X2GoClient__client_connected_sessions_of_profile_name(profile_name): @@ -544,7 +544,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): # suspend any running session that is in published applications mode (unless we are already associated with it) session_list = self._X2GoClient__list_sessions(session_uuid=session_uuid, profile_name=profile_name) if session_list: - pubapp_sessions_running = [ _sn for _sn in session_list.keys() if session_list[_sn].is_running() and session_list[_sn].is_published_applications_provider() ] + pubapp_sessions_running = [ _sn for _sn in list(session_list.keys()) if session_list[_sn].is_running() and session_list[_sn].is_published_applications_provider() ] for session_name in pubapp_sessions_running: self.suspend_session(session_uuid=connected_session(), session_name=session_name) @@ -556,7 +556,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): session_list = self._X2GoClient__list_sessions(session_uuid=session_uuid, profile_name=profile_name, refresh_cache=True) if session_list: - pubapp_sessions_suspended = [ _sn for _sn in session_list.keys() if session_list[_sn].is_suspended() and session_list[_sn].is_published_applications_provider() ] + pubapp_sessions_suspended = [ _sn for _sn in list(session_list.keys()) if session_list[_sn].is_suspended() and session_list[_sn].is_published_applications_provider() ] for session_name in pubapp_sessions_suspended: @@ -597,7 +597,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): return pubapp_session_started | pubapp_session_resumed elif not connected_session.has_server_feature('X2GO_PUBLISHED_APPLICATIONS') and self.get_profile_config(profile_name)['published']: - self.notifier.send(_(u'%s - server warning') % profile_name, _(u'The X2Go Server does not publish an application menu.'), icon='session_warning', timeout=10000) + self.notifier.send(_('%s - server warning') % profile_name, _('The X2Go Server does not publish an application menu.'), icon='session_warning', timeout=10000) return None @@ -641,14 +641,14 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): if _can_session_auto_connect or _can_sshproxy_auto_connect: self._X2GoClient__connect_session(session_uuid, add_to_known_hosts=self.add_to_known_hosts) if not self._X2GoClient__server_valid_x2gouser(session_uuid): - self.notifier.send(_(u'%s - connect failure') % profile_name, _(u'User is not allowed to start X2Go sessions!'), icon='session_warning', timeout=10000) + self.notifier.send(_('%s - connect failure') % profile_name, _('User is not allowed to start X2Go sessions!'), icon='session_warning', timeout=10000) self.OnServerDisconnect(evt) try: self._temp_disabled_profile_names.remove(profile_name) except ValueError: pass else: - self.notifier.send(_(u'%s - connect') % profile_name, _(u'SSH key authentication has been successful.'), icon='auth_success', timeout=4000) + self.notifier.send(_('%s - connect') % profile_name, _('SSH key authentication has been successful.'), icon='auth_success', timeout=4000) self._X2GoClient__list_sessions(session_uuid, refresh_cache=True, update_sessionregistry=True) self._post_authenticate(evt, session_uuid) try: @@ -690,7 +690,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): else: _logon_window = logon.PyHocaGUI_DialogBoxPassword(self, profile_name, caller=self, sshproxy_auth=True, ) self._logon_windows[profile_name] = _logon_window - except x2go.SSHException, e: + except x2go.SSHException as e: if str(e).startswith('Two-factor authentication requires a password'): self._pyhoca_logger('X2Go Server requests two-factor authentication', loglevel=x2go.loglevel_NOTICE) @@ -710,8 +710,8 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): except ValueError: pass connect_failed = True - self.notifier.send(_(u'%s - SSH error') % profile_name, u'%s!' % errmsg, icon='auth_error', timeout=10000) - except x2go.X2GoSSHProxyException, e: + self.notifier.send(_('%s - SSH error') % profile_name, '%s!' % errmsg, icon='auth_error', timeout=10000) + except x2go.X2GoSSHProxyException as e: if str(e).startswith('Two-factor authentication requires a password'): self._pyhoca_logger('SSH proxy host requests two-factor authentication', loglevel=x2go.loglevel_NOTICE) _logon_window = logon.PyHocaGUI_DialogBoxPassword(self, profile_name, @@ -730,16 +730,16 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): except ValueError: pass connect_failed = True - self.notifier.send(_(u'%s - SSH error') % profile_name, u'%s!' % errmsg, icon='auth_error', timeout=10000) - except x2go.X2GoHostKeyException, e: - self.notifier.send(_(u'%s - host key error') % profile_name, _(u'The remote server\'s host key is invalid or has not been accepted by the user') + '!', icon='auth_error', timeout=4000) + self.notifier.send(_('%s - SSH error') % profile_name, '%s!' % errmsg, icon='auth_error', timeout=10000) + except x2go.X2GoHostKeyException as e: + self.notifier.send(_('%s - host key error') % profile_name, _('The remote server\'s host key is invalid or has not been accepted by the user') + '!', icon='auth_error', timeout=4000) try: self._temp_disabled_profile_names.remove(profile_name) except ValueError: pass connect_failed = True - except x2go.X2GoSSHProxyHostKeyException, e: - self.notifier.send(_(u'%s - host key error') % profile_name, _(u'The SSH proxy\'s host key is invalid or has not been accepted by the user') + '!', icon='auth_error', timeout=4000) + except x2go.X2GoSSHProxyHostKeyException as e: + self.notifier.send(_('%s - host key error') % profile_name, _('The SSH proxy\'s host key is invalid or has not been accepted by the user') + '!', icon='auth_error', timeout=4000) try: self._temp_disabled_profile_names.remove(profile_name) except ValueError: @@ -752,42 +752,42 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): # except ValueError: # pass # connect_failed = True - except gevent.socket.error, e: - self.notifier.send(_(u'%s - socket error') % profile_name, e.strerror, icon='auth_error', timeout=4000) + except gevent.socket.error as e: + self.notifier.send(_('%s - socket error') % profile_name, e.strerror, icon='auth_error', timeout=4000) try: self._temp_disabled_profile_names.remove(profile_name) except ValueError: pass connect_failed = True - except EOFError, e: - self.notifier.send(_(u'%s - EOF error') % profile_name, _(u'Authentication protocol communication incomplete! Try again...'), icon='auth_error', timeout=4000) + except EOFError as e: + self.notifier.send(_('%s - EOF error') % profile_name, _('Authentication protocol communication incomplete! Try again...'), icon='auth_error', timeout=4000) try: self._temp_disabled_profile_names.remove(profile_name) except ValueError: pass connect_failed = True - except x2go.X2GoRemoteHomeException, e: - self.notifier.send(_(u'%s - missing home directory') % profile_name, _(u"The remote user's home directory does not exist."), icon='auth_error', timeout=4000) + except x2go.X2GoRemoteHomeException as e: + self.notifier.send(_('%s - missing home directory') % profile_name, _("The remote user's home directory does not exist."), icon='auth_error', timeout=4000) try: self._temp_disabled_profile_names.remove(profile_name) except ValueError: pass connect_failed = True - except x2go.X2GoSessionException, e: - self.notifier.send(_(u'%s - auth error') % profile_name, u'%s' % str(e), icon='auth_error', timeout=4000) + except x2go.X2GoSessionException as e: + self.notifier.send(_('%s - auth error') % profile_name, '%s' % str(e), icon='auth_error', timeout=4000) try: self._temp_disabled_profile_names.remove(profile_name) except ValueError: pass connect_failed = True except: - self.notifier.send('%s - unknown error' % profile_name, _(u'An unknown error occurred during authentication!'), icon='auth_error', timeout=4000) + self.notifier.send('%s - unknown error' % profile_name, _('An unknown error occurred during authentication!'), icon='auth_error', timeout=4000) try: self._temp_disabled_profile_names.remove(profile_name) except ValueError: pass connect_failed = True - if self.args.debug or self.args.libdebug or (os.environ.has_key('PYHOCAGUI_DEVELOPMENT') and os.environ['PYHOCAGUI_DEVELOPMENT'] == '1'): + if self.args.debug or self.args.libdebug or ('PYHOCAGUI_DEVELOPMENT' in os.environ and os.environ['PYHOCAGUI_DEVELOPMENT'] == '1'): raise if connect_failed and self.exit_on_disconnect: @@ -810,8 +810,8 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): profile_name = self._eventid_profilenames_map[evt.GetId()] if self.session_profiles.get_profile_config(profile_name)['directrdp']: m = messages.PyHoca_MessageWindow_Ok(self, - title=_(u'%s: DirectRDP not supported yet') % self.appname, - msg=_(u"We apologize for the inconvenience...\n\nSession profiles of type ,,DirectRDP'' are not\nsupported by %s (%s), yet!!\n\nDirectRDP support will be available in %s (>= 1.0.0.0).") % (self.appname, self.version, self.appname), + title=_('%s: DirectRDP not supported yet') % self.appname, + msg=_("We apologize for the inconvenience...\n\nSession profiles of type ,,DirectRDP'' are not\nsupported by %s (%s), yet!!\n\nDirectRDP support will be available in %s (>= 1.0.0.0).") % (self.appname, self.version, self.appname), icon='warning', profile_name=profile_name) m.ShowModal() @@ -826,7 +826,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): self._temp_disabled_profile_names.append(profile_name) gevent.spawn(self._do_authenticate, evt, session_uuid) elif self.args.session_profile: - self.notifier.send(profile_name, _(u'Unknown session profile, configure before using it...'), icon='profile_warning', timeout=10000) + self.notifier.send(profile_name, _('Unknown session profile, configure before using it...'), icon='profile_warning', timeout=10000) if not self.is_session_profile(profile_name): profilemanager.PyHocaGUI_ProfileManager(self, 'ADD_EXPLICITLY', profile_name=profile_name) @@ -887,8 +887,8 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): server_version = self.get_server_versions(profile_name, 'x2goserver') if not self.has_server_feature(profile_name, 'X2GO_LIST_SHADOWSESSIONS'): m = messages.PyHoca_MessageWindow_Ok(self, - title=_(u'Desktop Sharing with %s not supported by server') % self.appname, - msg=_(u"We apologize for the inconvenience...\n\nSession profiles of type ,,SHADOW'' are not\nsupported by X2Go Server (v%s)!!!\n\nDesktop Sharing with %s requires\nX2Go Server 4.0.1.21 and above.") % (server_version, self.appname), + title=_('Desktop Sharing with %s not supported by server') % self.appname, + msg=_("We apologize for the inconvenience...\n\nSession profiles of type ,,SHADOW'' are not\nsupported by X2Go Server (v%s)!!!\n\nDesktop Sharing with %s requires\nX2Go Server 4.0.1.21 and above.") % (server_version, self.appname), icon='warning', profile_name=profile_name) m.ShowModal() @@ -946,7 +946,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): try: _s._X2GoSession__exec_published_application(exec_name=_exec, timeout=40) except x2go.x2go_exceptions.X2GoControlSessionException: - self.notifier.send(_(u'%s - session warning') % profile_name, _(u'Execution of command ,,%s\'\' failed.') % _exec, icon='session_warning', timeout=10000) + self.notifier.send(_('%s - session warning') % profile_name, _('Execution of command ,,%s\'\' failed.') % _exec, icon='session_warning', timeout=10000) except KeyError: pass @@ -976,7 +976,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): @type session_uuid: C{str} """ - if profile_name not in self._temp_disabled_session_names.keys(): + if profile_name not in list(self._temp_disabled_session_names.keys()): self._temp_disabled_session_names[profile_name] = [] self._temp_disabled_session_names[profile_name].append(session_name) @@ -1087,10 +1087,10 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): session_list = self._X2GoClient__list_sessions(session_uuid) if self._X2GoClient__server_is_alive(session_uuid): if session_list: - _notify_text = _(u'Cleaning X2Go sessions...') - if not self._hide_notifications_map.has_key(profile_name): + _notify_text = _('Cleaning X2Go sessions...') + if profile_name not in self._hide_notifications_map: self._hide_notifications_map[profile_name] = [] - session_names = session_list.keys() + session_names = list(session_list.keys()) session_names = [ _sn for _sn in session_names if not session_list[_sn].is_published_applications_provider() ] for session_name in session_names: _notify_text += '\n%s' % session_name @@ -1135,7 +1135,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): self.WakeUpIdle() self.ExitMainLoop() else: - self.notifier.send(_(u'%s - disconnect') % profile_name, _(u'X2Go Profile is now disconnected.'), icon='auth_disconnect', timeout=4000) + self.notifier.send(_('%s - disconnect') % profile_name, _('X2Go Profile is now disconnected.'), icon='auth_disconnect', timeout=4000) try: del self._temp_disabled_session_names[profile_name] @@ -1156,7 +1156,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): """ self._pyhoca_logger('adding new X2Go session profile', loglevel=x2go.log.loglevel_INFO, ) - profilemanager.PyHocaGUI_ProfileManager(self, 'ADD', profile_name=_(u'New Session Profile')) + profilemanager.PyHocaGUI_ProfileManager(self, 'ADD', profile_name=_('New Session Profile')) def OnProfileEdit(self, evt): """\ @@ -1211,12 +1211,12 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): profile_name = self._eventid_profilenames_map[evt.GetId()] self._temp_disabled_profile_names.append(profile_name) - m = messages.PyHoca_MessageWindow_NoYes(self, shortmsg='REALLY_DELETE_PROFILE', title=_(u'Really Delete Session Profile ,,%s\'\'?') % profile_name, icon='question', profile_name=profile_name) + m = messages.PyHoca_MessageWindow_NoYes(self, shortmsg='REALLY_DELETE_PROFILE', title=_('Really Delete Session Profile ,,%s\'\'?') % profile_name, icon='question', profile_name=profile_name) m.ShowModal() if m.Yes(): self._pyhoca_logger('deleting session profile %s' % profile_name, loglevel=x2go.log.loglevel_INFO, ) self.session_profiles.delete_profile(profile_name) - self.notifier.send(title=_(u'%s - profile deleted') % profile_name, text=_(u'The session profile has been deleted.'), icon='profile_delete') + self.notifier.send(title=_('%s - profile deleted') % profile_name, text=_('The session profile has been deleted.'), icon='profile_delete') self._temp_disabled_profile_names.remove(profile_name) def OnProfileImport(self, evt):# @@ -1228,7 +1228,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): """ dlg = wx.FileDialog( - self.about, message=_(u"import session profile(s)"), wildcard="*.x2go", style=wx.FD_OPEN) + self.about, message=_("import session profile(s)"), wildcard="*.x2go", style=wx.FD_OPEN) # Show the dialog and retrieve the user response. If it is the OK response, # process the data. @@ -1240,8 +1240,8 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): imported_session_profiles = x2go.X2GoSessionProfiles(config_files=[_import_file]) except: m = messages.PyHoca_MessageWindow_Ok(self, - title=_(u'%s: Import of session profile(s) failed') % self.appname, - msg=_(u"The selected session profile(s) could not be imported from \nfile »%s«.\n\nAre you sure the session profiles file has the correct format?") % os.path.normpath(_import_file), + title=_('%s: Import of session profile(s) failed') % self.appname, + msg=_("The selected session profile(s) could not be imported from \nfile »%s«.\n\nAre you sure the session profiles file has the correct format?") % os.path.normpath(_import_file), icon='error') m.ShowModal() return @@ -1252,13 +1252,13 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): this_profile = imported_session_profiles.get_profile_config(profile_name) # clean up session profile options that are unknown to Python X2Go - for key in copy.deepcopy(this_profile).keys(): + for key in list(copy.deepcopy(this_profile).keys()): if key not in x2go.defaults.X2GO_SESSIONPROFILE_DEFAULTS: del this_profile[key] try: self.session_profiles.add_profile(**this_profile) - except x2go.x2go_exceptions.X2GoProfileException, e: + except x2go.x2go_exceptions.X2GoProfileException as e: self._pyhoca_logger('Importing session profile %s failed. Reason: %s' % (profile_name, str(e)), loglevel=x2go.loglevel_ERROR) failed_profiles.append(profile_name) @@ -1269,37 +1269,37 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): self.session_profiles.write_user_config = True if not self.session_profiles.write(): m = messages.PyHoca_MessageWindow_Ok(self, - title=_(u'%s: Write failure after import') % self.appname, - msg=_(u"The session profiles configuration could not be written to file after import\n\nCheck for common problems (disk full, insufficient access, etc.)."), + title=_('%s: Write failure after import') % self.appname, + msg=_("The session profiles configuration could not be written to file after import\n\nCheck for common problems (disk full, insufficient access, etc.)."), icon='error', profile_name=profile_name) m.ShowModal() elif len(failed_profiles) == len(imported_profiles): - _notify_text = _(u'None of the session profiles could be imported...') + '\n' + _notify_text = _('None of the session profiles could be imported...') + '\n' for failed_profile in failed_profiles: _notify_text += '\n %s' % failed_profile - _notify_text += '\n\n' + _(u'For details, start %s from the command line and retry the import.') % self.appname - self.notifier.send(u'Session Profile Import (Failure)', _notify_text, icon='profile_error', timeout=10000) + _notify_text += '\n\n' + _('For details, start %s from the command line and retry the import.') % self.appname + self.notifier.send('Session Profile Import (Failure)', _notify_text, icon='profile_error', timeout=10000) elif 0 < len(failed_profiles) < len(imported_profiles): - _notify_text = _(u'Only these session profiles could be imported...') + '\n' + _notify_text = _('Only these session profiles could be imported...') + '\n' for profile_name in [ pn for pn in imported_profiles if pn not in failed_profiles ]: _notify_text += '\n %s' % profile_name - _notify_text += '\n\n' + _(u'Whereas these session profiles failed to import...') + '\n' + _notify_text += '\n\n' + _('Whereas these session profiles failed to import...') + '\n' for failed_profile in failed_profiles: _notify_text += '\n %s' % failed_profile - _notify_text += '\n\n' + _(u'For details, start %s from the command line and retry the import.') % self.appname - self.notifier.send(u'Session Profile Import (Warning)', _notify_text, icon='profile_warning', timeout=10000) + _notify_text += '\n\n' + _('For details, start %s from the command line and retry the import.') % self.appname + self.notifier.send('Session Profile Import (Warning)', _notify_text, icon='profile_warning', timeout=10000) elif 1 < len(imported_profiles): - _notify_text = _(u'New session profiles have been imported...') + '\n' + _notify_text = _('New session profiles have been imported...') + '\n' for profile_name in imported_profiles: _notify_text += '\n %s' % profile_name - self.notifier.send(u'Session Profile Import (Success)', _notify_text, icon='profile_add', timeout=10000) + self.notifier.send('Session Profile Import (Success)', _notify_text, icon='profile_add', timeout=10000) elif 1 == len(imported_profiles): - _notify_text = _(u'New session profile has been imported...') + '\n' + _notify_text = _('New session profile has been imported...') + '\n' for profile_name in imported_profiles: _notify_text += '\n %s' % profile_name - self.notifier.send(u'Session Profile Import (Success)', _notify_text, icon='profile_add', timeout=10000) + self.notifier.send('Session Profile Import (Success)', _notify_text, icon='profile_add', timeout=10000) def OnProfileExport(self, evt): """\ @@ -1322,15 +1322,15 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): if profile_group: # This returns a Python list of files that were selected. - filtered_profile_names = [ pn for pn in self._X2GoClient__get_profiles().profile_names if pn.startswith(unicode(profile_group)) ] + filtered_profile_names = [ pn for pn in self._X2GoClient__get_profiles().profile_names if pn.startswith(str(profile_group)) ] dlg = wx.FileDialog( - self.about, message=_(u"%s - export session profiles") % profile_group, defaultFile="%s.x2go" % profile_group.replace("/", "::"), wildcard="*.x2go", style=wx.FD_SAVE) + self.about, message=_("%s - export session profiles") % profile_group, defaultFile="%s.x2go" % profile_group.replace("/", "::"), wildcard="*.x2go", style=wx.FD_SAVE) if profile_name: dlg = wx.FileDialog( - self.about, message=_(u"%s - export session profile") % profile_name, defaultFile="%s.x2go" % profile_name, wildcard="*.x2go", style=wx.FD_SAVE) + self.about, message=_("%s - export session profile") % profile_name, defaultFile="%s.x2go" % profile_name, wildcard="*.x2go", style=wx.FD_SAVE) filtered_profile_names = [profile_name] # Show the dialog and retrieve the user response. If it is the OK response, @@ -1342,8 +1342,8 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): if os.path.exists(_export_file): m = messages.PyHoca_MessageWindow_NoYes(self, - title=_(u'%s: Export file already exists') % self.appname, - msg=_(u"The file »%s« already exists in this folder.\n\nDo you want to replace it?") % os.path.basename(_export_file), + title=_('%s: Export file already exists') % self.appname, + msg=_("The file »%s« already exists in this folder.\n\nDo you want to replace it?") % os.path.basename(_export_file), icon='warning', profile_name=profile_name) m.ShowModal() @@ -1355,7 +1355,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): this_profile = self._X2GoClient__get_profile_config(profile_name) # clean up session profile options that are unknown to Python X2Go - for key in copy.deepcopy(this_profile).keys(): + for key in list(copy.deepcopy(this_profile).keys()): if key not in x2go.defaults.X2GO_SESSIONPROFILE_DEFAULTS: del this_profile[key] @@ -1364,14 +1364,14 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): exported_session_profiles.write_user_config = True if exported_session_profiles.write(): if profile_group: - self.notifier.send(_(u'%s - profiles exported') % profile_group, _(u'Successfully exported session profile group »%s« to file »%s«.') % (profile_group, os.path.basename(_export_file)), icon='success', timeout=10000) + self.notifier.send(_('%s - profiles exported') % profile_group, _('Successfully exported session profile group »%s« to file »%s«.') % (profile_group, os.path.basename(_export_file)), icon='success', timeout=10000) elif profile_name: - self.notifier.send(_(u'%s - profile exported') % profile_name, _(u'Successfully exported single session profile »%s« to file »%s«.') % (profile_name, os.path.basename(_export_file)), icon='success', timeout=10000) + self.notifier.send(_('%s - profile exported') % profile_name, _('Successfully exported single session profile »%s« to file »%s«.') % (profile_name, os.path.basename(_export_file)), icon='success', timeout=10000) else: self._pyhoca_logger('Exporting session profile(s) to file %s failed.' % _export_file, loglevel=x2go.loglevel_ERROR) m = messages.PyHoca_MessageWindow_Ok(self, - title=_(u'%s: Exporting session profile(s) failed') % self.appname, - msg=_(u"The selected session profile(s) could not be exported to the \nfile »%s«.\n\nCheck for common problems (disk full, insufficient access, etc.).") % os.path.normpath(_export_file), + title=_('%s: Exporting session profile(s) failed') % self.appname, + msg=_("The selected session profile(s) could not be exported to the \nfile »%s«.\n\nCheck for common problems (disk full, insufficient access, etc.).") % os.path.normpath(_export_file), icon='error', profile_name=profile_name) m.ShowModal() @@ -1390,7 +1390,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): if not os.path.exists(shared_folder): shared_folder = os.getcwd() dlg = wx.DirDialog( - self.about, message=_(u"%s - share local folder with sessions of this profile") % profile_name, style=1, defaultPath=shared_folder) + self.about, message=_("%s - share local folder with sessions of this profile") % profile_name, style=1, defaultPath=shared_folder) # Show the dialog and retrieve the user response. If it is the OK response, # process the data. if dlg.ShowModal() == wx.ID_OK: @@ -1556,15 +1556,15 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): @rtype: C{bool} """ - _message = _(u'The authenticity of host [%s]:%s can\'t be established.\n%s key fingerprint is ,,%s\'\'.\n\nAre you sure you want to continue connecting?') % (host, port, fingerprint_type, fingerprint) + _message = _('The authenticity of host [%s]:%s can\'t be established.\n%s key fingerprint is ,,%s\'\'.\n\nAre you sure you want to continue connecting?') % (host, port, fingerprint_type, fingerprint) - if self._logon_windows.has_key(profile_name): + if profile_name in self._logon_windows: _parent = self._logon_windows[profile_name] else: # use a dummy parent... _parent = None - m = messages.PyHoca_MessageWindow_NoYes(self, parent=_parent, msg=_message, title=_(u'%s: Confirm Host Authorization') % profile_name, icon='profile_warning') + m = messages.PyHoca_MessageWindow_NoYes(self, parent=_parent, msg=_message, title=_('%s: Confirm Host Authorization') % profile_name, icon='profile_warning') if _parent: m.ShowModal() @@ -1610,7 +1610,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): """ if not self._exiting: - self.notifier.send(_(u'%s - channel error') % profile_name, _(u'Lost connection to server %s unexpectedly!\n\nTry to re-authenticate to the server...') % profile_name, icon='session_warning', timeout=10000) + self.notifier.send(_('%s - channel error') % profile_name, _('Lost connection to server %s unexpectedly!\n\nTry to re-authenticate to the server...') % profile_name, icon='session_warning', timeout=10000) try: del self._temp_disabled_session_names[profile_name] except KeyError: @@ -1628,7 +1628,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): """ if not self._exiting: - self.notifier.send(_(u'%s - SFTP client error') % profile_name, _(u'New X2Go session will lack SFTP client support.\nCheck your server setup.\n\nAvoid echoing ~/.*shrc files on server!!!\n\nNot starting new session...'), icon='session_error', timeout=10000) + self.notifier.send(_('%s - SFTP client error') % profile_name, _('New X2Go session will lack SFTP client support.\nCheck your server setup.\n\nAvoid echoing ~/.*shrc files on server!!!\n\nNot starting new session...'), icon='session_error', timeout=10000) try: del self._temp_disabled_session_names[profile_name] except KeyError: @@ -1645,7 +1645,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): @type profile_name: C{str} """ - self.notifier.send(_(u'%s - session failure') % profile_name, _(u'The session startup failed.'), icon='session_error', timeout=10000) + self.notifier.send(_('%s - session failure') % profile_name, _('The session startup failed.'), icon='session_error', timeout=10000) if self.exit_on_disconnect: self.WakeUpIdle() self.ExitMainLoop() @@ -1658,7 +1658,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): @type profile_name: C{str} """ - self.notifier.send(_(u'%s - session failure') % profile_name, _(u'The session initialization failed.'), icon='session_error', timeout=10000) + self.notifier.send(_('%s - session failure') % profile_name, _('The session initialization failed.'), icon='session_error', timeout=10000) if self.exit_on_disconnect: self.WakeUpIdle() self.ExitMainLoop() @@ -1671,7 +1671,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): @type profile_name: C{str} """ - self.notifier.send(_(u'%s - desktop sharing failure') % profile_name, _(u'Desktop sharing was denied by the other user or\nboth of you have insufficient privileges to share one another\'s desktop.'), icon='session_error', timeout=10000) + self.notifier.send(_('%s - desktop sharing failure') % profile_name, _('Desktop sharing was denied by the other user or\nboth of you have insufficient privileges to share one another\'s desktop.'), icon='session_error', timeout=10000) if self.exit_on_disconnect: self.WakeUpIdle() self.ExitMainLoop() @@ -1684,7 +1684,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): @type profile_name: C{str} """ - self.notifier.send(_(u'%s - timeout') % profile_name, _(u'The server took long to provide a list of sharable desktops.\nThis can happen from time to time, please try again'), icon='session_warning', timeout=10000) + self.notifier.send(_('%s - timeout') % profile_name, _('The server took long to provide a list of sharable desktops.\nThis can happen from time to time, please try again'), icon='session_warning', timeout=10000) def HOOK_no_such_desktop(self, profile_name='UNKNOWN', desktop='UNKNOWN', **kwargs): """\ @@ -1696,7 +1696,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): @type desktop: C{str} """ - self.notifier.send(_(u'%s - desktop sharing failed') % profile_name, _(u'The desktop %s is not available for sharing (anymore).') % desktop, icon='session_warning', timeout=10000) + self.notifier.send(_('%s - desktop sharing failed') % profile_name, _('The desktop %s is not available for sharing (anymore).') % desktop, icon='session_warning', timeout=10000) if self.exit_on_disconnect: self.WakeUpIdle() self.ExitMainLoop() @@ -1714,9 +1714,9 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): """ if session_name == 'UNKNOWN': - self.notifier.send(_(u'%s - session failure') % profile_name, _(u'The command ,,%s\'\' is not available on X2Go server.') % cmd, icon='session_error', timeout=10000) + self.notifier.send(_('%s - session failure') % profile_name, _('The command ,,%s\'\' is not available on X2Go server.') % cmd, icon='session_error', timeout=10000) else: - self.notifier.send(_(u'%s - session failure') % profile_name, _(u'The command ,,%s\'\' is not available on X2Go server\n%s.') % (cmd, session_name), icon='session_error', timeout=10000) + self.notifier.send(_('%s - session failure') % profile_name, _('The command ,,%s\'\' is not available on X2Go server\n%s.') % (cmd, session_name), icon='session_error', timeout=10000) if self.exit_on_disconnect: self.WakeUpIdle() self.ExitMainLoop() @@ -1733,7 +1733,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): @type server_port: C{str} """ - self.notifier.send(_(u'%s - session warning') % profile_name, _(u'Reverse TCP port forwarding request for session %s to server port %s has been denied.') % (session_name, server_port), icon='session_warning', timeout=10000) + self.notifier.send(_('%s - session warning') % profile_name, _('Reverse TCP port forwarding request for session %s to server port %s has been denied.') % (session_name, server_port), icon='session_warning', timeout=10000) if self.exit_on_disconnect: self.WakeUpIdle() self.ExitMainLoop() @@ -1754,13 +1754,13 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): @type subsystem: C{str} """ - if type(subsystem) in (types.StringType, types.UnicodeType): + if type(subsystem) in (bytes, str): _subsystem = '(%s) ' % subsystem else: _subsystem = '' - self.notifier.send(_(u'%s - session failure') % profile_name, _(u'Forwarding tunnel request to [%s]:%s for session %s was denied by remote X2Go/SSH server. Subsystem %sstartup failed.') % (chain_host, chain_port, session_name, _subsystem), icon='session_error', timeout=10000) - if not self._hide_notifications_map.has_key(profile_name): + self.notifier.send(_('%s - session failure') % profile_name, _('Forwarding tunnel request to [%s]:%s for session %s was denied by remote X2Go/SSH server. Subsystem %sstartup failed.') % (chain_host, chain_port, session_name, _subsystem), icon='session_error', timeout=10000) + if profile_name not in self._hide_notifications_map: self._hide_notifications_map[profile_name] = [] self._hide_notifications_map[profile_name].append(session_name) try: @@ -1778,21 +1778,21 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): Notify that pulseaudio is not available in RDP sessions. """ - self.notifier.send(_(u'%s - audio warning') % self.appname, _(u'The X2Go PulseAudio system is not available within Remote Desktop sessions.'), icon='audio_error', timeout=10000) + self.notifier.send(_('%s - audio warning') % self.appname, _('The X2Go PulseAudio system is not available within Remote Desktop sessions.'), icon='audio_error', timeout=10000) def HOOK_pulseaudio_server_startup_failed(self, **kwargs): """\ Notify about pulseaudio daemon startup failures. """ - self.notifier.send(_(u'%s - audio error') % self.appname, _(u'The X2Go PulseAudio system could not be started.'), icon='audio_error', timeout=10000) + self.notifier.send(_('%s - audio error') % self.appname, _('The X2Go PulseAudio system could not be started.'), icon='audio_error', timeout=10000) def HOOK_pulseaudio_server_died(self, **kwargs): """\ Notify about sudden pulseaudio crashes. """ - self.notifier.send(_(u'%s - audio error') % self.appname, _(u'The X2Go PulseAudio system has died unexpectedly.'), icon='audio_error', timeout=10000) + self.notifier.send(_('%s - audio error') % self.appname, _('The X2Go PulseAudio system has died unexpectedly.'), icon='audio_error', timeout=10000) def HOOK_on_sound_tunnel_failed(self, profile_name='UNKNOWN', session_name='UNKNOWN', **kwargs): """\ @@ -1804,7 +1804,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): @type session_name: C{str} """ - self.notifier.send(_(u'%s - audio problem') % profile_name, _(u'The audio connection could not be set up for this session.\n%s') % session_name, icon='session_warning', timeout=5000) + self.notifier.send(_('%s - audio problem') % profile_name, _('The audio connection could not be set up for this session.\n%s') % session_name, icon='session_warning', timeout=5000) def HOOK_printing_not_available(self, profile_name='UNKNOWN', session_name='UNKNOWN', **kwargs): """\ @@ -1816,7 +1816,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): @type session_name: C{str} """ - self.notifier.send(_(u'%s - client-side printing not available') % profile_name, _(u'The server denies client-side printing from within this session.\n%s') % session_name, icon='session_warning', timeout=5000) + self.notifier.send(_('%s - client-side printing not available') % profile_name, _('The server denies client-side printing from within this session.\n%s') % session_name, icon='session_warning', timeout=5000) def HOOK_mimebox_not_available(self, profile_name='UNKNOWN', session_name='UNKNOWN', **kwargs): """\ @@ -1828,7 +1828,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): @type session_name: C{str} """ - self.notifier.send(_(u'%s - MIME box not available') % profile_name, _(u'The server does not support the X2Go MIME box.\n%s') % session_name, icon='session_warning', timeout=5000) + self.notifier.send(_('%s - MIME box not available') % profile_name, _('The server does not support the X2Go MIME box.\n%s') % session_name, icon='session_warning', timeout=5000) def HOOK_foldersharing_not_available(self, profile_name='UNKNOWN', session_name='UNKNOWN', **kwargs): """\ @@ -1840,7 +1840,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): @type session_name: C{str} """ - self.notifier.send(_(u'%s - client-side folders not sharable') % profile_name, _(u'The server denies client-side folder sharing with this session.\n%s') % session_name, icon='session_warning', timeout=5000) + self.notifier.send(_('%s - client-side folders not sharable') % profile_name, _('The server denies client-side folder sharing with this session.\n%s') % session_name, icon='session_warning', timeout=5000) def HOOK_sshfs_not_available(self, profile_name='UNKNOWN', session_name='UNKNOWN', **kwargs): """\ @@ -1852,7 +1852,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): @type session_name: C{str} """ - self.notifier.send(_(u'%s - client resources not sharable') % profile_name, _(u'Client-side folders and printers cannot be shared with this session.\n%s') % session_name, icon='session_warning', timeout=5000) + self.notifier.send(_('%s - client resources not sharable') % profile_name, _('Client-side folders and printers cannot be shared with this session.\n%s') % session_name, icon='session_warning', timeout=5000) def HOOK_printaction_error(self, filename, profile_name='UNKNOWN', session_name='UNKNOWN', err_msg='GENERIC_ERROR', printer=None, **kwargs): """\ @@ -1871,9 +1871,9 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): """ if printer: - self.notifier.send(_(u'%s - print error') % profile_name, _(u'%s\n...caused on printer %s by session\n%s') % (err_msg, printer, session_name), icon='session_error', timeout=5000) + self.notifier.send(_('%s - print error') % profile_name, _('%s\n...caused on printer %s by session\n%s') % (err_msg, printer, session_name), icon='session_error', timeout=5000) else: - self.notifier.send(_(u'%s - print error') % profile_name, _(u'%s\n...caused by session\n%s') % (err_msg, session_name), icon='session_error', timeout=5000) + self.notifier.send(_('%s - print error') % profile_name, _('%s\n...caused by session\n%s') % (err_msg, session_name), icon='session_error', timeout=5000) def HOOK_on_session_has_started_by_me(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN', **kwargs): """\ @@ -1888,7 +1888,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): """ self._enable_session_name(profile_name, session_name) - self.notifier.send(_(u'%s - start') % profile_name, _(u'New X2Go session starting up...\n%s') % session_name, icon='session_start', timeout=5000) + self.notifier.send(_('%s - start') % profile_name, _('New X2Go session starting up...\n%s') % session_name, icon='session_start', timeout=5000) def HOOK_on_session_has_started_by_other(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN', **kwargs): """\ @@ -1903,7 +1903,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): """ self._enable_session_name(profile_name, session_name) - self.notifier.send(_(u'%s - start') % profile_name, _(u'Another client started X2Go session\n%s') % session_name, icon='session_start', timeout=5000) + self.notifier.send(_('%s - start') % profile_name, _('Another client started X2Go session\n%s') % session_name, icon='session_start', timeout=5000) def HOOK_on_session_has_resumed_by_me(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN', **kwargs): """\ @@ -1918,7 +1918,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): """ self._enable_session_name(profile_name, session_name) - self.notifier.send(_(u'%s - resume') % profile_name, _(u'Resuming X2Go session...\n%s') % session_name, icon='session_resume', timeout=5000) + self.notifier.send(_('%s - resume') % profile_name, _('Resuming X2Go session...\n%s') % session_name, icon='session_resume', timeout=5000) def HOOK_on_session_has_resumed_by_other(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN', **kwargs): """\ @@ -1933,7 +1933,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): """ self._enable_session_name(profile_name, session_name) - self.notifier.send(_(u'%s - resume') % profile_name, _(u'Another client resumed X2Go session\n%s') % session_name, icon='session_resume', timeout=5000) + self.notifier.send(_('%s - resume') % profile_name, _('Another client resumed X2Go session\n%s') % session_name, icon='session_resume', timeout=5000) def HOOK_on_found_session_running_after_connect(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN', **kwargs): """\ @@ -1948,7 +1948,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): """ self._enable_session_name(profile_name, session_name) - gevent.spawn_later(5, self.notifier.send, _(u'%s - running') % profile_name, _(u'Found already running session\n%s') % session_name, icon='session_resume', timeout=5000) + gevent.spawn_later(5, self.notifier.send, _('%s - running') % profile_name, _('Found already running session\n%s') % session_name, icon='session_resume', timeout=5000) def HOOK_on_session_has_been_suspended(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN', **kwargs): """\ @@ -1963,12 +1963,12 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): """ self._enable_session_name(profile_name, session_name) - if self._hide_notifications_map.has_key(profile_name) and session_name in self._hide_notifications_map[profile_name]: + if profile_name in self._hide_notifications_map and session_name in self._hide_notifications_map[profile_name]: self._hide_notifications_map[profile_name].remove(session_name) if not self._hide_notifications_map[profile_name]: del self._hide_notifications_map[profile_name] else: - self.notifier.send(_(u'%s - suspend') % profile_name, _(u'X2Go Session has been suspended\n%s') % session_name, icon='session_suspend', timeout=5000) + self.notifier.send(_('%s - suspend') % profile_name, _('X2Go Session has been suspended\n%s') % session_name, icon='session_suspend', timeout=5000) if self.disconnect_on_suspend and session_name in self.client_associated_sessions(return_session_names=True): _dummy_id = wx.NewId() self._eventid_profilenames_map[_dummy_id] = profile_name @@ -1990,12 +1990,12 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): """ self._enable_session_name(profile_name, session_name) # avoid notification if X2Go Client.clean_sessions has been used to terminate sessions - if self._hide_notifications_map.has_key(profile_name) and session_name in self._hide_notifications_map[profile_name]: + if profile_name in self._hide_notifications_map and session_name in self._hide_notifications_map[profile_name]: self._hide_notifications_map[profile_name].remove(session_name) if not self._hide_notifications_map[profile_name]: del self._hide_notifications_map[profile_name] else: - self.notifier.send(_(u'%s - terminate') % profile_name, _(u'X2Go Session has terminated\n%s') % session_name, icon='session_terminate', timeout=5000) + self.notifier.send(_('%s - terminate') % profile_name, _('X2Go Session has terminated\n%s') % session_name, icon='session_terminate', timeout=5000) if self.disconnect_on_terminate and session_name in self.client_associated_sessions(return_session_names=True): _dummy_id = wx.NewId() self._eventid_profilenames_map[_dummy_id] = profile_name @@ -2019,14 +2019,14 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): """ if is_profile_connected: m = messages.PyHoca_MessageWindow_OkCancel(self, - title=_(u'%s: connection failure') % self.broker_name, - msg=_(u"While initializing a session for profile '%s' the connection\nto %s has failed.\n\nIt is possible to attempt session initialization anyway. Do you\nwant to continue?") % (profile_name, self.broker_name), + title=_('%s: connection failure') % self.broker_name, + msg=_("While initializing a session for profile '%s' the connection\nto %s has failed.\n\nIt is possible to attempt session initialization anyway. Do you\nwant to continue?") % (profile_name, self.broker_name), icon='warning', profile_name=profile_name) else: m = messages.PyHoca_MessageWindow_OkCancel(self, - title=_(u'%s: connection failure') % self.broker_name, - msg=_(u"While connecting to profile '%s' the connection\nto %s has failed.\n\nIt is possible to attempt session initialization anyway. Do you\nwant to continue?") % (profile_name, self.broker_name), + title=_('%s: connection failure') % self.broker_name, + msg=_("While connecting to profile '%s' the connection\nto %s has failed.\n\nIt is possible to attempt session initialization anyway. Do you\nwant to continue?") % (profile_name, self.broker_name), icon='warning', profile_name=profile_name) diff --git a/pyhoca/wxgui/launcher.py b/pyhoca/wxgui/launcher.py index 06afd46..0c8e5d4 100644 --- a/pyhoca/wxgui/launcher.py +++ b/pyhoca/wxgui/launcher.py @@ -42,11 +42,11 @@ from x2go import BACKENDS from x2go import X2GoLogger from pyhoca.wxgui import __VERSION__ -from frontend import PyHocaGUI -from messages import PyHoca_MessageWindow_Ok +from .frontend import PyHocaGUI +from .messages import PyHoca_MessageWindow_Ok -import defaults -import basepath +from . import defaults +from . import basepath class PyHocaGUI_Launcher(object): @@ -94,7 +94,7 @@ VERSION: %s os.environ.update({'NXPROXY_BINARY': nxproxy_binary, }) def modify_default_option(self, option, value): - if self.default_options.has_key(option): + if option in self.default_options: if type(self.default_options[option]) == type(value): self.default_options[option] = value @@ -102,7 +102,7 @@ VERSION: %s if sys.argv[0].startswith('./') or sys.argv[0].startswith('python'): sys.path.insert(0, os.getcwd()) os.environ['PYHOCAGUI_DEVELOPMENT'] = '1' - print '### {progname} running in development mode ###'.format(progname=self.PROG_NAME) + print('### {progname} running in development mode ###'.format(progname=self.PROG_NAME)) basepath.reload_base_paths() def check_running(self): @@ -135,8 +135,8 @@ VERSION: %s if display.split('.')[0] == my_display.split('.')[0]: other_pid = pidfile.split('.')[1] - print - print('One instance of {progname} (PID: {other_pid}) is already running for this $DISPLAY {display}'.format(progname=_executable, other_pid=other_pid, display=my_display)) + print() + print(('One instance of {progname} (PID: {other_pid}) is already running for this $DISPLAY {display}'.format(progname=_executable, other_pid=other_pid, display=my_display))) return True @@ -149,7 +149,7 @@ VERSION: %s for process in w.Win32_Process(): if process.Name == _executable: _p[process.ProcessId] = process.SessionId - return len([ _p_id for _p_id in _p.keys() if _p[self.PROG_PID] == _p[_p_id] ]) > 1 + return len([ _p_id for _p_id in list(_p.keys()) if _p[self.PROG_PID] == _p[_p_id] ]) > 1 def version(self): @@ -203,7 +203,7 @@ VERSION: %s _config_backends = ('FILE') _default_options = copy.deepcopy(self.default_options) - for key in _default_options.keys(): + for key in list(_default_options.keys()): if not _default_options[key]: _default_options[key] = None @@ -259,11 +259,11 @@ VERSION: %s ) backend_options = [ - {'args':['--backend-controlsession'], 'default': _default_options['backend_controlsession'], 'metavar': '<CONTROLSESSION_BACKEND>', 'choices': BACKENDS['X2GoControlSession'].keys(), 'help': 'force usage of a certain CONTROLSESSION_BACKEND (do not use this unless you know exactly what you are doing)', }, - {'args':['--backend-terminalsession'], 'default': _default_options['backend_terminalsession'], 'metavar': '<TERMINALSESSION_BACKEND>', 'choices': BACKENDS['X2GoTerminalSession'].keys(), 'help': 'force usage of a certain TERMINALSESSION_BACKEND (do not use this unless you know exactly what you are doing)', }, - {'args':['--backend-serversessioninfo'], 'default': _default_options['backend_serversessioninfo'], 'metavar': '<SERVERSESSIONINFO_BACKEND>', 'choices': BACKENDS['X2GoServerSessionInfo'].keys(), 'help': 'force usage of a certain SERVERSESSIONINFO_BACKEND (do not use this unless you know exactly what you are doing)', }, - {'args':['--backend-serversessionlist'], 'default': _default_options['backend_serversessionlist'], 'metavar': '<SERVERSESSIONLIST_BACKEND>', 'choices': BACKENDS['X2GoServerSessionList'].keys(), 'help': 'force usage of a certain SERVERSESSIONLIST_BACKEND (do not use this unless you know exactly what you are doing)', }, - {'args':['--backend-proxy'], 'default': _default_options['backend_proxy'], 'metavar': '<PROXY_BACKEND>', 'choices': BACKENDS['X2GoProxy'].keys(), 'help': 'force usage of a certain PROXY_BACKEND (do not use this unless you know exactly what you are doing)', }, + {'args':['--backend-controlsession'], 'default': _default_options['backend_controlsession'], 'metavar': '<CONTROLSESSION_BACKEND>', 'choices': list(BACKENDS['X2GoControlSession'].keys()), 'help': 'force usage of a certain CONTROLSESSION_BACKEND (do not use this unless you know exactly what you are doing)', }, + {'args':['--backend-terminalsession'], 'default': _default_options['backend_terminalsession'], 'metavar': '<TERMINALSESSION_BACKEND>', 'choices': list(BACKENDS['X2GoTerminalSession'].keys()), 'help': 'force usage of a certain TERMINALSESSION_BACKEND (do not use this unless you know exactly what you are doing)', }, + {'args':['--backend-serversessioninfo'], 'default': _default_options['backend_serversessioninfo'], 'metavar': '<SERVERSESSIONINFO_BACKEND>', 'choices': list(BACKENDS['X2GoServerSessionInfo'].keys()), 'help': 'force usage of a certain SERVERSESSIONINFO_BACKEND (do not use this unless you know exactly what you are doing)', }, + {'args':['--backend-serversessionlist'], 'default': _default_options['backend_serversessionlist'], 'metavar': '<SERVERSESSIONLIST_BACKEND>', 'choices': list(BACKENDS['X2GoServerSessionList'].keys()), 'help': 'force usage of a certain SERVERSESSIONLIST_BACKEND (do not use this unless you know exactly what you are doing)', }, + {'args':['--backend-proxy'], 'default': _default_options['backend_proxy'], 'metavar': '<PROXY_BACKEND>', 'choices': list(BACKENDS['X2GoProxy'].keys()), 'help': 'force usage of a certain PROXY_BACKEND (do not use this unless you know exactly what you are doing)', }, {'args':['--backend-sessionprofiles'], 'default': _default_options['backend_sessionprofiles'], 'metavar': '<SESSIONPROFILES_BACKEND>', 'choices': _config_backends, 'help': 'use given backend for accessing session profiles, available backends on your system: %s (default: %s)' % (', '.join(_config_backends), _profiles_backend_default), }, {'args':['--backend-clientsettings'], 'default': _default_options['backend_clientsettings'], 'metavar': '<CLIENTSETTINGS_BACKEND>', 'choices': _config_backends, 'help': 'use given backend for accessing the client settings configuration, available backends on your system: %s (default: %s)' % (', '.join(_config_backends), _settings_backend_default), }, {'args':['--backend-clientprinting'], 'default': _default_options['backend_clientprinting'], 'metavar': '<CLIENTPRINTING_BACKEND>', 'choices': _config_backends, 'help': 'use given backend for accessing the client printing configuration, available backends on your system: %s (default: %s)' % (', '.join(_config_backends), _printing_backend_default), }, @@ -381,14 +381,14 @@ VERSION: %s lang = gettext.translation('PyHoca-GUI', localedir=basepath.locale_basepath, languages=[args.lang], ) else: lang = gettext.translation('PyHoca-GUI', localedir=basepath.locale_basepath, languages=['en'], ) - lang.install(unicode=True) + lang.install(str=True) else: - gettext.install('PyHoca-GUI', localedir=basepath.locale_basepath, unicode=True) + gettext.install('PyHoca-GUI', localedir=basepath.locale_basepath, str=True) if self.check_running(): sys.stderr.write("\n###############################\n### %s: already running for user %s\n###############################\n" % (self.PROG_NAME, CURRENT_LOCAL_USER)) _dummy_app.appname = self.PROG_NAME - m = PyHoca_MessageWindow_Ok(_dummy_app, shortmsg='ALREADY_RUNNING', title=u'%s (%s)...' % (self.PROG_NAME, self.VERSION), icon='{progname}_trayicon'.format(progname=self.PROG_NAME)) + m = PyHoca_MessageWindow_Ok(_dummy_app, shortmsg='ALREADY_RUNNING', title='%s (%s)...' % (self.PROG_NAME, self.VERSION), icon='{progname}_trayicon'.format(progname=self.PROG_NAME)) m.ShowModal() self.version() diff --git a/pyhoca/wxgui/listdesktops.py b/pyhoca/wxgui/listdesktops.py index 02f96f4..efc1869 100644 --- a/pyhoca/wxgui/listdesktops.py +++ b/pyhoca/wxgui/listdesktops.py @@ -30,7 +30,7 @@ import os # PyHoca-GUI modules # ... NONE ... -if os.environ.has_key('DESKTOP_SESSION'): +if 'DESKTOP_SESSION' in os.environ: WINDOW_MANAGER = os.environ['DESKTOP_SESSION'] else: WINDOW_MANAGER = 'generic' @@ -64,24 +64,24 @@ class PyHocaGUI_DialogBoxListDesktops(wx.Dialog): wx.Dialog.__init__(self, None, id=-1, title=profile_name, style=wx.DEFAULT_FRAME_STYLE, ) self._PyHocaGUI._sub_windows.append(self) - self.SetTitle(_(u'Share Desktop Session - %s') % profile_name) + self.SetTitle(_('Share Desktop Session - %s') % profile_name) - self.titleLbl = wx.StaticText(self, wx.ID_ANY, _(u'Select one of the available desktop sessions on this server')+':', size=(-1, -1)) + self.titleLbl = wx.StaticText(self, wx.ID_ANY, _('Select one of the available desktop sessions on this server')+':', size=(-1, -1)) self.desktopList = wx.ListCtrl(self, size=(420,140), style=wx.LC_REPORT|wx.BORDER_SUNKEN|wx.LC_SINGLE_SEL) self.desktopList.InsertColumn(0, 'Display') self.desktopList.InsertColumn(1, 'User') - self.shareMode0 = wx.RadioButton(self, -1, _(u"View session only"), style=wx.RB_GROUP) - self.shareMode1 = wx.RadioButton(self, -1, _(u"Gain full access")) + self.shareMode0 = wx.RadioButton(self, -1, _("View session only"), style=wx.RB_GROUP) + self.shareMode1 = wx.RadioButton(self, -1, _("Gain full access")) self.share_mode = 0 ID_REFRESH = wx.NewId() - self.okBtn = wx.Button(self, wx.ID_OK, _(u'Share Desktop'), ) + self.okBtn = wx.Button(self, wx.ID_OK, _('Share Desktop'), ) self.okBtn.SetDefault() self.okBtn.Enable(False) - self.refreshBtn = wx.Button(self, ID_REFRESH, _(u'Refresh list'), ) - self.cancelBtn = wx.Button(self, wx.ID_CANCEL, _(u'Cancel'), ) + self.refreshBtn = wx.Button(self, ID_REFRESH, _('Refresh list'), ) + self.cancelBtn = wx.Button(self, wx.ID_CANCEL, _('Cancel'), ) self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnListClick, self.desktopList) self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnListDoubleClick, self.desktopList) diff --git a/pyhoca/wxgui/logon.py b/pyhoca/wxgui/logon.py index 7cf71b1..f35d0ea 100644 --- a/pyhoca/wxgui/logon.py +++ b/pyhoca/wxgui/logon.py @@ -31,9 +31,9 @@ import wx import os # PyHoca-GUI modules -import passphrase +from . import passphrase -if os.environ.has_key('DESKTOP_SESSION'): +if 'DESKTOP_SESSION' in os.environ: WINDOW_MANAGER = os.environ['DESKTOP_SESSION'] else: WINDOW_MANAGER = 'generic' @@ -79,30 +79,30 @@ class PyHocaGUI_DialogBoxPassword(wx.Dialog): if self.sshproxy_auth: self.sshproxy_started = False self.sshproxy_password = None - self.SetTitle(_(u'%s (via %s)') % (profile_name, self.current_profile_config['sshproxyhost'])) + self.SetTitle(_('%s (via %s)') % (profile_name, self.current_profile_config['sshproxyhost'])) self.password = None self.passphrase = passphrase self.sshproxy_passphrase = sshproxy_passphrase - self.userLbl = wx.StaticText(self, wx.ID_ANY, _(u'Username')+':', size=(-1, -1)) + self.userLbl = wx.StaticText(self, wx.ID_ANY, _('Username')+':', size=(-1, -1)) self.userTxt = wx.TextCtrl(self, wx.ID_ANY, '', style=wx.TE_PROCESS_ENTER, size=(120, -1)) - self.passwordLbl = wx.StaticText(self, wx.ID_ANY, _(u'Password')+':', size=(-1, -1)) + self.passwordLbl = wx.StaticText(self, wx.ID_ANY, _('Password')+':', size=(-1, -1)) self.passwordTxt = wx.TextCtrl(self, wx.ID_ANY, '', style=wx.TE_PROCESS_ENTER|wx.TE_PASSWORD, size=(120, -1)) self.passwordTxt.SetFocus() - self.loginBtn = wx.Button(self, wx.ID_OK, _(u'Authenticate'), ) + self.loginBtn = wx.Button(self, wx.ID_OK, _('Authenticate'), ) self.loginBtn.SetDefault() _tab_order = [] # widgets if self.sshproxy_auth: - self.sshProxyUserLbl = wx.StaticText(self, wx.ID_ANY, _(u'Username')+':', size=(-1, -1)) + self.sshProxyUserLbl = wx.StaticText(self, wx.ID_ANY, _('Username')+':', size=(-1, -1)) self.sshProxyUserTxt = wx.TextCtrl(self, wx.ID_ANY, '', style=wx.TE_PROCESS_ENTER, size=(120, -1)) - self.sshProxyPasswordLbl = wx.StaticText(self, wx.ID_ANY, _(u'Password')+':', size=(-1, -1)) + self.sshProxyPasswordLbl = wx.StaticText(self, wx.ID_ANY, _('Password')+':', size=(-1, -1)) self.sshProxyPasswordTxt = wx.TextCtrl(self, wx.ID_ANY, '', style=wx.TE_PROCESS_ENTER|wx.TE_PASSWORD, size=(120, -1)) self.sshProxyPasswordTxt.SetFocus() - self.sshProxyLoginBtn = wx.Button(self, wx.ID_OK, ' '+_(u'Start SSH tunnel')+' ') + self.sshProxyLoginBtn = wx.Button(self, wx.ID_OK, ' '+_('Start SSH tunnel')+' ') self.sshProxyLoginBtn.SetDefault() _tab_order.extend([self.sshProxyUserTxt, self.sshProxyPasswordTxt, self.sshProxyLoginBtn, ]) @@ -110,8 +110,8 @@ class PyHocaGUI_DialogBoxPassword(wx.Dialog): headerWidth = max(self.userLbl.GetSize().GetWidth(), self.passwordLbl.GetSize().GetWidth()) + 150 sshProxyHeaderWidth = max(self.sshProxyUserLbl.GetSize().GetWidth(), self.sshProxyPasswordLbl.GetSize().GetWidth()) + 150 - self.headerLbl = wx.StaticText(self, wx.ID_ANY, _(u'Session login')+':', size=(headerWidth, -1)) - self.sshProxyHeaderLbl = wx.StaticText(self, wx.ID_ANY, _(u'SSH proxy server login')+':', size=(sshProxyHeaderWidth, -1)) + self.headerLbl = wx.StaticText(self, wx.ID_ANY, _('Session login')+':', size=(headerWidth, -1)) + self.sshProxyHeaderLbl = wx.StaticText(self, wx.ID_ANY, _('SSH proxy server login')+':', size=(sshProxyHeaderWidth, -1)) self.headerLbl.SetFont(wx.Font(-1, wx.DEFAULT, wx.NORMAL, wx.FONTWEIGHT_BOLD, 0, "")) self.sshProxyHeaderLbl.SetFont(wx.Font(-1, wx.DEFAULT, wx.NORMAL, wx.FONTWEIGHT_BOLD, 0, "")) @@ -122,7 +122,7 @@ class PyHocaGUI_DialogBoxPassword(wx.Dialog): self.passwordTxt.Enable(False) self.loginBtn.Enable(False) - self.cancelBtn = wx.Button(self, wx.ID_CANCEL, _(u'Cancel'), ) + self.cancelBtn = wx.Button(self, wx.ID_CANCEL, _('Cancel'), ) _tab_order.extend([self.userTxt, self.passwordTxt, self.loginBtn, self.cancelBtn, ]) @@ -179,18 +179,18 @@ class PyHocaGUI_DialogBoxPassword(wx.Dialog): mainSizer.Add(credSizer, 0, wx.ALL, 5) mainSizer.Add(btnSizer, 0, wx.ALL|wx.ALIGN_RIGHT, 5) - if self.current_profile_config.has_key('user'): + if 'user' in self.current_profile_config: self.userTxt.SetValue(self.current_profile_config['user']) if not self.current_profile_config['user'] and not self.sshproxy_auth: self.userTxt.SetFocus() if self.sshproxy_auth: - if self.current_profile_config.has_key('sshproxyuser'): - if self.current_profile_config.has_key('sshproxysameuser') and not self.current_profile_config['sshproxysameuser']: + if 'sshproxyuser' in self.current_profile_config: + if 'sshproxysameuser' in self.current_profile_config and not self.current_profile_config['sshproxysameuser']: self.sshProxyUserTxt.SetValue(self.current_profile_config['sshproxyuser']) - if self.current_profile_config.has_key('user'): - if self.current_profile_config.has_key('sshproxysameuser') and self.current_profile_config['sshproxysameuser']: + if 'user' in self.current_profile_config: + if 'sshproxysameuser' in self.current_profile_config and self.current_profile_config['sshproxysameuser']: self.sshProxyUserTxt.SetValue(self.current_profile_config['user']) # Logged in variable @@ -199,7 +199,7 @@ class PyHocaGUI_DialogBoxPassword(wx.Dialog): self.SetSizerAndFit(mainSizer) self.Layout() - for i in xrange(len(_tab_order) - 1): + for i in range(len(_tab_order) - 1): _tab_order[i+1].MoveAfterInTabOrder(_tab_order[i]) maxX, maxY = wx.GetDisplaySize() @@ -294,14 +294,14 @@ class PyHocaGUI_DialogBoxPassword(wx.Dialog): ) if not self._PyHocaGUI._X2GoClient__server_valid_x2gouser(session_uuid): self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_(u'%s - connect failure') % self.current_profile_name, - text=_(u'User is not allowed to start X2Go sessions!'), + title=_('%s - connect failure') % self.current_profile_name, + text=_('User is not allowed to start X2Go sessions!'), icon='auth_error') self._PyHocaGUI.OnServerDisconnect(evt) else: self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_(u'%s - connect') % self.current_profile_name, - text=_(u'Authentication has been successful.'), + title=_('%s - connect') % self.current_profile_name, + text=_('Authentication has been successful.'), icon='auth_success') if self._PyHocaGUI.remember_username: _sp = self._PyHocaGUI.session_profiles @@ -343,12 +343,12 @@ class PyHocaGUI_DialogBoxPassword(wx.Dialog): self.sshProxyPasswordLbl.Enable(False) self.sshProxyPasswordTxt.Enable(False) self.sshProxyLoginBtn.Enable(False) - self.sshProxyLoginBtn.SetLabel(_(u'SSH tunnel started')) + self.sshProxyLoginBtn.SetLabel(_('SSH tunnel started')) return else: self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_(u'%s - connect failure') % self.current_profile_name, - text=_(u'Authentication failed!'), + title=_('%s - connect failure') % self.current_profile_name, + text=_('Authentication failed!'), icon='auth_failed') connect_failed = True @@ -356,8 +356,8 @@ class PyHocaGUI_DialogBoxPassword(wx.Dialog): try: wx.EndBusyCursor() except: pass self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_(u'%s - SSH proxy') % self.current_profile_name, - text=_(u'Authentication to the SSH proxy server failed!'), + title=_('%s - SSH proxy') % self.current_profile_name, + text=_('Authentication to the SSH proxy server failed!'), icon='auth_failed') if not self.current_profile_config['sshproxysamepass']: @@ -382,46 +382,46 @@ class PyHocaGUI_DialogBoxPassword(wx.Dialog): # icon='auth_error') # connect_failed = True - except gevent.socket.error, e: + except gevent.socket.error as e: self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_(u'%s - socket error') % self.current_profile_name, + title=_('%s - socket error') % self.current_profile_name, text=e.strerror + '!', icon='auth_error') connect_failed = True - except x2go.X2GoHostKeyException, e: + except x2go.X2GoHostKeyException as e: self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_(u'%s - host key error') % self.current_profile_name, - text=_(u'The remote server\'s host key is invalid or has not been accepted by the user') + '!', + title=_('%s - host key error') % self.current_profile_name, + text=_('The remote server\'s host key is invalid or has not been accepted by the user') + '!', icon='auth_error', timeout=4000) connect_failed = True - except x2go.X2GoRemoteHomeException, e: + except x2go.X2GoRemoteHomeException as e: self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_(u'%s - missing home directory') % self.current_profile_name, + title=_('%s - missing home directory') % self.current_profile_name, text=_("The remote user's home directory does not exist."), icon='auth_error', timeout=4000) connect_failed = True - except x2go.X2GoSSHProxyException, e: + except x2go.X2GoSSHProxyException as e: self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_(u'%s - key error') % self.current_profile_name, + title=_('%s - key error') % self.current_profile_name, text='%s!' % str(e), icon='auth_error', timeout=4000) connect_failed = True - except x2go.X2GoSessionException, e: + except x2go.X2GoSessionException as e: self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_(u'%s - auth error') % self.current_profile_name, + title=_('%s - auth error') % self.current_profile_name, text='%s!' % str(e), icon='auth_error', timeout=4000) connect_failed = True - except x2go.SSHException, e: + except x2go.SSHException as e: if str(e).startswith('Two-factor authentication requires a password'): if self.sshproxy_auth and (not self.sshproxy_started): @@ -443,7 +443,7 @@ class PyHocaGUI_DialogBoxPassword(wx.Dialog): self.sshProxyPasswordLbl.Enable(False) self.sshProxyPasswordTxt.Enable(False) self.sshProxyLoginBtn.Enable(False) - self.sshProxyLoginBtn.SetLabel(_(u'SSH tunnel started')) + self.sshProxyLoginBtn.SetLabel(_('SSH tunnel started')) return if str(e).startswith('Host key for server ') and str(e).endswith(' does not match!'): @@ -452,7 +452,7 @@ class PyHocaGUI_DialogBoxPassword(wx.Dialog): errmsg = str(e) self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_(u'%s - SSH error') % self.current_profile_name, + title=_('%s - SSH error') % self.current_profile_name, text='%s' % errmsg, icon='auth_error', timeout=10000) @@ -462,11 +462,11 @@ class PyHocaGUI_DialogBoxPassword(wx.Dialog): except: self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_(u'%s - unknown error') % self.current_profile_name, - text=_(u'An unknown error occured during authentication!'), + title=_('%s - unknown error') % self.current_profile_name, + text=_('An unknown error occured during authentication!'), icon='auth_error') connect_failed = True - if self._PyHocaGUI.args.debug or self._PyHocaGUI.args.libdebug or (os.environ.has_key('PYHOCAGUI_DEVELOPMENT') and os.environ['PYHOCAGUI_DEVELOPMENT'] == '1'): + if self._PyHocaGUI.args.debug or self._PyHocaGUI.args.libdebug or ('PYHOCAGUI_DEVELOPMENT' in os.environ and os.environ['PYHOCAGUI_DEVELOPMENT'] == '1'): raise self._PyHocaGUI.notifier.send(self.current_profile_name, context='AUTH_%s' % self.current_profile_name, timeout=4000) diff --git a/pyhoca/wxgui/menus_taskbar.py b/pyhoca/wxgui/menus_taskbar.py index 0a63c4f..a5f20a4 100644 --- a/pyhoca/wxgui/menus_taskbar.py +++ b/pyhoca/wxgui/menus_taskbar.py @@ -21,13 +21,13 @@ import os.path import wx -import StringIO +import io import base64 import x2go.defaults import x2go.x2go_exceptions -import basepath +from . import basepath class PyHocaGUI_Menu_TaskbarManageProfile(wx.Menu): """\ @@ -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=_(u"Edit Profile"), id=ID_EDITPROFILE) + self.Append(text=_("Edit Profile"), id=ID_EDITPROFILE) else: - self.Append(text=_(u"View Profile"), id=ID_EDITPROFILE) + self.Append(text=_("View Profile"), id=ID_EDITPROFILE) 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=_(u"Use as Template for New Profile"), id=ID_COPYPROFILE) + self.Append(text=_("Use as Template for New Profile"), id=ID_COPYPROFILE) self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnProfileCopy, id=ID_COPYPROFILE) self.AppendSeparator() - self.Append(text=_(u"Export Profile"), id=ID_EXPORTPROFILE) + self.Append(text=_("Export Profile"), id=ID_EXPORTPROFILE) self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnProfileExport, id=ID_EXPORTPROFILE) if self._PyHocaGUI.session_profiles.is_mutable(profile_name): - self.Append(text=_(u"Delete Profile"), id=ID_DELETEPROFILE) + self.Append(text=_("Delete Profile"), id=ID_DELETEPROFILE) 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=_(u"About %s (%s)...") % (self._PyHocaGUI.appname, self._PyHocaGUI.version)) - self.Append(id=ID_ABOUT_PYTHONX2GO, text=_(u"About %s (%s)...") % ("Python X2Go", x2go.__VERSION__)) + 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._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnAbout, id=ID_ABOUT) self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnAboutPythonX2Go, id=ID_ABOUT_PYTHONX2GO) @@ -120,7 +120,7 @@ class PyHocaGUI_Menu_TaskbarOptionsManager(wx.Menu): ID_PROFILEMANAGER = wx.NewId() _maintain_profiles_item = self.AppendMenu(id=ID_PROFILEMANAGER, - text=_(u"Profile Manager"), + text=_("Profile Manager"), submenu=PyHocaGUI_Menu_TaskbarProfileNames(self._PyHocaGUI, caller=self, filter_profiles=[], @@ -137,7 +137,7 @@ 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=_(u'Manage Session Profile'), + text=_('Manage Session Profile'), submenu=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): @@ -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=_(u"Disconnect from session broker")) + self.Append(id=ID_BROKER_DISCONNECT, text=_("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=_(u"Printing Preferences")) + _printingprefs_item = self.Append(id=ID_PRINTINGPREFS, text=_("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=_(u"Client Options")) + _options_item = self.Append(id=ID_OPTIONS, text=_("Client Options")) self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnOptions, id=ID_OPTIONS) if self._PyHocaGUI.options_disabled: _options_item.Enable(False) @@ -247,7 +247,7 @@ class PyHocaGUI_Menu_TaskbarSessionActions(wx.Menu): if _s is not None and _s.is_color_depth_ok(): _rs = self.Append(text=_("Resume Session"), id=ID_RESUMESESSION) else: - _rs = self.Append(text=_(u"Resume Session (not possible)"), id=ID_RESUMESESSION_DISABLED) + _rs = self.Append(text=_("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'): @@ -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=_(u"Transfer Session"), id=ID_TRANSFERSESSION) + self.Append(text=_("Transfer Session"), id=ID_TRANSFERSESSION) else: - _ts = self.Append(text=_(u"Transfer Session (not possible)"), id=ID_TRANSFERSESSION_DISABLED) + _ts = self.Append(text=_("Transfer Session (not possible)"), id=ID_TRANSFERSESSION_DISABLED) _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=_(u"Suspend Session (and disconnect/exit)"), id=ID_SUSPENDSESSION) + _ss = self.Append(text=_("Suspend Session (and disconnect/exit)"), id=ID_SUSPENDSESSION) elif self._PyHocaGUI.disconnect_on_suspend and _s.has_terminal_session(): - _ss = self.Append(text=_(u"Suspend Session (and disconnect)"), id=ID_SUSPENDSESSION) + _ss = self.Append(text=_("Suspend Session (and disconnect)"), id=ID_SUSPENDSESSION) else: - _ss = self.Append(text=_(u"Suspend Session"), id=ID_SUSPENDSESSION) + _ss = self.Append(text=_("Suspend Session"), id=ID_SUSPENDSESSION) 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=_(u"Terminate Session (and disconnect/exit)"), id=ID_SUSPENDSESSION) + self.Append(text=_("Terminate Session (and disconnect/exit)"), id=ID_SUSPENDSESSION) elif self._PyHocaGUI.disconnect_on_terminate and _s.has_terminal_session(): - self.Append(text=_(u"Terminate Session (and disconnect)"), id=ID_TERMINATESESSION) + self.Append(text=_("Terminate Session (and disconnect)"), id=ID_TERMINATESESSION) else: - self.Append(text=_(u"Terminate Session"), id=ID_TERMINATESESSION) + self.Append(text=_("Terminate Session"), id=ID_TERMINATESESSION) else: if self._PyHocaGUI.disconnect_on_terminate and self._PyHocaGUI.exit_on_disconnect and _s.has_terminal_session(): - self.Append(text=_(u"End Desktop Sharing (and disconnect/exit)"), id=ID_SUSPENDSESSION) + self.Append(text=_("End Desktop Sharing (and disconnect/exit)"), id=ID_SUSPENDSESSION) elif self._PyHocaGUI.disconnect_on_terminate and _s.has_terminal_session(): - self.Append(text=_(u"End Desktop Sharing (and disconnect)"), id=ID_TERMINATESESSION) + self.Append(text=_("End Desktop Sharing (and disconnect)"), id=ID_TERMINATESESSION) else: - self.Append(text=_(u"End Desktop Sharing"), id=ID_TERMINATESESSION) + self.Append(text=_("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'): self.AppendSeparator() - self.Append(text=_(u"Refresh menu tree"), id=ID_REFRESHMENU) + self.Append(text=_("Refresh menu tree"), id=ID_REFRESHMENU) if _s is not None and \ _s.get_session_type() in ('D', 'S') and \ @@ -342,19 +342,19 @@ 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=_(u"&Share custom local folder")) + self.Append(id=ID_SHARECUSTOMLOCALFOLDER, text=_("&Share custom local folder")) self.AppendSeparator() self._PyHocaGUI._eventid_unshared_folders_map={} _exported_folders = self._PyHocaGUI.get_profile_config(profile_name, 'export') _shared_folders = self._PyHocaGUI._X2GoClient__profile_get_shared_folders(profile_name=profile_name, check_list_mounts=True) or [] - _sharable_folders = _exported_folders.keys() + _sharable_folders = list(_exported_folders.keys()) _unshared_folders = [ f for f in _sharable_folders if f and f not in _shared_folders ] self._PyHocaGUI._eventid_unshared_folders_map = {} if _unshared_folders: - self.Append(id=wx.NewId(), text=_(u'Share:')) + self.Append(id=wx.NewId(), text=_('Share:')) for _unshared_folder in _unshared_folders: ID_THISFOLDER = wx.NewId() self.Append(id=ID_THISFOLDER, text=" %s" % _unshared_folder) @@ -364,7 +364,7 @@ class PyHocaGUI_Menu_TaskbarProfileSharedFolders(wx.Menu): self._PyHocaGUI._eventid_shared_folders_map = {} if _shared_folders: - self.Append(id=wx.NewId(), text=_(u'Unshare:')) + self.Append(id=wx.NewId(), text=_('Unshare:')) for _shared_folder in _shared_folders: ID_THISFOLDER = wx.NewId() self.Append(id=ID_THISFOLDER, text=" %s" % _shared_folder) @@ -372,14 +372,14 @@ class PyHocaGUI_Menu_TaskbarProfileSharedFolders(wx.Menu): 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=_(u"Unshare &all local folders")) + _unshare_folders = self.Append(id=ID_UNSHAREALLLOCALFOLDERS, text=_("Unshare &all local folders")) if not _shared_folders: _unshare_folders.Enable(False) self.AppendSeparator() - _remember_shared_folders_item = self.AppendCheckItem(id=ID_REMEMBERSHAREDFOLDERS, text=_(u"Restore shares in next session")) - if not self._PyHocaGUI._remember_shared_folders.has_key(profile_name): + _remember_shared_folders_item = self.AppendCheckItem(id=ID_REMEMBERSHAREDFOLDERS, text=_("Restore shares in next session")) + if profile_name not in self._PyHocaGUI._remember_shared_folders: self._PyHocaGUI._remember_shared_folders[profile_name] = self._PyHocaGUI.get_profile_config(profile_name, 'restoreexports') _remember_shared_folders_item.Check(self._PyHocaGUI._remember_shared_folders[profile_name]) @@ -411,10 +411,10 @@ class PyHocaGUI_Menu_LaunchSingleApplication(wx.Menu): wx.Menu.__init__(self) _available_applications = { - 'WWWBROWSER': _(u'Internet Browser'), - 'MAILCLIENT': _(u'Email Client'), - 'OFFICE': _(u'Office'), - 'TERMINAL': _(u'Terminal'), + 'WWWBROWSER': _('Internet Browser'), + 'MAILCLIENT': _('Email Client'), + 'OFFICE': _('Office'), + 'TERMINAL': _('Terminal'), } for application in self._PyHocaGUI.get_profile_config(profile_name, 'applications'): @@ -449,7 +449,7 @@ def _generate_Menu_PublishedApplications(_PyHocaGUI, caller=None, profile_name=N menu_map = _pubapp_session.get_published_applications(lang=_lang, max_no_submenus=_PyHocaGUI.args.published_applications_no_submenus) except AttributeError: menu_map = None - if not menu_map or not menu_map.has_key(_lang): + if not menu_map or _lang not in menu_map: menu_map = { _lang: {} } if x2go.defaults.X2GOCLIENT_OS == 'Windows': @@ -459,16 +459,16 @@ def _generate_Menu_PublishedApplications(_PyHocaGUI, caller=None, profile_name=N _icons_location = basepath.icons_basepath _category_name_translator = { - 'Multimedia': (_(u'Multimedia'), os.path.normpath('%s/PyHoca/%s/applications-multimedia.png' % (_icons_location, _icon_size), ), ), - 'Development': (_(u'Development'), os.path.normpath('%s/PyHoca/%s/applications-development.png' % (_icons_location, _icon_size), ), ), - 'Education': (_(u'Education'), os.path.normpath('%s/PyHoca/%s/applications-education.png' % (_icons_location, _icon_size), ), ), - 'Games': (_(u'Games'), os.path.normpath('%s/PyHoca/%s/applications-games.png' % (_icons_location, _icon_size), ), ), - 'Graphics': (_(u'Graphics'), os.path.normpath('%s/PyHoca/%s/applications-graphics.png' % (_icons_location, _icon_size), ), ), - 'Internet': (_(u'Internet'), os.path.normpath('%s/PyHoca/%s/applications-internet.png' % (_icons_location, _icon_size), ), ), - 'Office': (_(u'Office Applications'), os.path.normpath('%s/PyHoca/%s/applications-office.png' % (_icons_location, _icon_size), ), ), - 'System': (_(u'System'), os.path.normpath('%s/PyHoca/%s/applications-system.png' % (_icons_location, _icon_size), ), ), - 'Utilities': (_(u'Utilities'), os.path.normpath('%s/PyHoca/%s/applications-utilities.png' % (_icons_location, _icon_size), ), ), - 'Other Applications': (_(u'Other Applications'), os.path.normpath('%s/PyHoca/%s/applications-other.png' % (_icons_location, _icon_size), ), ), + 'Multimedia': (_('Multimedia'), os.path.normpath('%s/PyHoca/%s/applications-multimedia.png' % (_icons_location, _icon_size), ), ), + 'Development': (_('Development'), os.path.normpath('%s/PyHoca/%s/applications-development.png' % (_icons_location, _icon_size), ), ), + 'Education': (_('Education'), os.path.normpath('%s/PyHoca/%s/applications-education.png' % (_icons_location, _icon_size), ), ), + 'Games': (_('Games'), os.path.normpath('%s/PyHoca/%s/applications-games.png' % (_icons_location, _icon_size), ), ), + 'Graphics': (_('Graphics'), os.path.normpath('%s/PyHoca/%s/applications-graphics.png' % (_icons_location, _icon_size), ), ), + 'Internet': (_('Internet'), os.path.normpath('%s/PyHoca/%s/applications-internet.png' % (_icons_location, _icon_size), ), ), + 'Office': (_('Office Applications'), os.path.normpath('%s/PyHoca/%s/applications-office.png' % (_icons_location, _icon_size), ), ), + 'System': (_('System'), os.path.normpath('%s/PyHoca/%s/applications-system.png' % (_icons_location, _icon_size), ), ), + 'Utilities': (_('Utilities'), os.path.normpath('%s/PyHoca/%s/applications-utilities.png' % (_icons_location, _icon_size), ), ), + 'Other Applications': (_('Other Applications'), os.path.normpath('%s/PyHoca/%s/applications-other.png' % (_icons_location, _icon_size), ), ), 'TOP': ('TOP', os.path.normpath('%s/PyHoca/%s/x2go-logo-grey.png' % (_icons_location, _icon_size), ), ), } @@ -476,8 +476,8 @@ def _generate_Menu_PublishedApplications(_PyHocaGUI, caller=None, profile_name=N nolog = wx.LogNull() _wx_menu_map = {} - if menu_map[_lang].keys(): - for cat in menu_map[_lang].keys(): + if list(menu_map[_lang].keys()): + for cat in list(menu_map[_lang].keys()): _wx_menu_map[_category_name_translator[cat][0]] = (wx.Menu(), _category_name_translator[cat][1]) @@ -493,7 +493,7 @@ def _generate_Menu_PublishedApplications(_PyHocaGUI, caller=None, profile_name=N _menu_item.SetBitmap(wx.Bitmap(os.path.normpath('%s/PyHoca/%s/x2go-logo-grey.png' % (_icons_location, _icon_size)))) else: _menu_entry_icon_decoded = base64.b64decode(_item['icon']) - _icon_image = wx.ImageFromStream(StringIO.StringIO(_menu_entry_icon_decoded)) + _icon_image = wx.ImageFromStream(io.StringIO(_menu_entry_icon_decoded)) _icon_bitmap = None try: if x2go.defaults.X2GOCLIENT_OS == 'Windows': @@ -551,12 +551,12 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu): _foldersharing_disabled = False if self._PyHocaGUI.with_brokerage and not self._PyHocaGUI.session_profiles.is_broker_authenticated(): - _auth_menu_text = _(u'Connect to') + self._PyHocaGUI.broker_name + _auth_menu_text = _('Connect to') + self._PyHocaGUI.broker_name self.Append(id=ID_AUTHENTICATE_BROKER, text=_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=_(u'Connect %s') % profile_name) + connect = self.Append(id=ID_CONNECT, text=_('Connect %s') % profile_name) connect.Enable(False) else: _applications = self._PyHocaGUI.get_profile_config(profile_name, 'applications') @@ -565,13 +565,13 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu): _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...')) + _connecting_info = self.Append(wx.NewId(), text=_('Currently connecting...')) _connecting_info.Enable(False) 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=_(u'Connect %s') % profile_name) + self.Append(id=ID_CONNECT, text=_('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)' % (_(u"Start &new Desktop Session"), _command)) + self.Append(id=ID_SESSIONSTART, text='%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=_(u"Start Desktop Sharing Session")) + self.Append(id=ID_SHADOWSESSIONSTART, text=_("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=_(u"Retrieving Application Menu...")) + _pub_app_start_item = self.Append(id=ID_PUBAPPSESSIONSTART, text=_("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=_(u"Retrieve Application Menu")) + _pub_app_start_item = self.Append(id=ID_PUBAPPSESSIONSTART, text=_("Retrieve Application Menu")) self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnPubAppSessionStart, id=ID_PUBAPPSESSIONSTART) elif _command == 'RDP': - self.Append(id=ID_SESSIONSTART, text=_(u"Start &new RDP Session")) + self.Append(id=ID_SESSIONSTART, text=_("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.Append(id=ID_SESSIONSTART, text=_("Start &new Session")) self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnSessionStart, id=ID_SESSIONSTART) if _command == '' and _published: @@ -612,7 +612,7 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu): _pub_app_start_item.Enable(False) _foldersharing_disabled = _session_name_disabled = self._PyHocaGUI.is_session_name_disabled(profile_name, _pubapp_session.get_session_name()) _category_map = _generate_Menu_PublishedApplications(self._PyHocaGUI, caller=self, profile_name=profile_name, session_name=_pubapp_session.get_session_name()) - _category_names = _category_map.keys() + _category_names = list(_category_map.keys()) _category_names.sort() 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() @@ -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=_(u"Refresh menu tree"), id=ID_REFRESHMENU) + _refresh_menu_item = self.Append(text=_("Refresh menu tree"), id=ID_REFRESHMENU) 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=_(u"Suspend Session (and disconnect/exit)"), id=ID_SUSPENDSESSION) + _suspend_item = self.Append(text=_("Suspend Session (and disconnect/exit)"), id=ID_SUSPENDSESSION) elif self._PyHocaGUI.disconnect_on_suspend and _pubapp_session.has_terminal_session(): - _suspend_item = self.Append(text=_(u"Suspend Session (and disconnect)"), id=ID_SUSPENDSESSION) + _suspend_item = self.Append(text=_("Suspend Session (and disconnect)"), id=ID_SUSPENDSESSION) else: - _suspend_item = self.Append(text=_(u"Suspend Session"), id=ID_SUSPENDSESSION) + _suspend_item = self.Append(text=_("Suspend Session"), id=ID_SUSPENDSESSION) if _session_name_disabled: _refresh_menu_item.Enable(False) _suspend_item.Enable(False) elif _pubapp_session.is_suspended(): - _resume_item = self.Append(text=_(u"Resume Session"), id=ID_RESUMESESSION) + _resume_item = self.Append(text=_("Resume Session"), id=ID_RESUMESESSION) 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=_(u"Terminate Session (and disconnect/exit)"), id=ID_TERMINATESESSION) + _terminate_item = self.Append(text=_("Terminate Session (and disconnect/exit)"), id=ID_TERMINATESESSION) elif self._PyHocaGUI.disconnect_on_terminate and _pubapp_session.has_terminal_session(): - _terminate_item = self.Append(text=_(u"Terminate Session (and disconnect)"), id=ID_TERMINATESESSION) + _terminate_item = self.Append(text=_("Terminate Session (and disconnect)"), id=ID_TERMINATESESSION) else: - _terminate_item = self.Append(text=_(u"Terminate Session"), id=ID_TERMINATESESSION) + _terminate_item = self.Append(text=_("Terminate Session"), id=ID_TERMINATESESSION) if _session_name_disabled: _terminate_item.Enable(False) @@ -678,13 +678,13 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu): self._PyHocaGUI._eventid_profilenames_map[ID_LAUNCHAPPLICATION] = \ self._PyHocaGUI._eventid_profilenames_map[ID_CLEANSESSIONS] = profile_name - if _applications and _command in x2go.defaults.X2GO_DESKTOPSESSIONS.keys() and not _published: + if _applications and _command in list(x2go.defaults.X2GO_DESKTOPSESSIONS.keys()) and not _published: self.AppendSeparator() - self.AppendMenu(id=ID_LAUNCHAPPLICATION, text=_(u"Launch Single Application"), + self.AppendMenu(id=ID_LAUNCHAPPLICATION, text=_("Launch Single Application"), submenu=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=_(u"Start Desktop Sharing Session")) + self.Append(id=ID_SHADOWSESSIONSTART, text=_("Start Desktop Sharing Session")) self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnShadowSessionStart, id=ID_SHADOWSESSIONSTART) if _published: @@ -699,7 +699,7 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu): if _pubapp_session and _pubapp_session.is_running(): _session_name_disabled = self._PyHocaGUI.is_session_name_disabled(profile_name, _pubapp_session.get_session_name()) _category_map = _generate_Menu_PublishedApplications(self._PyHocaGUI, caller=self, profile_name=profile_name, session_name=_pubapp_session.get_session_name()) - _category_names = _category_map.keys() + _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]) @@ -721,7 +721,7 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu): elif _pubapp_session.is_suspended(): _status = 'S' if _status: - _submenu = self.AppendMenu(id=wx.NewId(), text=_(u'Manage Application Menu')+' %s' % _marker, + _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(), @@ -734,10 +734,10 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu): 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=_(u"Retrieving Application Menu...")) + _ram = self.Append(id=ID_PUBAPPSESSIONSTART, text=_("Retrieving Application Menu...")) _ram.Enable(False) else: - self.Append(id=ID_PUBAPPSESSIONSTART, text=_(u"Retrieve Application Menu")) + self.Append(id=ID_PUBAPPSESSIONSTART, text=_("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] @@ -748,9 +748,9 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu): # newest sessions at the top if _published: - _session_list_names = [ _s_name for _s_name in _session_list.keys() if not _session_list[_s_name].is_published_applications_provider() ] + _session_list_names = [ _s_name for _s_name in list(_session_list.keys()) if not _session_list[_s_name].is_published_applications_provider() ] else: - _session_list_names = _session_list.keys() + _session_list_names = list(_session_list.keys()) _session_list_names.reverse() if _session_list_names: @@ -776,37 +776,37 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu): _s_id = wx.NewId() if _session_list[session_name].get_status() == 'R': - state = _(u'Running') + state = _('Running') elif _session_list[session_name].get_status() == 'S': - state = _(u'Suspended') + state = _('Suspended') _marker = '' if session and session.is_master_session(): _marker = '(*)' if session: - session_submenu = self.AppendMenu(id=_s_id, text=u'%s: »%s« %s' % (state, session_name, _marker), + 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], ) ) - if self._PyHocaGUI._temp_disabled_session_names.has_key(profile_name) and session_name in self._PyHocaGUI._temp_disabled_session_names[profile_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) # redefine list of session names to decide if the clean all session menu item is not be shown _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=_(u"&Clean all sessions")) + self.Append(id=ID_CLEANSESSIONS, text=_("&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=_(u"Customize &profile")) + self.Append(id=ID_EDITPROFILEWHILECONNECTED, text=_("Customize &profile")) else: - self.Append(id=ID_EDITPROFILEWHILECONNECTED, text=_(u"View &profile")) + self.Append(id=ID_EDITPROFILEWHILECONNECTED, text=_("View &profile")) self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnProfileEditWhileConnected, id=ID_EDITPROFILEWHILECONNECTED) self._PyHocaGUI._eventid_profilenames_map[ID_EDITPROFILEWHILECONNECTED] = \ @@ -821,7 +821,7 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu): if self._PyHocaGUI.restricted_trayicon: self.AppendSeparator() - _shared_folders = self.AppendMenu(id=ID_SHARELOCALFOLDER, text=_(u"Shared &folders"), + _shared_folders = self.AppendMenu(id=ID_SHARELOCALFOLDER, text=_("Shared &folders"), submenu=PyHocaGUI_Menu_TaskbarProfileSharedFolders(self._PyHocaGUI, caller=self, profile_name=profile_name) ) @@ -833,29 +833,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=_(u"Server Information")) + self.Append(id=ID_SERVERINFO, text=_("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=_(u"&Disconnect from Server")) + self.Append(id=ID_DISCONNECT, text=_("&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=_(u"Suspend Session and E&xit application")) + self.Append(id=ID_EXIT, text=_("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=_(u"Disconnect and E&xit application")) + self.Append(id=ID_EXIT, text=_("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=_(u"E&xit")) + self.Append(id=ID_EXIT, text=_("E&xit")) self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnTaskbarExit, id=ID_EXIT) @@ -905,7 +905,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=_(u"Add Profile")) + self.Append(id=ID_ADDPROFILE, text=_("Add Profile")) self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnProfileAdd, id=ID_ADDPROFILE) self.AppendSeparator() @@ -982,9 +982,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=_(u'Session broker is not connected'), id=wx.NewId()) + _dummy = self.Append(text=_('Session broker is not connected'), id=wx.NewId()) else: - _dummy = self.Append(text=_(u'No session profiles defined'), id=wx.NewId()) + _dummy = self.Append(text=_('No session profiles defined'), id=wx.NewId()) _dummy.Enable(False) else: @@ -995,15 +995,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=_(u'Export all Profiles'), id=_export_id) + self.Append(text=_('Export all Profiles'), id=_export_id) else: - self.Append(text=_(u'Export Profile Group'), id=_export_id) + self.Append(text=_('Export Profile Group'), id=_export_id) 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=_(u'Import Session Profiles'), id=_import_id) + self.Append(text=_('Import Session Profiles'), id=_import_id) self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnProfileImport, id=_import_id) def OnUpdateUI(self, evt): @@ -1041,12 +1041,12 @@ class PyHocaGUI_Menu_TaskbarSessionManager(wx.Menu): ID_EXIT = wx.NewId() if self._PyHocaGUI.with_brokerage and not self._PyHocaGUI.session_profiles.is_broker_authenticated(): - _auth_menu_text = _(u'Connect to') + ' ' + self._PyHocaGUI.broker_name + _auth_menu_text = _('Connect to') + ' ' + self._PyHocaGUI.broker_name self.Append(id=ID_AUTHENTICATE_BROKER, text=_auth_menu_text) self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnBrokerAuthenticate, id=ID_AUTHENTICATE_BROKER) self.AppendSeparator() else: - _auth_menu_text = _(u'Connect Server') + _auth_menu_text = _('Connect Server') self.AppendMenu(id=ID_AUTHENTICATE_SESSION, text=_auth_menu_text, submenu=PyHocaGUI_Menu_TaskbarProfileNames(self._PyHocaGUI, @@ -1076,7 +1076,7 @@ class PyHocaGUI_Menu_TaskbarSessionManager(wx.Menu): if _connected_sessions: self.AppendSeparator() - self.Append(id=ID_EXIT, text=_(u"E&xit")) + self.Append(id=ID_EXIT, text=_("E&xit")) self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnTaskbarExit, id=ID_EXIT) diff --git a/pyhoca/wxgui/messages.py b/pyhoca/wxgui/messages.py index bd52c1b..472e930 100644 --- a/pyhoca/wxgui/messages.py +++ b/pyhoca/wxgui/messages.py @@ -26,7 +26,7 @@ import wx import os # PyHoca-GUI modules -import basepath +from . import basepath # X2Go modules from x2go.defaults import CURRENT_LOCAL_USER as _CURRENT_LOCAL_USER @@ -68,14 +68,14 @@ class PyHoca_MessageWindow(wx.Dialog): except: pass self._pyhoca_messages = { - 'REALLY_DELETE_PROFILE': _(u'Are you really sure you want to\ndelete the session profile ,,%s\'\'?') % profile_name, - 'ALREADY_RUNNING': _(u'{appname} is already running for user ,,{username}\'\'!\n\nOnly one instance of {appname} can be started per\nuser. The {appname} icon can be found in your desktop\'s\nnotification area/systray.').format(appname=self._PyHocaGUI.appname, username=_CURRENT_LOCAL_USER) + 'REALLY_DELETE_PROFILE': _('Are you really sure you want to\ndelete the session profile ,,%s\'\'?') % profile_name, + 'ALREADY_RUNNING': _('{appname} is already running for user ,,{username}\'\'!\n\nOnly one instance of {appname} can be started per\nuser. The {appname} icon can be found in your desktop\'s\nnotification area/systray.').format(appname=self._PyHocaGUI.appname, username=_CURRENT_LOCAL_USER) } if shortmsg is None: show_message = msg - elif shortmsg in self._pyhoca_messages.keys(): + elif shortmsg in list(self._pyhoca_messages.keys()): show_message = self._pyhoca_messages[shortmsg] else: show_message = 'No message has been given...' @@ -107,8 +107,8 @@ class PyHoca_MessageWindow(wx.Dialog): mainSizer = wx.BoxSizer(wx.VERTICAL) if buttontype in ('yesno', 'noyes'): - self.yesBtn = wx.Button(self, wx.ID_ANY, _(u'Yes'),) - self.noBtn = wx.Button(self, wx.ID_ANY, _(u'No')) + self.yesBtn = wx.Button(self, wx.ID_ANY, _('Yes'),) + self.noBtn = wx.Button(self, wx.ID_ANY, _('No')) self.Bind(wx.EVT_BUTTON, self.OnTrue, self.yesBtn) self.Bind(wx.EVT_BUTTON, self.OnFalse, self.noBtn) @@ -125,13 +125,13 @@ class PyHoca_MessageWindow(wx.Dialog): if buttontype in ('ok', 'okcancel', 'cancelok'): - self.okBtn = wx.Button(self, wx.ID_ANY, _(u'Ok'),) + self.okBtn = wx.Button(self, wx.ID_ANY, _('Ok'),) self.Bind(wx.EVT_BUTTON, self.OnTrue, self.okBtn) btnSizer.Add(self.okBtn, flag=wx.ALL, border=5) if buttontype in ('okcancel', 'cancelok'): - self.cancelBtn = wx.Button(self, wx.ID_ANY, _(u'Cancel')) + self.cancelBtn = wx.Button(self, wx.ID_ANY, _('Cancel')) self.Bind(wx.EVT_BUTTON, self.OnFalse, self.cancelBtn) btnSizer.Add(self.cancelBtn, flag=wx.ALL, border=5) diff --git a/pyhoca/wxgui/notify.py b/pyhoca/wxgui/notify.py index 7431915..3970f64 100644 --- a/pyhoca/wxgui/notify.py +++ b/pyhoca/wxgui/notify.py @@ -30,13 +30,12 @@ if X2GOCLIENT_OS in ('Linux', 'Mac'): # GTK3 notifications are unavailable, # hopefully pynotify / GTK2-based notifications are available then... import pynotify as _Notify -import exceptions -import basepath +from . import basepath import x2go.utils as utils -class NotSupportedException(exceptions.StandardError): pass -class PyHocaNotificationException(exceptions.StandardError): pass +class NotSupportedException(BaseException): pass +class PyHocaNotificationException(BaseException): pass def notification_service_available(): return _Notify.get_server_info()[0] @@ -386,7 +385,7 @@ class showballoon_NotifierPopup(object): 'session_terminate': wx.ICON_INFORMATION, 'session_warning': wx.ICON_WARNING, } - if icon in _icon_map_wx.keys(): + if icon in list(_icon_map_wx.keys()): icon = _icon_map_wx[icon] else: icon = wx.ICON_INFORMATION @@ -540,7 +539,7 @@ class notificationmessage_NotifierPopup(object): 'session_terminate': wx.ICON_INFORMATION, 'session_warning': wx.ICON_WARNING, } - if icon in _icon_map_wx.keys(): + if icon in list(_icon_map_wx.keys()): icon = _icon_map_wx[icon] else: icon = wx.ICON_INFORMATION diff --git a/pyhoca/wxgui/passphrase.py b/pyhoca/wxgui/passphrase.py index a7ff97d..efa3229 100644 --- a/pyhoca/wxgui/passphrase.py +++ b/pyhoca/wxgui/passphrase.py @@ -34,9 +34,9 @@ import os import base64 # PyHoca-GUI modules -import logon +from . import logon -if os.environ.has_key('DESKTOP_SESSION'): +if 'DESKTOP_SESSION' in os.environ: WINDOW_MANAGER = os.environ['DESKTOP_SESSION'] else: WINDOW_MANAGER = 'generic' @@ -67,9 +67,9 @@ class PyHocaGUI_DialogBoxPassphrase(wx.Dialog): self.current_profile_config = self._PyHocaGUI.session_profiles.get_profile_config(profile_name) if sshproxy_auth: - wx.Dialog.__init__(self, None, id=-1, title=_(u'%s (SSH proxy)') % profile_name, style=wx.DEFAULT_FRAME_STYLE, ) + wx.Dialog.__init__(self, None, id=-1, title=_('%s (SSH proxy)') % profile_name, style=wx.DEFAULT_FRAME_STYLE, ) else: - wx.Dialog.__init__(self, None, id=-1, title=_(u'%s (X2Go Server)') % profile_name, style=wx.DEFAULT_FRAME_STYLE, ) + wx.Dialog.__init__(self, None, id=-1, title=_('%s (X2Go Server)') % profile_name, style=wx.DEFAULT_FRAME_STYLE, ) self._PyHocaGUI._sub_windows.append(self) @@ -79,19 +79,19 @@ class PyHocaGUI_DialogBoxPassphrase(wx.Dialog): self.sshproxy_passphrase = sshproxy_passphrase if self.key_filename: - keyfilenameLbl = wx.StaticText(self, wx.ID_ANY, _(u'Unlock SSH private key (%s)...') % key_filename) + keyfilenameLbl = wx.StaticText(self, wx.ID_ANY, _('Unlock SSH private key (%s)...') % key_filename) else: - keyfilenameLbl = wx.StaticText(self, wx.ID_ANY, _(u'Unlock auto-discovered SSH private key...')) + keyfilenameLbl = wx.StaticText(self, wx.ID_ANY, _('Unlock auto-discovered SSH private key...')) - self.passphraseLbl = wx.StaticText(self, wx.ID_ANY, _(u'Passphrase')+':', size=(-1, -1)) + self.passphraseLbl = wx.StaticText(self, wx.ID_ANY, _('Passphrase')+':', size=(-1, -1)) self.passphraseTxt = wx.TextCtrl(self, wx.ID_ANY, '', style=wx.TE_PROCESS_ENTER|wx.TE_PASSWORD, size=(120, -1)) self.passphraseTxt.SetFocus() - self.unlockBtn = wx.Button(self, wx.ID_OK, _(u'Unlock SSH key'), ) + self.unlockBtn = wx.Button(self, wx.ID_OK, _('Unlock SSH key'), ) self.unlockBtn.SetDefault() _tab_order = [] - self.cancelBtn = wx.Button(self, wx.ID_CANCEL, _(u'Cancel'), ) + self.cancelBtn = wx.Button(self, wx.ID_CANCEL, _('Cancel'), ) _tab_order.extend([self.passphraseTxt, self.unlockBtn, self.cancelBtn, ]) @@ -119,7 +119,7 @@ class PyHocaGUI_DialogBoxPassphrase(wx.Dialog): self.SetSizerAndFit(mainSizer) self.Layout() - for i in xrange(len(_tab_order) - 1): + for i in range(len(_tab_order) - 1): _tab_order[i+1].MoveAfterInTabOrder(_tab_order[i]) maxX, maxY = wx.GetDisplaySize() @@ -196,8 +196,8 @@ class PyHocaGUI_DialogBoxPassphrase(wx.Dialog): add_to_known_hosts=self._PyHocaGUI.add_to_known_hosts, ) self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_(u'%s - connect') % self.current_profile_name, - text=_(u'Authentication has been successful.'), + title=_('%s - connect') % self.current_profile_name, + text=_('Authentication has been successful.'), icon='auth_success') except x2go.PasswordRequiredException: @@ -214,56 +214,56 @@ class PyHocaGUI_DialogBoxPassphrase(wx.Dialog): else: self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_(u'%s - connect failure') % self.current_profile_name, - text=_(u'SSH key file (for X2Go server) could not be unlocked!'), + title=_('%s - connect failure') % self.current_profile_name, + text=_('SSH key file (for X2Go server) could not be unlocked!'), icon='auth_failed') connect_failed = True except x2go.X2GoSSHProxyPasswordRequiredException: self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_(u'%s - connect failure') % self.current_profile_name, - text=_(u'SSH key file (for SSH proxy) could not be unlocked!'), + title=_('%s - connect failure') % self.current_profile_name, + text=_('SSH key file (for SSH proxy) could not be unlocked!'), icon='auth_failed') connect_failed = True except x2go.AuthenticationException: self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_(u'%s - connect failure') % self.current_profile_name, - text=_(u'Authentication failed!'), + title=_('%s - connect failure') % self.current_profile_name, + text=_('Authentication failed!'), icon='auth_failed') connect_failed = True except x2go.X2GoSSHProxyAuthenticationException: self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_(u'%s - connect failure') % self.current_profile_name, - text=_(u'Authentication to the SSH proxy server failed!'), + title=_('%s - connect failure') % self.current_profile_name, + text=_('Authentication to the SSH proxy server failed!'), icon='auth_failed') connect_failed = True - except gevent.socket.error, e: + except gevent.socket.error as e: self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_(u'%s - socket error') % self.current_profile_name, + title=_('%s - socket error') % self.current_profile_name, text=e.strerror + '!', icon='auth_error') connect_failed = True - except x2go.X2GoHostKeyException, e: + except x2go.X2GoHostKeyException as e: self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_(u'%s - host key error') % self.current_profile_name, - text=_(u'The remote server\'s host key is invalid or has not been accepted by the user') + '!', + title=_('%s - host key error') % self.current_profile_name, + text=_('The remote server\'s host key is invalid or has not been accepted by the user') + '!', icon='auth_error', timeout=4000) connect_failed = True - except x2go.X2GoRemoteHomeException, e: + except x2go.X2GoRemoteHomeException as e: self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_(u'%s - missing home directory') % self.current_profile_name, + title=_('%s - missing home directory') % self.current_profile_name, text=_("The remote user's home directory does not exist."), icon='auth_error', timeout=4000) connect_failed = True - except x2go.X2GoSSHProxyException, e: + except x2go.X2GoSSHProxyException as e: if str(e).startswith('Two-factor authentication requires a password'): self._pyhoca_logger('SSH proxy host requests two-factor authentication', loglevel=x2go.loglevel_NOTICE) _logon_window = logon.PyHocaGUI_DialogBoxPassword(self._PyHocaGUI, self.current_profile_name, @@ -280,21 +280,21 @@ class PyHocaGUI_DialogBoxPassphrase(wx.Dialog): else: errmsg = str(e) self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_(u'%s - key error') % self.current_profile_name, + title=_('%s - key error') % self.current_profile_name, text='%s!' % errmsg, icon='auth_error', timeout=4000) connect_failed = True - except x2go.X2GoSessionException, e: + except x2go.X2GoSessionException as e: self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_(u'%s - auth error') % self.current_profile_name, + title=_('%s - auth error') % self.current_profile_name, text='%s!' % str(e), icon='auth_error', timeout=4000) connect_failed = True - except x2go.SSHException, e: + except x2go.SSHException as e: if str(e).startswith('Two-factor authentication requires a password'): self._pyhoca_logger('X2Go Server requests two-factor authentication', loglevel=x2go.loglevel_NOTICE) _logon_window = logon.PyHocaGUI_DialogBoxPassword(self._PyHocaGUI, self.current_profile_name, @@ -312,7 +312,7 @@ class PyHocaGUI_DialogBoxPassphrase(wx.Dialog): errmsg = str(e) self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_(u'%s - SSH error') % self.current_profile_name, + title=_('%s - SSH error') % self.current_profile_name, text='%s' % errmsg, icon='auth_error', timeout=10000) @@ -320,11 +320,11 @@ class PyHocaGUI_DialogBoxPassphrase(wx.Dialog): except: self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_(u'%s - unknown error') % self.current_profile_name, - text=_(u'An unknown error occured during authentication!'), + title=_('%s - unknown error') % self.current_profile_name, + text=_('An unknown error occured during authentication!'), icon='auth_error') connect_failed = True - if self._PyHocaGUI.args.debug or self._PyHocaGUI.args.libdebug or (os.environ.has_key('PYHOCAGUI_DEVELOPMENT') and os.environ['PYHOCAGUI_DEVELOPMENT'] == '1'): + if self._PyHocaGUI.args.debug or self._PyHocaGUI.args.libdebug or ('PYHOCAGUI_DEVELOPMENT' in os.environ and os.environ['PYHOCAGUI_DEVELOPMENT'] == '1'): raise self._PyHocaGUI.notifier.send(self.current_profile_name, context='AUTH_%s' % self.current_profile_name, timeout=4000) diff --git a/pyhoca/wxgui/printingprefs.py b/pyhoca/wxgui/printingprefs.py index 0eaa3a2..198e9e3 100644 --- a/pyhoca/wxgui/printingprefs.py +++ b/pyhoca/wxgui/printingprefs.py @@ -35,7 +35,7 @@ if _X2GOCLIENT_OS != "Windows": else: import win32print -import basepath +from . import basepath class PyHocaGUI_PrintingPreferences(wx.Dialog): """\ @@ -65,21 +65,21 @@ class PyHocaGUI_PrintingPreferences(wx.Dialog): self._pyhoca_logger('opening client printing configuration dialog, mode: ,,%s\'\'' % self.mode, loglevel=log.loglevel_INFO) if self.mode == 'edit': - _title = _(u'%s - Printing Preferences') % self._PyHocaGUI.appname + _title = _('%s - Printing Preferences') % self._PyHocaGUI.appname else: - _title = _(u'%s - Incoming Print Job from %s (%s)') % (self._PyHocaGUI.appname, profile_name, session_name) + _title = _('%s - Incoming Print Job from %s (%s)') % (self._PyHocaGUI.appname, profile_name, session_name) wx.Dialog.__init__(self, None, -1, title=_title, style=wx.DEFAULT_DIALOG_STYLE, ) self._PyHocaGUI._sub_windows.append(self) self._availablePrintActions = { - 'DIALOG': _(u'Open this dialog window'), - 'PDFVIEW': _(u'Open with PDF viewer'), - 'PDFSAVE': _(u'Save to a local folder'), - 'PRINT': _(u'Print to a local printer'), - 'PRINTCMD': _(u'Run custom print command'), + 'DIALOG': _('Open this dialog window'), + 'PDFVIEW': _('Open with PDF viewer'), + 'PDFSAVE': _('Save to a local folder'), + 'PRINT': _('Print to a local printer'), + 'PRINTCMD': _('Run custom print command'), } if self.mode != 'edit': - self._availablePrintActions['DIALOG'] = _(u'<Select a print action here>') + self._availablePrintActions['DIALOG'] = _('<Select a print action here>') self._availablePrinters = {} if _X2GOCLIENT_OS != "Windows": @@ -88,7 +88,7 @@ class PyHocaGUI_PrintingPreferences(wx.Dialog): cups.setUser(_CURRENT_LOCAL_USER) cups_connection = cups.Connection() cups_printers = cups_connection.getPrinters() - for p in cups_printers.keys(): + for p in list(cups_printers.keys()): self._availablePrinters.update({ p: '%s (%s)' % (p, cups_printers[p]['printer-info']), }) self._defaultPrinter = cups_connection.getDefault() except RuntimeError: @@ -113,40 +113,40 @@ class PyHocaGUI_PrintingPreferences(wx.Dialog): ### widgets for CLIENT PRINTING ### if self.mode != 'edit': - self.PrintActionLabel = wx.StaticText(self, -1, _(u"Print action")+':') + self.PrintActionLabel = wx.StaticText(self, -1, _("Print action")+':') else: - self.PrintActionLabel = wx.StaticText(self, -1, _(u"Default action for incoming print jobs")+':') - self.PrintAction = wx.ComboBox(self, -1, choices=self._availablePrintActions.values(), style=wx.CB_DROPDOWN|wx.CB_READONLY) + self.PrintActionLabel = wx.StaticText(self, -1, _("Default action for incoming print jobs")+':') + self.PrintAction = wx.ComboBox(self, -1, choices=list(self._availablePrintActions.values()), style=wx.CB_DROPDOWN|wx.CB_READONLY) # widgets for print action PDFVIEW - self.PdfViewCmdLabel = wx.StaticText(self, -1, _(u'PDF viewer command') + ':', ) + self.PdfViewCmdLabel = wx.StaticText(self, -1, _('PDF viewer command') + ':', ) self.PdfViewCmd = wx.TextCtrl(self, -1, '', ) self.PdfViewCmdBrowseButton = wx.BitmapButton(self, -1, wx.Bitmap('%s/PyHoca/16x16/system-search.png' % _icons_location, wx.BITMAP_TYPE_ANY) ) # widgets for print action PDFSAVE - self.PdfSaveToFolderLabel = wx.StaticText(self, -1, _(u'Save PDFs to folder') + ':', ) + self.PdfSaveToFolderLabel = wx.StaticText(self, -1, _('Save PDFs to folder') + ':', ) self.PdfSaveToFolder = wx.TextCtrl(self, -1, '', ) self.PdfSaveToFolderBrowseButton = wx.BitmapButton(self, -1, wx.Bitmap('%s/PyHoca/16x16/system-search.png' % _icons_location, wx.BITMAP_TYPE_ANY) ) # widgets for print action PRINT - self.PrintPrinterLabel = wx.StaticText(self, -1, _(u'Use this printer') + ':', ) - self.PrintPrinter = wx.ComboBox(self, -1, choices=self._availablePrinters.values(), style=wx.CB_DROPDOWN|wx.CB_READONLY) + self.PrintPrinterLabel = wx.StaticText(self, -1, _('Use this printer') + ':', ) + self.PrintPrinter = wx.ComboBox(self, -1, choices=list(self._availablePrinters.values()), style=wx.CB_DROPDOWN|wx.CB_READONLY) # widgets for print action PRINTCMD - self.PrintCmdLabel = wx.StaticText(self, -1, _(u'Custom print command') + ':', ) + self.PrintCmdLabel = wx.StaticText(self, -1, _('Custom print command') + ':', ) self.PrintCmd = wx.TextCtrl(self, -1, '', ) if self.mode == 'edit': - self.OKButton = wx.Button(self, wx.ID_OK, _(u"Ok")) - self.ApplyButton = wx.Button(self, -1, _(u"Apply")) + self.OKButton = wx.Button(self, wx.ID_OK, _("Ok")) + self.ApplyButton = wx.Button(self, -1, _("Apply")) else: - self.OKButton = wx.Button(self, wx.ID_OK, _(u"Print")) + self.OKButton = wx.Button(self, wx.ID_OK, _("Print")) self.OKButton.SetDefault() - self.CancelButton = wx.Button(self, wx.ID_CANCEL, _(u"Cancel")) + self.CancelButton = wx.Button(self, wx.ID_CANCEL, _("Cancel")) self.__set_properties() self.__update_fields() @@ -246,21 +246,21 @@ class PyHocaGUI_PrintingPreferences(wx.Dialog): if self._defaultPrinter != None: _printer_name = self._availablePrinters[self._defaultPrinter] else: - _printer_name = self._availablePrinters[self._availablePrinters.keys()[0]] + _printer_name = self._availablePrinters[list(self._availablePrinters.keys())[0]] else: - _printer_name = _(u'- no printers installed -') + _printer_name = _('- no printers installed -') self.PrintPrinter.Clear() self.PrintPrinter.Append(_(_printer_name)) self.PrintPrinter.Enable(False) else: - _printer_name = _(u'- print system is not available -') + _printer_name = _('- print system is not available -') self.PrintPrinter.Clear() self.PrintPrinter.Append(_(_printer_name)) self.PrintPrinter.Enable(False) self.PrintPrinter.SetValue(_printer_name) self.PrintCmd.SetValue(self.client_printing.get_property('print_cmd')) - if self._availablePrintActions.has_key(print_action_name): + if print_action_name in self._availablePrintActions: self.PrintAction.SetValue(self._availablePrintActions[print_action_name]) else: self.PrintAction.SetValue(print_action_name) @@ -275,13 +275,13 @@ class PyHocaGUI_PrintingPreferences(wx.Dialog): @property def _print_action(self): - return [ p for p in self._availablePrintActions.keys() if self._availablePrintActions[p] == self.PrintAction.GetValue() ][0] + return [ p for p in list(self._availablePrintActions.keys()) if self._availablePrintActions[p] == self.PrintAction.GetValue() ][0] @property def _print_action_properties(self): # handle missing print system - _printer = [ p for p in self._availablePrinters.keys() if self._availablePrinters[p] == self.PrintPrinter.GetValue() and self._defaultPrinter != '#PRINTSYSTEM_UNAVAILABLE#' ] + _printer = [ p for p in list(self._availablePrinters.keys()) if self._availablePrinters[p] == self.PrintPrinter.GetValue() and self._defaultPrinter != '#PRINTSYSTEM_UNAVAILABLE#' ] try: _printer = _printer[0] except IndexError: @@ -407,7 +407,7 @@ class PyHocaGUI_PrintingPreferences(wx.Dialog): """ wildcard = "All files (*.*)|*" dlg = wx.FileDialog( - self, message=_(u"Choose PDF viewer application"), defaultDir=_LOCAL_HOME, + self, message=_("Choose PDF viewer application"), defaultDir=_LOCAL_HOME, defaultFile="", wildcard=wildcard, style=wx.FD_OPEN | wx.FD_CHANGE_DIR ) # Show the dialog and retrieve the user response. If it is the OK response, # process the data. @@ -430,7 +430,7 @@ class PyHocaGUI_PrintingPreferences(wx.Dialog): _start_dir = '~/%s' % _start_dir _start_dir = os.path.expanduser(_start_dir) dlg = wx.DirDialog( - self, message=_(u"Choose PDF saving location"), style=1, defaultPath=_start_dir, ) + self, message=_("Choose PDF saving location"), style=1, defaultPath=_start_dir, ) # Show the dialog and retrieve the user response. If it is the OK response, # process the data. if dlg.ShowModal() == wx.ID_OK: diff --git a/pyhoca/wxgui/profilemanager.py b/pyhoca/wxgui/profilemanager.py index 1cad7ed..3cf6281 100644 --- a/pyhoca/wxgui/profilemanager.py +++ b/pyhoca/wxgui/profilemanager.py @@ -30,7 +30,7 @@ import x2go.defaults as defaults from x2go import X2GOCLIENT_OS from x2go._paramiko import PARAMIKO_FEATURE -import basepath +from . import basepath _known_encodings = utils.known_encodings() @@ -79,41 +79,41 @@ class PyHocaGUI_ProfileManager(wx.Dialog): self.action = action self.sessionChoices = { - 'CINNAMON': _(u'Cinnamon Desktop (CINNAMON)'), - 'GNOME': _(u'GNOME Desktop (GNOME)'), - 'MATE': _(u'MATE Desktop (MATE)'), - 'KDE': _(u'K Desktop Environment (KDE)'), - 'LXDE': _(u'Lightweight X Desktop (LXDE, based on GTK-2)'), - 'LXQt': _(u'Lightweight X Desktop (LXQt, based on Qt5)'), - 'IceWM': _(u'IceWM Desktop'), - 'TRINITY': _(u'Trinity X Desktop (KDE3-like)'), - 'UNITY': _(u'Unity X Desktop Shell (UNITY)'), - 'XFCE': _(u'XFCE Desktop (XFCE)'), - 'PUBLISHEDAPPLICATIONS': _(u'Published Applications'), - 'APPLICATION': _(u'Single Application'), - 'SHADOW': _(u'X2Go/X11 Desktop Sharing (SHADOW)'), - 'XDMCP': _(u'XDMCP Query'), - 'RDP': _(u'Windows Terminal Server (X2Go-proxied RDP)'), - 'DirectRDP': _(u'Windows Terminal Server (Direct RDP)'), - 'CUSTOM': _(u'Custom command'), + 'CINNAMON': _('Cinnamon Desktop (CINNAMON)'), + 'GNOME': _('GNOME Desktop (GNOME)'), + 'MATE': _('MATE Desktop (MATE)'), + 'KDE': _('K Desktop Environment (KDE)'), + 'LXDE': _('Lightweight X Desktop (LXDE, based on GTK-2)'), + 'LXQt': _('Lightweight X Desktop (LXQt, based on Qt5)'), + 'IceWM': _('IceWM Desktop'), + 'TRINITY': _('Trinity X Desktop (KDE3-like)'), + 'UNITY': _('Unity X Desktop Shell (UNITY)'), + 'XFCE': _('XFCE Desktop (XFCE)'), + 'PUBLISHEDAPPLICATIONS': _('Published Applications'), + 'APPLICATION': _('Single Application'), + 'SHADOW': _('X2Go/X11 Desktop Sharing (SHADOW)'), + 'XDMCP': _('XDMCP Query'), + 'RDP': _('Windows Terminal Server (X2Go-proxied RDP)'), + 'DirectRDP': _('Windows Terminal Server (Direct RDP)'), + 'CUSTOM': _('Custom command'), } if self.action == 'EDIT_CONNECTED': del self.sessionChoices['DirectRDP'] self.applicationChoices = { - 'WWWBROWSER': _(u'Internet Browser'), - 'MAILCLIENT': _(u'Email Client'), - 'OFFICE': _(u'Office'), - 'TERMINAL': _(u'Terminal'), + 'WWWBROWSER': _('Internet Browser'), + 'MAILCLIENT': _('Email Client'), + 'OFFICE': _('Office'), + 'TERMINAL': _('Terminal'), } self.clipboardModeChoices = { - 'both': _(u'between client and server'), - 'server': _(u'from server to client only'), - 'client': _(u'from client to server only'), - 'none': _(u'not at all') + 'both': _('between client and server'), + 'server': _('from server to client only'), + 'client': _('from client to server only'), + 'none': _('not at all') } self.rdpclientChoices = { - 'rdesktop': u'rdesktop', - 'xfreerdp': u'xfreerdp', + 'rdesktop': 'rdesktop', + 'xfreerdp': 'xfreerdp', } self.linkChoices = { 0: 'MODEM', @@ -127,9 +127,9 @@ class PyHocaGUI_ProfileManager(wx.Dialog): 'pulse': 4713, } self.mimeboxactionChoices = { - 'OPEN': _(u'Open file with system\'s default application'), - 'OPENWITH': _(u'Open application chooser dialog'), - 'SAVEAS': _(u'Save incoming file as ...'), + 'OPEN': _('Open file with system\'s default application'), + 'OPENWITH': _('Open application chooser dialog'), + 'SAVEAS': _('Save incoming file as ...'), } self._compressions = defaults.pack_methods_nx3_noqual @@ -165,7 +165,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog): # 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 'sshproxytunnel' in self.profile_config: if self.profile_config['sshproxytunnel'].count(':') == 2: _from_port, _to_host, _to_port = self.profile_config['sshproxytunnel'].split(':') _from_host = 'localhost' @@ -205,34 +205,34 @@ class PyHocaGUI_ProfileManager(wx.Dialog): self.tab_SharedResources.Enable(False) # boxes for all tabs - self.staticbox_Profile = wx.StaticBox(self.tab_Profile, -1, ' %s ' % _(u'Session Title')) - self.staticbox_Window = wx.StaticBox(self.tab_Profile, -1, ' %s ' % _(u'Session Window')) - self.staticbox_SessionType = wx.StaticBox(self.tab_Session, -1, ' %s ' % _(u'Session Startup')) - self.staticbox_Server = wx.StaticBox(self.tab_Connection, -1, ' %s ' % _(u"Server")) - self.staticbox_Proxy = wx.StaticBox(self.tab_Connection, -1, ' %s ' % _(u"Proxy")) - self.staticbox_LinkSpeed = wx.StaticBox(self.tab_LinkQuality, -1, ' %s ' % _(u"Connection Link Speed")) - self.staticbox_Compression = wx.StaticBox(self.tab_LinkQuality, -1, ' %s ' % _(u"Compression")) - self.staticbox_Display = wx.StaticBox(self.tab_IO, -1, ' %s ' % _(u"Display")) - self.staticbox_Clipboard = wx.StaticBox(self.tab_IO, -1, ' %s ' % _(u"Clipboard")) - self.staticbox_Keyboard = wx.StaticBox(self.tab_IO, -1, ' %s ' % _(u"Keyboard")) - self.staticbox_Sound = wx.StaticBox(self.tab_MediaResources, -1, ' %s ' % _(u"Sound")) - self.staticbox_Printing = wx.StaticBox(self.tab_MediaResources, -1, ' %s ' % _(u"Printing")) - self.staticbox_FolderSharing = wx.StaticBox(self.tab_SharedResources, -1, ' %s ' % _(u"Folder Exports")) - self.staticbox_FileMIMEbox = wx.StaticBox(self.tab_SharedResources, -1, ' %s ' % _(u"File Import")) + self.staticbox_Profile = wx.StaticBox(self.tab_Profile, -1, ' %s ' % _('Session Title')) + self.staticbox_Window = wx.StaticBox(self.tab_Profile, -1, ' %s ' % _('Session Window')) + self.staticbox_SessionType = wx.StaticBox(self.tab_Session, -1, ' %s ' % _('Session Startup')) + self.staticbox_Server = wx.StaticBox(self.tab_Connection, -1, ' %s ' % _("Server")) + self.staticbox_Proxy = wx.StaticBox(self.tab_Connection, -1, ' %s ' % _("Proxy")) + self.staticbox_LinkSpeed = wx.StaticBox(self.tab_LinkQuality, -1, ' %s ' % _("Connection Link Speed")) + self.staticbox_Compression = wx.StaticBox(self.tab_LinkQuality, -1, ' %s ' % _("Compression")) + self.staticbox_Display = wx.StaticBox(self.tab_IO, -1, ' %s ' % _("Display")) + self.staticbox_Clipboard = wx.StaticBox(self.tab_IO, -1, ' %s ' % _("Clipboard")) + self.staticbox_Keyboard = wx.StaticBox(self.tab_IO, -1, ' %s ' % _("Keyboard")) + self.staticbox_Sound = wx.StaticBox(self.tab_MediaResources, -1, ' %s ' % _("Sound")) + self.staticbox_Printing = wx.StaticBox(self.tab_MediaResources, -1, ' %s ' % _("Printing")) + self.staticbox_FolderSharing = wx.StaticBox(self.tab_SharedResources, -1, ' %s ' % _("Folder Exports")) + self.staticbox_FileMIMEbox = wx.StaticBox(self.tab_SharedResources, -1, ' %s ' % _("File Import")) ### ### widgets for the PROFILE tab ### - self.ProfileNameLabel = wx.StaticText(self.tab_Profile, -1, _(u"Name")+": ") + self.ProfileNameLabel = wx.StaticText(self.tab_Profile, -1, _("Name")+": ") self.ProfileName = wx.TextCtrl(self.tab_Profile, -1, "") if self.action in ("ADD_EXPLICITLY", "EDIT_EXPLICITLY"): self.ProfileNameLabel.Enable(False) self.ProfileName.Enable(False) - self.SetSessionWindowTitle = wx.CheckBox(self.tab_Profile, -1, _(u"Set session window title")) - self.UseDefaultSessionWindowTitle = wx.CheckBox(self.tab_Profile, -1, _(u"Use a default session window title")) - self.CustomSessionWindowTitleLabel = wx.StaticText(self.tab_Profile, -1, _(u"Custom session window title") + ": ") + self.SetSessionWindowTitle = wx.CheckBox(self.tab_Profile, -1, _("Set session window title")) + self.UseDefaultSessionWindowTitle = wx.CheckBox(self.tab_Profile, -1, _("Use a default session window title")) + self.CustomSessionWindowTitleLabel = wx.StaticText(self.tab_Profile, -1, _("Custom session window title") + ": ") self.CustomSessionWindowTitle = wx.TextCtrl(self.tab_Profile, -1, "") path_to_icon = os.path.normpath('%s/%s/128x128/%s_sessionicon.png' % (self._icons_location, self._PyHocaGUI.appname, self._PyHocaGUI.appname)) self.default_icon = True @@ -251,151 +251,151 @@ class PyHocaGUI_ProfileManager(wx.Dialog): path_to_icon = os.path.normpath('%s/PyHoca/128x128/PyHoca-GUI_sessionicon.png' % self._icons_location) self.default_icon = True self.IconPath = path_to_icon - self.IconButtonLabel = wx.StaticText(self.tab_Profile, -1, _(u"Window Icon")+": ") + self.IconButtonLabel = wx.StaticText(self.tab_Profile, -1, _("Window Icon")+": ") self.IconButton = wx.BitmapButton(self.tab_Profile, -1, wx.Bitmap(os.path.expanduser(path_to_icon), wx.BITMAP_TYPE_ANY), size=wx.Size(136,136), ) ### ### widgets for the SESSION tab ### - self.AutoStartSession = wx.CheckBox(self.tab_Session, -1, _(u"Start session automatically after login")) - self.AutoConnectSessionProfile = wx.CheckBox(self.tab_Session, -1, _(u"Login automatically after %s has started (needs --auto-connect)") % self._PyHocaGUI.appname) - self.SessionTypeLabel = wx.StaticText(self.tab_Session, -1, _(u"Type")+": ") - self.SessionType = wx.ComboBox(self.tab_Session, -1, choices=self.sessionChoices.values(), style=wx.CB_DROPDOWN|wx.CB_READONLY) - self.SessionTypeKDrive = wx.CheckBox(self.tab_Session, -1, _(u"Use X2Go KDrive graphical backend (experimental)")) - self.ApplicationLabel = wx.StaticText(self.tab_Session, -1, _(u"Application")+": ") - self.Application = wx.ComboBox(self.tab_Session, -1, choices=self.applicationChoices.values(), style=wx.CB_DROPDOWN|wx.CB_READONLY) - self.CommandLabel = wx.StaticText(self.tab_Session, -1, _(u"Custom command")+": ") + self.AutoStartSession = wx.CheckBox(self.tab_Session, -1, _("Start session automatically after login")) + self.AutoConnectSessionProfile = wx.CheckBox(self.tab_Session, -1, _("Login automatically after %s has started (needs --auto-connect)") % self._PyHocaGUI.appname) + self.SessionTypeLabel = wx.StaticText(self.tab_Session, -1, _("Type")+": ") + self.SessionType = wx.ComboBox(self.tab_Session, -1, choices=list(self.sessionChoices.values()), style=wx.CB_DROPDOWN|wx.CB_READONLY) + self.SessionTypeKDrive = wx.CheckBox(self.tab_Session, -1, _("Use X2Go KDrive graphical backend (experimental)")) + self.ApplicationLabel = wx.StaticText(self.tab_Session, -1, _("Application")+": ") + self.Application = wx.ComboBox(self.tab_Session, -1, choices=list(self.applicationChoices.values()), style=wx.CB_DROPDOWN|wx.CB_READONLY) + self.CommandLabel = wx.StaticText(self.tab_Session, -1, _("Custom command")+": ") self.Command = wx.TextCtrl(self.tab_Session, -1, "", ) - self.XDMCPServerLabel = wx.StaticText(self.tab_Session, -1, _(u"XDMCP server")+": ") + self.XDMCPServerLabel = wx.StaticText(self.tab_Session, -1, _("XDMCP server")+": ") self.XDMCPServer = wx.TextCtrl(self.tab_Session, -1, "", ) - self.RDPServerLabel = wx.StaticText(self.tab_Session, -1, _(u"RDP server")+": ") + self.RDPServerLabel = wx.StaticText(self.tab_Session, -1, _("RDP server")+": ") self.RDPServer = wx.TextCtrl(self.tab_Session, -1, "", ) - self.RDPOptionsLabel = wx.StaticText(self.tab_Session, -1, _(u"RDP options")+": ") + self.RDPOptionsLabel = wx.StaticText(self.tab_Session, -1, _("RDP options")+": ") self.RDPOptions = wx.TextCtrl(self.tab_Session, -1, "", ) - self.RootlessSession = wx.CheckBox(self.tab_Session, -1, _(u"Integrate remote application(s) into local desktop (rootless mode)")) - self.UsePublishedApplications = wx.CheckBox(self.tab_Session, -1, _(u"Menu of published applications")) + self.RootlessSession = wx.CheckBox(self.tab_Session, -1, _("Integrate remote application(s) into local desktop (rootless mode)")) + self.UsePublishedApplications = wx.CheckBox(self.tab_Session, -1, _("Menu of published applications")) self._last_pubapp_value = None self._last_auto_start_value = None ### ### widgets for the CONNECTION tab ### - self.UserNameLabel = wx.StaticText(self.tab_Connection, -1, _(u"User")+": ") + self.UserNameLabel = wx.StaticText(self.tab_Connection, -1, _("User")+": ") self.UserName = wx.TextCtrl(self.tab_Connection, -1, "", size=wx.Size(200,20)) - self.HostLabel = wx.StaticText(self.tab_Connection, -1, _(u"Host")+": ") + self.HostLabel = wx.StaticText(self.tab_Connection, -1, _("Host")+": ") self.Host = wx.TextCtrl(self.tab_Connection, -1, "", size=wx.Size(200,20)) - self.SSHPortLabel = wx.StaticText(self.tab_Connection, -1, _(u"Port")+": ") + self.SSHPortLabel = wx.StaticText(self.tab_Connection, -1, _("Port")+": ") self.SSHPort = wx.SpinCtrl(self.tab_Connection, -1, "22", min=1, max=65534) - self.SSHKeyFileLabel = wx.StaticText(self.tab_Connection, -1, _(u"Key")+": ") + self.SSHKeyFileLabel = wx.StaticText(self.tab_Connection, -1, _("Key")+": ") self.SSHKeyFile = wx.TextCtrl(self.tab_Connection, -1, style=wx.TE_PROCESS_ENTER) self.SSHKeyFileBrowseButton = wx.BitmapButton(self.tab_Connection, -1, wx.Bitmap('%s/PyHoca/16x16/system-search.png' % self._icons_location, wx.BITMAP_TYPE_ANY), size=wx.Size(self._textfield_height,self._textfield_height), ) - self.SSHAutoLogin = wx.CheckBox(self.tab_Connection, -1, _(u"Discover SSH keys or use SSH agent for X2Go authentication")) + self.SSHAutoLogin = wx.CheckBox(self.tab_Connection, -1, _("Discover SSH keys or use SSH agent for X2Go authentication")) if PARAMIKO_FEATURE['forward-ssh-agent']: - self.SSHForwardAuthAgent = wx.CheckBox(self.tab_Connection, -1, _(u"Enable forwarding of SSH authentication agent connections")) - self.UniqueHostKeyAliases = wx.CheckBox(self.tab_Connection, -1, _(u"Store SSH host keys under (unique) X2Go session profile ID")) - self.UseSSHProxy = wx.CheckBox(self.tab_Connection, -1, _(u"Server behind SSH proxy")) - self.SSHProxyUserLabel = wx.StaticText(self.tab_Connection, -1, _(u"User")+": ") + self.SSHForwardAuthAgent = wx.CheckBox(self.tab_Connection, -1, _("Enable forwarding of SSH authentication agent connections")) + self.UniqueHostKeyAliases = wx.CheckBox(self.tab_Connection, -1, _("Store SSH host keys under (unique) X2Go session profile ID")) + self.UseSSHProxy = wx.CheckBox(self.tab_Connection, -1, _("Server behind SSH proxy")) + self.SSHProxyUserLabel = wx.StaticText(self.tab_Connection, -1, _("User")+": ") self.SSHProxyUser = wx.TextCtrl(self.tab_Connection, -1, "", size=wx.Size(80,20)) - self.SSHProxySameUser = wx.CheckBox(self.tab_Connection, -1, _(u"Use same username for X2Go and proxy host")) - self.SSHProxySamePassword = wx.CheckBox(self.tab_Connection, -1, _(u"Use same authentication for X2Go and proxy host")) - self.SSHProxyKeyFileLabel = wx.StaticText(self.tab_Connection, -1, _(u"Key file")+": ") + self.SSHProxySameUser = wx.CheckBox(self.tab_Connection, -1, _("Use same username for X2Go and proxy host")) + self.SSHProxySamePassword = wx.CheckBox(self.tab_Connection, -1, _("Use same authentication for X2Go and proxy host")) + self.SSHProxyKeyFileLabel = wx.StaticText(self.tab_Connection, -1, _("Key file")+": ") self.SSHProxyKeyFile = wx.TextCtrl(self.tab_Connection, -1, style=wx.TE_PROCESS_ENTER) self.SSHProxyKeyFileBrowseButton = wx.BitmapButton(self.tab_Connection, -1, wx.Bitmap('%s/PyHoca/16x16/system-search.png' % self._icons_location, wx.BITMAP_TYPE_ANY), size=wx.Size(self._textfield_height,self._textfield_height), ) - self.SSHProxyHostLabel = wx.StaticText(self.tab_Connection, -1, _(u"Host")+": ") + self.SSHProxyHostLabel = wx.StaticText(self.tab_Connection, -1, _("Host")+": ") self.SSHProxyHost = wx.TextCtrl(self.tab_Connection, -1, "", size=wx.Size(80,20)) - self.SSHProxyPortLabel = wx.StaticText(self.tab_Connection, -1, _(u"Port")+": ") + self.SSHProxyPortLabel = wx.StaticText(self.tab_Connection, -1, _("Port")+": ") self.SSHProxyPort = 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.SSHProxyAutoLogin = wx.CheckBox(self.tab_Connection, -1, _("Discover SSH keys or use SSH agent for proxy authentication")) self.LinkSpeed = wx.Slider(self.tab_LinkQuality, -1, 0, 0, 4) - self.ModemLabel = wx.StaticText(self.tab_LinkQuality, -1, "|\n "+_(u"Modem"), style=wx.ALIGN_CENTRE) - self.ISDNLabel = wx.StaticText(self.tab_LinkQuality, -1, "|\n "+_(u"ISDN"), style=wx.ALIGN_CENTRE) - self.ADSLLabel = wx.StaticText(self.tab_LinkQuality, -1, "|\n"+_(u"ADSL"), style=wx.ALIGN_CENTRE) - self.WANLabel = wx.StaticText(self.tab_LinkQuality, -1, "|\n"+_(u"WAN"), style=wx.ALIGN_CENTRE) - self.LANLabel = wx.StaticText(self.tab_LinkQuality, -1, "|\n"+_(u"LAN"), style=wx.ALIGN_CENTRE) - - self.CompressionLabel = wx.StaticText(self.tab_LinkQuality, -1, _(u"Method")+": ") - self.Compression = wx.ComboBox(self.tab_LinkQuality, -1, choices=self.compressionChoices.values(), style=wx.CB_DROPDOWN) - self.ImageQualityLabel = wx.StaticText(self.tab_LinkQuality, -1, _(u"Image quality")+": ") + self.ModemLabel = wx.StaticText(self.tab_LinkQuality, -1, "|\n "+_("Modem"), style=wx.ALIGN_CENTRE) + self.ISDNLabel = wx.StaticText(self.tab_LinkQuality, -1, "|\n "+_("ISDN"), style=wx.ALIGN_CENTRE) + self.ADSLLabel = wx.StaticText(self.tab_LinkQuality, -1, "|\n"+_("ADSL"), style=wx.ALIGN_CENTRE) + self.WANLabel = wx.StaticText(self.tab_LinkQuality, -1, "|\n"+_("WAN"), style=wx.ALIGN_CENTRE) + self.LANLabel = wx.StaticText(self.tab_LinkQuality, -1, "|\n"+_("LAN"), style=wx.ALIGN_CENTRE) + + self.CompressionLabel = wx.StaticText(self.tab_LinkQuality, -1, _("Method")+": ") + self.Compression = wx.ComboBox(self.tab_LinkQuality, -1, choices=list(self.compressionChoices.values()), style=wx.CB_DROPDOWN) + self.ImageQualityLabel = wx.StaticText(self.tab_LinkQuality, -1, _("Image quality")+": ") self.ImageQuality = wx.SpinCtrl(self.tab_LinkQuality, -1, "9", min=0, max=9) ### ### wigdets for the IO tab ### - self.DisplayTypeFullscreen = wx.RadioButton(self.tab_IO, -1, _(u"Fullscreen"), style=wx.RB_GROUP) - self.DisplayTypeMaximize = wx.RadioButton(self.tab_IO, -1, _(u"Maximized")) - self.DisplayTypeCustom = wx.RadioButton(self.tab_IO, -1, _(u"Custom Size")+": ") + self.DisplayTypeFullscreen = wx.RadioButton(self.tab_IO, -1, _("Fullscreen"), style=wx.RB_GROUP) + self.DisplayTypeMaximize = wx.RadioButton(self.tab_IO, -1, _("Maximized")) + self.DisplayTypeCustom = wx.RadioButton(self.tab_IO, -1, _("Custom Size")+": ") self.ScreenWidthLabel = wx.StaticText(self.tab_IO, -1, '') self.ScreenWidth = wx.SpinCtrl(self.tab_IO, -1, "800", min=400, max=3000) self.ScreenHeightLabel = wx.StaticText(self.tab_IO, -1, "x") self.ScreenHeight = wx.SpinCtrl(self.tab_IO, -1, "600", min=500, max=3000) - self.SetDisplayDPI = wx.CheckBox(self.tab_IO, -1, _(u"Set display DPI")+": ") + self.SetDisplayDPI = wx.CheckBox(self.tab_IO, -1, _("Set display DPI")+": ") self.DisplayDPI = wx.SpinCtrl(self.tab_IO, -1, "96", min=32, max=512) - self.EnableXinerama = wx.CheckBox(self.tab_IO, -1, _(u"Xinerama extension (support for two or more physical displays)")) - self.ClipboardModeLabel = wx.StaticText(self.tab_IO, -1, _(u"Allow copy'n'paste")+": ") - self.ClipboardMode = wx.ComboBox(self.tab_IO, -1, choices=self.clipboardModeChoices.values(), style=wx.CB_DROPDOWN|wx.CB_READONLY) - self.DontSetKeyboard = wx.RadioButton(self.tab_IO, -1, label=_(u"Do not set (use server-side tools to configure the keyboard)"), style=wx.RB_GROUP) - self.AutoSetKeyboard = wx.RadioButton(self.tab_IO, -1, label=_(u"Automatically detect and use client-side keyboard configuration inside the session")) - self.CustomSetKeyboard = wx.RadioButton(self.tab_IO, -1, label=_(u"Use custom keyboard settings as provided below") + ": ") - self.KeyboardModelLabel = wx.StaticText(self.tab_IO, -1, _(u"Keyboard model")+": ") + self.EnableXinerama = wx.CheckBox(self.tab_IO, -1, _("Xinerama extension (support for two or more physical displays)")) + self.ClipboardModeLabel = wx.StaticText(self.tab_IO, -1, _("Allow copy'n'paste")+": ") + self.ClipboardMode = wx.ComboBox(self.tab_IO, -1, choices=list(self.clipboardModeChoices.values()), style=wx.CB_DROPDOWN|wx.CB_READONLY) + self.DontSetKeyboard = wx.RadioButton(self.tab_IO, -1, label=_("Do not set (use server-side tools to configure the keyboard)"), style=wx.RB_GROUP) + self.AutoSetKeyboard = wx.RadioButton(self.tab_IO, -1, label=_("Automatically detect and use client-side keyboard configuration inside the session")) + self.CustomSetKeyboard = wx.RadioButton(self.tab_IO, -1, label=_("Use custom keyboard settings as provided below") + ": ") + self.KeyboardModelLabel = wx.StaticText(self.tab_IO, -1, _("Keyboard model")+": ") self.KeyboardModel = wx.TextCtrl(self.tab_IO, -1, "") - self.KeyboardLayoutLabel = wx.StaticText(self.tab_IO, -1, _(u"Layout")+": ") + self.KeyboardLayoutLabel = wx.StaticText(self.tab_IO, -1, _("Layout")+": ") self.KeyboardLayout = wx.TextCtrl(self.tab_IO, -1, "") - self.KeyboardVariantLabel = wx.StaticText(self.tab_IO, -1, _(u"Layout variant")+": ") + self.KeyboardVariantLabel = wx.StaticText(self.tab_IO, -1, _("Layout variant")+": ") self.KeyboardVariant = wx.TextCtrl(self.tab_IO, -1, "") ### ### wigdets for the MEDIA tab ### - self.EnableSound = wx.CheckBox(self.tab_MediaResources, -1, _(u"Enable sound support")) - self.PulseAudio = wx.RadioButton(self.tab_MediaResources, -1, _(u"Pulse Audio"), style=wx.RB_GROUP) + self.EnableSound = wx.CheckBox(self.tab_MediaResources, -1, _("Enable sound support")) + self.PulseAudio = wx.RadioButton(self.tab_MediaResources, -1, _("Pulse Audio"), style=wx.RB_GROUP) # Arts daemon is not supported by PyHoca-GUI / Python X2Go as it is outdated. # However, config files can contain an Arts configuration, so we will honour this - self.Arts = wx.RadioButton(self.tab_MediaResources, -1, _(u"Arts (not supported)")) + self.Arts = wx.RadioButton(self.tab_MediaResources, -1, _("Arts (not supported)")) self.Arts.Enable(False) - self.Esd = wx.RadioButton(self.tab_MediaResources, -1, _(u"esd")) - self.DefaultSoundPort = wx.CheckBox(self.tab_MediaResources, -1, _(u"Use default sound port")) - self.SoundPortLabel = wx.StaticText(self.tab_MediaResources, -1, _(u"Custom sound port")+": ") + self.Esd = wx.RadioButton(self.tab_MediaResources, -1, _("esd")) + self.DefaultSoundPort = wx.CheckBox(self.tab_MediaResources, -1, _("Use default sound port")) + self.SoundPortLabel = wx.StaticText(self.tab_MediaResources, -1, _("Custom sound port")+": ") self.SoundPort = wx.SpinCtrl(self.tab_MediaResources, -1, "4713", min=23, max=64889) - self.ClientSidePrinting = wx.CheckBox(self.tab_MediaResources, -1, _(u"Client Side printing")) + self.ClientSidePrinting = wx.CheckBox(self.tab_MediaResources, -1, _("Client Side printing")) ### ### wigdets for the SHARING tab ### - self.UseLocalFolderSharing = wx.CheckBox(self.tab_SharedResources, -1, _(u"Use local folder sharing")) - self.RestoreSharedLocalFolders = wx.CheckBox(self.tab_SharedResources, -1, _(u"Store share list at end of session")) - self.SharedFolderPathLabel = wx.StaticText(self.tab_SharedResources, -1, _(u"Path")+": ") + self.UseLocalFolderSharing = wx.CheckBox(self.tab_SharedResources, -1, _("Use local folder sharing")) + self.RestoreSharedLocalFolders = wx.CheckBox(self.tab_SharedResources, -1, _("Store share list at end of session")) + self.SharedFolderPathLabel = wx.StaticText(self.tab_SharedResources, -1, _("Path")+": ") self.SharedFolderPath = wx.TextCtrl(self.tab_SharedResources, -1, "", style=wx.TE_PROCESS_ENTER) self.SharedFolderPathBrowseButton = wx.BitmapButton(self.tab_SharedResources, -1, wx.Bitmap('%s/PyHoca/16x16/system-search.png' % self._icons_location, wx.BITMAP_TYPE_ANY), size=wx.Size(self._textfield_height,self._textfield_height), ) - self.AddSharedFolderPathButton = wx.Button(self.tab_SharedResources, -1, _(u"Add")) + self.AddSharedFolderPathButton = wx.Button(self.tab_SharedResources, -1, _("Add")) self.SharedFoldersList = CheckListCtrl(self.tab_SharedResources) self.SharedFoldersList.InsertColumn(0, _("Local Path"), wx.LIST_FORMAT_LEFT) self.SharedFoldersList.InsertColumn(1, _("Connect Method"), wx.LIST_FORMAT_CENTER) - self.DeleteSharedFolderPathButton = wx.Button(self.tab_SharedResources, -1, _(u"Delete")) + self.DeleteSharedFolderPathButton = wx.Button(self.tab_SharedResources, -1, _("Delete")) - self.UseEncodingConverter = wx.CheckBox(self.tab_SharedResources, -1, _(u"Convert between client and server encodings")) - self.ClientEncodingLabel = wx.StaticText(self.tab_SharedResources, -1, _(u"Client encoding")+": ") + self.UseEncodingConverter = wx.CheckBox(self.tab_SharedResources, -1, _("Convert between client and server encodings")) + self.ClientEncodingLabel = wx.StaticText(self.tab_SharedResources, -1, _("Client encoding")+": ") self.ClientEncoding = wx.ComboBox(self.tab_SharedResources, -1, choices=_known_encodings, style=wx.CB_DROPDOWN|wx.CB_READONLY) - self.ServerEncodingLabel = wx.StaticText(self.tab_SharedResources, -1, _(u"Server encoding")+": ") + self.ServerEncodingLabel = wx.StaticText(self.tab_SharedResources, -1, _("Server encoding")+": ") self.ServerEncoding = wx.ComboBox(self.tab_SharedResources, -1, choices=_known_encodings, style=wx.CB_DROPDOWN|wx.CB_READONLY) - self.UseFileMIMEbox = wx.CheckBox(self.tab_SharedResources, -1, _(u"Use file MIME box for local file import")) - self.FileMIMEboxExtensionsLabel = wx.StaticText(self.tab_SharedResources, -1, _(u"Extensions")+": ") + self.UseFileMIMEbox = wx.CheckBox(self.tab_SharedResources, -1, _("Use file MIME box for local file import")) + self.FileMIMEboxExtensionsLabel = wx.StaticText(self.tab_SharedResources, -1, _("Extensions")+": ") self.FileMIMEboxExtensions = wx.TextCtrl(self.tab_SharedResources, -1, "", style=wx.TE_PROCESS_ENTER) - self.FileMIMEboxActionLabel = wx.StaticText(self.tab_SharedResources, -1, _(u"Action")+": ") - self.FileMIMEboxAction = wx.ComboBox(self.tab_SharedResources, -1, choices=self.mimeboxactionChoices.values(), style=wx.CB_DROPDOWN|wx.CB_READONLY) + self.FileMIMEboxActionLabel = wx.StaticText(self.tab_SharedResources, -1, _("Action")+": ") + self.FileMIMEboxAction = wx.ComboBox(self.tab_SharedResources, -1, choices=list(self.mimeboxactionChoices.values()), style=wx.CB_DROPDOWN|wx.CB_READONLY) if self.action == 'ADD': - self.OKButton = wx.Button(self, -1, _(u"Add")) - self.DefaultButton = wx.Button(self, -1, _(u'Defaults')) + self.OKButton = wx.Button(self, -1, _("Add")) + self.DefaultButton = wx.Button(self, -1, _('Defaults')) else: - self.OKButton = wx.Button(self, -1, _(u"Save")) - self.DefaultButton = wx.Button(self, -1, _(u'Reset')) - self.ApplyButton = wx.Button(self, -1, _(u"Apply")) - self.CancelButton = wx.Button(self, -1, _(u"Cancel")) + self.OKButton = wx.Button(self, -1, _("Save")) + self.DefaultButton = wx.Button(self, -1, _('Reset')) + self.ApplyButton = wx.Button(self, -1, _("Apply")) + self.CancelButton = wx.Button(self, -1, _("Cancel")) if self.session_profiles.is_mutable(self.profile_id): self.OKButton.SetDefault() elif self.action.startswith('ADD'): @@ -466,17 +466,17 @@ class PyHocaGUI_ProfileManager(wx.Dialog): """ if self.action == 'ADD': - self.SetTitle(_(u"%s Profile Manager - new profile") % self._PyHocaGUI.appname) + self.SetTitle(_("%s Profile Manager - new profile") % self._PyHocaGUI.appname) elif self.action == 'EDIT_CONNECTED': if self._PyHocaGUI.session_profiles.is_mutable(profile_id=self.profile_id): - self.SetTitle(_(u"%s Profile Manager - %s (connected)") % (self._PyHocaGUI.appname, self.profile_config['name'])) + self.SetTitle(_("%s Profile Manager - %s (connected)") % (self._PyHocaGUI.appname, self.profile_config['name'])) else: - self.SetTitle(_(u"%s Profile Manager - %s (connected, immutable)") % (self._PyHocaGUI.appname, self.profile_config['name'])) + self.SetTitle(_("%s Profile Manager - %s (connected, immutable)") % (self._PyHocaGUI.appname, self.profile_config['name'])) else: if self._PyHocaGUI.session_profiles.is_mutable(profile_id=self.profile_id): - self.SetTitle(_(u"%s Profile Manager - %s") % (self._PyHocaGUI.appname, self.profile_config['name'])) + self.SetTitle(_("%s Profile Manager - %s") % (self._PyHocaGUI.appname, self.profile_config['name'])) else: - self.SetTitle(_(u"%s Profile Manager - %s (immutable)") % (self._PyHocaGUI.appname, self.profile_config['name'])) + self.SetTitle(_("%s Profile Manager - %s (immutable)") % (self._PyHocaGUI.appname, self.profile_config['name'])) self.SetFont(wx.Font(9, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "")) self._textfield_height = 30 @@ -863,13 +863,13 @@ class PyHocaGUI_ProfileManager(wx.Dialog): self.tab_SharedResources.SetSizerAndFit(sizer_7) 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_IO, _(u"Input/Output")) - self.X2GoTabs.AddPage(self.tab_MediaResources, _(u"Media")) - self.X2GoTabs.AddPage(self.tab_SharedResources, _(u"Sharing")) + self.X2GoTabs.AddPage(self.tab_Profile, _("Profile")) + self.X2GoTabs.AddPage(self.tab_Session, _("Session")) + self.X2GoTabs.AddPage(self.tab_Connection, _("Connection")) + self.X2GoTabs.AddPage(self.tab_LinkQuality, _("Link Quality")) + self.X2GoTabs.AddPage(self.tab_IO, _("Input/Output")) + self.X2GoTabs.AddPage(self.tab_MediaResources, _("Media")) + self.X2GoTabs.AddPage(self.tab_SharedResources, _("Sharing")) # the bottom area with OK, Defaults and Cancel buttons sizer_B = wx.BoxSizer(wx.HORIZONTAL) @@ -915,7 +915,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog): self.SetSessionWindowTitle.SetValue(self.profile_config['setsessiontitle']) self.CustomSessionWindowTitle.SetValue(self.profile_config['sessiontitle']) - if type(self.profile_config['host']) is types.ListType: + if type(self.profile_config['host']) is list: self.Host.SetValue(",".join(self.profile_config['host'])) else: self.Host.SetValue(self.profile_config['host']) @@ -980,7 +980,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog): self.RootlessSession.Enable(False) self.UsePublishedApplications.SetValue(_published) - self.Application.SetItems(self.applicationChoices.values()) + self.Application.SetItems(list(self.applicationChoices.values())) self.SessionTypeKDrive.Enable(True) self.SessionTypeKDrive.SetValue(self.profile_config['kdrive']) # XFCE4 has been renamed to XFCE for 0.2.1.0 @@ -996,13 +996,13 @@ class PyHocaGUI_ProfileManager(wx.Dialog): self.AutoStartSession.SetValue(False) self.SessionTypeKDrive.Enable(False) self.SessionTypeKDrive.SetValue(False) - elif _command in self.sessionChoices.keys(): + elif _command in list(self.sessionChoices.keys()): self.SessionType.SetValue(self.sessionChoices[_command]) self.Application.SetValue('') self.Command.SetValue('') - if _command not in defaults.X2GO_DESKTOPSESSIONS.keys(): + if _command not in list(defaults.X2GO_DESKTOPSESSIONS.keys()): self.RootlessSession.SetValue(True) - elif _command in self.applicationChoices.keys(): + elif _command in list(self.applicationChoices.keys()): self.SessionType.SetValue(self.sessionChoices['APPLICATION']) self.ApplicationLabel.Enable(True) self.Application.Enable(True) @@ -1066,15 +1066,15 @@ class PyHocaGUI_ProfileManager(wx.Dialog): else: self.DontSetKeyboard.SetValue(True) if self.profile_config['type'] == 'auto': - self.KeyboardModel.SetValue(_(u'<xkbtype>')) - self.KeyboardLayout.SetValue(_(u'<xkblayout>')) - self.KeyboardVariant.SetValue(_(u'<xkbvariant>')) + self.KeyboardModel.SetValue(_('<xkbtype>')) + self.KeyboardLayout.SetValue(_('<xkblayout>')) + self.KeyboardVariant.SetValue(_('<xkbvariant>')) else: self.KeyboardModel.SetValue(self.profile_config['type']) self.KeyboardLayout.SetValue(self.profile_config['layout']) self.KeyboardVariant.SetValue(self.profile_config['variant']) - if self.profile_config['clipboard'] in self.clipboardModeChoices.keys(): + if self.profile_config['clipboard'] in list(self.clipboardModeChoices.keys()): self.ClipboardMode.SetValue(self.clipboardModeChoices[self.profile_config['clipboard']]) else: self.ClipboardMode.SetValue(self.clipboardModeChoices['both']) @@ -1209,7 +1209,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog): # self.profile_config['export'] = self.profile_config['export'].replace(',', ';') # strip off whitespaces and ";" from beginning and end of string - _shared_folders = self.profile_config['export'].keys() + _shared_folders = list(self.profile_config['export'].keys()) for _shared_folder_path in _shared_folders: @@ -1241,7 +1241,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog): self.staticbox_FileMIMEbox.Enable(False) self.FileMIMEboxExtensions.SetValue(self.profile_config['mimeboxextensions']) - if self.profile_config['mimeboxaction'] in self.mimeboxactionChoices.keys(): + if self.profile_config['mimeboxaction'] in list(self.mimeboxactionChoices.keys()): self.FileMIMEboxAction.SetValue(self.mimeboxactionChoices[self.profile_config['mimeboxaction']]) else: self.FileMIMEboxAction.SetValue(self.mimeboxactionChoices['OPEN']) @@ -1249,7 +1249,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog): self.disable_EditConnected_options() - self._last_session_type = [ i for i in self.sessionChoices.keys() if self.sessionChoices[i] == self.SessionType.GetValue() ][0] + self._last_session_type = [ i for i in list(self.sessionChoices.keys()) if self.sessionChoices[i] == self.SessionType.GetValue() ][0] def _toggle_DisplayProperties(self): """\ @@ -1358,7 +1358,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog): """ self.profile_config['name'] = self.ProfileName.GetValue() self.profile_config['setsessiontitle'] = self.SetSessionWindowTitle.GetValue() - _session_type = [ s for s in self.sessionChoices.keys() if self.sessionChoices[s] == self.SessionType.GetValue() ][0] + _session_type = [ s for s in list(self.sessionChoices.keys()) if self.sessionChoices[s] == self.SessionType.GetValue() ][0] self.profile_config['kdrive'] = self.SessionTypeKDrive.GetValue() if self.UseDefaultSessionWindowTitle.GetValue(): self.profile_config['sessiontitle'] = '' @@ -1402,10 +1402,10 @@ class PyHocaGUI_ProfileManager(wx.Dialog): else: self.profile_config['sshproxykeyfile'] = self.SSHProxyKeyFile.GetValue() - self.profile_config['applications'] = self.applicationChoices.keys() + self.profile_config['applications'] = list(self.applicationChoices.keys()) self.profile_config['directrdp'] = False if _session_type == 'APPLICATION': - _command = [ a for a in self.applicationChoices.keys() if self.applicationChoices[a] == self.Application.GetValue() ][0] + _command = [ a for a in list(self.applicationChoices.keys()) if self.applicationChoices[a] == self.Application.GetValue() ][0] self.profile_config['rootless'] = True elif _session_type == 'CUSTOM': _command = self.Command.GetValue() @@ -1423,7 +1423,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog): self.profile_config['directrdp'] = True self.profile_config['directrdpsettings'] = self.RDPOptions.GetValue() self.profile_config['rdpport'] = self.SSHPort.GetValue() - self.profile_config['rdpclient'] = [ rc for rc in self.rdpclientChoices.keys() if self.rdpclientChoices[rc] == self.Application.GetValue() ][0] + self.profile_config['rdpclient'] = [ rc for rc in list(self.rdpclientChoices.keys()) if self.rdpclientChoices[rc] == self.Application.GetValue() ][0] elif _session_type == 'PUBLISHEDAPPLICATIONS': _command = "" self.profile_config['rootless'] = True @@ -1451,7 +1451,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog): self.profile_config['xinerama'] = self.EnableXinerama.GetValue() - self.profile_config['clipboard'] = [ m for m in self.clipboardModeChoices.keys() if self.clipboardModeChoices[m] == self.ClipboardMode.GetValue() ][0] + self.profile_config['clipboard'] = [ m for m in list(self.clipboardModeChoices.keys()) if self.clipboardModeChoices[m] == self.ClipboardMode.GetValue() ][0] self.profile_config['usekbd'] = self.CustomSetKeyboard.GetValue() or self.AutoSetKeyboard.GetValue() self.profile_config['type'] = self.AutoSetKeyboard.GetValue() and "auto" or self.KeyboardModel.GetValue() @@ -1484,7 +1484,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog): _item_id = self.SharedFoldersList.GetNextItem(_item_id) if _shared_folders: - self.profile_config['export'] = '"' + ';'.join([ '%s:%s' % (_sf,int(_shared_folders[_sf])) for _sf in _shared_folders.keys() ]) + ';"' + self.profile_config['export'] = '"' + ';'.join([ '%s:%s' % (_sf,int(_shared_folders[_sf])) for _sf in list(_shared_folders.keys()) ]) + ';"' else: self.profile_config['export'] = '' self.profile_config['useiconv'] = self.UseEncodingConverter.GetValue() @@ -1502,7 +1502,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog): _normalized_exts.append(_ext) self.profile_config['mimeboxextensions'] = ','.join(_normalized_exts) try: - _mimebox_action = [ a for a in self.mimeboxactionChoices.keys() if self.mimeboxactionChoices[a] == self.FileMIMEboxAction.GetValue() ][0] + _mimebox_action = [ a for a in list(self.mimeboxactionChoices.keys()) if self.mimeboxactionChoices[a] == self.FileMIMEboxAction.GetValue() ][0] except IndexError: _mimebox_action = 'OPEN' self.profile_config['mimeboxaction'] = _mimebox_action @@ -1537,10 +1537,10 @@ class PyHocaGUI_ProfileManager(wx.Dialog): iconsdir = self._icons_location if not os.path.exists(iconsdir): iconsdir = os.getcwd() - wildcard = _(u"Icon Files (*.png)|*.png|" \ - u"All files (*.*)|*") + wildcard = _("Icon Files (*.png)|*.png|" \ + "All files (*.*)|*") dlg = wx.FileDialog( - self, message=_(u"Choose an icon for this session profile"), defaultDir=iconsdir, + self, message=_("Choose an icon for this session profile"), defaultDir=iconsdir, defaultFile="", wildcard=wildcard, style=wx.FD_OPEN | wx.FD_CHANGE_DIR ) # Show the dialog and retrieve the user response. If it is the OK response, # process the data. @@ -1646,9 +1646,9 @@ class PyHocaGUI_ProfileManager(wx.Dialog): # only one host address supported self.RDPServer.SetValue(_hosts.split(',')[0]) self.RDPOptions.SetValue(self.profile_config_bak['directrdpsettings']) - if self.Application.GetValue() in self.applicationChoices.keys(): + if self.Application.GetValue() in list(self.applicationChoices.keys()): self._last_application = self.Application.GetValue() - self.Application.SetItems(self.rdpclientChoices.values()) + self.Application.SetItems(list(self.rdpclientChoices.values())) self.Application.SetValue(self._last_rdpclient) self.Application.Enable(True) @@ -1702,9 +1702,9 @@ class PyHocaGUI_ProfileManager(wx.Dialog): self.tab_SharedResources.Enable(True) self.RDPServer.SetValue(self.profile_config_bak['rdpserver']) self.RDPOptions.SetValue(self.profile_config_bak['rdpoptions']) - if self.Application.GetValue() in self.rdpclientChoices.keys(): + if self.Application.GetValue() in list(self.rdpclientChoices.keys()): self._last_rdpclient = self.Application.GetValue() - self.Application.SetItems(self.applicationChoices.values()) + self.Application.SetItems(list(self.applicationChoices.values())) self.Application.SetValue(self._last_application) def OnSessionTypeSelected(self, event): @@ -1715,7 +1715,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog): @type event: C{obj} """ - _session_type = [ i for i in self.sessionChoices.keys() if self.sessionChoices[i] == self.SessionType.GetValue() ][0] + _session_type = [ i for i in list(self.sessionChoices.keys()) if self.sessionChoices[i] == self.SessionType.GetValue() ][0] if self._last_session_type == 'SHADOW': self.EnableSound.SetValue(self.profile_config_bak['sound']) @@ -1757,11 +1757,11 @@ class PyHocaGUI_ProfileManager(wx.Dialog): self.UsePublishedApplications.Enable(True) self.AutoStartSession.Enable(True) - if _session_type in defaults.X2GO_DESKTOPSESSIONS.keys(): + if _session_type in list(defaults.X2GO_DESKTOPSESSIONS.keys()): self.RootlessSession.SetValue(False) self.RootlessSession.Enable(False) self.SessionTypeKDrive.Enable(True) - if _session_type in defaults.X2GO_DESKTOPSESSIONS_KDRIVE_PREFERRED.keys(): + if _session_type in list(defaults.X2GO_DESKTOPSESSIONS_KDRIVE_PREFERRED.keys()): self.SessionTypeKDrive.SetValue(True) else: self.SessionTypeKDrive.SetValue(False) @@ -1994,7 +1994,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog): @type event: C{obj} """ - if [ k for k in self.sessionChoices.keys() if self.sessionChoices[k] == self.SessionType.GetValue() ][0] == 'DirectRDP': + if [ k for k in list(self.sessionChoices.keys()) if self.sessionChoices[k] == self.SessionType.GetValue() ][0] == 'DirectRDP': self.RDPServer.SetValue(self.Host.GetValue().split(',')[0]) def OnSSHKeyFileBrowse(self, event): @@ -2008,9 +2008,9 @@ class PyHocaGUI_ProfileManager(wx.Dialog): sshdir = os.path.expanduser('~/.ssh') if not os.path.exists(sshdir): sshdir = os.getcwd() - wildcard = _(u"All files (*.*)|*") + wildcard = _("All files (*.*)|*") dlg = wx.FileDialog( - self, message=_(u"Choose a public SSH key"), defaultDir=sshdir, + self, message=_("Choose a public SSH key"), defaultDir=sshdir, defaultFile="", wildcard=wildcard, style=wx.FD_OPEN | wx.FD_CHANGE_DIR ) # Show the dialog and retrieve the user response. If it is the OK response, # process the data. @@ -2034,7 +2034,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog): sshdir = os.getcwd() wildcard = "All files (*.*)|*" dlg = wx.FileDialog( - self, message=_(u"Choose a public SSH key"), defaultDir=sshdir, + self, message=_("Choose a public SSH key"), defaultDir=sshdir, defaultFile="", wildcard=wildcard, style=wx.FD_OPEN | wx.FD_CHANGE_DIR ) # Show the dialog and retrieve the user response. If it is the OK response, # process the data. @@ -2207,7 +2207,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog): @type event: C{obj} """ - _session_type = [ i for i in self.sessionChoices.keys() if self.sessionChoices[i] == self.SessionType.GetValue() ][0] + _session_type = [ i for i in list(self.sessionChoices.keys()) if self.sessionChoices[i] == self.SessionType.GetValue() ][0] if self.EnableSound.GetValue(): self.PulseAudio.Enable(True) if _session_type != 'DirectRDP': @@ -2368,7 +2368,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog): if not os.path.exists(shared_folder): shared_folder = os.getcwd() dlg = wx.DirDialog( - self, message=_(u"Choose a folder to share within a session"), style=1, defaultPath=shared_folder, ) + self, message=_("Choose a folder to share within a session"), style=1, defaultPath=shared_folder, ) # Show the dialog and retrieve the user response. If it is the OK response, # process the data. if dlg.ShowModal() == wx.ID_OK: @@ -2496,13 +2496,13 @@ class PyHocaGUI_ProfileManager(wx.Dialog): validateOk = True if len(self.profile_config['name'].strip()) == 0: validateOk = False - self._PyHocaGUI.notifier.send(title=_(u'Profile Manager'), text=_(u'Profile name is missing, profile unusable!!!'), icon='profile_error') + self._PyHocaGUI.notifier.send(title=_('Profile Manager'), text=_('Profile name is missing, profile unusable!!!'), icon='profile_error') elif self.profile_config['name'].strip() in self.session_profiles.profile_names and self.action == 'ADD': 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') + self._PyHocaGUI.notifier.send(title=_('Profile Manager'), text=_('Profile name %s already exists!!!') % self.profile_config['name'].strip(), icon='profile_error') elif self.profile_config['name'].strip() != self.profile_config_bak['name'] and self.profile_config['name'].strip() 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') + self._PyHocaGUI.notifier.send(title=_('Profile Manager'), text=_('Profile name %s already exists!!!') % self.profile_config['name'].strip(), icon='profile_error') return validateOk def OnApplyButton(self, event): @@ -2522,7 +2522,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog): if self.action in ('ADD', 'COPY'): self.profile_id = self.session_profiles.add_profile(**self.profile_config) else: - for k in self.profile_config.keys(): + for k in list(self.profile_config.keys()): self.session_profiles.update_value(self.profile_id, k, self.profile_config[k]) self.session_profiles.write_user_config = True @@ -2530,13 +2530,13 @@ class PyHocaGUI_ProfileManager(wx.Dialog): self.profile_id = self.session_profiles.to_profile_id(self.profile_config['name']) if self.action == 'ADD': - self._PyHocaGUI.notifier.send(title=_(u'%s - profile added') % self.profile_config['name'], - text=_(u'A new session profile has been added.'), + self._PyHocaGUI.notifier.send(title=_('%s - profile added') % self.profile_config['name'], + text=_('A new session profile has been added.'), icon='profile_add', ) elif self.action == 'EDIT': - self._PyHocaGUI.notifier.send(title=_(u'%s - modified') % self.profile_config['name'], - text=_(u'Changes to profile have been saved.'), + self._PyHocaGUI.notifier.send(title=_('%s - modified') % self.profile_config['name'], + text=_('Changes to profile have been saved.'), icon='profile_save', ) self._PyHocaGUI.register_available_server_sessions_by_profile_name(profile_name=self.profile_config['name'], re_register=True) diff --git a/pyhoca/wxgui/serverinfo.py b/pyhoca/wxgui/serverinfo.py index 29b0f5c..37dc915 100644 --- a/pyhoca/wxgui/serverinfo.py +++ b/pyhoca/wxgui/serverinfo.py @@ -30,7 +30,7 @@ import os # PyHoca-GUI modules # ... NONE ... -if os.environ.has_key('DESKTOP_SESSION'): +if 'DESKTOP_SESSION' in os.environ: WINDOW_MANAGER = os.environ['DESKTOP_SESSION'] else: WINDOW_MANAGER = 'generic' @@ -59,15 +59,15 @@ class PyHocaGUI_DialogBoxServerInfo(wx.Dialog): wx.Dialog.__init__(self, None, id=-1, title=profile_name, style=wx.DEFAULT_FRAME_STYLE, ) self._PyHocaGUI._sub_windows.append(self) - self.SetTitle(_(u'Server Information - %s') % profile_name) + self.SetTitle(_('Server Information - %s') % profile_name) - self.titleLbl = wx.StaticText(self, wx.ID_ANY, _(u'Session Profile: %s\n\nList of X2Go Server components, add-ons and their versions...') % self.current_profile_name, size=(-1, -1)) + self.titleLbl = wx.StaticText(self, wx.ID_ANY, _('Session Profile: %s\n\nList of X2Go Server components, add-ons and their versions...') % self.current_profile_name, size=(-1, -1)) self.infoArea = wx.TextCtrl(self, id=-1, value="", size=(520,300), style=wx.TE_READONLY|wx.TE_MULTILINE|wx.SUNKEN_BORDER) ID_REFRESH = wx.NewId() - self.refreshBtn = wx.Button(self, ID_REFRESH, _(u'Refresh'), ) - self.cancelBtn = wx.Button(self, wx.ID_CANCEL, _(u'Close'), ) + self.refreshBtn = wx.Button(self, ID_REFRESH, _('Refresh'), ) + self.cancelBtn = wx.Button(self, wx.ID_CANCEL, _('Close'), ) self.Bind(wx.EVT_BUTTON, self.OnRefreshServerInfo, self.refreshBtn) self.Bind(wx.EVT_BUTTON, self.OnCancel, self.cancelBtn) @@ -128,34 +128,34 @@ class PyHocaGUI_DialogBoxServerInfo(wx.Dialog): def _refreshServerInfo(self): server_components = self._PyHocaGUI.get_server_components(self.current_profile_name, force=True) - server_extensions = [ k for k in server_components.keys() if k.startswith('x2goserver-') and k != 'x2goserver-common' ] + server_extensions = [ k for k in list(server_components.keys()) if k.startswith('x2goserver-') and k != 'x2goserver-common' ] server_extensions.sort() - server_addons = [ k for k in server_components.keys() if not k.startswith('x2goserver') and k != 'x2goagent' ] + server_addons = [ k for k in list(server_components.keys()) if not k.startswith('x2goserver') and k != 'x2goagent' ] server_addons.sort() server_features = self._PyHocaGUI.get_server_features(self.current_profile_name, force=True) halftab = ' ' newline = '\n' - self.infoArea.AppendText(_(u'X2Go Server')+':'+2*newline) - self.infoArea.AppendText(halftab+_(u'Server Core')+':'+newline) + self.infoArea.AppendText(_('X2Go Server')+':'+2*newline) + self.infoArea.AppendText(halftab+_('Server Core')+':'+newline) self.infoArea.AppendText(newline) self.infoArea.AppendText(2*halftab+'%s (%s)\n' % ('x2goserver', server_components['x2goserver'])) - if 'x2goserver-common' in server_components.keys(): + if 'x2goserver-common' in list(server_components.keys()): self.infoArea.AppendText(2*halftab+'%s (%s)\n' % ('x2goserver-common', server_components['x2goserver-common'])) self.infoArea.AppendText(2*halftab+'%s (%s)\n' % ('x2goagent', server_components['x2goagent'])) self.infoArea.AppendText('\n') if server_extensions: - self.infoArea.AppendText(halftab+_(u'Server Extensions')+':'+newline) + self.infoArea.AppendText(halftab+_('Server Extensions')+':'+newline) self.infoArea.AppendText(newline) for comp in server_extensions: self.infoArea.AppendText(2*halftab+'%s (%s)\n' % (comp, server_components[comp])) self.infoArea.AppendText('\n') if server_addons: - self.infoArea.AppendText(_(u'X2Go Server Add-ons')+':'+2*newline) + self.infoArea.AppendText(_('X2Go Server Add-ons')+':'+2*newline) for comp in server_addons: self.infoArea.AppendText(2*halftab+'%s (%s)\n' % (comp, server_components[comp])) self.infoArea.AppendText('\n') - self.infoArea.AppendText(_(u'X2Go Server Features')+':'+2*newline) + self.infoArea.AppendText(_('X2Go Server Features')+':'+2*newline) for feature in server_features: self.infoArea.AppendText(2*halftab+'%s\n' % (feature)) self.infoArea.ShowPosition(0) diff --git a/pyhoca/wxgui/sessiontitle.py b/pyhoca/wxgui/sessiontitle.py index ad3cc98..86adb5b 100644 --- a/pyhoca/wxgui/sessiontitle.py +++ b/pyhoca/wxgui/sessiontitle.py @@ -30,7 +30,7 @@ import os # PyHoca-GUI modules # ... NONE ... -if os.environ.has_key('DESKTOP_SESSION'): +if 'DESKTOP_SESSION' in os.environ: WINDOW_MANAGER = os.environ['DESKTOP_SESSION'] else: WINDOW_MANAGER = 'generic' @@ -63,13 +63,13 @@ class PyHocaGUI_DialogBoxSessionTitle(wx.Dialog): wx.Dialog.__init__(self, None, id=-1, title=profile_name, style=wx.DEFAULT_FRAME_STYLE, ) self._PyHocaGUI._sub_windows.append(self) - self.SetTitle(_(u'Session Title - %s') % profile_name) + self.SetTitle(_('Session Title - %s') % profile_name) - self.titleLbl = wx.StaticText(self, wx.ID_ANY, _(u'Change session title to')+':', size=(-1, -1)) + self.titleLbl = wx.StaticText(self, wx.ID_ANY, _('Change session title to')+':', size=(-1, -1)) self.titleTxt = wx.TextCtrl(self, wx.ID_ANY, '', style=wx.TE_PROCESS_ENTER, size=(120, -1)) - self.okBtn = wx.Button(self, wx.ID_OK, _(u'OK'), ) + self.okBtn = wx.Button(self, wx.ID_OK, _('OK'), ) self.okBtn.SetDefault() - self.cancelBtn = wx.Button(self, wx.ID_CANCEL, _(u'Cancel'), ) + self.cancelBtn = wx.Button(self, wx.ID_CANCEL, _('Cancel'), ) self.Bind(wx.EVT_BUTTON, self.OnOk, self.okBtn) self.Bind(wx.EVT_TEXT_ENTER, self.OnOk, self.titleTxt) diff --git a/pyhoca/wxgui/splash.py b/pyhoca/wxgui/splash.py index 684188d..c741560 100644 --- a/pyhoca/wxgui/splash.py +++ b/pyhoca/wxgui/splash.py @@ -23,7 +23,7 @@ import wx import os # PyHoca-GUI modules -import basepath +from . import basepath class PyHocaGUI_SplashScreen(wx.SplashScreen): """\ diff --git a/pyhoca/wxgui/taskbar.py b/pyhoca/wxgui/taskbar.py index 51eea5b..23eeab1 100644 --- a/pyhoca/wxgui/taskbar.py +++ b/pyhoca/wxgui/taskbar.py @@ -35,8 +35,8 @@ if x2go.X2GOCLIENT_OS == 'Windows': import win32gui # PyHoca-GUI modules -import menus_taskbar -import basepath +from . import menus_taskbar +from . import basepath def MakeIcon(icon_name, fallback_name='PyHoca-GUI_trayicon.png', appname="PyHoca-GUI"): @@ -116,11 +116,11 @@ class PyHocaGUI_TaskBarIcon(wx.TaskBarIcon): if x2go.X2GOCLIENT_OS == 'Windows': icon_name = self._PyHocaGUI.tray_icon_connecting or self._PyHocaGUI.tray_icon self.icon = MakeIcon(icon_name=icon_name, appname=self._PyHocaGUI.appname) - self.SetIcon(self.icon, _(u"%s\nConnecting you to ,,%s\'\'") % (self._PyHocaGUI.appname, profile_name)) + self.SetIcon(self.icon, _("%s\nConnecting you to ,,%s\'\'") % (self._PyHocaGUI.appname, profile_name)) else: icon_name = self._PyHocaGUI.tray_icon_connecting or self._PyHocaGUI.tray_icon self.icon = MakeIcon(icon_name=icon_name, appname=self._PyHocaGUI.appname) - self.SetIcon(self.icon, _(u"%s\nCurrently connecting you to remote X2Go server ,,%s\'\'") % (self._PyHocaGUI.appname, profile_name)) + self.SetIcon(self.icon, _("%s\nCurrently connecting you to remote X2Go server ,,%s\'\'") % (self._PyHocaGUI.appname, profile_name)) def SetIconIdle(self): """\ @@ -130,11 +130,11 @@ class PyHocaGUI_TaskBarIcon(wx.TaskBarIcon): if x2go.X2GOCLIENT_OS == 'Windows': icon_name = self._PyHocaGUI.tray_icon self.icon = MakeIcon(icon_name=icon_name, appname=self._PyHocaGUI.appname) - self.SetIcon(self.icon, _(u"%s\nConnecting you to X2Go...") % self._PyHocaGUI.appname) + self.SetIcon(self.icon, _("%s\nConnecting you to X2Go...") % self._PyHocaGUI.appname) else: icon_name = self._PyHocaGUI.tray_icon self.icon = MakeIcon(icon_name=icon_name, appname=self._PyHocaGUI.appname) - self.SetIcon(self.icon, _(u"%s\nClient for connecting you to a remote X2Go server") % self._PyHocaGUI.appname) + self.SetIcon(self.icon, _("%s\nClient for connecting you to a remote X2Go server") % self._PyHocaGUI.appname) def CreateSessionManagerPopupMenu(self, evt): """\ diff --git a/setup.py b/setup.py index 841254b..1ca7b1e 100755 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # vim:fenc=utf-8 @@ -35,7 +35,7 @@ PROGRAM_DESC_SHORT = '%s is a graphical X2Go client.' % PROGRAM_NAME # silence pyflakes with assigning a dummy version here... the real __VERSION__ assignment happens below __VERSION__ = '0.0.0.0' -for line in file(os.path.join('pyhoca', 'wxgui', '__init__.py')).readlines(): +for line in open(os.path.join('pyhoca', 'wxgui', '__init__.py'), 'r').readlines(): if (line.startswith('__VERSION__')): exec(line.strip()) if platform.system() == 'Windows': @@ -194,9 +194,9 @@ class build_installer(object): self.dist_dir, UNINSTALL_ICON ) - print "*** creating the NSIS setup script***" + print("*** creating the NSIS setup script***") script.create() - print "*** compiling the NSIS setup script***" + print("*** compiling the NSIS setup script***") script.compile() @@ -211,7 +211,7 @@ class build_installer_py2exe(build_installer, py2exe): # First, let py2exe do it's work. py2exe.run(self) -class build_installer_bbfreeze(build_installer, Freezer, Command): +class build_installer_bbfreeze(build_installer, Command, Freezer): user_options = [ ('dist-dir=', 'd', @@ -255,7 +255,7 @@ class build_installer_bbfreeze(build_installer, Freezer, Command): self.setIcon('pixmaps/pyhoca-gui.ico') Freezer.__call__(self) if self.distribution.has_data_files(): - print "*** copy data files ***" + print("*** copy data files ***") install_data = self.reinitialize_command('install_data') install_data.install_dir = self.dist_dir install_data.ensure_finalized() -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/pyhoca-gui.git
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@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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository pyhoca-gui. commit fa352bca6b3e422af069a8a258235351a0626f36 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Mon Dec 2 10:27:43 2019 +0100 Port to wxPython 4.0.x. --- pyhoca/wxgui/about.py | 7 ++++++- pyhoca/wxgui/frontend.py | 43 +++++++++++++++++++++++++------------------ pyhoca/wxgui/launcher.py | 6 ++++-- pyhoca/wxgui/menus_taskbar.py | 32 +++++++++++++++++++++++++++++++- pyhoca/wxgui/splash.py | 26 ++++++++++++++++++-------- pyhoca/wxgui/taskbar.py | 20 ++++++++++++++++---- 6 files changed, 100 insertions(+), 34 deletions(-) diff --git a/pyhoca/wxgui/about.py b/pyhoca/wxgui/about.py index ceadb65..414d5e5 100644 --- a/pyhoca/wxgui/about.py +++ b/pyhoca/wxgui/about.py @@ -29,6 +29,8 @@ import x2go # wxPython import wx +wx_major = int(wx.__version__.split('.')[0]) + # PyHoca-GUI modules from . import basepath @@ -114,7 +116,10 @@ class PyHocaGUI_AboutFrame(wx.Frame): icon_file = '%s/%s/%s/%s' % (basepath.icons_basepath, icon_folder, icon_size, icon_name) img = wx.Image(icon_file) - icon = wx.IconFromBitmap(img.ConvertToBitmap()) + if wx_major < 4: + icon = wx.IconFromBitmap(img.ConvertToBitmap()) + else: + icon = wx.Icon(img.ConvertToBitmap()) self.icon = self.SetIcon(icon) self.CenterOnScreen() diff --git a/pyhoca/wxgui/frontend.py b/pyhoca/wxgui/frontend.py index e65b227..dfc1e76 100644 --- a/pyhoca/wxgui/frontend.py +++ b/pyhoca/wxgui/frontend.py @@ -23,6 +23,7 @@ modules ={} import os import re +import sys # Python X2Go import x2go @@ -51,7 +52,9 @@ from . import sessiontitle from . import listdesktops from . import serverinfo -wx.SetDefaultPyEncoding("utf-8") +wx_major = int(wx.__version__.split('.')[0]) +if wx_major < 4: + wx.SetDefaultPyEncoding("utf-8") #def SetExitHandler(func): # """\ @@ -276,11 +279,11 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): gevent.sleep(self.gevent_sleep_when_idle) except KeyboardInterrupt: self._pyhoca_logger('Received Ctrl-C keyboard interrupt... Wait till %s has exited cleanly.' % self.appname, loglevel=x2go.loglevel_NOTICE) - self.WakeUpIdle() + if wx_major < 4: self.WakeUpIdle() self.ExitMainLoop() except SystemExit: self._pyhoca_logger('Received SIGTERM signal... Wait till %s has exited cleanly.' % self.appname, loglevel=x2go.loglevel_NOTICE) - self.WakeUpIdle() + if wx_major < 4: self.WakeUpIdle() self.ExitMainLoop() evt.RequestMore() return True @@ -319,8 +322,12 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): self.about_pythonx2go.Show(False) self.taskbar = taskbar.PyHocaGUI_TaskBarIcon(self.about) - self.taskbar.Bind(wx.EVT_TASKBAR_LEFT_DCLICK, lambda _Show: self.about.Show(True)) - self.taskbar.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self.taskbar.CreateSessionManagerPopupMenu) + if wx_major < 4: + self.taskbar.Bind(wx.EVT_TASKBAR_LEFT_DCLICK, lambda _Show: self.about.Show(True)) + self.taskbar.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self.taskbar.CreateSessionManagerPopupMenu) + else: + self.taskbar.Bind(wx.adv.EVT_TASKBAR_LEFT_DCLICK, lambda _Show: self.about.Show(True)) + self.taskbar.Bind(wx.adv.EVT_TASKBAR_LEFT_DOWN, self.taskbar.CreateSessionManagerPopupMenu) if x2go.X2GOCLIENT_OS in ('Linux', 'Mac'): if notify.notification_service_available(): @@ -450,7 +457,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): Currently unused. """ - self.WakeUpIdle() + if wx_major < 4: self.WakeUpIdle() self.ExitMainLoop() # wx.App's OnExit method @@ -499,7 +506,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): else: self.notifier.send(self.appname, _('Exiting application...'), icon='application-exit', timeout=10000) self._eventid_profilenames_map[evt.GetId()] = self.args.session_profile - self.WakeUpIdle() + if wx_major < 4: self.WakeUpIdle() self.ExitMainLoop() def _init_pubapp_session(self, session_uuid=None, profile_name=None): @@ -791,7 +798,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): raise if connect_failed and self.exit_on_disconnect: - self.WakeUpIdle() + if wx_major < 4: self.WakeUpIdle() self.ExitMainLoop() self._remember_shared_folders[profile_name] = self.get_profile_config(profile_name, 'restoreexports') @@ -1132,7 +1139,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): if self.exit_on_disconnect: self._pyhoca_logger('Exiting %s because %s got disconnected.' % (self.appname, profile_name), loglevel=x2go.loglevel_NOTICE) - self.WakeUpIdle() + if wx_major < 4: self.WakeUpIdle() self.ExitMainLoop() else: self.notifier.send(_('%s - disconnect') % profile_name, _('X2Go Profile is now disconnected.'), icon='auth_disconnect', timeout=4000) @@ -1616,7 +1623,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): except KeyError: pass if self.exit_on_disconnect: - self.WakeUpIdle() + if wx_major < 4: self.WakeUpIdle() self.ExitMainLoop() def HOOK_on_failing_SFTP_client(self, profile_name='UNKNOWN', **kwargs): @@ -1634,7 +1641,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): except KeyError: pass if self.exit_on_disconnect: - self.WakeUpIdle() + if wx_major < 4: self.WakeUpIdle() self.ExitMainLoop() def HOOK_session_startup_failed(self, profile_name='UNKNOWN', **kwargs): @@ -1647,7 +1654,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): """ self.notifier.send(_('%s - session failure') % profile_name, _('The session startup failed.'), icon='session_error', timeout=10000) if self.exit_on_disconnect: - self.WakeUpIdle() + if wx_major < 4: self.WakeUpIdle() self.ExitMainLoop() def session_registration_failed(self, profile_name='UNKNOWN', **kwargs): @@ -1660,7 +1667,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): """ self.notifier.send(_('%s - session failure') % profile_name, _('The session initialization failed.'), icon='session_error', timeout=10000) if self.exit_on_disconnect: - self.WakeUpIdle() + if wx_major < 4: self.WakeUpIdle() self.ExitMainLoop() def HOOK_desktop_sharing_denied(self, profile_name='UNKNOWN', **kwargs): @@ -1673,7 +1680,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): """ self.notifier.send(_('%s - desktop sharing failure') % profile_name, _('Desktop sharing was denied by the other user or\nboth of you have insufficient privileges to share one another\'s desktop.'), icon='session_error', timeout=10000) if self.exit_on_disconnect: - self.WakeUpIdle() + if wx_major < 4: self.WakeUpIdle() self.ExitMainLoop() def HOOK_list_desktops_timeout(self, profile_name='UNKNOWN', **kwargs): @@ -1698,7 +1705,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): """ self.notifier.send(_('%s - desktop sharing failed') % profile_name, _('The desktop %s is not available for sharing (anymore).') % desktop, icon='session_warning', timeout=10000) if self.exit_on_disconnect: - self.WakeUpIdle() + if wx_major < 4: self.WakeUpIdle() self.ExitMainLoop() def HOOK_no_such_command(self, cmd, profile_name='UNKNOWN', session_name='UNKNOWN', **kwargs): @@ -1718,7 +1725,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): else: self.notifier.send(_('%s - session failure') % profile_name, _('The command ,,%s\'\' is not available on X2Go server\n%s.') % (cmd, session_name), icon='session_error', timeout=10000) if self.exit_on_disconnect: - self.WakeUpIdle() + if wx_major < 4: self.WakeUpIdle() self.ExitMainLoop() def HOOK_rforward_request_denied(self, profile_name='UNKNOWN', session_name='UNKNOWN', server_port=0, **kwargs): @@ -1735,7 +1742,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): """ self.notifier.send(_('%s - session warning') % profile_name, _('Reverse TCP port forwarding request for session %s to server port %s has been denied.') % (session_name, server_port), icon='session_warning', timeout=10000) if self.exit_on_disconnect: - self.WakeUpIdle() + if wx_major < 4: self.WakeUpIdle() self.ExitMainLoop() def HOOK_forwarding_tunnel_setup_failed(self, profile_name='UNKNOWN', session_name='UNKNOWN', chain_host='UNKNOWN', chain_port=0, subsystem=None, **kwargs): @@ -1770,7 +1777,7 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): except ValueError: pass if self.exit_on_disconnect: - self.WakeUpIdle() + if wx_major < 4: self.WakeUpIdle() self.ExitMainLoop() def HOOK_pulseaudio_not_supported_in_RDPsession(self, **kwargs): diff --git a/pyhoca/wxgui/launcher.py b/pyhoca/wxgui/launcher.py index 91e2d94..3cbd4ad 100644 --- a/pyhoca/wxgui/launcher.py +++ b/pyhoca/wxgui/launcher.py @@ -31,6 +31,8 @@ import copy import wx +wx_major = int(wx.__version__.split('.')[0]) + # we need to register a wx.App() instance before we load any # of the X2Go modules. When importing x2go.*, gevent.monkey_patch_all() # is called which seems to break wxPython 3.0... @@ -403,11 +405,11 @@ VERSION: %s thisPyHocaGUI.MainLoop() except KeyboardInterrupt: if thisPyHocaGUI is not None: - thisPyHocaGUI.WakeUpIdle() + if wx_major < 4: thisPyHocaGUI.WakeUpIdle() thisPyHocaGUI.ExitMainLoop() except SystemExit: if thisPyHocaGUI is not None: - thisPyHocaGUI.WakeUpIdle() + if wx_major < 4: thisPyHocaGUI.WakeUpIdle() thisPyHocaGUI.ExitMainLoop() self.remove_pidfile() diff --git a/pyhoca/wxgui/menus_taskbar.py b/pyhoca/wxgui/menus_taskbar.py index c0b1519..93bee28 100644 --- a/pyhoca/wxgui/menus_taskbar.py +++ b/pyhoca/wxgui/menus_taskbar.py @@ -29,6 +29,14 @@ import x2go.x2go_exceptions from . import basepath +wx_major = int(wx.__version__.split('.')[0]) + +def _legacy_wrap_AppendMenu(instance, *args, **kwargs): + if wx_major < 4: + return wx.Menu.AppendMenu(instance, *args, **kwargs) + else: + return wx.Menu.Append(instance, *args, **kwargs) + class PyHocaGUI_Menu_TaskbarManageProfile(wx.Menu): """\ Individual profile management submenu: copy, use as template or delete session profile. @@ -84,6 +92,12 @@ class PyHocaGUI_Menu_TaskbarManageProfile(wx.Menu): self.Append(ID_DELETEPROFILE, _("Delete Profile")) self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnProfileDelete, id=ID_DELETEPROFILE) + def AppendMenu(self, *args, **kwargs): + if wx_major < 4: + return wx.Menu.AppendMenu(self, *args, **kwargs) + else: + return wx.Menu.Append(self, *args, **kwargs) + class PyHocaGUI_Menu_TaskbarOptionsManager(wx.Menu): """\ @@ -170,6 +184,9 @@ class PyHocaGUI_Menu_TaskbarOptionsManager(wx.Menu): self.Append(ID_EXIT, _("E&xit")) self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnTaskbarExit, id=ID_EXIT) + def AppendMenu(self, *args, **kwargs): + _legacy_wrap_AppendMenu(self, *args, **kwargs) + class PyHocaGUI_Menu_TaskbarSessionActions(wx.Menu): """\ @@ -310,6 +327,9 @@ class PyHocaGUI_Menu_TaskbarSessionActions(wx.Menu): self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnSessionSuspend, id=ID_SUSPENDSESSION) self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnSessionTerminate, id=ID_TERMINATESESSION) + def AppendMenu(self, *args, **kwargs): + _legacy_wrap_AppendMenu(self, *args, **kwargs) + class PyHocaGUI_Menu_TaskbarProfileSharedFolders(wx.Menu): """\ @@ -425,6 +445,9 @@ class PyHocaGUI_Menu_LaunchSingleApplication(wx.Menu): self.Append(_app_id, _available_applications[application]) self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnApplicationStart, id=_app_id) + def AppendMenu(self, *args, **kwargs): + _legacy_wrap_AppendMenu(self, *args, **kwargs) + def _generate_Menu_PublishedApplications(_PyHocaGUI, caller=None, profile_name=None, session_name=None): """\ @@ -861,6 +884,9 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu): self.Append(ID_EXIT, _("E&xit")) self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnTaskbarExit, id=ID_EXIT) + def AppendMenu(self, *args, **kwargs): + _legacy_wrap_AppendMenu(self, *args, **kwargs) + class PyHocaGUI_Menu_TaskbarProfileNames(wx.Menu): """\ @@ -1019,6 +1045,9 @@ class PyHocaGUI_Menu_TaskbarProfileNames(wx.Menu): self._pyhoca_logger('Updating UI, re-enabling session profile %s' % profile_name) self.Enable(id=evt.GetId(), enable=True) + def AppendMenu(self, *args, **kwargs): + _legacy_wrap_AppendMenu(self, *args, **kwargs) + class PyHocaGUI_Menu_TaskbarSessionManager(wx.Menu): """\ @@ -1086,4 +1115,5 @@ class PyHocaGUI_Menu_TaskbarSessionManager(wx.Menu): self.Append(ID_EXIT, _("E&xit")) self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnTaskbarExit, id=ID_EXIT) - + def AppendMenu(self, *args, **kwargs): + _legacy_wrap_AppendMenu(self, *args, **kwargs) diff --git a/pyhoca/wxgui/splash.py b/pyhoca/wxgui/splash.py index c741560..46c202d 100644 --- a/pyhoca/wxgui/splash.py +++ b/pyhoca/wxgui/splash.py @@ -22,10 +22,20 @@ import wx import os +wx_major = int(wx.__version__.split('.')[0]) +if wx_major < 4: + from wx import SplashScreen as _SplashScreen + _wx_SPLASH_CENTRE_ON_SCREEN = wx.SPLASH_CENTRE_ON_SCREEN + _wx_SPLASH_TIMEOUT = wx.SPLASH_TIMEOUT +else: + from wx.adv import SplashScreen as _SplashScreen + _wx_SPLASH_CENTRE_ON_SCREEN = wx.adv.SPLASH_CENTRE_ON_SCREEN + _wx_SPLASH_TIMEOUT = wx.adv.SPLASH_TIMEOUT + # PyHoca-GUI modules from . import basepath -class PyHocaGUI_SplashScreen(wx.SplashScreen): +class PyHocaGUI_SplashScreen(_SplashScreen): """\ L{PyHocaGUI} splash screen that gets shown an application startup. @@ -57,13 +67,13 @@ class PyHocaGUI_SplashScreen(wx.SplashScreen): splash_wximage.Rescale(400, int(float(400)/splash_wximage.Width*splash_wximage.Height)) splash_wxbitmap = splash_wximage.ConvertToBitmap() - wx.SplashScreen.__init__(self, - splash_wxbitmap, - splashStyle=wx.SPLASH_CENTRE_ON_SCREEN|wx.SPLASH_TIMEOUT, - milliseconds=5000, - parent=None, - style=wx.SIMPLE_BORDER|wx.STAY_ON_TOP|wx.FRAME_NO_TASKBAR - ) + _SplashScreen.__init__(self, + splash_wxbitmap, + splashStyle=_wx_SPLASH_CENTRE_ON_SCREEN|_wx_SPLASH_TIMEOUT, + milliseconds=5000, + parent=None, + style=wx.SIMPLE_BORDER|wx.STAY_ON_TOP|wx.FRAME_NO_TASKBAR + ) self.Bind(wx.EVT_CLOSE, self.OnClose) def OnClose(self, evt): diff --git a/pyhoca/wxgui/taskbar.py b/pyhoca/wxgui/taskbar.py index 23eeab1..5985979 100644 --- a/pyhoca/wxgui/taskbar.py +++ b/pyhoca/wxgui/taskbar.py @@ -25,6 +25,12 @@ modules ={} import x2go import wx +wx_major = int(wx.__version__.split('.')[0]) +if wx_major < 4: + from wx import TaskBarIcon as _TaskBarIcon +else: + from wx.adv import TaskBarIcon as _TaskBarIcon + import os # Warning: If pyflakes says you should delete these 2 lines, @@ -77,11 +83,14 @@ def MakeIcon(icon_name, fallback_name='PyHoca-GUI_trayicon.png', appname="PyHoca icon_file = '%s/%s/%s/%s' % (_icons_location, icon_folder, icon_size, fallback_name) img = wx.Image(icon_file) - icon = wx.IconFromBitmap(img.ConvertToBitmap()) + if wx_major < 4: + icon = wx.IconFromBitmap(img.ConvertToBitmap()) + else: + icon = wx.Icon(img.ConvertToBitmap()) return icon -class PyHocaGUI_TaskBarIcon(wx.TaskBarIcon): +class PyHocaGUI_TaskBarIcon(_TaskBarIcon): """\ Class for the L{PyHocaGUI} taskbar icon. @@ -96,7 +105,7 @@ class PyHocaGUI_TaskBarIcon(wx.TaskBarIcon): @type about: C{obj} """ - wx.TaskBarIcon.__init__(self) + _TaskBarIcon.__init__(self) self._PyHocaGUI = about._PyHocaGUI self._pyhoca_logger = self._PyHocaGUI._pyhoca_logger self._pyhoca_logger('start TaskBarIcon of type: %s' % (wx.PlatformInfo, ), loglevel=x2go.loglevel_INFO) @@ -175,7 +184,10 @@ class PyHocaGUI_TaskBarIcon(wx.TaskBarIcon): @rtype: C{obj} """ - self.menu_optionsmanager = self.PopupMenu(menus_taskbar.PyHocaGUI_Menu_TaskbarOptionsManager(self._PyHocaGUI, caller=self,)) + if wx_major < 4: + self.menu_optionsmanager = self.PopupMenu(menus_taskbar.PyHocaGUI_Menu_TaskbarOptionsManager(self._PyHocaGUI, caller=self,)) + else: + self.menu_optionsmanager = menus_taskbar.PyHocaGUI_Menu_TaskbarOptionsManager(self._PyHocaGUI, caller=self,) return self.menu_optionsmanager def Close(self): -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/pyhoca-gui.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository pyhoca-gui. commit d0f9cc3e5d46dda41d0c7e548685f27ae7c86d07 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Mon Dec 2 17:08:23 2019 +0100 pyhoca/wxgui/{logon.py,passphrase.py}: Merge code of both files into one, break up circular import dependency. --- pyhoca/wxgui/frontend.py | 1 - pyhoca/wxgui/logon.py | 343 ++++++++++++++++++++++++++++++++++++++++- pyhoca/wxgui/passphrase.py | 375 --------------------------------------------- 3 files changed, 339 insertions(+), 380 deletions(-) diff --git a/pyhoca/wxgui/frontend.py b/pyhoca/wxgui/frontend.py index dfc1e76..a45b317 100644 --- a/pyhoca/wxgui/frontend.py +++ b/pyhoca/wxgui/frontend.py @@ -40,7 +40,6 @@ import locale from . import about from . import logon from . import brokerlogon -from . import passphrase from . import taskbar from . import profilemanager from . import printingprefs diff --git a/pyhoca/wxgui/logon.py b/pyhoca/wxgui/logon.py index f35d0ea..9853299 100644 --- a/pyhoca/wxgui/logon.py +++ b/pyhoca/wxgui/logon.py @@ -26,18 +26,19 @@ import x2go # gevent import gevent +import gevent.monkey +gevent.monkey.patch_all() import wx import os - -# PyHoca-GUI modules -from . import passphrase +import base64 if 'DESKTOP_SESSION' in os.environ: WINDOW_MANAGER = os.environ['DESKTOP_SESSION'] else: WINDOW_MANAGER = 'generic' + class PyHocaGUI_DialogBoxPassword(wx.Dialog): """\ Logon window for L{PyHocaGUI}. @@ -320,7 +321,7 @@ class PyHocaGUI_DialogBoxPassword(wx.Dialog): except KeyError: pass self._pyhoca_logger('SSH private key file (for SSH proxy) is encrypted and requires a passphrase', loglevel=x2go.log.loglevel_INFO, ) - _passphrase_window = passphrase.PyHocaGUI_DialogBoxPassphrase(self._PyHocaGUI, self.current_profile_name, caller=self, password=password, sshproxy_auth=True, key_filename=key_filename) + _passphrase_window = PyHocaGUI_DialogBoxPassphrase(self._PyHocaGUI, self.current_profile_name, caller=self, password=password, sshproxy_auth=True, key_filename=key_filename) self._PyHocaGUI._logon_windows[self.current_profile_name] = _passphrase_window except x2go.AuthenticationException: @@ -514,3 +515,337 @@ class PyHocaGUI_DialogBoxPassword(wx.Dialog): except ValueError: pass wx.Dialog.Destroy(self) + + +class PyHocaGUI_DialogBoxPassphrase(wx.Dialog): + """\ + SSH key passphrase window for L{PyHocaGUI}. + + """ + def __init__(self, _PyHocaGUI, profile_name, caller=None, password=None, sshproxy_auth=False, sshproxy_passphrase=None, key_filename=None): + """\ + Passphrase window (constructor) + + @param _PyHocaGUI: main application instance + @type _PyHocaGUI: C{obj} + @param profile_name: name of session profile that defines the server we authenticate against + @type profile_name: C{str} + @param caller: unused + @type caller: C{None} + + """ + self._PyHocaGUI = _PyHocaGUI + self._PyHocaGUI.gevent_sleep_when_idle = 0.1 + self._pyhoca_logger = self._PyHocaGUI._pyhoca_logger + self._pyhoca_logger('SSH key passphrase dialog box started', loglevel=x2go.loglevel_INFO, ) + + self.current_profile_name = profile_name + self.current_profile_config = self._PyHocaGUI.session_profiles.get_profile_config(profile_name) + + if sshproxy_auth: + wx.Dialog.__init__(self, None, id=-1, title=_('%s (SSH proxy)') % profile_name, style=wx.DEFAULT_FRAME_STYLE, ) + else: + wx.Dialog.__init__(self, None, id=-1, title=_('%s (X2Go Server)') % profile_name, style=wx.DEFAULT_FRAME_STYLE, ) + + self._PyHocaGUI._sub_windows.append(self) + + self.password = password + self.key_filename = key_filename + self.sshproxy_auth = sshproxy_auth + self.sshproxy_passphrase = sshproxy_passphrase + + if self.key_filename: + keyfilenameLbl = wx.StaticText(self, wx.ID_ANY, _('Unlock SSH private key (%s)...') % key_filename) + else: + keyfilenameLbl = wx.StaticText(self, wx.ID_ANY, _('Unlock auto-discovered SSH private key...')) + + self.passphraseLbl = wx.StaticText(self, wx.ID_ANY, _('Passphrase')+':', size=(-1, -1)) + self.passphraseTxt = wx.TextCtrl(self, wx.ID_ANY, '', style=wx.TE_PROCESS_ENTER|wx.TE_PASSWORD, size=(120, -1)) + self.passphraseTxt.SetFocus() + self.unlockBtn = wx.Button(self, wx.ID_OK, _('Unlock SSH key'), ) + self.unlockBtn.SetDefault() + + _tab_order = [] + + self.cancelBtn = wx.Button(self, wx.ID_CANCEL, _('Cancel'), ) + + _tab_order.extend([self.passphraseTxt, self.unlockBtn, self.cancelBtn, ]) + + self.Bind(wx.EVT_BUTTON, self.OnPassphrase, self.unlockBtn) + self.Bind(wx.EVT_TEXT_ENTER, self.OnPassphrase, self.passphraseTxt) + self.Bind(wx.EVT_BUTTON, self.OnCancel, self.cancelBtn) + + btnSizer = wx.BoxSizer(wx.HORIZONTAL) + credSizer = wx.GridBagSizer(hgap=1, vgap=1) + mainSizer = wx.BoxSizer(wx.VERTICAL) + + credSizer.Add(self.passphraseLbl, pos=(0,0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=5) + credSizer.Add(self.passphraseTxt, pos=(0,1), flag=wx.ALL, border=5) + + btnSizer.Add(self.unlockBtn, 0, wx.ALL, 5) + btnSizer.Add(self.cancelBtn, 0, wx.ALL, 5) + + mainSizer.Add(keyfilenameLbl, 0, wx.ALL|wx.ALIGN_LEFT, 5) + mainSizer.Add(credSizer, 0, wx.ALL|wx.ALIGN_CENTER, 5) + mainSizer.Add(btnSizer, 0, wx.ALL|wx.ALIGN_RIGHT, 5) + + # Logged in variable + self.loggedIn = False + + self.SetSizerAndFit(mainSizer) + self.Layout() + + for i in range(len(_tab_order) - 1): + _tab_order[i+1].MoveAfterInTabOrder(_tab_order[i]) + + maxX, maxY = wx.GetDisplaySize() + + if self._PyHocaGUI.logon_window_position_x and self._PyHocaGUI.logon_window_position_y: + + # allow positioning of logon window via command line option + if self._PyHocaGUI.logon_window_position_x < 0: + move_x = maxX - (self.GetSize().GetWidth() + self._PyHocaGUI.logon_window_position_x) + else: + move_x = self._PyHocaGUI.logon_window_position_x + if self._PyHocaGUI.logon_window_position_y < 0: + move_y = maxX - (self.GetSize().GetHeight() + self._PyHocaGUI.logon_window_position_y) + else: + move_y = self._PyHocaGUI.logon_window_position_y + + elif (x2go.X2GOCLIENT_OS == 'Linux') and (WINDOW_MANAGER in ('gnome', 'gnome-fallback', 'awesome', 'mate', 'ubuntu', 'ubuntu-2d', 'openbox-gnome', )): + + # automatically place logon Window for GNOME, awesome + move_x = maxX - (self.GetSize().GetWidth() + 20) + move_y = 35 + + else: + + # automatically place logon Window for KDE4, LXDE, etc. + move_x = maxX - (self.GetSize().GetWidth() + 20) + move_y = maxY - (self.GetSize().GetHeight() + 70) + + self.Move((move_x, move_y)) + self.Show() + + def OnPassphrase(self, evt): + """\ + If the user clicks ,,Ok'' in the passphrase window. + + @param evt: event + @type evt: C{obj} + + """ + password = None + passphrase = None + force_password_auth = False + sshproxy_force_password_auth = False + if self.sshproxy_auth and self.password: + password = self.password + sshproxy_passphrase = self.passphraseTxt.GetValue() + force_password_auth = True + elif self.sshproxy_auth: + passphrase = sshproxy_passphrase = self.passphraseTxt.GetValue() + else: + passphrase = self.passphraseTxt.GetValue() + try: + sshproxy_passphrase = base64.b64decode(self.sshproxy_passphrase) + except TypeError: + sshproxy_passphrase = None + + try: + b64_passphrase = base64.b64encode(passphrase) + except TypeError: + b64_passphrase = None + + connect_failed = False + + wx.BeginBusyCursor() + session_uuid = self._PyHocaGUI._X2GoClient__client_registered_sessions_of_profile_name(self.current_profile_name)[0] + + try: + self._PyHocaGUI._X2GoClient__connect_session(session_uuid, + password=password, + passphrase=passphrase, + sshproxy_passphrase=sshproxy_passphrase, + force_password_auth=force_password_auth, + sshproxy_force_password_auth=sshproxy_force_password_auth, + add_to_known_hosts=self._PyHocaGUI.add_to_known_hosts, + ) + self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, + title=_('%s - connect') % self.current_profile_name, + text=_('Authentication has been successful.'), + icon='auth_success') + + except x2go.PasswordRequiredException: + if self.sshproxy_auth: + key_filename = '' + try: + if not self._PyHocaGUI._X2GoClient__get_session(session_uuid).control_params['look_for_keys']: + key_filename = self._PyHocaGUI._X2GoClient__get_session(session_uuid).control_params['key_filename'] + except KeyError: + pass + self._pyhoca_logger('SSH private key file is encrypted and requires a passphrase', loglevel=x2go.log.loglevel_INFO, ) + _passphrase_window = PyHocaGUI_DialogBoxPassphrase(self._PyHocaGUI, self.current_profile_name, caller=self, sshproxy_passphrase=b64_passphrase, key_filename=key_filename) + self._PyHocaGUI._logon_windows[self.current_profile_name] = _passphrase_window + + else: + self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, + title=_('%s - connect failure') % self.current_profile_name, + text=_('SSH key file (for X2Go server) could not be unlocked!'), + icon='auth_failed') + connect_failed = True + + except x2go.X2GoSSHProxyPasswordRequiredException: + self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, + title=_('%s - connect failure') % self.current_profile_name, + text=_('SSH key file (for SSH proxy) could not be unlocked!'), + icon='auth_failed') + connect_failed = True + + except x2go.AuthenticationException: + self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, + title=_('%s - connect failure') % self.current_profile_name, + text=_('Authentication failed!'), + icon='auth_failed') + connect_failed = True + + except x2go.X2GoSSHProxyAuthenticationException: + self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, + title=_('%s - connect failure') % self.current_profile_name, + text=_('Authentication to the SSH proxy server failed!'), + icon='auth_failed') + connect_failed = True + + except gevent.socket.error as e: + self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, + title=_('%s - socket error') % self.current_profile_name, + text=e.strerror + '!', + icon='auth_error') + connect_failed = True + + except x2go.X2GoHostKeyException as e: + self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, + title=_('%s - host key error') % self.current_profile_name, + text=_('The remote server\'s host key is invalid or has not been accepted by the user') + '!', + icon='auth_error', + timeout=4000) + connect_failed = True + + except x2go.X2GoRemoteHomeException as e: + self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, + title=_('%s - missing home directory') % self.current_profile_name, + text=_("The remote user's home directory does not exist."), + icon='auth_error', + timeout=4000) + connect_failed = True + + except x2go.X2GoSSHProxyException as e: + if str(e).startswith('Two-factor authentication requires a password'): + self._pyhoca_logger('SSH proxy host requests two-factor authentication', loglevel=x2go.loglevel_NOTICE) + _logon_window = logon.PyHocaGUI_DialogBoxPassword(self._PyHocaGUI, self.current_profile_name, + caller=self, + passphrase=passphrase, + sshproxy_passphrase=sshproxy_passphrase, + sshproxy_auth=True, + sshproxy_twofactor_auth=True, + ) + self._PyHocaGUI._logon_windows[self.current_profile_name] = _logon_window + else: + if str(e).startswith('Host key for server ') and str(e).endswith(' does not match!'): + errmsg = _('Host key verification failed. The X2Go server may have been compromised.\n\nIt is also possible that the host key has just been changed.\n\nHowever, for security reasons the connection will not be established!!!') + else: + errmsg = str(e) + self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, + title=_('%s - key error') % self.current_profile_name, + text='%s!' % errmsg, + icon='auth_error', + timeout=4000) + connect_failed = True + + except x2go.X2GoSessionException as e: + self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, + title=_('%s - auth error') % self.current_profile_name, + text='%s!' % str(e), + icon='auth_error', + timeout=4000) + connect_failed = True + + except x2go.SSHException as e: + if str(e).startswith('Two-factor authentication requires a password'): + self._pyhoca_logger('X2Go Server requests two-factor authentication', loglevel=x2go.loglevel_NOTICE) + _logon_window = logon.PyHocaGUI_DialogBoxPassword(self._PyHocaGUI, self.current_profile_name, + caller=self, + passphrase=passphrase, + sshproxy_passphrase=sshproxy_passphrase, + sshproxy_auth=False, + twofactor_auth=True, + ) + self._PyHocaGUI._logon_windows[self.current_profile_name] = _logon_window + else: + if str(e).startswith('Host key for server ') and str(e).endswith(' does not match!'): + errmsg = _('Host key verification failed. The X2Go server may have been compromised.\n\nIt is also possible that the host key has just been changed.\n\nHowever, for security reasons the connection will not be established!!!') + else: + errmsg = str(e) + + self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, + title=_('%s - SSH error') % self.current_profile_name, + text='%s' % errmsg, + icon='auth_error', + timeout=10000) + connect_failed = True + + except: + self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, + title=_('%s - unknown error') % self.current_profile_name, + text=_('An unknown error occured during authentication!'), + icon='auth_error') + connect_failed = True + if self._PyHocaGUI.args.debug or self._PyHocaGUI.args.libdebug or ('PYHOCAGUI_DEVELOPMENT' in os.environ and os.environ['PYHOCAGUI_DEVELOPMENT'] == '1'): + raise + + self._PyHocaGUI.notifier.send(self.current_profile_name, context='AUTH_%s' % self.current_profile_name, timeout=4000) + + wx.SetCursor(wx.StockCursor(wx.CURSOR_ARROW)) + # Windows's GUI is more picky then Linux's GTK GUI about EndBusyCursor if cursor is not busy... + try: wx.EndBusyCursor() + except: pass + + if connect_failed and self._PyHocaGUI.exit_on_disconnect: + self._PyHocaGUI.WakeUpIdle() + self._PyHocaGUI.ExitMainLoop() + + if self._PyHocaGUI._X2GoClient__is_session_connected(session_uuid): + self._PyHocaGUI._post_authenticate(evt, session_uuid) + self.sshproxy_started = False + try: del self._PyHocaGUI._logon_windows[self.current_profile_name] + except KeyError: pass + + self.Close() + self.Destroy() + + def OnCancel(self, evt): + """ + If the user clicks ,,Cancel'' in the logon window. + + @param evt: event + @type evt: C{obj} + + """ + self.Close() + self.Destroy() + + def Destroy(self): + """ + Tidy up some stuff in the main application instance when the logon window gets destroyed. + + """ + self._PyHocaGUI.gevent_sleep_when_idle = 0.25 + try: + self._PyHocaGUI._sub_windows.remove(self) + except ValueError: + pass + try: + self._PyHocaGUI._temp_disabled_profile_names.remove(self.current_profile_name) + except ValueError: + pass + wx.Dialog.Destroy(self) diff --git a/pyhoca/wxgui/passphrase.py b/pyhoca/wxgui/passphrase.py deleted file mode 100644 index efa3229..0000000 --- a/pyhoca/wxgui/passphrase.py +++ /dev/null @@ -1,375 +0,0 @@ -# -*- coding: utf-8 -*- -# vim:fenc=utf-8 - -# Copyright (C) 2010-2019 by Mike Gabriel <mike.gabriel@das-netzwerkteam.de> -# Copyright (C) 2010-2016 by Dick Kniep <dick.kniep@lindix.nl> -# -# PyHoca GUI is free software; you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# PyHoca GUI is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program; if not, write to the -# Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - -modules ={} - -# Python X2Go -import x2go - -# gevent -import gevent -import gevent.monkey -gevent.monkey.patch_all() - -import wx -import os -import base64 - -# PyHoca-GUI modules -from . import logon - -if 'DESKTOP_SESSION' in os.environ: - WINDOW_MANAGER = os.environ['DESKTOP_SESSION'] -else: - WINDOW_MANAGER = 'generic' - -class PyHocaGUI_DialogBoxPassphrase(wx.Dialog): - """\ - SSH key passphrase window for L{PyHocaGUI}. - - """ - def __init__(self, _PyHocaGUI, profile_name, caller=None, password=None, sshproxy_auth=False, sshproxy_passphrase=None, key_filename=None): - """\ - Passphrase window (constructor) - - @param _PyHocaGUI: main application instance - @type _PyHocaGUI: C{obj} - @param profile_name: name of session profile that defines the server we authenticate against - @type profile_name: C{str} - @param caller: unused - @type caller: C{None} - - """ - self._PyHocaGUI = _PyHocaGUI - self._PyHocaGUI.gevent_sleep_when_idle = 0.1 - self._pyhoca_logger = self._PyHocaGUI._pyhoca_logger - self._pyhoca_logger('SSH key passphrase dialog box started', loglevel=x2go.loglevel_INFO, ) - - self.current_profile_name = profile_name - self.current_profile_config = self._PyHocaGUI.session_profiles.get_profile_config(profile_name) - - if sshproxy_auth: - wx.Dialog.__init__(self, None, id=-1, title=_('%s (SSH proxy)') % profile_name, style=wx.DEFAULT_FRAME_STYLE, ) - else: - wx.Dialog.__init__(self, None, id=-1, title=_('%s (X2Go Server)') % profile_name, style=wx.DEFAULT_FRAME_STYLE, ) - - self._PyHocaGUI._sub_windows.append(self) - - self.password = password - self.key_filename = key_filename - self.sshproxy_auth = sshproxy_auth - self.sshproxy_passphrase = sshproxy_passphrase - - if self.key_filename: - keyfilenameLbl = wx.StaticText(self, wx.ID_ANY, _('Unlock SSH private key (%s)...') % key_filename) - else: - keyfilenameLbl = wx.StaticText(self, wx.ID_ANY, _('Unlock auto-discovered SSH private key...')) - - self.passphraseLbl = wx.StaticText(self, wx.ID_ANY, _('Passphrase')+':', size=(-1, -1)) - self.passphraseTxt = wx.TextCtrl(self, wx.ID_ANY, '', style=wx.TE_PROCESS_ENTER|wx.TE_PASSWORD, size=(120, -1)) - self.passphraseTxt.SetFocus() - self.unlockBtn = wx.Button(self, wx.ID_OK, _('Unlock SSH key'), ) - self.unlockBtn.SetDefault() - - _tab_order = [] - - self.cancelBtn = wx.Button(self, wx.ID_CANCEL, _('Cancel'), ) - - _tab_order.extend([self.passphraseTxt, self.unlockBtn, self.cancelBtn, ]) - - self.Bind(wx.EVT_BUTTON, self.OnPassphrase, self.unlockBtn) - self.Bind(wx.EVT_TEXT_ENTER, self.OnPassphrase, self.passphraseTxt) - self.Bind(wx.EVT_BUTTON, self.OnCancel, self.cancelBtn) - - btnSizer = wx.BoxSizer(wx.HORIZONTAL) - credSizer = wx.GridBagSizer(hgap=1, vgap=1) - mainSizer = wx.BoxSizer(wx.VERTICAL) - - credSizer.Add(self.passphraseLbl, pos=(0,0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=5) - credSizer.Add(self.passphraseTxt, pos=(0,1), flag=wx.ALL, border=5) - - btnSizer.Add(self.unlockBtn, 0, wx.ALL, 5) - btnSizer.Add(self.cancelBtn, 0, wx.ALL, 5) - - mainSizer.Add(keyfilenameLbl, 0, wx.ALL|wx.ALIGN_LEFT, 5) - mainSizer.Add(credSizer, 0, wx.ALL|wx.ALIGN_CENTER, 5) - mainSizer.Add(btnSizer, 0, wx.ALL|wx.ALIGN_RIGHT, 5) - - # Logged in variable - self.loggedIn = False - - self.SetSizerAndFit(mainSizer) - self.Layout() - - for i in range(len(_tab_order) - 1): - _tab_order[i+1].MoveAfterInTabOrder(_tab_order[i]) - - maxX, maxY = wx.GetDisplaySize() - - if self._PyHocaGUI.logon_window_position_x and self._PyHocaGUI.logon_window_position_y: - - # allow positioning of logon window via command line option - if self._PyHocaGUI.logon_window_position_x < 0: - move_x = maxX - (self.GetSize().GetWidth() + self._PyHocaGUI.logon_window_position_x) - else: - move_x = self._PyHocaGUI.logon_window_position_x - if self._PyHocaGUI.logon_window_position_y < 0: - move_y = maxX - (self.GetSize().GetHeight() + self._PyHocaGUI.logon_window_position_y) - else: - move_y = self._PyHocaGUI.logon_window_position_y - - elif (x2go.X2GOCLIENT_OS == 'Linux') and (WINDOW_MANAGER in ('gnome', 'gnome-fallback', 'awesome', 'mate', 'ubuntu', 'ubuntu-2d', 'openbox-gnome', )): - - # automatically place logon Window for GNOME, awesome - move_x = maxX - (self.GetSize().GetWidth() + 20) - move_y = 35 - - else: - - # automatically place logon Window for KDE4, LXDE, etc. - move_x = maxX - (self.GetSize().GetWidth() + 20) - move_y = maxY - (self.GetSize().GetHeight() + 70) - - self.Move((move_x, move_y)) - self.Show() - - def OnPassphrase(self, evt): - """\ - If the user clicks ,,Ok'' in the passphrase window. - - @param evt: event - @type evt: C{obj} - - """ - password = None - passphrase = None - force_password_auth = False - sshproxy_force_password_auth = False - if self.sshproxy_auth and self.password: - password = self.password - sshproxy_passphrase = self.passphraseTxt.GetValue() - force_password_auth = True - elif self.sshproxy_auth: - passphrase = sshproxy_passphrase = self.passphraseTxt.GetValue() - else: - passphrase = self.passphraseTxt.GetValue() - try: - sshproxy_passphrase = base64.b64decode(self.sshproxy_passphrase) - except TypeError: - sshproxy_passphrase = None - - try: - b64_passphrase = base64.b64encode(passphrase) - except TypeError: - b64_passphrase = None - - connect_failed = False - - wx.BeginBusyCursor() - session_uuid = self._PyHocaGUI._X2GoClient__client_registered_sessions_of_profile_name(self.current_profile_name)[0] - - try: - self._PyHocaGUI._X2GoClient__connect_session(session_uuid, - password=password, - passphrase=passphrase, - sshproxy_passphrase=sshproxy_passphrase, - force_password_auth=force_password_auth, - sshproxy_force_password_auth=sshproxy_force_password_auth, - add_to_known_hosts=self._PyHocaGUI.add_to_known_hosts, - ) - self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_('%s - connect') % self.current_profile_name, - text=_('Authentication has been successful.'), - icon='auth_success') - - except x2go.PasswordRequiredException: - if self.sshproxy_auth: - key_filename = '' - try: - if not self._PyHocaGUI._X2GoClient__get_session(session_uuid).control_params['look_for_keys']: - key_filename = self._PyHocaGUI._X2GoClient__get_session(session_uuid).control_params['key_filename'] - except KeyError: - pass - self._pyhoca_logger('SSH private key file is encrypted and requires a passphrase', loglevel=x2go.log.loglevel_INFO, ) - _passphrase_window = PyHocaGUI_DialogBoxPassphrase(self._PyHocaGUI, self.current_profile_name, caller=self, sshproxy_passphrase=b64_passphrase, key_filename=key_filename) - self._PyHocaGUI._logon_windows[self.current_profile_name] = _passphrase_window - - else: - self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_('%s - connect failure') % self.current_profile_name, - text=_('SSH key file (for X2Go server) could not be unlocked!'), - icon='auth_failed') - connect_failed = True - - except x2go.X2GoSSHProxyPasswordRequiredException: - self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_('%s - connect failure') % self.current_profile_name, - text=_('SSH key file (for SSH proxy) could not be unlocked!'), - icon='auth_failed') - connect_failed = True - - except x2go.AuthenticationException: - self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_('%s - connect failure') % self.current_profile_name, - text=_('Authentication failed!'), - icon='auth_failed') - connect_failed = True - - except x2go.X2GoSSHProxyAuthenticationException: - self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_('%s - connect failure') % self.current_profile_name, - text=_('Authentication to the SSH proxy server failed!'), - icon='auth_failed') - connect_failed = True - - except gevent.socket.error as e: - self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_('%s - socket error') % self.current_profile_name, - text=e.strerror + '!', - icon='auth_error') - connect_failed = True - - except x2go.X2GoHostKeyException as e: - self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_('%s - host key error') % self.current_profile_name, - text=_('The remote server\'s host key is invalid or has not been accepted by the user') + '!', - icon='auth_error', - timeout=4000) - connect_failed = True - - except x2go.X2GoRemoteHomeException as e: - self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_('%s - missing home directory') % self.current_profile_name, - text=_("The remote user's home directory does not exist."), - icon='auth_error', - timeout=4000) - connect_failed = True - - except x2go.X2GoSSHProxyException as e: - if str(e).startswith('Two-factor authentication requires a password'): - self._pyhoca_logger('SSH proxy host requests two-factor authentication', loglevel=x2go.loglevel_NOTICE) - _logon_window = logon.PyHocaGUI_DialogBoxPassword(self._PyHocaGUI, self.current_profile_name, - caller=self, - passphrase=passphrase, - sshproxy_passphrase=sshproxy_passphrase, - sshproxy_auth=True, - sshproxy_twofactor_auth=True, - ) - self._PyHocaGUI._logon_windows[self.current_profile_name] = _logon_window - else: - if str(e).startswith('Host key for server ') and str(e).endswith(' does not match!'): - errmsg = _('Host key verification failed. The X2Go server may have been compromised.\n\nIt is also possible that the host key has just been changed.\n\nHowever, for security reasons the connection will not be established!!!') - else: - errmsg = str(e) - self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_('%s - key error') % self.current_profile_name, - text='%s!' % errmsg, - icon='auth_error', - timeout=4000) - connect_failed = True - - except x2go.X2GoSessionException as e: - self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_('%s - auth error') % self.current_profile_name, - text='%s!' % str(e), - icon='auth_error', - timeout=4000) - connect_failed = True - - except x2go.SSHException as e: - if str(e).startswith('Two-factor authentication requires a password'): - self._pyhoca_logger('X2Go Server requests two-factor authentication', loglevel=x2go.loglevel_NOTICE) - _logon_window = logon.PyHocaGUI_DialogBoxPassword(self._PyHocaGUI, self.current_profile_name, - caller=self, - passphrase=passphrase, - sshproxy_passphrase=sshproxy_passphrase, - sshproxy_auth=False, - twofactor_auth=True, - ) - self._PyHocaGUI._logon_windows[self.current_profile_name] = _logon_window - else: - if str(e).startswith('Host key for server ') and str(e).endswith(' does not match!'): - errmsg = _('Host key verification failed. The X2Go server may have been compromised.\n\nIt is also possible that the host key has just been changed.\n\nHowever, for security reasons the connection will not be established!!!') - else: - errmsg = str(e) - - self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_('%s - SSH error') % self.current_profile_name, - text='%s' % errmsg, - icon='auth_error', - timeout=10000) - connect_failed = True - - except: - self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name, - title=_('%s - unknown error') % self.current_profile_name, - text=_('An unknown error occured during authentication!'), - icon='auth_error') - connect_failed = True - if self._PyHocaGUI.args.debug or self._PyHocaGUI.args.libdebug or ('PYHOCAGUI_DEVELOPMENT' in os.environ and os.environ['PYHOCAGUI_DEVELOPMENT'] == '1'): - raise - - self._PyHocaGUI.notifier.send(self.current_profile_name, context='AUTH_%s' % self.current_profile_name, timeout=4000) - - wx.SetCursor(wx.StockCursor(wx.CURSOR_ARROW)) - # Windows's GUI is more picky then Linux's GTK GUI about EndBusyCursor if cursor is not busy... - try: wx.EndBusyCursor() - except: pass - - if connect_failed and self._PyHocaGUI.exit_on_disconnect: - self._PyHocaGUI.WakeUpIdle() - self._PyHocaGUI.ExitMainLoop() - - if self._PyHocaGUI._X2GoClient__is_session_connected(session_uuid): - self._PyHocaGUI._post_authenticate(evt, session_uuid) - self.sshproxy_started = False - try: del self._PyHocaGUI._logon_windows[self.current_profile_name] - except KeyError: pass - - self.Close() - self.Destroy() - - def OnCancel(self, evt): - """ - If the user clicks ,,Cancel'' in the logon window. - - @param evt: event - @type evt: C{obj} - - """ - self.Close() - self.Destroy() - - def Destroy(self): - """ - Tidy up some stuff in the main application instance when the logon window gets destroyed. - - """ - self._PyHocaGUI.gevent_sleep_when_idle = 0.25 - try: - self._PyHocaGUI._sub_windows.remove(self) - except ValueError: - pass - try: - self._PyHocaGUI._temp_disabled_profile_names.remove(self.current_profile_name) - except ValueError: - pass - wx.Dialog.Destroy(self) -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/pyhoca-gui.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository pyhoca-gui. commit 7025cd8c0f0a172b113d15bf1e2690d97f87083b Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Mon Dec 2 17:12:29 2019 +0100 debian/changelog: update from Git history --- debian/changelog | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index 18443d9..ecb0c84 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,18 @@ -pyhoca-gui (0.5.1.1-0x2go1) UNRELEASED; urgency=medium - - * Continue development - - -- X2Go Release Manager <git-admin@x2go.org> Sat, 23 Nov 2019 14:19:02 +0100 +pyhoca-gui (0.6.0.0-0x2go1) UNRELEASED; urgency=medium + + * New upstream version (0.6.0.0): + - PyHocaGUI.OnExit(): Return an exitcode. + - Run 2to3 on this project. + - More porting to Python 3 (manually). + - wxgui/profilemanager.py: Capture failures that might occur when writing + session profile configs back to disk. + - pyhoca/wxgui/{logon.py,passphrase.py}: Merge code of both files into one, + break up circular import dependency. + - Menu.Append() calls: Turn arguments into positional arguments. Makes the + code run on wx3 and wx4. + - Port to wxPython 4.0.x. + + -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Mon, 02 Dec 2019 17:10:19 +0100 pyhoca-gui (0.5.1.0-0x2go1) unstable; urgency=medium -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/pyhoca-gui.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository pyhoca-gui. commit da3d33a0e8a3cb70650454f629a13c9dd52f66b4 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Mon Dec 2 17:14:54 2019 +0100 debian/control: Switch from Py2 to Py3 (B-Ds and Ds). --- debian/changelog | 2 ++ debian/control | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/debian/changelog b/debian/changelog index ecb0c84..32d3c6f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,8 @@ pyhoca-gui (0.6.0.0-0x2go1) UNRELEASED; urgency=medium - Menu.Append() calls: Turn arguments into positional arguments. Makes the code run on wx3 and wx4. - Port to wxPython 4.0.x. + * debian/control: + + Switch from Py2 to Py3 (B-Ds and Ds). -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Mon, 02 Dec 2019 17:10:19 +0100 diff --git a/debian/control b/debian/control index 6645142..0c62f28 100644 --- a/debian/control +++ b/debian/control @@ -9,10 +9,10 @@ Uploaders: Build-Depends: debhelper (>= 7.0.50~), man2html-base | man2html, - python (>=2.6.5-0~), - python-setuptools, - python-support | dh-python, - python-distutils-extra, + python3, (>=3.6~), + python3-setuptools, + python3-support | dh-python, + python3-distutils-extra, gnome-colors-common, Standards-Version: 3.9.6 Homepage: https://code.x2go.org/releases/source/pyhoca-gui @@ -24,15 +24,15 @@ Package: pyhoca-gui Architecture: all Depends: ${misc:Depends}, - python, - python-x2go (>=0.6.1.0-0~), - python-argparse, - python-gi, + python3, + python3-x2go (>=0.6.1.0-0~), + python3-argparse, + python3-gi, gir1.2-notify-0.7, - python-setproctitle, - python-wxgtk3.0 | python-wxgtk2.8, + python3-setproctitle, + python3-wxgtk4.0, gnome-colors-common, - python-cups, + python3-cups, Recommends: mate-notification-daemon | notification-daemon, Suggests: -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/pyhoca-gui.git