[X2Go-Commits] pyhoca-gui.git - build-59a18b6e3b5d3f1dd8f07f26433d37fe5984a57d (branch) updated: 670fdf479ed7f837331eed42d1a01eae735cadd8

X2Go dev team git-admin at x2go.org
Tue Aug 27 13:20:36 CEST 2013


The branch, build-59a18b6e3b5d3f1dd8f07f26433d37fe5984a57d has been updated
       via  670fdf479ed7f837331eed42d1a01eae735cadd8 (commit)
      from  2689544a7184a8509b4c5ed4021b1f560f4894e6 (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:
 pyhoca-gui               |    1 +
 pyhoca/wxgui/frontend.py |   29 +++++++++++++++++++++++++----
 pyhoca/wxgui/logon.py    |   38 +++++++++++++++++++++++++-------------
 3 files changed, 51 insertions(+), 17 deletions(-)

The diff of changes is:
diff --git a/pyhoca-gui b/pyhoca-gui
index 2b1508f..039a5b9 100755
--- a/pyhoca-gui
+++ b/pyhoca-gui
@@ -106,6 +106,7 @@ def parseargs():
 
     logger = x2go.X2goLogger(tag='PyHoca-GUI')
     liblogger = x2go.X2goLogger()
+    print logger.loglevel
 
     if a.debug:
         logger.set_loglevel_debug()
diff --git a/pyhoca/wxgui/frontend.py b/pyhoca/wxgui/frontend.py
index b0297e2..5be8778 100644
--- a/pyhoca/wxgui/frontend.py
+++ b/pyhoca/wxgui/frontend.py
@@ -177,9 +177,10 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
         self._pyhoca_logger('PyHoca GUI is starting up', loglevel=x2go.loglevel_INFO, )
         self._pyhoca_logger('registering PyHocaGUI control sessions', loglevel=x2go.loglevel_INFO, )
 
-        self._chooser_selected_profile_name = None
+        #self._chooser_selected_profile_name = None
         self.taskbar = taskbar.PyHocaGUI_TaskBarIcon(self)
-        self.taskbar.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self.taskbar.CreateSessionManagerPopupMenu)        
+        self.taskbar.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self.taskbar.CreateSessionManagerPopupMenu)
+        self._sub_windows = []
         self._eventid_profilenames_map = {}
         self._eventid_sessionnames_map = {}
 
@@ -193,13 +194,28 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
 
             for s in self._X2goClient__client_registered_sessions:
                 session_uuid = s.get_uuid()
+                self._pyhoca_logger('auto-connecting to %s session profile' % s.get_profile_name(), loglevel=x2go.log.loglevel_NOTICE)
                 gevent.spawn(self._auto_connect, session_uuid)
 
+        # prepare start/resume options
         self.start_on_connect = self.args.start_on_connect
         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
 
+        if self.args.session_profile:
+            for profile_name in self.args.session_profile.split(','):
+                if not self._X2goClient__client_registered_sessions_of_name(profile_name):
+                    continue
+                _dummy_id = wx.NewId()
+                self._eventid_profilenames_map[_dummy_id] = profile_name
+                evt = wx.CommandEvent()
+                evt.SetId(_dummy_id)
+                self.start_on_connect = True
+                self.resume_newest_on_connect = True
+                self._pyhoca_logger('opening default session profile %s' % profile_name, loglevel=x2go.log.loglevel_NOTICE)
+                self.OnSessionAuthenticate(evt)
+
     def _auto_connect(self, session_uuid):
 
         try:
@@ -211,6 +227,9 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
     # wx.App's OnExit method
     def OnExit(self):
         x2go.x2go_cleanup()
+        for _win in self._sub_windows:
+            _win.Destroy()
+        self.Destroy()
 
     # the taskbar's OnExit method...
     def OnTaskbarExit(self, evt):
@@ -255,7 +274,8 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
         self.OnSessionResume(evt)
 
     def _post_authenticate(self, evt, session_uuid):
-        # try SSH key auth first
+
+        _resumed = False
         if self.resume_newest_on_connect:
             _resumed = self._resume_newest_on_connect(evt, session_uuid)
         elif self.resume_oldest_on_connect:
@@ -277,7 +297,8 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
             self._X2goClient__connect_session(session_uuid)
             self._post_authenticate(evt, session_uuid)
         except x2go.AuthenticationException:
-            logon.PyHocaGUI_DialogBoxPassword(self, caller=self, current_profile_name=profile_name)
+            _logon_window = logon.PyHocaGUI_DialogBoxPassword(self, profile_name, caller=self )
+            self._sub_windows.append(_logon_window)
         if self._X2goClient__is_session_connected(session_uuid):
             self._pyhoca_logger('authentication to server has been successful', x2go.loglevel_INFO, )
         else:
diff --git a/pyhoca/wxgui/logon.py b/pyhoca/wxgui/logon.py
index 6f3e240..21e3201 100644
--- a/pyhoca/wxgui/logon.py
+++ b/pyhoca/wxgui/logon.py
@@ -79,12 +79,10 @@ class PyHocaGUI_LogonStatusBar(wx.StatusBar):
         self.SetFieldsCount(2)
         self.SetStatusWidths([-1,200])
 
-
         self.timer = wx.PyTimer(self.Notify)
         self.timer.Start(1000)
         self.Notify()
 
-
     def Notify(self):
         """\
         STILL UNDOCUMENTED
@@ -100,7 +98,7 @@ class PyHocaGUI_DialogBoxPassword(sc.SizedFrame):
     STILL UNDOCUMENTED
 
     """
-    def __init__(self, _PyHocaGUI, current_profile_name, caller=None, ):
+    def __init__(self, _PyHocaGUI, profile_name, caller=None, ):
         """\
         Dialog box to enter the username and password for the selected
         session profile.
@@ -110,19 +108,26 @@ class PyHocaGUI_DialogBoxPassword(sc.SizedFrame):
         self._pyhoca_logger = self._PyHocaGUI._pyhoca_logger
         self._pyhoca_logger('password dialog box started', x2go.loglevel_INFO, )
 
-        self.current_profile_name = current_profile_name
-        self.current_profile_config = self._PyHocaGUI.session_profiles.get_profile_config(current_profile_name)
+        self.current_profile_name = profile_name
+        self.current_profile_config = self._PyHocaGUI.session_profiles.get_profile_config(profile_name)
+        self._authentication_failed = False
 
-        captionText = "Authentication X2go Session: " + current_profile_name
+        captionText = profile_name
         sc.SizedFrame.__init__(self, None, -1, captionText,
                         style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
-        self.CentreOnScreen()
-        self.SetSize((350,250))
+        #self.CentreOnScreen()
+        self.SetSize((220,96))
 
         pane = self.GetContentsPane()
         pane.SetSizerType("form")
         pwbox = self.enterPasswordForm(pane)
-        self.Fit()
+        #self.Fit()
+        maxX, maxY = wx.GetDisplaySize()
+        if x2go.X2GOCLIENT_OS == 'Linux':
+            self.Move((maxX-225,35))
+        elif x2go.X2GOCLIENT_OS == 'Windows':
+            self.Move((maxX-225,maxY-35))
+
         self.Show()
 
     def enterPasswordForm(self, pnl):
@@ -130,7 +135,8 @@ class PyHocaGUI_DialogBoxPassword(sc.SizedFrame):
         STILL UNDOCUMENTED
 
         """
-        wx.StaticText(pnl, -1, '  Username'),
+        #wx.StaticText(pnl, -1, 'Authentication X2go Session...', (25, 80))
+        wx.StaticText(pnl, -1, 'Username', (5, 160))
         self.username_ctl = wx.TextCtrl(pnl, -1)
         self.username_ctl.SetSizerProps(expand=True)
         if self.current_profile_config.has_key('user'):
@@ -138,8 +144,11 @@ class PyHocaGUI_DialogBoxPassword(sc.SizedFrame):
         else:
             self.username_ctl.SetValue(self._PyHocaGUI.args.username)
 
-        wx.StaticText(pnl, -1, '  Password'),
+        wx.StaticText(pnl, -1, 'Password', (20, 240))
         self.passwd_ctl = wx.TextCtrl(pnl, -1, style=wx.TE_PASSWORD)
+        self.passwd_ctl.SetSizerProps(expand=True)
+        if self._authentication_failed:
+            wx.StaticText(pnl, -1, 'Authentication Failed', (5, 320)),
 
         self.ConnectButton = wx.Button(pnl, -1, "Authenticate")
         self.ConnectButton.Bind(wx.EVT_BUTTON, self.OnAuthenticate)
@@ -166,8 +175,11 @@ class PyHocaGUI_DialogBoxPassword(sc.SizedFrame):
             self.Iconize()
 
         session_uuid = self._PyHocaGUI._X2goClient__client_registered_sessions_of_name(self.current_profile_name)[0].get_uuid()
-        self._PyHocaGUI._X2goClient__connect_session(session_uuid, username=username, password=password, force_password_auth=True)
-        self._PyHocaGUI._post_authenticate(evt, session_uuid)
+        try:
+            self._PyHocaGUI._X2goClient__connect_session(session_uuid, username=username, password=password, force_password_auth=True)
+            self._PyHocaGUI._post_authenticate(evt, session_uuid)
+        except x2go.AuthenticationException:
+            self._authentication_failed = True
         self.Destroy()
 
     def OnCancel(self, evt):


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)).




More information about the x2go-commits mailing list