The branch, twofactorauth has been updated
via 4e565a5ce2c87f19af6eb2402b1c8bed7f469700 (commit)
from 32c541af677a17485c8c8f1b61152826ec03ed12 (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 | 10 +-
pyhoca/wxgui/__init__.pyc | Bin 0 -> 243 bytes
pyhoca/wxgui/{ => _delete_}/x2goLogon.py | 0
pyhoca/wxgui/chooser.py | 316 +++++++++++
pyhoca/wxgui/chooser.pyc | Bin 0 -> 10365 bytes
pyhoca/wxgui/frontend.py | 834 ++++++++++--------------------
pyhoca/wxgui/frontend.pyc | Bin 0 -> 9254 bytes
pyhoca/wxgui/images.py | 22 +-
pyhoca/wxgui/images.pyc | Bin 0 -> 8317 bytes
pyhoca/wxgui/logon.py | 176 +++++++
pyhoca/wxgui/logon.pyc | Bin 0 -> 5513 bytes
pyhoca/wxgui/menus_chooser.py | 184 +++++++
pyhoca/wxgui/menus_chooser.pyc | Bin 0 -> 5223 bytes
pyhoca/wxgui/menus_taskbar.py | 260 ++++++++++
pyhoca/wxgui/menus_taskbar.pyc | Bin 0 -> 7630 bytes
pyhoca/wxgui/messages.py | 40 +-
pyhoca/wxgui/messages.pyc | Bin 0 -> 1630 bytes
pyhoca/wxgui/profilemanager.py | 40 +-
pyhoca/wxgui/profilemanager.pyc | Bin 0 -> 22748 bytes
pyhoca/wxgui/taskbar.py | 113 ++++
pyhoca/wxgui/taskbar.pyc | Bin 0 -> 3707 bytes
21 files changed, 1390 insertions(+), 605 deletions(-)
create mode 100644 pyhoca/wxgui/__init__.pyc
rename pyhoca/wxgui/{ => _delete_}/x2goLogon.py (100%)
create mode 100644 pyhoca/wxgui/chooser.py
create mode 100644 pyhoca/wxgui/chooser.pyc
create mode 100644 pyhoca/wxgui/frontend.pyc
create mode 100644 pyhoca/wxgui/images.pyc
create mode 100644 pyhoca/wxgui/logon.py
create mode 100644 pyhoca/wxgui/logon.pyc
create mode 100644 pyhoca/wxgui/menus_chooser.py
create mode 100644 pyhoca/wxgui/menus_chooser.pyc
create mode 100644 pyhoca/wxgui/menus_taskbar.py
create mode 100644 pyhoca/wxgui/menus_taskbar.pyc
create mode 100644 pyhoca/wxgui/messages.pyc
create mode 100644 pyhoca/wxgui/profilemanager.pyc
create mode 100644 pyhoca/wxgui/taskbar.py
create mode 100644 pyhoca/wxgui/taskbar.pyc
The diff of changes is:
diff --git a/pyhoca-gui b/pyhoca-gui
index 1cdc108..ec3786e 100755
--- a/pyhoca-gui
+++ b/pyhoca-gui
@@ -21,6 +21,12 @@
modules ={}
+import gevent
+import gevent.monkey
+gevent.monkey.patch_all()
+
+import x2go.gevent_subprocess as subprocess
+
try:
import wxversion
wxversion.select('2.8')
@@ -31,7 +37,6 @@ import os.path
import sys
import platform
import exceptions
-from subprocess import Popen, PIPE
# Python X2go modules
import x2go
@@ -48,6 +53,7 @@ VERSION_TEXT="""
%s[%s] - an X2go GUI client written in Python
----------------------------------------------------------------------
developed by Dick Kniep <dick.kniep(a)lindix.nl>
+ and Mike Gabriel <m.gabriel(a)das-netzwerkteam.de>
VERSION: %s
@@ -130,7 +136,7 @@ def version():
def check_running(logger):
if platform.system() in ('Linux', 'Mac'):
- p = Popen(['ps', '-A'], stdout=PIPE)
+ p = subprocess.Popen(['ps', '-A'], stdout=subprocess.PIPE)
psA_out = p.communicate()
#logger('psa_out %s' % (psA_out,), x2go.loglevel_DEBUG )
return psA_out[0].count(PROG_NAME) > 1
diff --git a/pyhoca/wxgui/__init__.pyc b/pyhoca/wxgui/__init__.pyc
new file mode 100644
index 0000000..4f35946
Binary files /dev/null and b/pyhoca/wxgui/__init__.pyc differ
diff --git a/pyhoca/wxgui/x2goLogon.py b/pyhoca/wxgui/_delete_/x2goLogon.py
similarity index 100%
rename from pyhoca/wxgui/x2goLogon.py
rename to pyhoca/wxgui/_delete_/x2goLogon.py
diff --git a/pyhoca/wxgui/chooser.py b/pyhoca/wxgui/chooser.py
new file mode 100644
index 0000000..25d59b9
--- /dev/null
+++ b/pyhoca/wxgui/chooser.py
@@ -0,0 +1,316 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2010 by Dick Kniep <dick.kniep(a)lindix.nl>
+# Copyright (C) 2010 by Mike Gabriel <m.gabriel(a)das-netzwerkteam.de>
+#
+# 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.8')
+except: pass
+
+# Python X2go
+import x2go
+
+import gevent
+import gevent.monkey
+gevent.monkey.patch_all()
+
+import wx
+import wx.lib.scrolledpanel as scrolled
+import wx.lib.mixins.listctrl as listmix
+
+import time
+import sys
+import platform
+import types
+import copy
+import threading
+
+# PyHoca-GUI modules
+import menus_chooser
+import taskbar
+import profilemanager
+import images
+from messages import Message
+
+try:
+ from agw import knobctrl as KC
+ knobctrlavailable = True
+except ImportError: # if it's not there locally, try the wxPython lib.
+ try:
+ import wx.lib.agw.knobctrl as KC
+ knobctrlavailable = True
+ except ImportError:
+ knobctrlavailable = False
+
+import wx.lib.sized_controls as sc
+
+
+class PyHocaGUI_SessionChooser(wx.Frame):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ def __init__(self, _PyHocaGUI, iconized=True):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ self._PyHocaGUI = _PyHocaGUI
+ self._pyhoca_logger = self._PyHocaGUI._pyhoca_logger
+
+ #self._pyhoca_logger('session chooser screen starts iconized in systray: %s' % iconized,
+ # loglevel=x2go.loglevel_INFO, )
+
+ #self.current_session_uuid = _PyHocaGUI.current_session_uuid
+
+ #self.selected_session_uuid = None
+ self.currentItem = None
+
+ #if self.current_session_uuid:
+ # self._pyhoca_logger('with current session profile %s' % _PyHocaGUI.get_profile_name(current_session_uuid),
+ # loglevel=x2go.loglevel_INFO, )
+
+ wx.Frame.__init__(self, None, -1)
+ self.CentreOnScreen()
+ self.il = wx.ImageList(16, 16)
+ self.list = PyHocaGUI_ListCtrl(self, -1,
+ style=wx.LC_REPORT | wx.BORDER_NONE | wx.LC_SORT_ASCENDING
+ )
+ self.idx1 = self.il.Add(images.getnetwork_disconnected_lanBitmap())
+ self.idx2 = self.il.Add(images.getnetwork_connected_lan_kncBitmap())
+ self.idx3 = self.il.Add(images.getresumeBitmap())
+
+ self.list.SetImageList(self.il, wx.IMAGE_LIST_SMALL)
+
+ self.TaskBarIcon = taskbar.PyHocaGUI_TaskBarIcon(self._PyHocaGUI)
+ self.TaskBarIcon.Bind(wx.EVT_TASKBAR_LEFT_DCLICK, lambda _Show: self.Show(True))
+ self.TaskBarIcon.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self.TaskBarIcon.CreateSessionManagerPopupMenu)
+
+ self.Main_MenuBar = wx.MenuBar()
+ self.SetMenuBar(self.Main_MenuBar)
+ self.Main_MenuBar.Append(menus_chooser.PyHocaGUI_Menu_ChooserSessions(self._PyHocaGUI, caller=self), '&Sessions')
+ self.Main_MenuBar.Append(menus_chooser.PyHocaGUI_Menu_ChooserProfiles(self._PyHocaGUI, caller=self), '&Profiles')
+ self.Main_MenuBar.Append(menus_chooser.PyHocaGUI_Menu_ChooserExtras(self._PyHocaGUI, caller=self), '&Extras')
+
+ self.PopulateList()
+
+ self.Bind(wx.EVT_SIZE, self.OnSize)
+
+ self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected, self.list)
+ self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated, self.list)
+
+ self.list.Bind(wx.EVT_LEFT_DCLICK, self.OnDoubleClick)
+ self.list.Bind(wx.EVT_RIGHT_DOWN, self.OnRightDown)
+
+ # for wxMSW
+ self.list.Bind(wx.EVT_COMMAND_RIGHT_CLICK, self.OnRightClick)
+
+ # for wxGTK
+ self.list.Bind(wx.EVT_RIGHT_UP, self.OnRightClick)
+
+ self.Bind(wx.EVT_CLOSE, self.OnCancel)
+
+ if iconized:
+ if not self.IsIconized():
+ self.Iconize(True)
+ #if parent.args.password and parent.args.username and self.current_profile:
+ # X2GoPasswordScrn(self)
+ #elif parent.args.profile:
+ # Message(self, 4)
+ # self.Iconize(False)
+ else:
+ self.Show(True)
+
+ def OnSize(self, event):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ w,h = self.GetClientSizeTuple()
+ self.list.SetDimensions(0, 0, w, h)
+
+ def PopulateList(self):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ info = wx.ListItem()
+ info.m_mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_IMAGE | wx.LIST_MASK_FORMAT
+ info.m_image = -1
+ info.m_format = 0
+ info.m_text = "Session Profile"
+ self.list.InsertColumnInfo(0, info)
+
+ info.m_format = wx.LIST_FORMAT_RIGHT
+ info.m_text = ""
+ self.list.InsertColumnInfo(1, info)
+
+ info.m_format = wx.LIST_FORMAT_RIGHT
+ info.m_text = "Status"
+ self.list.InsertColumnInfo(2, info)
+
+ info.m_format = wx.LIST_FORMAT_RIGHT
+ info.m_text = "Profile ID"
+ self.list.InsertColumnInfo(3, info)
+
+ #self._pyhoca_logger('sessions profiles: %s' % self.session_profiles.profile_names, loglevel=x2go.loglevel_INFO, )
+ for session_uuid in [ s() for s in self._PyHocaGUI.control_sessions.values() ]:
+
+ _rs = registered_session = self._PyHocaGUI.get_registered_session(session_uuid)
+ profile_name = registered_session.get_profile_name()
+ session_name = registered_session.get_session_name()
+ self.addRow(profile_name, session_name=session_name, connected=_rs.is_connected(), running=_rs.is_running(), suspended=_rs.is_suspended(), alive=_rs.session_ok())
+
+ self.list.SetColumnWidth(0, wx.LIST_AUTOSIZE)
+
+ def addRow(self, profile_name, session_name=None, connected=False, running=False, suspended=False, alive=False):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ if connected and alive and running:
+ imageNr = self.idx2
+ statusText = 'Connected'
+ elif suspended or (not connected and (alive or running)):
+ imageNr = self.idx3
+ statusText = 'Suspended'
+ else:
+ imageNr = self.idx1
+ statusText = 'Not Connected'
+ _index = self.list.InsertImageStringItem(sys.maxint, profile_name, imageNr)
+ #self.list.SetStringItem(_index, 1, str(idx))
+ self.list.SetStringItem(_index, 2, statusText)
+ if session_name: self.list.SetStringItem(_index, 3, session_name)
+
+ def OnRightDown(self, event):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ x = event.GetX()
+ y = event.GetY()
+ item, flags = self.list.HitTest((x, y))
+
+ if flags & wx.LIST_HITTEST_ONITEM:
+ self.list.Select(item)
+ event.Skip()
+
+ def OnItemSelected(self, event):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ ##print event.GetItem().GetTextColour()
+ self.currentItem = event.m_itemIndex
+ self.selected_profile = self.current_profile = self.parent.SessionProfiles.get_profile_config(self.list.GetItemText(self.currentItem))
+
+ def OnItemActivated(self, event):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ self.currentItem = event.m_itemIndex
+ self.selected_profile = self.current_profile = self.SessionProfiles.get_profile_config(self.list.GetItemText(self.currentItem))
+
+ def OnDoubleClick(self, event):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ self._pyhoca_logger('DoubleClick', x2go.loglevel_INFO, )
+ PyHocaGUI_PasswordScrn(self)
+ event.Skip()
+
+ def OnRightClick(self, event):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ # only do this part the first time so the events are only bound once
+ # Popup the menu. If an item is selected then its handler
+ # will be called before PopupMenu returns.
+ self.PopupMenu(menus.PyHocaGUI_MenuProfileManager(self._PyHocaGUI, caller=self))
+
+ def OnCancel(self, evt):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ #if not self._PyHocaGUI.has_running_sessions:
+ # self.TaskBarIcon.Destroy()
+ self.Iconize(True)
+
+ def callbackConnection(self, error):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ if self.currentItem:
+ if error:
+ self.list.SetItemImage(self.currentItem, self.idx1)
+ else:
+ self.list.SetItemImage(self.currentItem, self.idx2)
+
+ def callbackupdList(self, action, profile):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ if action == 'Add':
+ self.addRow(profile.name, False, False)
+ else:
+ self.list.SetStringItem(self.currentItem, 0, profile['name'])
+
+
+class PyHocaGUI_ListCtrl(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSorterMixin):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ def __init__(self, parent, ID, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0):
+
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ wx.ListCtrl.__init__(self, parent, ID, pos, size, style)
+ listmix.ListCtrlAutoWidthMixin.__init__(self)
+ self.sm_up = parent.il.Add(images.getSmallUpArrowBitmap())
+ self.sm_dn = parent.il.Add(images.getSmallDnArrowBitmap())
+ listmix.ColumnSorterMixin.__init__(self, 2)
+ self.SortListItems(0, True)
+
+ # Used by the ColumnSorterMixin, see wx/lib/mixins/listctrl.py
+ def GetListCtrl(self):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ return self
+
+ # Used by the ColumnSorterMixin, see wx/lib/mixins/listctrl.py
+ def GetSortImages(self):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ return (self.sm_dn, self.sm_up)
+
diff --git a/pyhoca/wxgui/chooser.pyc b/pyhoca/wxgui/chooser.pyc
new file mode 100644
index 0000000..96548f9
Binary files /dev/null and b/pyhoca/wxgui/chooser.pyc differ
diff --git a/pyhoca/wxgui/frontend.py b/pyhoca/wxgui/frontend.py
index 98dedfb..ea11f13 100644
--- a/pyhoca/wxgui/frontend.py
+++ b/pyhoca/wxgui/frontend.py
@@ -24,40 +24,35 @@ try:
import wxversion
wxversion.select('2.8')
except: pass
-import wx
+
+# Python X2go
import x2go
-import time
-import sys
+
+import gevent
+import gevent.monkey
+gevent.monkey.patch_all()
+
+import wx
import wx.lib.scrolledpanel as scrolled
import wx.lib.mixins.listctrl as listmix
+
+import time
+import sys
import platform
import types
+import copy
+import threading
# PyHoca-GUI modules
+import logon
+import taskbar
+import chooser
+import menus_chooser
+import menus_taskbar
import profilemanager
import images
from messages import Message
-
-class PyHocaGUI(wx.App, x2go.X2goClient):
- def __init__(self, args, logger, liblogger):
- self.args = args
- self.logger = logger
- self.liblogger = liblogger
- wx.App.__init__(self)
-
- def OnInit(self):
- wx.BeginBusyCursor()
- self.SetAppName('PyHoca-GUI -- Python based X2go Client')
- self.SetVendorName('Lindix BV. Almere (c) 2010')
- startX2Go(self)
- wx.EndBusyCursor()
- return True
-
- def OnExit(self):
- pass
-
-
try:
from agw import knobctrl as KC
knobctrlavailable = True
@@ -70,557 +65,284 @@ except ImportError: # if it's not there locally, try the wxPython lib.
import wx.lib.sized_controls as sc
-class menuActions(wx.Menu):
- def __init__(self, parent, fromTaskBarIcon=False, popupMenu=False):
- if fromTaskBarIcon:
- self.parent = parent.parent
- else:
- self.parent = parent
- self.fromTaskBarIcon = fromTaskBarIcon
- self.popupMenu = popupMenu
- if hasattr(parent,'logger'):
- self.logger = self.parent.logger
- else:
- self.logger = self.parent.parent.logger
- if hasattr(parent,'settingsProfile'):
- self.settingsProfile = parent.settingsProfile
- self.SessionProfiles = parent.SessionProfiles
- self.printProfile = parent.printProfile
- self.registeredSessions = parent.registeredSessions
+
+class PyHocaGUI(wx.App, x2go.X2goClient):
+
+ def __init__(self, args, logger, liblogger,
+ appname='PyHoca-GUI -- Python based X2go Client',
+ vendorname='Open Source Software Foundation',):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ self.appname = appname
+ self.vendorname = vendorname
+
+ self.args = args
+ if logger is None:
+ self._pyhoca_logger = x2go.X2goLogger(tag='PyHocaGUI')
else:
- self.settingsProfile = parent.parent.settingsProfile
- self.SessionProfiles = parent.parent.SessionProfiles
- self.printProfile = parent.parent.printProfile
- self.registeredSessions = parent.parent.registeredSessions
- if hasattr(parent,'selected_profile'):
- self.selected_profile = parent.selected_profile
+ self._pyhoca_logger = copy.deepcopy(logger)
+ self._pyhoca_logger.tag = 'PyHocaGUI'
+
+ if liblogger is None:
+ self._pyhoca_liblogger = x2go.X2goLogger()
else:
- self.selected_profile = parent.parent.selected_profile
-
- ADDPROFILEMENUTXT = "Add &New profile"
- OPENNEWMENUTXT = "&Open new Session"
- RUNNINGMENUTXT = "R&Unning sessions"
- SUSPENDMENUTXT = "&Suspend session"
- RESUMEMENUTXT = "&Resume suspended session"
- UPDATEPROFMNUTEXT = "&Update current Profile"
- CLOSEMENUTXT = "&Close running Session"
- EXITMENUTXT = "E&xit"
- MENU_NEWSESSION = wx.NewId()
- MENU_LISTSESSIONS = wx.NewId()
- MENU_SUSPEND = wx.NewId()
- MENU_RESUME = wx.NewId()
- MENU_EDITSESSION = wx.NewId()
- MENU_CLOSESESSION = wx.NewId()
- MENU_EXIT = wx.NewId()
- MENU_NEWPROFILE = wx.NewId()
- wx.Menu.__init__(self)
- self.logger('settingsProfile.newProfile %s' % dir(self.settingsProfile), x2go.loglevel_INFO, )
- self.Append(MENU_NEWSESSION, OPENNEWMENUTXT)
- parent.Bind(wx.EVT_MENU, self.OnNewSession, id=MENU_NEWSESSION)
- if self.settingsProfile.get('Authorization','newprofile',types.BooleanType):
- self.Append(MENU_NEWPROFILE, ADDPROFILEMENUTXT)
- parent.Bind(wx.EVT_MENU, self.OnAddProfile, id=MENU_NEWPROFILE)
- if self.registeredSessions.has_running_session and popupMenu is False:
- self.Append(MENU_LISTSESSIONS, RUNNINGMENUTXT)
- parent.Bind(wx.EVT_MENU, self.OnListSessions, id=MENU_LISTSESSIONS)
- if self.settingsProfile.get('Authorization','suspend',types.BooleanType) and ((popupMenu is False and self.registeredSessions.has_running_session)
- or (popupMenu and self.registeredSessions.running_sessions_of_name(self.parent.selected_profile['name']) is False and self.selected_profile.session_ok())):
- self.Append(MENU_SUSPEND, SUSPENDMENUTXT)
- parent.Bind(wx.EVT_MENU, self.OnSuspend, id=MENU_SUSPEND)
- if self.settingsProfile.get('Authorization','resume',types.BooleanType) and self.registeredSessions.has_suspended_session:
- self.Append(MENU_RESUME, RESUMEMENUTXT)
- parent.Bind(wx.EVT_MENU, self.OnResume, id=MENU_RESUME)
- if self.settingsProfile.get('Authorization','editprofile',types.BooleanType):
- self.AppendSeparator()
- self.Append(MENU_EDITSESSION, UPDATEPROFMNUTEXT)
- parent.Bind(wx.EVT_MENU, self.OnUpdateProfile, id=MENU_EDITSESSION)
- self.AppendSeparator()
- self.Append(MENU_EXIT, EXITMENUTXT)
- parent.Bind(wx.EVT_MENU, self.OnExit, id=MENU_EXIT)
- #self.parent.Bind(wx.EVT_CLOSE, self.OnClose)
-
- def OnAddProfile(self, evt):
- self.logger('Add Profile started', x2go.loglevel_INFO, )
- profilemanager.X2goMaintProfile('Add', self.parent, self.SessionProfiles, self.parent.callbackupdList)
-
- def OnNewSession(self, evt):
- if hasattr(self.parent,'selected_profile'):
- X2GoPasswordScrn(self.parent)
- elif len(self.SessionProfiles.x2goprofs) > 1:
- self.logger('self.parent.IsIconized() %s' % self.parent.IsIconized(), x2go.loglevel_INFO, )
- if self.parent.IsIconized() or not self.parent.IsShown():
- self.parent.Iconize(False)
- if not self.parent.IsShown():
- self.parent.Show(True)
- self.parent.Raise()
- self.parent.SetFocus()
+ self._pyhoca_liblogger = copy.deepcopy(liblogger)
- def OnListSessions(self, evt):
- self.logger('List Sessions started', x2go.loglevel_INFO, )
+ x2go.X2goClient.__init__(self, logger=self._pyhoca_liblogger)
+ wx.App.__init__(self)
+ self.Bind (wx.EVT_IDLE, self.OnIdle)
- def OnSuspend(self, evt):
- self.logger('Suspend Sessions started', x2go.loglevel_INFO, )
+ def OnInit(self):
+ """\
+ STILL UNDOCUMENTED
- def OnResume(self, evt):
- self.logger('Resume Sessions started', x2go.loglevel_INFO, )
+ """
+ wx.BeginBusyCursor()
+ self.SetAppName(self.appname)
+ self.SetVendorName(self.vendorname)
+ self.startGUI()
+ wx.EndBusyCursor()
+ return True
- def OnUpdateProfile(self, evt):
- self.logger('Update Profile started', x2go.loglevel_INFO, )
- if self.selected_profile:
- profilemanager.X2goMaintProfile('Upd', self.parent, self.SessionProfiles, self.parent.callbackupdList, self.selected_profile)
+ def OnIdle(self, evt):
+ """\
+ STILL UNDOCUMENTED
- def OnExit(self, evt):
- self.logger('Exit application', x2go.loglevel_INFO, )
- self.__getFrameParent().Close(True)
+ """
+ gevent.sleep(.01)
+ evt.RequestMore()
+ return True
+
+ def startGUI(self):
+ """\
+ This routine starts all PyHoca-GUI processing. On startup PyHoca-GUI behaves
+ as below:
+
+ 1. If there is only one profile available, or if there is one (1) single
+ profile that has the default switch, and the password has not been passed,
+ the logon screen is shown immediately.
+
+ 2. If there is only one profile available, or if there is one (1) single
+ profile that has the default switch, and the password has been passed,
+ the connection can be made immediately and the screens should not be shown,
+ but if there is an error in the connection, the logon screen should be shown with an errormessage.
+
+ 3. If there are more than one profile available, and there is no default,
+ the list of available profiles should be shown. After the user chooses
+ a profile, the connection should be made to that specific profile, turning
+ it into a session. After that all screens should be minimized.
- def OnClose(self, evt):
- self.logger('Close application', x2go.loglevel_INFO, )
- self.__getFrameParent().Close()
-
- def __getFrameParent(self):
- if isinstance(self, wx.Frame):
- return self
- if isinstance(self.parent, wx.Frame):
- return self.parent
- elif isinstance(self.parent.parent, wx.Frame):
- return self.parent.parent
-
-
-class LogonStatusBar(wx.StatusBar):
- def __init__(self, parent):
- wx.StatusBar.__init__(self, parent, -1)
- font = self.GetFont()
- font.SetPointSize(7)
- self.SetFont(font)
- self.SetFieldsCount(2)
- self.SetStatusWidths([-1,200])
- self.parent = parent
-
- self.timer = wx.PyTimer(self.Notify)
- self.timer.Start(1000)
- self.Notify()
-
- def Notify(self):
- self.SetStatusText(self.parent.Environment, 0)
- self.SetStatusText(self.parent.StatusText, 1)
- t = time.localtime(time.time())
-
-class X2GoResumeSessions(sc.SizedFrame):
- def __init__(self, parent, SessionProfiles, settingsProfile, printProfile, Iconize):
- sc.SizedFrame.__init__(self, None, -1, "X2go Password entry",
- style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
-
-class X2GoPasswordScrn(sc.SizedFrame):
- def __init__(self, parent):
"""
- Screen to enter the userid and password for the session
+ self._pyhoca_logger('starting a new X2go GUI session', loglevel=x2go.loglevel_INFO, )
+
+ # THIS HAS TO MOVE INTO Python X2go
+ #if platform.system() == 'Windows':
+ # #parent.settingsProfile = SessionProfile.XServer(parent.liblogger)
+ # import x2go.X2goXServer as _xserver
+ # _xserver.startXserver(parent)
+
+ # We register one session per available session profile.
+ # These registered sessions we call ,,control'' sessions
+ # On control sessions we will never start an X2go session
+ # X2go sessions are started on siblings of the control session
+
+ self._pyhoca_logger('registering PyHocaGUI control sessions', loglevel=x2go.loglevel_INFO, )
+ self.control_sessions = self.register_all_session_profiles(return_objects=True)
+
+ #default_session = None
+ #_defaults = _session_profiles.get_default_profiles()
+ #if _defaultProfiles and len(_defaultProfiles) == 1:
+ # self.current_profile = defaultProfile = _defaultProfiles[0]
+
+ # auto-resume suspended sessions
+ #_suspended_sessions = self.suspended_sessions
+ #if _suspended_sessions and len(_suspended_sessions) > 0:
+ # if _client_settings.autoresume:
+ #
+ # self._pyhoca_logger('autoresuming suspended sessions: %s' % _suspended_sessions, loglevel=x2go.loglevel_INFO, )
+ # ChoiceScrn = X2GoChooseSessionScrn(self, Iconize=True)
+ # for suspended in _suspended_sessions:
+ # suspended.resume()
+ # else:
+ #
+ # self._pyhoca_logger('select sessions to be resumed from suspended sessions: %s' % _suspended_sessions, loglevel=x2go.loglevel_INFO, )
+ # X2GoResumeSessions(self, _suspended_sessions)
+ #
+ #elif defaultProfile:
+ #
+ # # start minimized and immediately connect to the default sessions
+ # ChoiceScrn = X2GoChooseSessionScrn(self, Iconize=self.args.minimized)
+
+ #elif len(_session_profiles.profile_ids) > 0:
+ #
+ # self._pyhoca_logger('starting profile selection window', loglevel=x2go.loglevel_INFO, )
+ self._chooser_selected_profile_name = None
+ self.chooser = chooser.PyHocaGUI_SessionChooser(self)
+ self.taskbar = self.chooser.TaskBarIcon
+ self._eventid_profilenames_map = {}
+ self._eventid_sessionnames_map = {}
+
+ #else:
+ #
+ # self._pyhoca_logger('starting profile manager with new/empty session profile', loglevel=x2go.loglevel_INFO, )
+ # defScrn = X2GoSessionDefScrn(self, directCall=True)
+
+ # wx.App's OnExit method
+ def OnExit(self):
+ x2go.x2go_cleanup()
+
+ # the taskbar's OnExit method...
+ def OnTaskbarExit(self, evt):
+ """\
+ STILL UNDOCUMENTED
- if the screen is iconized, but an error occurs, the screen is displayed
- and the user can enter another userid/password
"""
- captionText = "X2go Profile " + parent.current_profile['name']
- sc.SizedFrame.__init__(self, None, -1, captionText,
- style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
- self.CentreOnScreen()
-
- self.SetSize((350,250))
-
- self.settingsProfile = parent.settingsProfile
- self.SessionProfiles = parent.SessionProfiles
- self.current_profile = parent.current_profile
- self.registeredSessions = parent.registeredSessions
- self.printProfile = parent.printProfile
- self.parent = parent
- self.logger = parent.logger
- self.logger('Password entry screen started', x2go.loglevel_INFO, )
- pane = self.GetContentsPane()
- pane.SetSizerType("form")
- pwScrn = self.passwordScrn(pane)
- self.Fit()
- if parent.parent.args.password and parent.parent.args.username and self.current_profile:
- self.onConnect()
- else:
- self.Show(True)
-
- def passwordScrn(self, pnl):
- wx.StaticText(pnl, -1, ' User'),
- self.username_ctl = wx.TextCtrl(pnl, -1)
- self.username_ctl.SetSizerProps(expand=True)
- if hasattr(self.current_profile,'username'):
- self.username_ctl.SetValue(self.current_profile.username)
- else:
- self.username_ctl.SetValue(self.parent.parent.args.username)
-
- wx.StaticText(pnl, -1, ' Password'),
- self.passwd_ctl = wx.TextCtrl(pnl, -1, style=wx.TE_PASSWORD)
-
- self.ConnectButton = wx.Button(pnl, -1, "Connect")
- self.ConnectButton.Bind(wx.EVT_BUTTON, self.OnOK)
- self.ConnectButton.SetDefault()
-
- self.CancelButton = wx.Button(pnl, -1, "Cancel")
- self.CancelButton.Bind(wx.EVT_BUTTON, self.OnCancel)
-
- def OnOK(self, evt):
- username = self.username_ctl.GetValue()
- password = self.passwd_ctl.GetValue()
- if len(username) == 0:
- Message(self,1)
- return
- if len(password) == 0:
- Message(self,2)
- return
- self.onConnect(username, password)
-
- def onConnect(self, username, password):
- removeParms = ['defsndport', 'useiconv', 'iconvfrom', 'height', 'width', 'export', 'speed', 'quality', 'fullscreen','xdmcpserver', 'rdpoptions', 'print', 'sndport', 'usekbd','fstunnel', 'sound', 'rootless', 'icon', 'default', 'iconvto', 'dpi','rdpserver', 'soundtunnel', 'name','applications', 'setdpi', 'startsoundsystem']
- error = True
- profile_name = self.current_profile['name']
- profile_id = self.SessionProfiles.to_profile_id(profile_name)
- _params = self.SessionProfiles.get_profile_config(profile_name)
- if 'export' in _params:
- _params['share_local_folders'] = _params['export'].split(',')
- else:
- _params['share_local_folders'] = self.settingsProfile.get('General','sharefolders')
-
- _params['geometry'] = str(_params['width']) + 'x' + str(_params['height'])
- for fromparm, toparm in x2go.defaults.X2GO_INIPARMS_TO_SESSION_PARMS:
- if fromparm in _params:
- _params[toparm] = _params[fromparm]
- del _params[fromparm]
-
- for parm in removeParms:
- if parm in _params:
- del _params[parm]
-
- _params['printing'] = self.settingsProfile.get('General','printing')
- #try:
- session_uuid = self.registeredSessions.register(profile_id, profile_name, **_params)
- self.registeredSessions(session_uuid).connect(password=password)
- self.registeredSessions(session_uuid).start()
- error = False
- #except x2go.AuthenticationException:
- #Message(self,3)
- #except x2go.BadHostKeyException:
- #Message(self,message='SSH host key verification for remote host [%s]:%s failed' % (self.current_profile['host'], self.current_profile['sshport'] ))
- #except x2go.SSHException, e:
- #Message(self,message='Problem with ssh tunnel for host [%s]:%s failed' % (self.current_profile['host'], self.current_profile['sshport'] ))
- #except:
- #Message(self,message='Unknown problem with connection to host [%s]:%s' % (self.current_profile['host'], self.current_profile['sshport'] ))
- if error:
- self.Show(True)
- if self.IsIconized():
- self.Iconize(False)
- else:
- self.Show(False)
- if not self.IsIconized():
- self.Iconize(True)
- self.parent.callbackConnection(error)
- return
-
- def OnCancel(self, evt):
- self.Destroy()
-
-class X2GoListCtrl(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSorterMixin):
- def __init__(self, parent, ID, pos=wx.DefaultPosition,
- size=wx.DefaultSize, style=0):
- wx.ListCtrl.__init__(self, parent, ID, pos, size, style)
- listmix.ListCtrlAutoWidthMixin.__init__(self)
- self.sm_up = parent.il.Add(images.getSmallUpArrowBitmap())
- self.sm_dn = parent.il.Add(images.getSmallDnArrowBitmap())
- listmix.ColumnSorterMixin.__init__(self, 2)
- self.SortListItems(0, True)
-
- # Used by the ColumnSorterMixin, see wx/lib/mixins/listctrl.py
- def GetListCtrl(self):
- return self
-
- # Used by the ColumnSorterMixin, see wx/lib/mixins/listctrl.py
- def GetSortImages(self):
- return (self.sm_dn, self.sm_up)
-
-
-class X2GoChooseSessionScrn(wx.Frame):
- def __init__(self, parent, Iconize=False):
- self.parent = parent
- self.logger = parent.logger
- self.settingsProfile = parent.settingsProfile
- self.SessionProfiles = parent.SessionProfiles
- self.current_profile = parent.current_profile
- self.registeredSessions = parent.registeredSessions
- self.selected_profile = None
- self.currentItem = None
- self.printProfile = parent.printProfile
- self.logger('Choose Session screen started iconize %s' % Iconize, x2go.loglevel_INFO, )
- if self.current_profile: self.logger('With current session %s' % self.current_profile['name'], x2go.loglevel_INFO, )
- wx.Frame.__init__(self, None, -1)
- self.CentreOnScreen()
- self.il = wx.ImageList(16, 16)
- self.list = X2GoListCtrl(self, -1,
- style=wx.LC_REPORT | wx.BORDER_NONE | wx.LC_SORT_ASCENDING
- )
- self.idx1 = self.il.Add(images.getnetwork_disconnected_lanBitmap())
- self.idx2 = self.il.Add(images.getnetwork_connected_lan_kncBitmap())
- self.idx3 = self.il.Add(images.getresumeBitmap())
-
- self.list.SetImageList(self.il, wx.IMAGE_LIST_SMALL)
-
- self.PopulateList()
-
- self.Main_MenuBar = wx.MenuBar()
- self.SetMenuBar(self.Main_MenuBar)
- self.Main_MenuBar.Append(menuActions(self), '&Connection')
- self.tb = X2GoLogonTaskBarIcon(self)
-
- self.Bind(wx.EVT_SIZE, self.OnSize)
-
- self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected, self.list)
- self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated, self.list)
-
- self.list.Bind(wx.EVT_LEFT_DCLICK, self.OnDoubleClick)
- self.list.Bind(wx.EVT_RIGHT_DOWN, self.OnRightDown)
-
- # for wxMSW
- self.list.Bind(wx.EVT_COMMAND_RIGHT_CLICK, self.OnRightClick)
-
- # for wxGTK
- self.list.Bind(wx.EVT_RIGHT_UP, self.OnRightClick)
-
- self.Bind(wx.EVT_CLOSE, self.OnCancel)
- if Iconize:
- if not self.IsIconized():
- self.Iconize(True)
- if parent.args.password and parent.args.username and self.current_profile:
- X2GoPasswordScrn(self)
- elif parent.args.profile:
- Message(self, 4)
- self.Iconize(False)
- else:
- self.Show(True)
-
- def OnSize(self, event):
- w,h = self.GetClientSizeTuple()
- self.list.SetDimensions(0, 0, w, h)
-
- def PopulateList(self):
- sessions = self.parent.SessionProfiles.profile_names
- info = wx.ListItem()
- info.m_mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_IMAGE | wx.LIST_MASK_FORMAT
- info.m_image = -1
- info.m_format = 0
- info.m_text = "Profile"
- self.list.InsertColumnInfo(0, info)
-
- info.m_format = wx.LIST_FORMAT_RIGHT
- info.m_text = ""
- self.list.InsertColumnInfo(1, info)
-
- info.m_format = wx.LIST_FORMAT_RIGHT
- info.m_text = "Status"
- self.list.InsertColumnInfo(2, info)
-
- info.m_format = wx.LIST_FORMAT_RIGHT
- info.m_text = "Sessie-Id"
- self.list.InsertColumnInfo(3, info)
-
- self.logger('sessions %s' % sessions, x2go.loglevel_INFO, )
- for profilename in sessions:
- registeredProfiles = self.registeredSessions.registered_sessions_of_name(profilename)
- if len(registeredProfiles):
- for idx, session in enumerate(registeredProfiles):
- if len(registeredProfiles) > 1:
- prName = profilename
- else:
- prName = profilename
- self.addRow(prName, idx, session, session.connected, session.is_running(), session.is_suspended(), sessions.session_ok())
- else:
- self.addRow(profilename)
- self.list.SetColumnWidth(0, wx.LIST_AUTOSIZE)
-
- def addRow(self, profilename, idx='', sessionName=None, connected=False, running=False, suspended=False, alive=False):
- if connected and alive and running:
- imageNr = self.idx2
- statusText = 'Connected'
- elif suspended or (not connected and (alive or running)):
- imageNr = self.idx3
- statusText = 'Suspended'
- else:
- imageNr = self.idx1
- statusText = 'Not Connected'
- index = self.list.InsertImageStringItem(sys.maxint, profilename, imageNr)
- self.list.SetStringItem(index, 1, str(idx))
- self.list.SetStringItem(index, 2, statusText)
- if sessionName: self.list.SetStringItem(index, 3, sessionName)
-
- def OnRightDown(self, event):
- x = event.GetX()
- y = event.GetY()
- item, flags = self.list.HitTest((x, y))
-
- if flags & wx.LIST_HITTEST_ONITEM:
- self.list.Select(item)
- event.Skip()
-
- def OnItemSelected(self, event):
- ##print event.GetItem().GetTextColour()
- self.currentItem = event.m_itemIndex
- self.selected_profile = self.current_profile = self.parent.SessionProfiles.get_profile_config(self.list.GetItemText(self.currentItem))
-
- def OnItemActivated(self, event):
- self.currentItem = event.m_itemIndex
- self.selected_profile = self.current_profile = self.SessionProfiles.get_profile_config(self.list.GetItemText(self.currentItem))
-
- def OnDoubleClick(self, event):
- self.logger('DoubleClick', x2go.loglevel_INFO, )
- X2GoPasswordScrn(self)
- event.Skip()
-
- def OnRightClick(self, event):
- # only do this part the first time so the events are only bound once
-
- # Popup the menu. If an item is selected then its handler
- # will be called before PopupMenu returns.
- self.PopupMenu(menuActions(self, popupMenu=True))
-
- def OnCancel(self, evt):
- if not self.registeredSessions.has_running_session:
- #self.Close()
- self.tb.Destroy()
- self.Destroy()
-
- def callbackConnection(self, error):
- if self.currentItem:
- if error:
- self.list.SetItemImage(self.currentItem, self.idx1)
- else:
- self.list.SetItemImage(self.currentItem, self.idx2)
-
- def callbackupdList(self, action, profile):
- if action == 'Add':
- self.addRow(profile.name, False, False)
+ self._pyhoca_logger('Exit application', x2go.loglevel_INFO, )
+ self.taskbar.Destroy()
+ self.chooser.Destroy()
+
+ def OnControlSessionAuthenticate(self, evt):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ profile_name = self._eventid_profilenames_map[evt.GetId()]
+ session_uuid = self.control_sessions[profile_name].get_uuid()
+ try:
+ # try SSH key auth first
+ self._X2goClient__connect_session(session_uuid)
+ except x2go.AuthenticationException:
+ logon.PyHocaGUI_DialogBoxPassword(self, caller=self, current_profile_name=profile_name)
+
+ def OnSessionStart(self, evt):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ _username = self.control_sessions[self.current_profile_name].get_username()
+ _password = self.control_sessions[self.current_profile_name].get_password()
+ session_uuid = self._X2goClient__register_session(profile_name=self.current_profile_name)
+ if _password is None:
+ # use the SSH auth_pubkey mechanism
+ self._X2goClient__connect_session(session_uuid)
else:
- self.list.SetStringItem(self.currentItem, 0, profile['name'])
+ self._X2goClient__connect_session(session_uuid, username=_username, password=_password, force_password_auth=True)
+ gevent.spawn(self._X2goClient__start_session, session_uuid)
+
+ #pst = PyHocaGUI_SessionThread(self._X2goClient__start_session, session_uuid)
+ #pst.start()
+
+ def OnSessionResume(self, evt):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ control_session = self._eventid_sessionnames_map[evt.GetId()]['control_session']
+ session_name = self._eventid_sessionnames_map[evt.GetId()]['session_name']
+ gevent.spawn(self._X2goClient__resume_session, control_session, session_name=session_name)
+ self._eventid_sessionnames_map = {}
+
+ def OnSessionSuspend(self, evt):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ control_session = self._eventid_sessionnames_map[evt.GetId()]['control_session']
+ session_name = self._eventid_sessionnames_map[evt.GetId()]['session_name']
+ gevent.spawn(self._X2goClient__suspend_session, control_session, session_name=session_name)
+ self._eventid_sessionnames_map = {}
+ def OnSessionTerminate(self, evt):
+ """\
+ STILL UNDOCUMENTED
-class X2GoLogonTaskBarIcon(wx.TaskBarIcon):
+ """
+ control_session = self._eventid_sessionnames_map[evt.GetId()]['control_session']
+ session_name = self._eventid_sessionnames_map[evt.GetId()]['session_name']
+ gevent.spwan(self._X2goClient__terminate_session, control_session, session_name=session_name)
+ self._eventid_sessionnames_map = {}
- def __init__(self, parent=None):
- wx.TaskBarIcon.__init__(self)
- self.parent = parent
- self.parent.parent.logger('Start TaskBarIcon type %s' % (wx.PlatformInfo, ), x2go.loglevel_INFO, )
- icon = self.MakeIcon(images.getx2goclientImage())
- self.SetIcon(icon, "x2go connect")
- self.imgidx = 1
+ def OnCleanSessions(self, evt):
+ """\
+ STILL UNDOCUMENTED
- def CreatePopupMenu(self):
"""
- This method is called by the base class when it needs to popup
- the menu for the default EVT_RIGHT_DOWN event. Just create
- the menu how you want it and return it from this function,
- the base class takes care of the rest.
+ control_session = self.control_sessions[self.current_profile_name]
+ gevent.spawn(self._X2goClient__clean_sessions, control_session())
+
+ def OnSessionDisconnect(self, evt):
+ """\
+ STILL UNDOCUMENTED
+
"""
- menu = menuActions(self, fromTaskBarIcon=True)
- return menu
+ session_uuid = self.control_sessions[self.current_profile_name]()
+ session_list = self._X2goClient__list_sessions(session_uuid)
+
+ # suspend all running server sessions
+ for session_name in self._X2goClient__server_running_sessions(session_uuid):
+ self._X2goClient__suspend_session(session_uuid, session_name=session_name)
+
+ # disconnect any non-control session that has been recently connected
+ for reg_session in self._X2goClient__client_connected_sessions(session_uuid):
+ reg_session.disconnect()
+
+ # disconnect control session
+ self._X2goClient__disconnect_session(session_uuid)
+
+# def OnProfileAdd(self, evt):
+# """\
+# STILL UNDOCUMENTED
+#
+# """
+# self._pyhoca_logger('Add Profile started', x2go.loglevel_INFO, )
+# profilemanager.PyHocaGUI_ProfileManager('Add', self._PyHocaGUI)
+#
+# def OnProfileEdit(self, evt):
+# """\
+# STILL UNDOCUMENTED
+#
+# """
+# self._pyhoca_logger('Update Profile started', x2go.loglevel_INFO, )
+# if self.selected_profile:
+# profilemanager.PyHocaGUI_ProfileManager('Upd', self.parent, self.SessionProfiles, self.parent.callbackupdList, self.selected_profile)
+#
+# def OnProfileDeleteEdit(self, evt):
+# """\
+# STILL UNDOCUMENTED
+#
+# """
+# self._pyhoca_logger('deleting session profile ...', x2go.loglevel_INFO, )
+#
+# def OnNewSession(self, evt):
+# """\
+# STILL UNDOCUMENTED
+#
+# """
+# if hasattr(self.parent,'selected_profile'):
+# PyHocaGUI_DialogBoxPassword(self.parent)
+# elif len(self.SessionProfiles.x2goprofs) > 1:
+# self._pyhoca_logger('self.parent.IsIconized() %s' % self.parent.IsIconized(), x2go.loglevel_INFO, )
+# if self.parent.IsIconized() or not self.parent.IsShown():
+# self.parent.Iconize(False)
+# if not self.parent.IsShown():
+# self.parent.Show(True)
+# self.parent.Raise()
+# self.parent.SetFocus()
+
+ def OnListSessions(self, evt):
+ """\
+ STILL UNDOCUMENTED
- def MakeIcon(self, img):
"""
- The various platforms have different requirements for the
- icon size...
+ self._pyhoca_logger('List Sessions started', x2go.loglevel_INFO, )
+
+ def OnClose(self, evt):
+ """\
+ STILL UNDOCUMENTED
+
"""
- if "wxMSW" in wx.PlatformInfo:
- img = img.Scale(16, 16)
- elif "wxGTK" in wx.PlatformInfo:
- img = img.Scale(22, 22)
- # wxMac can be any size upto 128x128, so leave the source img alone....
- icon = wx.IconFromBitmap(img.ConvertToBitmap() )
- return icon
-
- def OnTaskBarEditSession(self, evt):
- if self.parent.IsIconized():
- self.parent.Iconize(False)
- if not self.parent.IsShown():
- self.parent.Show(True)
- self.parent.Raise()
-
-
- def OnTaskBarExitSessions(self, evt):
- if self.parent:
- wx.CallAfter(self.parent.Close)
-
-
- #def OnTaskBarResumeSession(self, evt):
- #names = [ "WXPdemo", "Mondrian", "Pencil", "Carrot" ]
- #name = names[self.imgidx]
-
- #eImg = getattr(images, name)
- #self.imgidx += 1
- #if self.imgidx >= len(names):
- #self.imgidx = 0
-
- #icon = self.MakeIcon(eImg.Image)
- #self.SetIcon(icon, "This is a new icon: " + name)
-
-
- #def OnTaskBarNewSession(self, evt):
- #self.RemoveIcon()
-
-def checkArgs(parent, args, SessionProfiles):
- if args.profile and not SessionProfiles.profileExists(args.profile):
- Message(parent, 5)
- exit(0)
-
-
-def startX2Go(parent):
- """
- This routine starts all processing
-
- If there is only one profile available, or if there is one (1) single
- profile that has the default switch, and the password has not been passed,
- the logon screen is shown immediately
-
- If there is only one profile available, or if there is one (1) single
- profile that has the default switch, and the password has been passed,
- the connection can be made immediately and the screens should not be shown,
- but if there is an error in the connection, the logon screen should be shown with an errormessage.
-
- if there are more than one profile available, and there is no default,
- the list of available profiles should be shown. After the user chooses
- a profile, the connection should be made to that specific profile, turning
- it into a session. After that all screens should be minimized.
-
- First all profile information is retrieved together with the settings and
- the printprofile.
-
- Then it is tested if there are more than one profile that can be selected
- """
- parent.logger('starting a new X2go GUI session', x2go.loglevel_INFO, )
-
- parent.printProfile = x2go.printing.X2goClientPrinting(logger=parent.liblogger)
- parent.settingsProfile = x2go.settings.X2goClientSettings(logger=parent.liblogger)
- if platform.system() == 'Windows':
- #parent.settingsProfile = SessionProfile.XServer(parent.liblogger)
- import X2goXserver
- X2goXserver.startXserver(parent)
-
- parent.SessionProfiles = x2go.profiles.X2goSessionProfiles(logger=parent.liblogger)
- parent.registeredSessions = x2go.registry.X2goSessionRegistry(logger=parent.liblogger)
-
- sessionsSuspended = parent.registeredSessions.suspended_sessions
- parent.current_profile = defaultProfile = parent.SessionProfiles.get_default_profile()
- if sessionsSuspended and len(sessionsSuspended) > 0:
- if parent.settingsProfile.autoresume:
- parent.logger('autoresume sessionsSuspended %s' % sessionsSuspended, x2go.loglevel_INFO, )
- ChoiceScrn = X2GoChooseSessionScrn(parent, Iconize=True)
- for suspended in sessionsSuspended:
- suspended.Resume(parent)
- else:
- parent.logger('Choose SuspendedSessions %s' % sessionsSuspended, x2go.loglevel_INFO, )
- X2GoResumeSessions(parent, sessionsSuspended)
- elif defaultProfile:
- ChoiceScrn = X2GoChooseSessionScrn(parent, Iconize=parent.args.minimized)
- elif len(parent.SessionProfiles.profile_names) > 0:
- parent.logger('Start Profile choice', x2go.loglevel_INFO, )
- choiceScrn = X2GoChooseSessionScrn(parent)
- else:
- parent.logger('Start Profile Definition', x2go.loglevel_INFO, )
- defScrn = X2GoSessionDefScrn(parent, directCall=True)
+ self.OnExit(evt)
+
+
diff --git a/pyhoca/wxgui/frontend.pyc b/pyhoca/wxgui/frontend.pyc
new file mode 100644
index 0000000..1e8bc9a
Binary files /dev/null and b/pyhoca/wxgui/frontend.pyc differ
diff --git a/pyhoca/wxgui/images.py b/pyhoca/wxgui/images.py
index 0590532..4510e0f 100644
--- a/pyhoca/wxgui/images.py
+++ b/pyhoca/wxgui/images.py
@@ -1,6 +1,26 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2010 by Dick Kniep <dick.kniep(a)lindix.nl>
+# Copyright (C) 2010 by Mike Gabriel <m.gabriel(a)das-netzwerkteam.de>
+#
+# 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.
+
#----------------------------------------------------------------------
# This file was generated by /usr/bin/img2py
-#
+
from wx.lib.embeddedimage import PyEmbeddedImage
from wx import ImageFromStream, BitmapFromImage
from wx import EmptyIcon
diff --git a/pyhoca/wxgui/images.pyc b/pyhoca/wxgui/images.pyc
new file mode 100644
index 0000000..4306e52
Binary files /dev/null and b/pyhoca/wxgui/images.pyc differ
diff --git a/pyhoca/wxgui/logon.py b/pyhoca/wxgui/logon.py
new file mode 100644
index 0000000..20b5dd8
--- /dev/null
+++ b/pyhoca/wxgui/logon.py
@@ -0,0 +1,176 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2010 by Dick Kniep <dick.kniep(a)lindix.nl>
+# Copyright (C) 2010 by Mike Gabriel <m.gabriel(a)das-netzwerkteam.de>
+#
+# 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.8')
+except: pass
+
+# Python X2go
+import x2go
+
+import gevent
+import gevent.monkey
+gevent.monkey.patch_all()
+
+import wx
+import wx.lib.scrolledpanel as scrolled
+import wx.lib.mixins.listctrl as listmix
+
+import time
+import sys
+import platform
+import types
+import copy
+import threading
+
+# PyHoca-GUI modules
+import images
+from messages import Message
+
+try:
+ from agw import knobctrl as KC
+ knobctrlavailable = True
+except ImportError: # if it's not there locally, try the wxPython lib.
+ try:
+ import wx.lib.agw.knobctrl as KC
+ knobctrlavailable = True
+ 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_DialogBoxPassword(sc.SizedFrame):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ def __init__(self, _PyHocaGUI, current_profile_name, caller=None, ):
+ """\
+ Dialog box to enter the username and password for the selected
+ session profile.
+
+ """
+ self._PyHocaGUI = _PyHocaGUI
+ 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)
+
+ captionText = "Authentication X2go Session: " + current_profile_name
+ sc.SizedFrame.__init__(self, None, -1, captionText,
+ style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
+ self.CentreOnScreen()
+ self.SetSize((350,250))
+
+ pane = self.GetContentsPane()
+ pane.SetSizerType("form")
+ pwbox = self.enterPasswordForm(pane)
+ self.Fit()
+ self.Show()
+
+ def enterPasswordForm(self, pnl):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ wx.StaticText(pnl, -1, ' Username'),
+ 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'),
+ self.passwd_ctl = wx.TextCtrl(pnl, -1, style=wx.TE_PASSWORD)
+
+ 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()
+ if len(username) == 0:
+ Message(self,1)
+ return
+ if len(password) == 0:
+ Message(self,2)
+ return
+
+ if not self.IsIconized():
+ self.Iconize()
+
+ session_uuid = self._PyHocaGUI.control_sessions[self.current_profile_name].get_uuid()
+ self._PyHocaGUI._X2goClient__connect_session(session_uuid, username=username, password=password, force_password_auth=True)
+
+ self.Destroy()
+
+ def OnCancel(self, evt):
+ self.Destroy()
+
+
diff --git a/pyhoca/wxgui/logon.pyc b/pyhoca/wxgui/logon.pyc
new file mode 100644
index 0000000..5f0c973
Binary files /dev/null and b/pyhoca/wxgui/logon.pyc differ
diff --git a/pyhoca/wxgui/menus_chooser.py b/pyhoca/wxgui/menus_chooser.py
new file mode 100644
index 0000000..e1051e7
--- /dev/null
+++ b/pyhoca/wxgui/menus_chooser.py
@@ -0,0 +1,184 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2010 by Dick Kniep <dick.kniep(a)lindix.nl>
+# Copyright (C) 2010 by Mike Gabriel <m.gabriel(a)das-netzwerkteam.de>
+#
+# 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.
+
+try:
+ import wxversion
+ wxversion.select('2.8')
+except: pass
+
+import wx
+
+class PyHocaGUI_Menu_ChooserProfiles(wx.Menu):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ def __init__(self, _PyHocaGUI, caller=None):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ self._PyHocaGUI = _PyHocaGUI
+ self._pyhoca_logger = self._PyHocaGUI._pyhoca_logger
+
+ wx.Menu.__init__(self)
+
+ profile_name = self._PyHocaGUI._chooser_selected_profile_name
+
+ ID_ADDPROFILE = wx.NewId()
+ ID_DELPROFILE = wx.NewId()
+ ID_RENPROFILE = wx.NewId()
+ ID_EDITPROFILE = wx.NewId()
+
+ self.Append(text="Add Profile", id=ID_ADDPROFILE)
+ self.AppendSeparator()
+ self.Append(text="Edit Profile", id=ID_EDITPROFILE)
+ self.Append(text="Delete Profile", id=ID_DELPROFILE)
+
+ #self.Bind(wx.EVT_MENU, self._PyHocaGUI.OnProfileAdd, id=ID_ADDPROFILE)
+ #self.Bind(wx.EVT_MENU, self._PyHocaGUI.OnProfileEdit, id=ID_EDITPROFILE)
+ #self.Bind(wx.EVT_MENU, self._PyHocaGUI.OnProfileDelete, id=ID_DELPROFILE)
+
+
+class PyHocaGUI_Menu_ChooserExtras(wx.Menu):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ def __init__(self, _PyHocaGUI, caller=None):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ self._PyHocaGUI = _PyHocaGUI
+ self._pyhoca_logger = self._PyHocaGUI._pyhoca_logger
+
+ wx.Menu.__init__(self)
+
+ ID_OPTIONS = wx.NewId()
+ ID_EXIT = wx.NewId()
+
+ self.Append(id=ID_OPTIONS, text="X2go Client Options")
+ #self.Bind(wx.EVT_MENU, self._PyHocaGUI.OnOptions, id=ID_OPTIONS)
+ self.AppendSeparator()
+
+ self.Append(id=ID_EXIT, text="E&xit")
+ self.Bind(wx.EVT_MENU, self._PyHocaGUI.OnTaskbarExit, id=ID_EXIT)
+
+
+class PyHocaGUI_Menu_ChooserSessionActions(wx.Menu):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ def __init__(self, _PyHocaGUI, caller=None):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ self._PyHocaGUI = _PyHocaGUI
+ self._pyhoca_logger = self._PyHocaGUI._pyhoca_logger
+
+ wx.Menu.__init__(self)
+
+ ID_RESUMESESSION = wx.NewId()
+ ID_SUSPENDSESSION = wx.NewId()
+ ID_TERMINATESESSION = wx.NewId()
+
+ # preparing information for the main PyHocaGUI instance
+ self._PyHocaGUI._eventid_sessionnames_map[ID_RESUMESESSION] = \
+ self._PyHocaGUI._eventid_sessionnames_map[ID_SUSPENDSESSION] = \
+ self._PyHocaGUI._eventid_sessionnames_map[ID_TERMINATESESSION] = {
+ 'session_name': session_name,
+ 'control_session': control_session,
+ }
+
+ if status == 'S':
+ self.Append(text="Resume Session", id=ID_RESUMESESSION)
+ elif status == 'R':
+ self.Append(text="Suspend Session", id=ID_SUSPENDSESSION)
+
+ self.Append(text="Terminate Session", id=ID_TERMINATESESSION)
+
+ self.Bind(wx.EVT_MENU, self._PyHocaGUI.OnSessionResume, id=ID_RESUMESESSION)
+ self.Bind(wx.EVT_MENU, self._PyHocaGUI.OnSessionSuspend, id=ID_SUSPENDSESSION)
+ self.Bind(wx.EVT_MENU, self._PyHocaGUI.OnSessionTerminate, id=ID_TERMINATESESSION)
+
+
+class PyHocaGUI_Menu_ChooserSessions(wx.Menu):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ def __init__(self, _PyHocaGUI, caller=None):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ self._PyHocaGUI = _PyHocaGUI
+ self._pyhoca_logger = self._PyHocaGUI._pyhoca_logger
+
+ profile_name = self._PyHocaGUI._chooser_selected_profile_name
+
+ wx.Menu.__init__(self)
+
+ ID_AUTHENTICATE = wx.NewId()
+ ID_SESSIONSTART=wx.NewId()
+ ID_CLEANSESSIONS = wx.NewId()
+ ID_DISCONNECT = wx.NewId()
+
+ self.Append(id=ID_AUTHENTICATE, text="Authenticate")
+ self.AppendSeparator()
+ self.Append(id=ID_SESSIONSTART, text="Start &new Session")
+
+ if self._PyHocaGUI._chooser_selected_profile_name:
+ _control_session = self._PyHocaGUI.control_sessions[self._PyHocaGUI._chooser_selected_profile_name].get_uuid()
+ _session_list = self._PyHocaGUI.list_sessions(_control_session)
+
+ if _session_list:
+
+ self.AppendSeparator()
+ for session_name in _session_list.keys():
+
+ _s_id = wx.NewId()
+
+ if _session_list[session_name].status == 'R':
+ state = 'Running'
+ elif _session_list[session_name].status == 'S':
+ state = 'Suspended'
+ self.AppendMenu(id=_s_id, text='%s: »%s«' % (state, session_name),
+ submenu=PyHocaGUI_Menu_TaskbarSessionActions(self._PyHocaGUI, caller=self,
+ control_session=_control_session,
+ session_name=session_name,
+ status=_session_list[session_name].status,
+ )
+ )
+
+ self.AppendSeparator()
+ self.Append(id=ID_CLEANSESSIONS, text="&Clean sessions")
+ self.AppendSeparator()
+ self.Append(id=ID_DISCONNECT, text="&Disconnect from Server")
+
+ self.Bind(wx.EVT_MENU, self._PyHocaGUI.OnControlSessionAuthenticate, id=ID_AUTHENTICATE)
+ self.Bind(wx.EVT_MENU, self._PyHocaGUI.OnSessionStart, id=ID_SESSIONSTART)
+ self.Bind(wx.EVT_MENU, self._PyHocaGUI.OnCleanSessions, id=ID_CLEANSESSIONS)
+ self.Bind(wx.EVT_MENU, self._PyHocaGUI.OnSessionDisconnect, id=ID_DISCONNECT)
+
+
diff --git a/pyhoca/wxgui/menus_chooser.pyc b/pyhoca/wxgui/menus_chooser.pyc
new file mode 100644
index 0000000..f708bf1
Binary files /dev/null and b/pyhoca/wxgui/menus_chooser.pyc differ
diff --git a/pyhoca/wxgui/menus_taskbar.py b/pyhoca/wxgui/menus_taskbar.py
new file mode 100644
index 0000000..4aa89fb
--- /dev/null
+++ b/pyhoca/wxgui/menus_taskbar.py
@@ -0,0 +1,260 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2010 by Dick Kniep <dick.kniep(a)lindix.nl>
+# Copyright (C) 2010 by Mike Gabriel <m.gabriel(a)das-netzwerkteam.de>
+#
+# 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.
+
+try:
+ import wxversion
+ wxversion.select('2.8')
+except: pass
+
+import wx
+
+class PyHocaGUI_Menu_TaskbarManageProfile(wx.Menu):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ def __init__(self, _PyHocaGUI, caller=None):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ self._PyHocaGUI = _PyHocaGUI
+ self._pyhoca_logger = self._PyHocaGUI._pyhoca_logger
+
+ wx.Menu.__init__(self)
+
+ #ID_ADDPROFILE = wx.NewId()
+ ID_DELPROFILE = wx.NewId()
+ ID_RENPROFILE = wx.NewId()
+ ID_EDITPROFILE = wx.NewId()
+
+ #self.Append(text="Add Profile", id=ID_ADDPROFILE)
+ self.Append(text="Edit Profile", id=ID_EDITPROFILE)
+ self.AppendSeparator()
+ self.Append(text="Delete Profile", id=ID_DELPROFILE)
+
+ #self.Bind(wx.EVT_MENU, self._PyHocaGUI.OnAddProfile, id=ID_ADDPROFILE)
+ #self.Bind(wx.EVT_MENU, self._PyHocaGUI.OnEditProfile, id=ID_EDITPROFILE)
+ #self.Bind(wx.EVT_MENU, self._PyHocaGUI.OnDeleteProfile, id=ID_DELPROFILE)
+
+
+class PyHocaGUI_Menu_TaskbarOptionsManager(wx.Menu):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ def __init__(self, _PyHocaGUI, caller=None):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ self._PyHocaGUI = _PyHocaGUI
+ self._pyhoca_logger = self._PyHocaGUI._pyhoca_logger
+
+ wx.Menu.__init__(self)
+
+ ID_NEWPROFILE = wx.NewId()
+ ID_PROFILEMANAGER = wx.NewId()
+ ID_OPTIONS = wx.NewId()
+ ID_EXIT = wx.NewId()
+
+ self.Append(id=ID_NEWPROFILE, text="Add new X2go Session Profile")
+ self.AppendMenu(id=ID_PROFILEMANAGER,
+ text="Maintain X2go Session Profiles",
+ submenu=PyHocaGUI_Menu_TaskbarProfileNames(self._PyHocaGUI,
+ caller=self,
+ submenu=PyHocaGUI_Menu_TaskbarManageProfile))
+
+ self.AppendSeparator()
+ self.Append(id=ID_OPTIONS, text="X2go Client Options")
+ #self.Bind(wx.EVT_MENU, self._PyHocaGUI.OnOptions, id=ID_OPTIONS)
+
+ self.AppendSeparator()
+ self.Append(id=ID_EXIT, text="E&xit")
+ self.Bind(wx.EVT_MENU, self._PyHocaGUI.OnTaskbarExit, id=ID_EXIT)
+
+
+
+class PyHocaGUI_Menu_TaskbarSessionActions(wx.Menu):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ def __init__(self, _PyHocaGUI, caller=None, control_session=None, session_name=None, status=None):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ self._PyHocaGUI = _PyHocaGUI
+ self._pyhoca_logger = self._PyHocaGUI._pyhoca_logger
+
+ wx.Menu.__init__(self)
+
+ ID_RESUMESESSION = wx.NewId()
+ ID_SUSPENDSESSION = wx.NewId()
+ ID_TERMINATESESSION = wx.NewId()
+
+ # preparing information for the main PyHocaGUI instance
+ self._PyHocaGUI._eventid_sessionnames_map[ID_RESUMESESSION] = \
+ self._PyHocaGUI._eventid_sessionnames_map[ID_SUSPENDSESSION] = \
+ self._PyHocaGUI._eventid_sessionnames_map[ID_TERMINATESESSION] = {
+ 'session_name': session_name,
+ 'control_session': control_session,
+ }
+
+ if status == 'S':
+ self.Append(text="Resume Session", id=ID_RESUMESESSION)
+ elif status == 'R':
+ self.Append(text="Suspend Session", id=ID_SUSPENDSESSION)
+
+ self.Append(text="Terminate Session", id=ID_TERMINATESESSION)
+
+ self.Bind(wx.EVT_MENU, self._PyHocaGUI.OnSessionResume, id=ID_RESUMESESSION)
+ self.Bind(wx.EVT_MENU, self._PyHocaGUI.OnSessionSuspend, id=ID_SUSPENDSESSION)
+ self.Bind(wx.EVT_MENU, self._PyHocaGUI.OnSessionTerminate, id=ID_TERMINATESESSION)
+
+
+class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ def __init__(self, _PyHocaGUI, caller=None, profile_name=None):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ self._PyHocaGUI = _PyHocaGUI
+ self._pyhoca_logger = self._PyHocaGUI._pyhoca_logger
+
+ wx.Menu.__init__(self)
+
+ ID_CONNECT = wx.NewId()
+ ID_SESSIONSTART=wx.NewId()
+ ID_CLEANSESSIONS = wx.NewId()
+ ID_DISCONNECT = wx.NewId()
+
+ self.Append(id=ID_SESSIONSTART, text="Start &new Session")
+
+ _control_session = self._PyHocaGUI.control_sessions[profile_name].get_uuid()
+ _session_list = self._PyHocaGUI.list_sessions(_control_session)
+
+ if _session_list:
+
+ self.AppendSeparator()
+ for session_name in _session_list.keys():
+
+ _s_id = wx.NewId()
+
+ if _session_list[session_name].status == 'R':
+ state = 'Running'
+ elif _session_list[session_name].status == 'S':
+ state = 'Suspended'
+ self.AppendMenu(id=_s_id, text='%s: »%s«' % (state, session_name),
+ submenu=PyHocaGUI_Menu_TaskbarSessionActions(self._PyHocaGUI, caller=self,
+ control_session=_control_session,
+ session_name=session_name,
+ status=_session_list[session_name].status,
+ )
+ )
+
+ self.AppendSeparator()
+ self.Append(id=ID_CLEANSESSIONS, text="&Clean sessions")
+ self.AppendSeparator()
+ self.Append(id=ID_DISCONNECT, text="&Disconnect from Server")
+
+ self._PyHocaGUI.current_profile_name = profile_name
+ self.Bind(wx.EVT_MENU, self._PyHocaGUI.OnSessionStart, id=ID_SESSIONSTART)
+ self.Bind(wx.EVT_MENU, self._PyHocaGUI.OnCleanSessions, id=ID_CLEANSESSIONS)
+ self.Bind(wx.EVT_MENU, self._PyHocaGUI.OnSessionDisconnect, id=ID_DISCONNECT)
+
+
+class PyHocaGUI_Menu_TaskbarProfileNames(wx.Menu):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ def __init__(self, _PyHocaGUI, caller=None, filter_profiles=None, bind_method=None, submenu=None):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ self._PyHocaGUI = _PyHocaGUI
+ self._pyhoca_logger = self._PyHocaGUI._pyhoca_logger
+
+ wx.Menu.__init__(self)
+
+ _profile_names = self._PyHocaGUI.session_profiles.profile_names
+ _profile_names.sort()
+ if filter_profiles:
+ _profile_names = [ p for p in _profile_names if p not in filter_profiles ]
+ for profile_name in _profile_names:
+ _this_id = wx.NewId()
+ self._PyHocaGUI._eventid_profilenames_map[_this_id] = profile_name
+ if submenu is not None:
+ self.AppendMenu(text=profile_name, id=_this_id, submenu=submenu(self._PyHocaGUI, caller=self))
+ else:
+ self.Append(text=profile_name, id=_this_id)
+ if bind_method is not None:
+ self.Bind(wx.EVT_MENU, bind_method, id=_this_id)
+
+
+class PyHocaGUI_Menu_TaskbarSessionManager(wx.Menu):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ def __init__(self, _PyHocaGUI, caller=None):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ self._PyHocaGUI = _PyHocaGUI
+ self._pyhoca_logger = self._PyHocaGUI._pyhoca_logger
+
+ wx.Menu.__init__(self)
+
+ ID_AUTHENTICATE = wx.NewId()
+ ID_EXIT = wx.NewId()
+
+ self.AppendMenu(id=ID_AUTHENTICATE,
+ text="Authenticate X2go Session",
+ submenu=PyHocaGUI_Menu_TaskbarProfileNames(self._PyHocaGUI,
+ caller=self,
+ filter_profiles=self._PyHocaGUI.client_connected_sessions(return_profile_names=True),
+ bind_method=self._PyHocaGUI.OnControlSessionAuthenticate))
+ self.AppendSeparator()
+
+ _connected_sessions = False
+ for profile_name in self._PyHocaGUI.session_profiles.profile_names:
+ if profile_name in self._PyHocaGUI._X2goClient__client_connected_sessions(return_profile_names=True):
+ _connected_sessions = True
+ _this_id = wx.NewId()
+ self.AppendMenu(text=profile_name,
+ id=_this_id,
+ submenu=PyHocaGUI_Menu_TaskbarSessionProfile(self._PyHocaGUI, caller=self, profile_name=profile_name))
+
+ if _connected_sessions:
+ self.AppendSeparator()
+
+ self.Append(id=ID_EXIT, text="E&xit")
+ self.Bind(wx.EVT_MENU, self._PyHocaGUI.OnTaskbarExit, id=ID_EXIT)
+
+
diff --git a/pyhoca/wxgui/menus_taskbar.pyc b/pyhoca/wxgui/menus_taskbar.pyc
new file mode 100644
index 0000000..986f669
Binary files /dev/null and b/pyhoca/wxgui/menus_taskbar.pyc differ
diff --git a/pyhoca/wxgui/messages.py b/pyhoca/wxgui/messages.py
index 21e0a0e..9673deb 100644
--- a/pyhoca/wxgui/messages.py
+++ b/pyhoca/wxgui/messages.py
@@ -1,28 +1,22 @@
-#!/usr/bin/env python
# -*- coding: utf-8 -*-
-"""
- Copyright (C) 2010 by Dick Kniep <dick.kniep(a)lindix.nl>
-
- This program 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.
-
- This program 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.,
- 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
- Contributors to the code of this programme:
- Jörg Sawatzki <joerg.sawatzki(a)web.de>
- Mike Gabriel <m.gabriel(a)das-netzwerkteam.de>
-"""
+# Copyright (C) 2010 by Dick Kniep <dick.kniep(a)lindix.nl>
+# Copyright (C) 2010 by Mike Gabriel <m.gabriel(a)das-netzwerkteam.de>
+#
+# 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.
import wx
messages = { 1: 'Userid is invalid',
diff --git a/pyhoca/wxgui/messages.pyc b/pyhoca/wxgui/messages.pyc
new file mode 100644
index 0000000..b24e046
Binary files /dev/null and b/pyhoca/wxgui/messages.pyc differ
diff --git a/pyhoca/wxgui/profilemanager.py b/pyhoca/wxgui/profilemanager.py
index 320dfbb..607a19c 100644
--- a/pyhoca/wxgui/profilemanager.py
+++ b/pyhoca/wxgui/profilemanager.py
@@ -1,28 +1,22 @@
-#!/usr/bin/env python
# -*- coding: utf-8 -*-
-"""
- Copyright (C) 2010 by Dick Kniep <dick.kniep(a)lindix.nl>
-
- This program 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.
-
- This program 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.,
- 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
- Contributors to the code of this programme:
- Jörg Sawatzki <joerg.sawatzki(a)web.de>
- Mike Gabriel <m.gabriel(a)das-netzwerkteam.de>
-"""
+# Copyright (C) 2010 by Dick Kniep <dick.kniep(a)lindix.nl>
+# Copyright (C) 2010 by Mike Gabriel <m.gabriel(a)das-netzwerkteam.de>
+#
+# 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.
import wx
import platform
diff --git a/pyhoca/wxgui/profilemanager.pyc b/pyhoca/wxgui/profilemanager.pyc
new file mode 100644
index 0000000..3328b85
Binary files /dev/null and b/pyhoca/wxgui/profilemanager.pyc differ
diff --git a/pyhoca/wxgui/taskbar.py b/pyhoca/wxgui/taskbar.py
new file mode 100644
index 0000000..b904855
--- /dev/null
+++ b/pyhoca/wxgui/taskbar.py
@@ -0,0 +1,113 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2010 by Dick Kniep <dick.kniep(a)lindix.nl>
+# Copyright (C) 2010 by Mike Gabriel <m.gabriel(a)das-netzwerkteam.de>
+#
+# 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.8')
+except: pass
+
+# Python X2go
+import x2go
+
+import gevent
+import gevent.monkey
+gevent.monkey.patch_all()
+
+import wx
+import wx.lib.scrolledpanel as scrolled
+import wx.lib.mixins.listctrl as listmix
+
+import time
+import sys
+import platform
+import types
+import copy
+import threading
+
+# PyHoca-GUI modules
+import menus_taskbar
+import profilemanager
+import images
+from messages import Message
+
+try:
+ from agw import knobctrl as KC
+ knobctrlavailable = True
+except ImportError: # if it's not there locally, try the wxPython lib.
+ try:
+ import wx.lib.agw.knobctrl as KC
+ knobctrlavailable = True
+ except ImportError:
+ knobctrlavailable = False
+
+import wx.lib.sized_controls as sc
+
+
+class PyHocaGUI_TaskBarIcon(wx.TaskBarIcon):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ def __init__(self, _PyHocaGUI):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ wx.TaskBarIcon.__init__(self)
+ self._PyHocaGUI = _PyHocaGUI
+ self._pyhoca_logger = self._PyHocaGUI._pyhoca_logger
+ self._pyhoca_logger('start TaskBarIcon of type: %s' % (wx.PlatformInfo, ), loglevel=x2go.loglevel_INFO)
+ icon = self.MakeIcon(images.getx2goclientImage())
+ self.SetIcon(icon, "PyHoca-GUI (Python X2go Client)")
+ self.imgidx = 1
+
+ def CreateSessionManagerPopupMenu(self, evt):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ self.PopupMenu(menus_taskbar.PyHocaGUI_Menu_TaskbarSessionManager(self._PyHocaGUI, caller=self))
+
+ def CreatePopupMenu(self):
+ """\
+ This method is called by the base class when it needs to popup
+ the menu for the default EVT_RIGHT_DOWN event. Just create
+ the menu how you want it and return it from this function,
+ the base class takes care of the rest.
+ """
+ return self.CreateProfileManagerPopupMenu()
+
+ def CreateProfileManagerPopupMenu(self):
+ return menus_taskbar.PyHocaGUI_Menu_TaskbarOptionsManager(self._PyHocaGUI, caller=self)
+
+ def MakeIcon(self, img):
+ """\
+ The various platforms have different requirements for the
+ icon size...
+ """
+ if "wxMSW" in wx.PlatformInfo:
+ img = img.Scale(16, 16)
+ elif "wxGTK" in wx.PlatformInfo:
+ img = img.Scale(22, 22)
+ # wxMac can be any size upto 128x128, so leave the source img alone....
+ icon = wx.IconFromBitmap(img.ConvertToBitmap() )
+ return icon
\ No newline at end of file
diff --git a/pyhoca/wxgui/taskbar.pyc b/pyhoca/wxgui/taskbar.pyc
new file mode 100644
index 0000000..364342c
Binary files /dev/null and b/pyhoca/wxgui/taskbar.pyc differ
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)).