[X2Go-Commits] pyhoca-gui.git - twofactorauth (branch) updated: 25876c55a9bfe58734164aca8eb3527eda3bebd6

X2Go dev team git-admin at x2go.org
Sat Sep 14 15:54:14 CEST 2013


The branch, twofactorauth has been updated
       via  25876c55a9bfe58734164aca8eb3527eda3bebd6 (commit)
      from  502800b9d1f45fcc0af5b8f7ae82fe869f325f98 (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/wxgui/frontend.py |    7 +-
 pyhoca/wxgui/logon.py    |  173 +++++++++++++++++++++++-----------------------
 pyhoca/wxgui/taskbar.py  |    2 +-
 3 files changed, 87 insertions(+), 95 deletions(-)

The diff of changes is:
diff --git a/pyhoca/wxgui/frontend.py b/pyhoca/wxgui/frontend.py
index 5951606..f5efcbe 100644
--- a/pyhoca/wxgui/frontend.py
+++ b/pyhoca/wxgui/frontend.py
@@ -238,10 +238,7 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
         # close open password dialogs (or other remaining windows)
         for _win in self._sub_windows:
             _win.Destroy()
-        try:
-            self.Destroy()
-        except wx._core.PyDeadObjectError:
-            pass
+        self.Destroy()
 
     # the taskbar's OnExit method...
     def OnTaskbarExit(self, evt):
@@ -446,5 +443,3 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
 
         """
         self.OnExit(evt)
-
-
diff --git a/pyhoca/wxgui/logon.py b/pyhoca/wxgui/logon.py
index c01149c..17007eb 100644
--- a/pyhoca/wxgui/logon.py
+++ b/pyhoca/wxgui/logon.py
@@ -45,7 +45,7 @@ import threading
 
 # PyHoca-GUI modules
 import images
-from messages import Message
+#from messages import Message
 
 try:
     from agw import knobctrl as KC
@@ -57,71 +57,93 @@ except ImportError: # if it's not there locally, try the wxPython lib.
     except ImportError:
         knobctrlavailable = False
 
-import wx.lib.sized_controls as sc
-
+#class PyHocaGUI_LogonStatusBar(wx.StatusBar):
+#    """\
+#    STILL UNDOCUMENTED
+#
+#    """
+#    def __init__(self, _PyHocaGUI):
+#        """\
+#        STILL UNDOCUMENTED
+#
+#        """
+#        self._PyHocaGUI = _PyHocaGUI
+#
+#        wx.StatusBar.__init__(self, self._PyHocaGUI, -1)
+#        font = self.GetFont()
+#        font.SetPointSize(7)
+#        self.SetFont(font)
+#        self.SetFieldsCount(2)
+#        self.SetStatusWidths([-1,200])
+#
+#        self.timer = wx.PyTimer(self.Notify)
+#        self.timer.Start(1000)
+#        self.Notify()
+#
+#    def Notify(self):
+#        """\
+#        STILL UNDOCUMENTED
+#
+#        """
+#        self.SetStatusText(self._PyHocaGUI.Environment, 0)
+#        self.SetStatusText(self._PyHocaGUI.parent.StatusText, 1)
+#        t = time.localtime(time.time())
+#
 
-class PyHocaGUI_LogonStatusBar(wx.StatusBar):
+class PyHocaGUI_DialogBoxPassword(wx.Dialog):
     """\
     STILL UNDOCUMENTED
 
     """
-    def __init__(self, _PyHocaGUI):
-        """\
-        STILL UNDOCUMENTED
+    def __init__(self, _PyHocaGUI, profile_name, caller=None): 
+        wx.Dialog.__init__(self, None, -1, 'Login', size=(210,150))
 
-        """
         self._PyHocaGUI = _PyHocaGUI
+        self._pyhoca_logger = self._PyHocaGUI._pyhoca_logger
+        self._pyhoca_logger('password dialog box started', x2go.loglevel_INFO, )
 
-        wx.StatusBar.__init__(self, self._PyHocaGUI, -1)
-        font = self.GetFont()
-        font.SetPointSize(7)
-        self.SetFont(font)
-        self.SetFieldsCount(2)
-        self.SetStatusWidths([-1,200])
-
-        self.timer = wx.PyTimer(self.Notify)
-        self.timer.Start(1000)
-        self.Notify()
-
-    def Notify(self):
-        """\
-        STILL UNDOCUMENTED
-
-        """
-        self.SetStatusText(self._PyHocaGUI.Environment, 0)
-        self.SetStatusText(self._PyHocaGUI.parent.StatusText, 1)
-        t = time.localtime(time.time())
+        self.current_profile_name = profile_name
+        self.current_profile_config = self._PyHocaGUI.session_profiles.get_profile_config(profile_name)
 
+        # widgets 
+        userLbl = wx.StaticText(self, wx.ID_ANY, 'Username:', size=(80, -1)) 
+        self.userTxt = wx.TextCtrl(self, wx.ID_ANY, '') 
+        passwordLbl = wx.StaticText(self, wx.ID_ANY, 'Password:', size=(80, -1)) 
+        self.passwordTxt = wx.TextCtrl(self, wx.ID_ANY, '', style=wx.TE_PROCESS_ENTER|wx.TE_PASSWORD) 
+        loginBtn = wx.Button(self, wx.ID_YES, 'Authenticate')
+        loginBtn.SetDefault()
+        cancelBtn = wx.Button(self, wx.ID_ANY, 'Cancel')
+        self.Bind(wx.EVT_BUTTON, self.OnLogin, loginBtn)
+        self.Bind(wx.EVT_BUTTON, self.OnCancel, cancelBtn)
+
+        # sizer / layout 
+        userSizer = wx.BoxSizer(wx.HORIZONTAL) 
+        passwordSizer = wx.BoxSizer(wx.HORIZONTAL) 
+        btnSizer = wx.BoxSizer(wx.HORIZONTAL) 
+        mainSizer = wx.BoxSizer(wx.VERTICAL)
+
+        userSizer.Add(userLbl, 0, wx.ALL, 5) 
+        userSizer.Add(self.userTxt, 0, wx.ALL, 5) 
+        passwordSizer.Add(passwordLbl, 0, wx.LEFT|wx.RIGHT, 5) 
+        passwordSizer.Add(self.passwordTxt, 0, wx.LEFT, 5) 
+        btnSizer.Add(loginBtn, 0, wx.ALL, 5) 
+        btnSizer.Add(cancelBtn, 0, wx.ALL, 5) 
+        mainSizer.Add(userSizer, 0, wx.ALL, 0) 
+        mainSizer.Add(passwordSizer, 0, wx.ALL, 0) 
+        mainSizer.Add(btnSizer, 0, wx.ALL, 5)
 
-class PyHocaGUI_DialogBoxPassword(sc.SizedFrame):
-    """\
-    STILL UNDOCUMENTED
+        if self.current_profile_config.has_key('user'):
+            self.userTxt.SetValue(self.current_profile_config['user'])
+        else:
+            self.userTxt.SetValue(self._PyHocaGUI.args.username)
 
-    """
-    def __init__(self, _PyHocaGUI, profile_name, caller=None, ):
-        """\
-        Dialog box to enter the username and password for the selected
-        session profile.
+        # Logged in variable 
+        self.loggedIn = False
 
-        """
-        self._PyHocaGUI = _PyHocaGUI
-        self._pyhoca_logger = self._PyHocaGUI._pyhoca_logger
-        self._pyhoca_logger('password dialog box started', x2go.loglevel_INFO, )
+        self.SetSizer(mainSizer) 
+        self.Fit()
+        self.Layout()
 
-        self.current_profile_name = profile_name
-        self.current_profile_config = self._PyHocaGUI.session_profiles.get_profile_config(profile_name)
-        self._authentication_failed = False
-
-        captionText = profile_name
-        sc.SizedFrame.__init__(self, None, -1, captionText,
-                        style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
-        #self.CentreOnScreen()
-        self.SetSize((220,96))
-
-        pane = self.GetContentsPane()
-        pane.SetSizerType("form")
-        pwbox = self.enterPasswordForm(pane)
-        #self.Fit()
         maxX, maxY = wx.GetDisplaySize()
         if x2go.X2GOCLIENT_OS == 'Linux':
             self.Move((maxX-225,35))
@@ -130,50 +152,20 @@ class PyHocaGUI_DialogBoxPassword(sc.SizedFrame):
 
         self.Show()
 
-    def enterPasswordForm(self, pnl):
+    def OnLogin(self, evt):
         """\
         STILL UNDOCUMENTED
 
         """
-        #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'):
-            self.username_ctl.SetValue(self.current_profile_config['user'])
-        else:
-            self.username_ctl.SetValue(self._PyHocaGUI.args.username)
-
-        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)
-        self.ConnectButton.SetDefault()
-
-        self.CancelButton = wx.Button(pnl, -1, "Cancel")
-        self.CancelButton.Bind(wx.EVT_BUTTON, self.OnCancel)
-
-    def OnAuthenticate(self, evt):
-        """\
-        STILL UNDOCUMENTED
-
-        """
-        username = self.username_ctl.GetValue()
-        password = self.passwd_ctl.GetValue()
+        username = self.userTxt.GetValue()
+        password = self.passwordTxt.GetValue()
         if len(username) == 0:
-            Message(self,1)
+            #Message(self,1)
             return
         if len(password) == 0:
-            Message(self,2)
+            #Message(self,2)
             return
 
-        if not self.IsIconized():
-            self.Iconize()
-
         session_uuid = self._PyHocaGUI._X2goClient__client_registered_sessions_of_name(self.current_profile_name)[0].get_uuid()
         try:
             self._PyHocaGUI._X2goClient__connect_session(session_uuid, username=username, password=password, force_password_auth=True)
@@ -192,4 +184,9 @@ class PyHocaGUI_DialogBoxPassword(sc.SizedFrame):
     def OnCancel(self, evt):
         self.Destroy()
 
+    def Destroy(self):
+        self._PyHocaGUI._sub_windows.remove(self)
+        wx.Dialog.Destroy(self)
+
+
 
diff --git a/pyhoca/wxgui/taskbar.py b/pyhoca/wxgui/taskbar.py
index 7896dc9..c5b8da6 100644
--- a/pyhoca/wxgui/taskbar.py
+++ b/pyhoca/wxgui/taskbar.py
@@ -50,7 +50,7 @@ import threading
 import menus_taskbar
 import profilemanager
 import images
-from messages import Message
+#from messages import Message
 
 try:
     from agw import knobctrl as KC


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