[X2Go-Commits] pyhoca-gui.git - twofactorauth (branch) updated: 0.1.0.10-23-gc3c9a80

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


The branch, twofactorauth has been updated
       via  c3c9a80b9e0c3a48c38440aca0003ea1f182f202 (commit)
      from  17a0f93e9cdf6f96492995dc844ac6fca8edaef5 (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:
 debian/changelog              |    1 +
 pyhoca/wxgui/frontend.py      |    6 ++
 pyhoca/wxgui/menus_taskbar.py |   13 +++-
 pyhoca/wxgui/sessiontitle.py  |  154 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 172 insertions(+), 2 deletions(-)
 create mode 100644 pyhoca/wxgui/sessiontitle.py

The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index 1312f46..99ebe5e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -16,6 +16,7 @@ pyhoca-gui (0.1.0.11-0~x2go1) UNRELEASED; urgency=low
       generic name).
     - Add extra menu: launch single application, once a session profile is
       connected.
+    - Add extra session menu titem: Rename Session Window.
   * Depend on Python X2Go 0.1.1.9.
 
  -- Mike Gabriel <mike.gabriel at das-netzwerkteam.de>  Wed, 09 Nov 2011 03:13:09 +0100
diff --git a/pyhoca/wxgui/frontend.py b/pyhoca/wxgui/frontend.py
index bba8e87..6e3daa3 100644
--- a/pyhoca/wxgui/frontend.py
+++ b/pyhoca/wxgui/frontend.py
@@ -62,6 +62,7 @@ import notify
 import basepath
 import messages
 import splash
+import sessiontitle
 
 wx.SetDefaultPyEncoding("utf-8")
 wx.InitAllImageHandlers()
@@ -697,6 +698,11 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
         """
         self._pyhoca_logger('The ,,List Sessions\'\' information window is not implemented yet', loglevel=x2go.log.loglevel_WARN, )
 
+    def OnSessionRename(self, evt):
+        profile_name = self._eventid_profilenames_map[evt.GetId()]
+        session_name = self._eventid_sessionnames_map[evt.GetId()]
+        sessiontitle.PyHocaGUI_DialogBoxSessionTitle(self, profile_name, session_name)
+
     def OnAbout(self, evt):
         """\
         STILL UNDOCUMENTED
diff --git a/pyhoca/wxgui/menus_taskbar.py b/pyhoca/wxgui/menus_taskbar.py
index 5c066fb..8229590 100644
--- a/pyhoca/wxgui/menus_taskbar.py
+++ b/pyhoca/wxgui/menus_taskbar.py
@@ -137,6 +137,7 @@ class PyHocaGUI_Menu_TaskbarSessionActions(wx.Menu):
 
         wx.Menu.__init__(self)
 
+        ID_RENAMESESSION = wx.NewId()
         ID_TRANSFERSESSION = wx.NewId()
         ID_TRANSFERSESSION_DISABLED = wx.NewId()
         ID_RESUMESESSION = wx.NewId()
@@ -145,19 +146,26 @@ class PyHocaGUI_Menu_TaskbarSessionActions(wx.Menu):
         ID_TERMINATESESSION = wx.NewId()
 
         # preparing profile_name information for the main PyHocaGUI instance
-        self._PyHocaGUI._eventid_profilenames_map[ID_TRANSFERSESSION] = \
+        self._PyHocaGUI._eventid_profilenames_map[ID_RENAMESESSION] = \
+            self._PyHocaGUI._eventid_profilenames_map[ID_TRANSFERSESSION] = \
             self._PyHocaGUI._eventid_profilenames_map[ID_RESUMESESSION] = \
             self._PyHocaGUI._eventid_profilenames_map[ID_SUSPENDSESSION] = \
             self._PyHocaGUI._eventid_profilenames_map[ID_TERMINATESESSION] = profile_name
 
         # preparing session_name information for the main PyHocaGUI instance
-        self._PyHocaGUI._eventid_sessionnames_map[ID_TRANSFERSESSION] = \
+        self._PyHocaGUI._eventid_sessionnames_map[ID_RENAMESESSION] = \
+            self._PyHocaGUI._eventid_sessionnames_map[ID_TRANSFERSESSION] = \
             self._PyHocaGUI._eventid_sessionnames_map[ID_RESUMESESSION] = \
             self._PyHocaGUI._eventid_sessionnames_map[ID_SUSPENDSESSION] = \
             self._PyHocaGUI._eventid_sessionnames_map[ID_TERMINATESESSION] = session_name
 
         _s = self._PyHocaGUI.get_session_of_session_name(session_name, return_object=True)
 
+        if _s.get_session_cmd() in x2go.defaults.X2GO_DESKTOPSESSIONS and status == 'R':
+
+            _rens = self.Append(text=_("Rename Session Window"), id=ID_RENAMESESSION)
+            self.AppendSeparator()
+
         if status == 'S':
 
             if _s is not None and _s.is_color_depth_ok():
@@ -180,6 +188,7 @@ class PyHocaGUI_Menu_TaskbarSessionActions(wx.Menu):
 
         self.Append(text=_(u"Terminate Session"), id=ID_TERMINATESESSION)
 
+        self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnSessionRename, id=ID_RENAMESESSION)
         self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnSessionResume, id=ID_RESUMESESSION)
         self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnSessionResume, id=ID_TRANSFERSESSION)
         self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnSessionSuspend, id=ID_SUSPENDSESSION)
diff --git a/pyhoca/wxgui/sessiontitle.py b/pyhoca/wxgui/sessiontitle.py
new file mode 100644
index 0000000..13f27cf
--- /dev/null
+++ b/pyhoca/wxgui/sessiontitle.py
@@ -0,0 +1,154 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2010-2011 by Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
+# Copyright (C) 2010-2011 by Dick Kniep <dick.kniep at lindix.nl>
+#
+# PyHoca GUI is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 General Public License for more details.
+#
+# You should have received a copy of the GNU 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 ={}
+
+try:
+    import wxversion
+    wxversion.select('2.9')
+except: pass
+
+try:
+    import wxversion
+    wxversion.select('2.8')
+except: pass
+
+# Python X2go
+import x2go
+
+# gevent
+import gevent
+import gevent.monkey
+gevent.monkey.patch_all()
+
+import wx
+import os
+
+# PyHoca-GUI modules
+# ... NONE ...
+
+if os.environ.has_key('DESKTOP_SESSION'):
+    WINDOW_MANAGER = os.environ['DESKTOP_SESSION']
+else:
+    WINDOW_MANAGER = 'generic'
+
+class PyHocaGUI_DialogBoxSessionTitle(wx.Dialog):
+    """\
+    STILL UNDOCUMENTED
+
+    """
+    def __init__(self, _PyHocaGUI, profile_name, session_name): 
+
+        self._PyHocaGUI = _PyHocaGUI
+        self._pyhoca_logger = self._PyHocaGUI._pyhoca_logger
+        self._pyhoca_logger('session title query box started', loglevel=x2go.loglevel_INFO, )
+
+        self.current_profile_name = profile_name
+        self.current_session_name = session_name
+
+        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.titleLbl = wx.StaticText(self, wx.ID_ANY, _(u'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.SetDefault()
+        self.cancelBtn = wx.Button(self, wx.ID_CANCEL, _(u'Cancel'), )
+
+        self.Bind(wx.EVT_BUTTON, self.OnOk, self.okBtn)
+        self.Bind(wx.EVT_TEXT_ENTER, self.OnOk, self.titleTxt)
+        self.Bind(wx.EVT_BUTTON, self.OnCancel, self.cancelBtn)
+
+        titleSizer = wx.BoxSizer(wx.HORIZONTAL)
+        btnSizer = wx.BoxSizer(wx.HORIZONTAL)
+        mainSizer = wx.BoxSizer(wx.VERTICAL)
+
+        titleSizer.Add(self.titleLbl, 0, wx.ALL, 5)
+        titleSizer.Add(self.titleTxt, 0, wx.ALL, 5)
+
+        btnSizer.Add(self.okBtn, 0, wx.ALL, 5) 
+        btnSizer.Add(self.cancelBtn, 0, wx.ALL, 5) 
+
+        mainSizer.Add(titleSizer, 0, wx.ALL, 5) 
+        mainSizer.Add(btnSizer, 0, wx.ALL|wx.ALIGN_RIGHT, 5)
+
+        self.SetSizerAndFit(mainSizer) 
+        self.Layout()
+
+        maxX, maxY = wx.GetDisplaySize()
+
+        # we will use the logon window position for this session re-titling windows, as well
+        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', 'awesome',)):
+
+            # 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 OnOk(self, evt):
+        """\
+        STILL UNDOCUMENTED
+
+        """
+        title = self.titleTxt.GetValue()
+
+        _session = self._PyHocaGUI._X2goClient__get_session_of_session_name(session_name=self.current_session_name, return_object=True)
+        _session.set_session_window_title(title=title)
+
+        self.Close()
+        self.Destroy()
+
+    def OnCancel(self, evt):
+
+        self.Close()
+        self.Destroy()
+
+    def Destroy(self):
+        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)


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