The branch, twofactorauth has been updated
via 022811f7ea1033c3f4a2e17c6c95e4f1bf71f776 (commit)
from 1dd252e00d59e41021fe98644ade03b4444f3d81 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
man/pyhoca-gui.1 | 25 +++++++++++++++---
pyhoca-gui | 20 ++++++++++++++-
pyhoca/wxgui/frontend.py | 56 ++++++++++++++++++++++++++++++-----------
pyhoca/wxgui/logon.py | 2 +-
pyhoca/wxgui/menus_taskbar.py | 49 +++++++++++++++++++-----------------
5 files changed, 110 insertions(+), 42 deletions(-)
The diff of changes is:
diff --git a/man/pyhoca-gui.1 b/man/pyhoca-gui.1
index 64d5f9c..d24fee1 100644
--- a/man/pyhoca-gui.1
+++ b/man/pyhoca-gui.1
@@ -64,12 +64,22 @@ Username for the session (default: currently logged in user).
The name of the session profile to be used to make the connection. You can actually pass a komma-separated list of
session profile names to this option.
.TP
+\*(T<\fB\-\-non-interactive\fR\*(T>
+Run in non-interactive mode. This option requires the \fB\-\-session-profile\fR option. It also sets the following options to true automagically:
+
+ \fB\-\-restricted-trayicon\fR
+ \fB\-\-start-on-connect\fR
+ \fB\-\-resume-all-on-connect\fR
+ \fB\-\-exit-on-disconnect\fR
+ \fB\-\-disconnect-on-suspend\fR
+ \fB\-\-disconnect-on-terminate\fR
+.TP
\*(T<\fB\-\-show-profile-metatypes\fR\*(T>
Show descriptive meta information on session profiles in menus (NOTE: this makes menus appear a bit more sluggish, use it mostly for debugging).
.TP
-\*(T<\fB\-\-hide-trayicon\fR\*(T>
-Hide \fBpyhoca-gui\fR's main session manager icon that is normally shown in the notification area / system tray. Note: With a hidden system tray icon
-you cannot control session states with \fBpyhoca-gui\fR interactively. All session control has to be performed by command-line options.
+\*(T<\fB\-\-restricted-trayicon\fR\*(T>
+Restrict functionality of \fBpyhoca-gui\fR's main session manager icon that is shown in the notification area / system tray. This
+switch limits the icon 's functionality to a right-click menu that allows to raise the ,,About'' window and exit the application.
.TP
\*(T<\fB\-\-auto-connect\fR\*(T>
Connect sessions via SSH public key authentication on application startup, if possible.
@@ -77,6 +87,9 @@ Connect sessions via SSH public key authentication on application startup, if po
\*(T<\fB\-\-start-on-connect\fR\*(T>
Start a session directly after authentication (only if no suspended sessions are available).
.TP
+\*(T<\fB\-\-exit-on-disconnect\fR\*(T>
+Exit \fBpyhoca-gui\fR cleanly once a session has been disconnected.
+.TP
\*(T<\fB\-\-resume-on-connect, \-\-resume-newest-on-connect\fR\*(T>
After authentication directly auto-resume the newest available running/suspended session.
.TP
@@ -86,6 +99,12 @@ After authentication directly auto-resume the oldest available running/suspended
\*(T<\fB\-\-resume-all-on-connect\fR\*(T>
After authentication directly auto-resume all available running/suspended session.
.TP
+\*(T<\fB\-\-disconnect-on-suspend\fR\*(T>
+Disconnect from a server if a session on that server has been suspended.
+.TP
+\*(T<\fB\-\-disconnect-on-terminate\fR\*(T>
+Disconnect from a server if a session on that server has been terminated.
+.TP
\*(T<\fB\-\-disable-options\fR\*(T>
Grey-out the ,,Options'' menu item and thus disable the client configuration window.
.TP
diff --git a/pyhoca-gui b/pyhoca-gui
index cf621e6..720dc99 100755
--- a/pyhoca-gui
+++ b/pyhoca-gui
@@ -168,13 +168,17 @@ debug_options = [
x2go_gui_options = [
{'args':['-u','--username'], 'default': None, 'help': 'username for the session (default: current user)', },
{'args':['-P','--session-profile'], 'default': None, 'help': 'directly connect to a session profile', },
+ {'args':['--non-interactive'], 'default': False, 'action': 'store_true', 'help': 'run the session manager in non-interactive mode, this option sets the following options to true: --restricted-trayicon, --start-on-connect, --resume-all-on-connect, --exit-on-disconnect, --disconnect-on-suspend and --disconnect-on-terminate', },
{'args':['--auto-connect'], 'default': False, 'action': 'store_true', 'help': 'connect sessions via SSH pubkey authentication if possible', },
{'args':['--show-profile-metatypes'], 'default': False, 'action': 'store_true', 'help': 'show descriptive meta information on session profiles in menus (NOTE: this makes menus appear a bit more sluggish, use it mostly for debugging)', },
- {'args':['--hide-trayicon'], 'default': False, 'action': 'store_true', 'help': 'hide session manager\'s main icon that is normally shown in the notification area / system tray', },
+ {'args':['--restricted-trayicon'], 'default': False, 'action': 'store_true', 'help': 'restricts session manager\'s main icon functionality to information window and application exit', },
{'args':['--start-on-connect'], 'default': False, 'action': 'store_true', 'help': 'start a session directly after authentication', },
+ {'args':['--exit-on-disconnect'], 'default': False, 'action': 'store_true', 'help': 'exit the session manager after a server connection has died', },
{'args':['--resume-newest-on-connect', '--resume-on-connect'], 'default': False, 'action': 'store_true', 'help': ' on connect auto-resume the newest suspended session', },
{'args':['--resume-oldest-on-connect'], 'default': False, 'action': 'store_true', 'help': ' on connect auto-resume the oldest suspended session', },
{'args':['--resume-all-on-connect'], 'default': False, 'action': 'store_true', 'help': 'auto-resume all suspended session on connect', },
+ {'args':['--disconnect-on-suspend'], 'default': False, 'action': 'store_true', 'help': 'disconnect a server if a session has been suspended', },
+ {'args':['--disconnect-on-terminate'], 'default': False, 'action': 'store_true', 'help': 'disconnect a server if a session has been terminated', },
{'args':['--disable-options'], 'default': False, 'action': 'store_true', 'help': 'disable the client options configuration window', },
{'args':['--disable-printingprefs'], 'default': False, 'action': 'store_true', 'help': 'disable the client\'s printing preferences window', },
{'args':['--disable-profilemanager'], 'default': False, 'action': 'store_true', 'help': 'disable the session profile manager window', },
@@ -261,6 +265,20 @@ def parseargs():
if a.username is None:
a.username = _CURRENT_LOCAL_USER
+ if a.non_interactive:
+ if a.session_profile is None:
+ runtime_error('In non-interactive mode you have to use the --session-profile option (or -P) to specify a certain session profile name!', parser=p)
+ a.restricted_trayicon = True
+ a.start_on_connect = True
+ a.resume_all_on_connect = True
+ a.exit_on_disconnect = True
+ a.disconnect_on_suspend = True
+ a.disconnect_on_terminate = True
+
+ if a.non_interactive and (a.resume_newest_on_connect or a.resume_oldest_on_connect):
+ # allow override...
+ a.resume_all_on_connect = False
+
if _X2GOCLIENT_OS == 'Windows' and a.preferred_xserver:
if a.preferred_xserver not in _installed_xservers:
runtime_error('Xserver ,,%s\'\' is not installed on your Windows system' % a.preferred_xserver, parser=p)
diff --git a/pyhoca/wxgui/frontend.py b/pyhoca/wxgui/frontend.py
index 273b4d3..ca8636f 100644
--- a/pyhoca/wxgui/frontend.py
+++ b/pyhoca/wxgui/frontend.py
@@ -101,7 +101,6 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
wx.BeginBusyCursor()
splash.PyHocaGUI_SplashScreen()
- wx.Yield()
_x2goclient_kwargs = {
'use_listsessions_cache': True,
@@ -158,9 +157,11 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
gevent.sleep(.04)
except KeyboardInterrupt:
self._pyhoca_logger('Received Ctrl-C keyboard interrupt... Wait till %s has exited cleanly.' % self.appname, loglevel=x2go.loglevel_NOTICE)
+ 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()
self.ExitMainLoop()
evt.RequestMore()
return True
@@ -176,8 +177,11 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
self.resume_newest_on_connect = self.args.resume_newest_on_connect
self.resume_oldest_on_connect = self.args.resume_oldest_on_connect
self.resume_all_on_connect = self.args.resume_all_on_connect
+ self.exit_on_disconnect = self.args.exit_on_disconnect
+ self.disconnect_on_suspend = self.args.disconnect_on_suspend
+ self.disconnect_on_terminate = self.args.disconnect_on_terminate
self.show_profile_metatypes = self.args.show_profile_metatypes
- self.hide_trayicon = self.args.hide_trayicon
+ self.restricted_trayicon = self.args.restricted_trayicon
self._pyhoca_logger('PyHoca GUI is starting up', loglevel=x2go.log.loglevel_INFO, )
self._pyhoca_logger('registering PyHocaGUI control sessions', loglevel=x2go.log.loglevel_INFO, )
@@ -185,9 +189,9 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
self.about = about.PyHocaGUI_AboutFrame(self)
self.about.Show(False)
- if not self.hide_trayicon:
- self.taskbar = taskbar.PyHocaGUI_TaskBarIcon(self.about)
- self.taskbar.Bind(wx.EVT_TASKBAR_LEFT_DCLICK, lambda _Show: self.about.Show(True))
+ self.taskbar = taskbar.PyHocaGUI_TaskBarIcon(self.about)
+ self.taskbar.Bind(wx.EVT_TASKBAR_LEFT_DCLICK, lambda _Show: self.about.Show(True))
+ if not self.restricted_trayicon:
self.taskbar.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self.taskbar.CreateSessionManagerPopupMenu)
if x2go.X2GOCLIENT_OS in ('Linux', 'Mac'):
@@ -258,8 +262,7 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
for _win in self._sub_windows:
_win.Close()
_win.Destroy()
- if not self.hide_trayicon:
- self.taskbar.Close()
+ self.taskbar.Close()
self.about.Close()
self.about.Destroy()
x2go.x2go_cleanup()
@@ -326,7 +329,7 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
self._X2goClient__connect_session(session_uuid)
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._X2goClient__disconnect_profile(profile_name)
+ self.OnServerDisconnect(evt)
self._temp_disabled_profile_names.remove(profile_name)
else:
self.notifier.send(_(u'%s - connect') % profile_name, _(u'Public SSH key authentication has been successful.'), icon='auth_success', timeout=4000)
@@ -365,8 +368,7 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
except:
self.notifier.send('%s - connect error' % profile_name, 'An unknown error occurred during authentication!', icon='auth_error', timeout=4000)
self._temp_disabled_profile_names.remove(profile_name)
- if not self.hide_trayicon:
- self.taskbar.SetIconIdle()
+ self.taskbar.SetIconIdle()
def OnSessionAuthenticate(self, evt):
"""\
@@ -374,8 +376,7 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
"""
self.current_profile_name = self._eventid_profilenames_map[evt.GetId()]
- if not self.hide_trayicon:
- self.taskbar.SetIconConnecting(self.current_profile_name)
+ self.taskbar.SetIconConnecting(self.current_profile_name)
session_uuid = self._X2goClient__register_session(profile_name=self.current_profile_name)
self._temp_disabled_profile_names.append(self.current_profile_name)
gevent.spawn(self._do_authenticate, evt, session_uuid)
@@ -428,6 +429,8 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
self._disable_session_name(self.current_profile_name, session_name)
gevent.spawn(self._X2goClient__suspend_session, session_uuid, session_name=session_name)
self._eventid_sessionnames_map = {}
+ if self.disconnect_on_suspend:
+ self.OnServerDisconnect(evt)
def OnSessionTerminate(self, evt):
"""\
@@ -440,6 +443,8 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
self._disable_session_name(self.current_profile_name, session_name)
gevent.spawn(self._X2goClient__terminate_session, session_uuid, session_name=session_name)
self._eventid_sessionnames_map = {}
+ if self.disconnect_on_terminate:
+ self.OnServerDisconnect(evt)
def OnCleanSessions(self, evt):
"""\
@@ -460,7 +465,7 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
self.notifier.send(self.current_profile_name, _notify_text, icon='session_cleanall', timeout=10000)
gevent.spawn(self._X2goClient__clean_sessions, session_uuid)
- def OnSessionDisconnect(self, evt):
+ def OnServerDisconnect(self, evt):
"""\
STILL UNDOCUMENTED
@@ -470,9 +475,12 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
# disconnect all profile sessions
if self._X2goClient__server_is_alive(session_uuid):
self._X2goClient__disconnect_profile(self.current_profile_name)
- #gevent.sleep(2)
if not self._X2goClient__is_session_connected(session_uuid):
self.notifier.send(_(u'%s - disconnect') % self.current_profile_name, _(u'X2go Profile is now disconnected.'), icon='auth_disconnect', timeout=4000)
+ if self.exit_on_disconnect:
+ self._pyhoca_logger('Exiting %s because %s got disconnected.' % (self.appname, self.current_profile_name), loglevel=x2go.loglevel_NOTICE)
+ self.WakeUpIdle()
+ self.ExitMainLoop()
def OnProfileAdd(self, evt):
"""\
@@ -608,15 +616,23 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
# this hook gets called from Python X2go classes if profile_name's control session has died...
def HOOK_on_control_session_death(self, profile_name):
self.notifier.send(_(u'%s - channel error') % profile_name, _(u'Lost connection to server %s unexpectedly! Try to re-authenticate to the server...') % profile_name, icon='session_warning', timeout=10000)
+ if self.exit_on_disconnect:
+ self.Exit()
def HOOK_no_such_command(self, cmd, profile_name='UNKNOWN', session_name='UNKNOWN'):
self.notifier.send(_(u'%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.Exit()
def HOOK_rforward_request_denied(self, profile_name='UNKNOWN', session_name='UNKNOWN', server_port=0):
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 by the X2go server. This is a common issue with SSH, it might help to restart the X2go server\'s SSH daemon.') % (session_name, server_port), icon='session_warning', timeout=10000)
+ if self.exit_on_disconnect:
+ self.Exit()
def HOOK_forwarding_tunnel_setup_failed(self, profile_name='UNKNOWN', session_name='UNKNOWN', chain_host='UNKNOWN', chain_port=0):
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. Session startup failed.') % (chain_host, chain_port, session_name), icon='session_error', timeout=10000)
+ if self.exit_on_disconnect:
+ self.Exit()
def HOOK_pulseaudio_not_supported_in_RDPsession(self):
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)
@@ -669,6 +685,12 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
def HOOK_on_session_has_been_suspended(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN'):
self._enable_session_name(profile_name, session_name)
self.notifier.send(_(u'%s - suspend') % profile_name, _(u'X2go Session has been suspended\n%s') % session_name, icon='session_suspend', timeout=5000)
+ if self.disconnect_on_suspend:
+ _dummy_id = wx.NewId()
+ self._eventid_profilenames_map[_dummy_id] = profile_name
+ evt = wx.IdleEvent()
+ evt.SetId(_dummy_id)
+ self.OnServerDisconnect(dummy_evt)
def HOOK_on_session_has_terminated(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN'):
self._enable_session_name(profile_name, session_name)
@@ -679,3 +701,9 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
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)
+ if self.disconnect_on_terminate:
+ _dummy_id = wx.NewId()
+ self._eventid_profilenames_map[_dummy_id] = profile_name
+ evt = wx.IdleEvent()
+ evt.SetId(_dummy_id)
+ self.OnServerDisconnect(evt)
diff --git a/pyhoca/wxgui/logon.py b/pyhoca/wxgui/logon.py
index 4853a5d..9ee6687 100644
--- a/pyhoca/wxgui/logon.py
+++ b/pyhoca/wxgui/logon.py
@@ -246,7 +246,7 @@ class PyHocaGUI_DialogBoxPassword(wx.Frame):
title=_(u'%s - connect failure') % self.current_profile_name,
text=_(u'User is not allowed to start X2go sessions!'),
icon='auth_error')
- self._PyHocaGUI._X2goClient__disconnect_profile(self.current_profile_name)
+ self._PyHocaGUI.OnServerDisconnect(evt)
else:
self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name,
title=_(u'%s - connect') % self.current_profile_name,
diff --git a/pyhoca/wxgui/menus_taskbar.py b/pyhoca/wxgui/menus_taskbar.py
index b833e8c..b3156f0 100644
--- a/pyhoca/wxgui/menus_taskbar.py
+++ b/pyhoca/wxgui/menus_taskbar.py
@@ -79,33 +79,36 @@ class PyHocaGUI_Menu_TaskbarOptionsManager(wx.Menu):
self.Append(id=ID_ABOUT, text=_(u"About %s ...") % self._PyHocaGUI.appname)
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnAbout, id=ID_ABOUT)
- self.AppendSeparator()
+ if not self._PyHocaGUI.restricted_trayicon:
+ self.AppendSeparator()
- ID_PROFILEMANAGER = wx.NewId()
- _maintain_profiles_item = self.AppendMenu(id=ID_PROFILEMANAGER,
- text=_(u"Profile Manager"),
- submenu=PyHocaGUI_Menu_TaskbarProfileNames(self._PyHocaGUI,
- caller=self,
- disabled_profiles=self._PyHocaGUI.client_connected_profiles(return_profile_names=True),
- submenu=PyHocaGUI_Menu_TaskbarManageProfile))
- if self._PyHocaGUI.profilemanager_disabled:
- _maintain_profiles_item.Enable(False)
+ ID_PROFILEMANAGER = wx.NewId()
+ _maintain_profiles_item = self.AppendMenu(id=ID_PROFILEMANAGER,
+ text=_(u"Profile Manager"),
+ submenu=PyHocaGUI_Menu_TaskbarProfileNames(self._PyHocaGUI,
+ caller=self,
+ disabled_profiles=self._PyHocaGUI.client_connected_profiles(return_profile_names=True),
+ submenu=PyHocaGUI_Menu_TaskbarManageProfile
+ )
+ )
+ if self._PyHocaGUI.profilemanager_disabled:
+ _maintain_profiles_item.Enable(False)
- self.AppendSeparator()
+ self.AppendSeparator()
- ID_PRINTINGPREFS = wx.NewId()
- _printingprefs_item = self.Append(id=ID_PRINTINGPREFS, text=_(u"Printing Preferences"))
- self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnPrintingPreferences, id=ID_PRINTINGPREFS)
- if self._PyHocaGUI.printingprefs_disabled:
- _printingprefs_item.Enable(False)
+ ID_PRINTINGPREFS = wx.NewId()
+ _printingprefs_item = self.Append(id=ID_PRINTINGPREFS, text=_(u"Printing Preferences"))
+ self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnPrintingPreferences, id=ID_PRINTINGPREFS)
+ if self._PyHocaGUI.printingprefs_disabled:
+ _printingprefs_item.Enable(False)
- ID_OPTIONS = wx.NewId()
- _options_item = self.Append(id=ID_OPTIONS, text=_(u"Client Options"))
- self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnOptions, id=ID_OPTIONS)
- if self._PyHocaGUI.options_disabled:
- _options_item.Enable(False)
+ ID_OPTIONS = wx.NewId()
+ _options_item = self.Append(id=ID_OPTIONS, text=_(u"Client Options"))
+ self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnOptions, id=ID_OPTIONS)
+ if self._PyHocaGUI.options_disabled:
+ _options_item.Enable(False)
- self.AppendSeparator()
+ self.AppendSeparator()
ID_EXIT = wx.NewId()
self.Append(id=ID_EXIT, text=_("E&xit"))
@@ -235,7 +238,7 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu):
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnCleanSessions, id=ID_CLEANSESSIONS)
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnProfileEditWhileConnected, id=ID_EDITPROFILEWHILECONNECTED)
self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnShareLocalFolder, id=ID_SHARELOCALFOLDER)
- self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnSessionDisconnect, id=ID_DISCONNECT)
+ self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnServerDisconnect, id=ID_DISCONNECT)
class PyHocaGUI_Menu_TaskbarProfileNames(wx.Menu):
hooks/post-receive
--
pyhoca-gui.git (Python X2Go Client (wxPython GUI))
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "pyhoca-gui.git" (Python X2Go Client (wxPython GUI)).