This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch master in repository pyhoca-gui. from f8c6a42 profilemanager: also disable the DefaultButton for immutable session profiles new bd01f67 typo fix, and some whitespace fixes new 8284868 Gracefully handle "Connection refused" errors after a broker login has already been successful. The 2 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 | 2 ++ pyhoca/wxgui/frontend.py | 52 ++++++++++++++++++++++++++++++++++++++++++++-- pyhoca/wxgui/messages.py | 16 +++++++------- 3 files changed, 60 insertions(+), 10 deletions(-) -- Alioth's /srv/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 82848688e04e5daf9e31976cdd0d330e24a7b5e7 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Sat Apr 5 01:18:58 2014 +0200 Gracefully handle "Connection refused" errors after a broker login has already been successful. --- debian/changelog | 2 ++ pyhoca/wxgui/frontend.py | 52 ++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index ba15158..e883e27 100644 --- a/debian/changelog +++ b/debian/changelog @@ -34,6 +34,8 @@ pyhoca-gui (0.5.0.0-0x2go1) UNRELEASED; urgency=low with SSL certificates that have been self-signed against a non-public root-CA certificate file. - Handle "Connection refused" errors during broker login attempts. + - Gracefully handle "Connection refused" errors after a broker login has already + been successful. - Update English / German translation. -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Wed, 08 Jan 2014 21:28:37 +0100 diff --git a/pyhoca/wxgui/frontend.py b/pyhoca/wxgui/frontend.py index 08f9953..324d7ce 100644 --- a/pyhoca/wxgui/frontend.py +++ b/pyhoca/wxgui/frontend.py @@ -371,7 +371,10 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): if not self.args.single_session_profile: self.auto_connect = True self._pyhoca_logger('opening default session profile %s' % profile_name, loglevel=x2go.log.loglevel_NOTICE) - self._X2GoClient__register_session(profile_name=profile_name, auto_connect=self.auto_connect) + try: + self._X2GoClient__register_session(profile_name=profile_name, auto_connect=self.auto_connect) + except x2go.x2go_exceptions.X2GoBrokerConnectionException: + self.session_registration_failed(profile_name=profile_name) if self.auto_connect or self.broker_autoconnect: gevent.spawn(self._auto_connect) @@ -819,7 +822,10 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): return self.taskbar.SetIconConnecting(profile_name) if session_uuid is None: - session_uuid = self._X2GoClient__register_session(profile_name=profile_name) + try: + session_uuid = self._X2GoClient__register_session(profile_name=profile_name) + except x2go.x2go_exceptions.X2GoBrokerConnectionException: + self.session_registration_failed(profile_name) if session_uuid: self._temp_disabled_profile_names.append(profile_name) gevent.spawn(self._do_authenticate, evt, session_uuid) @@ -1648,6 +1654,19 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): self.WakeUpIdle() self.ExitMainLoop() + def session_registration_failed(self, profile_name='UNKNOWN', **kwargs): + """\ + Notify about session registration failures. + + @param profile_name: profile name of session that called this hook method + @type profile_name: C{str} + + """ + self.notifier.send(_(u'%s - session failure') % profile_name, _(u'The session initialization failed.'), icon='session_error', timeout=10000) + if self.exit_on_disconnect: + self.WakeUpIdle() + self.ExitMainLoop() + def HOOK_desktop_sharing_denied(self, profile_name='UNKNOWN', **kwargs): """\ Notify about the denial of desktop sharing by the other user. @@ -1981,3 +2000,32 @@ class PyHocaGUI(wx.App, x2go.X2GoClient): evt.SetId(_dummy_id) self.OnServerDisconnect(evt) + def HOOK_broker_ignore_connection_problems(self, profile_name='UNKNOWN', is_profile_connected=False, **kwargs): + """\ + Query about what to do with broker connection failures. + + @param profile_name: profile name of a session that triggered this hook method + @type profile_name: C{str} + @param is_profile_connected: C{True} if the given session profile is already conneced to the server + @type is_profile_connected: C{bool} + + @return: C{true} if session startup shall be attempted anyway, even if session + broker is down. + @rtype: C{bool} + + """ + 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), + 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), + icon='warning', + profile_name=profile_name) + + m.ShowModal() + return m.Ok() -- Alioth's /srv/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 bd01f679afb6d3bfc5ac7b1c0f36fe586cba291d Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Sat Apr 5 01:18:02 2014 +0200 typo fix, and some whitespace fixes --- pyhoca/wxgui/messages.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pyhoca/wxgui/messages.py b/pyhoca/wxgui/messages.py index 71656eb..18d1568 100644 --- a/pyhoca/wxgui/messages.py +++ b/pyhoca/wxgui/messages.py @@ -35,7 +35,7 @@ class PyHoca_MessageWindow(wx.Dialog): A simple message window for L{PyHocaGUI}. """ - def __init__(self, _PyHocaGUI, parent=None, title=None, shortmsg=None, msg=None, icon=None, buttontype='ok', + def __init__(self, _PyHocaGUI, parent=None, title=None, shortmsg=None, msg=None, icon=None, buttontype='ok', profile_name=None, session_name=None): """\ @@ -66,7 +66,7 @@ class PyHoca_MessageWindow(wx.Dialog): try: wx.EndBusyCursor() except: pass - self._pyhoca_messages = { + self._pyhoca_messages = { 'REALLY_DELETE_PROFILE': _(u'Are you really sure you want to\ndelete the session profile ,,%s\'\'?') % profile_name, 'ALREADY_RUNNING': _(u'PyHoca-GUI is already running for user ,,%s\'\'!\n\nOnly one instance of PyHoca-GUI can be started per\nuser. The PyHoca-GUI icon can be found in your desktops\'s\nnotification area/systray.') % _CURRENT_LOCAL_USER } @@ -95,7 +95,7 @@ class PyHoca_MessageWindow(wx.Dialog): if icon: path_to_icon = os.path.normpath('%s/PyHoca/64x64/%s.png' % (_icons_location, icon)) self.icon = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap(path_to_icon, wx.BITMAP_TYPE_ANY)) - self.message = wx.StaticText(self, wx.ID_ANY, self.show_message, size=(-1, -1), style=wx.ALIGN_LEFT) + self.message = wx.StaticText(self, wx.ID_ANY, self.show_message, size=(-1, -1), style=wx.ALIGN_LEFT) btnSizer = wx.BoxSizer(wx.HORIZONTAL) msgSizer = wx.BoxSizer(wx.HORIZONTAL) @@ -108,8 +108,8 @@ class PyHoca_MessageWindow(wx.Dialog): self.Bind(wx.EVT_BUTTON, self.OnTrue, self.yesBtn) self.Bind(wx.EVT_BUTTON, self.OnFalse, self.noBtn) - btnSizer.Add(self.yesBtn, flag=wx.ALL, border=5) - btnSizer.Add(self.noBtn, flag=wx.ALL, border=5) + btnSizer.Add(self.yesBtn, flag=wx.ALL, border=5) + btnSizer.Add(self.noBtn, flag=wx.ALL, border=5) if buttontype == 'yesno': self.yesBtn.SetDefault() @@ -122,13 +122,13 @@ class PyHoca_MessageWindow(wx.Dialog): self.okBtn = wx.Button(self, wx.ID_ANY, _(u'Ok'),) self.Bind(wx.EVT_BUTTON, self.OnTrue, self.okBtn) - btnSizer.Add(self.okBtn, flag=wx.ALL, border=5) + 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.Bind(wx.EVT_BUTTON, self.OnFalse, self.cancelBtn) - btnSizer.Add(self.cancelBtn, flag=wx.ALL, borde=5) + btnSizer.Add(self.cancelBtn, flag=wx.ALL, border=5) if buttontype in ('ok', 'okcancel'): self.okBtn.SetDefault() @@ -144,7 +144,7 @@ class PyHoca_MessageWindow(wx.Dialog): mainSizer.Add(msgSizer, flag=wx.ALL, border=10) mainSizer.Add(btnSizer, flag=wx.ALL|wx.ALIGN_RIGHT, border=5) - self.SetSizerAndFit(mainSizer) + self.SetSizerAndFit(mainSizer) self.Layout() maxX, maxY = wx.GetDisplaySize() -- Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/pyhoca-gui.git