The branch, build-59a18b6e3b5d3f1dd8f07f26433d37fe5984a57d has been updated via a1c77b0af5b5f817b501d40574ca382d58922345 (commit) from 2a68b11349f8888ceaef7767c1ea7adc1fb08876 (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 | 12 ++- pyhoca/wxgui/frontend.py | 171 +++++++++++++++++++++------------------- pyhoca/wxgui/logon.py | 6 +- pyhoca/wxgui/menus_taskbar.py | 27 +++---- pyhoca/wxgui/profilemanager.py | 161 +++++++++++++++++++------------------ pyhoca/wxgui/x2go | 1 - 6 files changed, 204 insertions(+), 174 deletions(-) delete mode 120000 pyhoca/wxgui/x2go The diff of changes is: diff --git a/pyhoca-gui b/pyhoca-gui index aaa3793..53c2e62 100755 --- a/pyhoca-gui +++ b/pyhoca-gui @@ -37,6 +37,11 @@ import os.path import sys import exceptions +app = sys.argv[0] +if app.startswith('./'): + sys.path.insert(0, os.path.join(os.path.dirname(__file__))) + os.environ['PYTHONX2GO_LOCAL'] = '1' + # Python X2go modules import x2go @@ -67,9 +72,12 @@ debug_options = [ {'args':['-V', '--version'], 'default': False, 'action': 'store_true', 'help': 'print version number and exit', }, ] x2go_gui_options = [ - {'args':['-m','--minimized'], 'default':False, 'action': 'store_true', 'help': 'start x2go gui minimized on the taskbar',} , + #{'args':['-m','--minimized'], 'default':False, 'action': 'store_true', 'help': 'start x2go gui minimized on the taskbar',} , {'args':['-u','--username'], 'default': None, 'help': 'username for the session (default: current user)', }, - {'args':['-s','--profile'], 'default': None, 'help': 'The name of the sessionprofile to be used to make the connection', } + {'args':['-P','--session-profile'], 'default': None, 'help': 'directly connect to a session profile', }, + {'args':['--auto-connect'], 'default': False, 'action': 'store_true', 'help': 'connect sessions via SSH pubkey authentication if possible', }, + {'args':['--start-on-connect'], 'default': False, 'action': 'store_true', 'help': 'start a session directly after authentication', }, + {'args':['--resume-on-connect'], 'default': False, 'action': 'store_true', 'help': 'if there is only one session it will be auto-resume', }, ] def parseargs(): diff --git a/pyhoca/wxgui/frontend.py b/pyhoca/wxgui/frontend.py index f73af9d..9e8f5d7 100644 --- a/pyhoca/wxgui/frontend.py +++ b/pyhoca/wxgui/frontend.py @@ -135,27 +135,18 @@ class PyHocaGUI(wx.App, x2go.X2goClient): it into a session. After that all screens should be minimized. """ - 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: @@ -178,21 +169,42 @@ class PyHocaGUI(wx.App, x2go.X2goClient): #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) + #else: + # + # self._pyhoca_logger('starting profile manager with new/empty session profile', loglevel=x2go.loglevel_INFO, ) + # defScrn = X2GoSessionDefScrn(self, directCall=True) + + self._pyhoca_logger('PyHoca GUI is starting up', loglevel=x2go.loglevel_INFO, ) + self._pyhoca_logger('registering PyHocaGUI control sessions', loglevel=x2go.loglevel_INFO, ) + self._chooser_selected_profile_name = None self.taskbar = taskbar.PyHocaGUI_TaskBarIcon(self) - #self.taskbar.Bind(wx.EVT_TASKBAR_LEFT_DCLICK, lambda _Show: self.Show(True)) self.taskbar.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self.taskbar.CreateSessionManagerPopupMenu) - #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) + # We register one session per available session profile. + # These registered sessions will be used to access the profile's + # ,,control'' sessions at first. Later, any session can be used + # to access the profile's control session. + self.register_all_session_profiles(return_objects=True) + + if self.args.auto_connect: + + for s in self._X2goClient__client_registered_sessions: + session_uuid = s.get_uuid() + gevent.spawn(self._auto_connect, session_uuid) + + self.start_on_connect = self.args.start_on_connect + self.resume_on_connect =self.args.resume_on_connect + + def _auto_connect(self, session_uuid): + + try: + self._X2goClient__connect_session(session_uuid) + self.logger('auto-connected session profile %s' % self._X2goClient__get_session_profile_name(session_uuid), loglevel=x2go.log.loglevel_NOTICE) + except x2go.AuthenticationException: + self.logger('no pubkey authentication available for session profile %s' % self._X2goClient__get_session_profile_name(session_uuid), loglevel=x2go.log.loglevel_NOTICE) # wx.App's OnExit method def OnExit(self): @@ -206,47 +218,64 @@ class PyHocaGUI(wx.App, x2go.X2goClient): """ self._pyhoca_logger('Exit application', x2go.loglevel_INFO, ) self.taskbar.Destroy() - self.chooser.Destroy() - - def OnControlSessionAuthenticate(self, evt): + #self.chooser.Destroy() + + def _start_on_connect(self, evt, session_uuid): + if not self._X2goClient__list_sessions(session_uuid): + self.OnSessionStart(evt) + + def _resume_on_connect(self, evt, session_uuid): + session_infos = self._X2goClient__list_sessions(session_uuid) + if session_infos: + newest_session_name = x2go.utils.session_names_by_timestamp(session_infos)[-1] + self._eventid_sessionnames_map[evt.GetId()] = newest_session_name + self.OnSessionResume(evt) + return True + return False + + def OnSessionAuthenticate(self, evt): """\ STILL UNDOCUMENTED """ profile_name = self._eventid_profilenames_map[evt.GetId()] - session_uuid = self.control_sessions[profile_name].get_uuid() + self.current_profile_name = profile_name + session_uuid = self._X2goClient__register_session(profile_name=self.current_profile_name) try: # try SSH key auth first self._X2goClient__connect_session(session_uuid) + if self.resume_on_connect: + _resumed = self._resume_on_connect(evt, session_uuid) + if not _resumed and self.start_on_connect: + self._start_on_connect(evt, session_uuid) except x2go.AuthenticationException: logon.PyHocaGUI_DialogBoxPassword(self, caller=self, current_profile_name=profile_name) + if self._X2goClient__is_session_connected(session_uuid): + self._pyhoca_logger('authentication to server has been successful', x2go.loglevel_INFO, ) + else: + self._pyhoca_logger('authentication to server has been successful', x2go.loglevel_INFO, ) + 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() + _query_session = self._X2goClient__client_registered_sessions_of_name(self.current_profile_name)[0] 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._X2goClient__connect_session(session_uuid, username=_username, password=_password, force_password_auth=True) + self._pyhoca_logger('starting new X2go session', x2go.loglevel_INFO, ) 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) + _control_session = self._X2goClient__client_registered_sessions_of_name(self.current_profile_name)[0] + session_uuid = _control_session.get_uuid() + session_name = self._eventid_sessionnames_map[evt.GetId()] + self._pyhoca_logger('resuming X2go session %s' % session_name, x2go.loglevel_INFO, ) + gevent.spawn(self._X2goClient__resume_session, session_uuid, session_name=session_name) self._eventid_sessionnames_map = {} def OnSessionSuspend(self, evt): @@ -254,9 +283,11 @@ class PyHocaGUI(wx.App, x2go.X2goClient): 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) + _control_session = self._X2goClient__client_registered_sessions_of_name(self.current_profile_name)[0] + session_uuid = _control_session.get_uuid() + session_name = self._eventid_sessionnames_map[evt.GetId()] + self._pyhoca_logger('suspending X2go session %s' % session_name, x2go.loglevel_INFO, ) + gevent.spawn(self._X2goClient__suspend_session, session_uuid, session_name=session_name) self._eventid_sessionnames_map = {} def OnSessionTerminate(self, evt): @@ -264,9 +295,11 @@ class PyHocaGUI(wx.App, x2go.X2goClient): 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__terminate_session, control_session, session_name=session_name) + _control_session = self._X2goClient__client_registered_sessions_of_name(self.current_profile_name)[0] + session_uuid = _control_session.get_uuid() + session_name = self._eventid_sessionnames_map[evt.GetId()] + self._pyhoca_logger('terminating X2go session %s' % session_name, x2go.loglevel_INFO, ) + gevent.spawn(self._X2goClient__terminate_session, session_uuid, session_name=session_name) self._eventid_sessionnames_map = {} def OnCleanSessions(self, evt): @@ -274,36 +307,31 @@ class PyHocaGUI(wx.App, x2go.X2goClient): STILL UNDOCUMENTED """ - control_session = self.control_sessions[self.current_profile_name] - gevent.spawn(self._X2goClient__clean_sessions, control_session()) + _control_session = self._X2goClient__client_registered_sessions_of_name(self.current_profile_name)[0] + session_uuid = _control_session.get_uuid() + self._pyhoca_logger('cleaning all X2go sessions %s' % session_uuid, x2go.loglevel_INFO, ) + gevent.spawn(self._X2goClient__clean_sessions, session_uuid) def OnSessionDisconnect(self, evt): """\ STILL UNDOCUMENTED """ - 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() + _control_session = self._X2goClient__client_registered_sessions_of_name(self.current_profile_name)[0] + session_uuid = _control_session.get_uuid() # disconnect control session + self._pyhoca_logger('disconnecting from X2go session %s' % session_uuid, x2go.loglevel_INFO, ) 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 OnProfileAdd(self, evt): + """\ + STILL UNDOCUMENTED + + """ + self._pyhoca_logger('adding new X2go session profile', x2go.loglevel_INFO, ) + profilemanager.PyHocaGUI_ProfileManager(self._PyHocaGUI, 'ADD') + # def OnProfileEdit(self, evt): # """\ # STILL UNDOCUMENTED @@ -311,30 +339,15 @@ class PyHocaGUI(wx.App, x2go.X2goClient): # """ # 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) +# profilemanager.PyHocaGUI_ProfileManager('EDIT', self._PyhocaGUI) # -# def OnProfileDeleteEdit(self, evt): +# def OnProfileDelete(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): """\ diff --git a/pyhoca/wxgui/logon.py b/pyhoca/wxgui/logon.py index 20b5dd8..9285d46 100644 --- a/pyhoca/wxgui/logon.py +++ b/pyhoca/wxgui/logon.py @@ -165,8 +165,12 @@ class PyHocaGUI_DialogBoxPassword(sc.SizedFrame): if not self.IsIconized(): self.Iconize() - session_uuid = self._PyHocaGUI.control_sessions[self.current_profile_name].get_uuid() + session_uuid = self._PyHocaGUI._X2goClient__client_registered_sessions_of_name(self.current_profile_name)[0].get_uuid() self._PyHocaGUI._X2goClient__connect_session(session_uuid, username=username, password=password, force_password_auth=True) + if self._PyHocaGUI.resume_on_connect: + _resumed = self._PyHocaGUI._resume_on_connect(evt, session_uuid) + if not _resumed and self._PyHocaGUI.start_on_connect: + self._PyHocaGUI._start_on_connect(evt, session_uuid) self.Destroy() diff --git a/pyhoca/wxgui/menus_taskbar.py b/pyhoca/wxgui/menus_taskbar.py index 55bd43a..93a7ce1 100644 --- a/pyhoca/wxgui/menus_taskbar.py +++ b/pyhoca/wxgui/menus_taskbar.py @@ -40,19 +40,19 @@ class PyHocaGUI_Menu_TaskbarManageProfile(wx.Menu): wx.Menu.__init__(self) - #ID_ADDPROFILE = wx.NewId() + 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="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) + 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_TaskbarOptionsManager(wx.Menu): @@ -97,7 +97,7 @@ class PyHocaGUI_Menu_TaskbarSessionActions(wx.Menu): STILL UNDOCUMENTED """ - def __init__(self, _PyHocaGUI, caller=None, control_session=None, session_name=None, status=None): + def __init__(self, _PyHocaGUI, caller=None, session_name=None, status=None): """\ STILL UNDOCUMENTED @@ -114,10 +114,7 @@ class PyHocaGUI_Menu_TaskbarSessionActions(wx.Menu): # 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, - } + self._PyHocaGUI._eventid_sessionnames_map[ID_TERMINATESESSION] = session_name if status == 'S': self.Append(text="Resume Session", id=ID_RESUMESESSION) @@ -153,8 +150,8 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu): 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) + _query_session = self._PyHocaGUI.client_registered_sessions_of_name(profile_name)[0] + _session_list = self._PyHocaGUI.list_sessions(_query_session.get_uuid()) if _session_list: @@ -169,7 +166,6 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu): 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, ) @@ -234,12 +230,13 @@ class PyHocaGUI_Menu_TaskbarSessionManager(wx.Menu): ID_AUTHENTICATE = wx.NewId() ID_EXIT = wx.NewId() + _auth_menu_text = self._PyHocaGUI.start_on_connect and 'Start X2go Session' or 'Authenticate X2go Server' self.AppendMenu(id=ID_AUTHENTICATE, - text="Authenticate X2go Server", + text=_auth_menu_text, submenu=PyHocaGUI_Menu_TaskbarProfileNames(self._PyHocaGUI, caller=self, filter_profiles=self._PyHocaGUI.client_connected_sessions(return_profile_names=True), - bind_method=self._PyHocaGUI.OnControlSessionAuthenticate)) + bind_method=self._PyHocaGUI.OnSessionAuthenticate)) self.AppendSeparator() _connected_sessions = False diff --git a/pyhoca/wxgui/profilemanager.py b/pyhoca/wxgui/profilemanager.py index 607a19c..e0f3bb9 100644 --- a/pyhoca/wxgui/profilemanager.py +++ b/pyhoca/wxgui/profilemanager.py @@ -24,9 +24,20 @@ import platform # begin wxGlade: extracode # end wxGlade +class PyHocaGUI_ProfileManager(wx.Frame): + """\ + STILL UNDOCUMENTED -class X2goMaintProfile(wx.Frame): - def __init__(self, action, parent, Profiles, callback, selected=None, *args, **kwds): + """ + def __init__(self, _PyHocaGUI, action, profile_id=None): + """\ + STILL UNDOCUMENTED + + """ + self.PyHocaGUI = _PyHocaGUI + self._pyhoca_logger = self._PyHocaGUI._pyhoca_logger + + self._pyhoca_logger('starting profile manager, action is: %s' % action, loglevel=log.loglevel_INFO) self.sessionChoicesText = ["KDE", "GNOME", "LXDE", "Connect to Windows Terminal server", "Custom desktop", "Single application"] self.sessionChoices = ["KDE", "GNOME", "LXDE", "TerminalServer", "Custom", "application"] self.applicationListText = ["Internet browser", "Email client", "Openoffice.org", "Terminal", "xterm", "Server side programlist"] @@ -34,14 +45,14 @@ class X2goMaintProfile(wx.Frame): self.linkText = ['MODEM','ISDN','ADSL','WAN','LAN'] self.compText = ["4k-jpeg", "32k-jpeg", "64k-jpeg", "256k-jpeg", "2m-jpeg", "16m-jpeg"] - self.Profiles = Profiles + self.session_profiles = self._PyHocaGUI.session_profiles self.action = action - self.callback = callback - self.selected = selected - if self.action == 'Add': - self.selected = self.Profiles.createDefaultProfile() + if self.action == 'ADD': + # this will create a default session profile + self.profile_id = self.session_profiles.add_profile() + self.profile_config = self.session_profiles.get_profile_config(profile_id) - wx.Frame.__init__(self, parent, -1, style=wx.DEFAULT_FRAME_STYLE, size=wx.Size(400,400)) + wx.Frame.__init__(self, self._PyHocaGUI, -1, style=wx.DEFAULT_FRAME_STYLE, size=wx.Size(400,400)) self.CentreOnScreen() self.X2goTabs = wx.Notebook(self, -1, style=0) self.X2goTabs_pane_4 = wx.Panel(self.X2goTabs, -1) @@ -59,13 +70,13 @@ class X2goMaintProfile(wx.Frame): self.X2goSessionTab = wx.Panel(self.X2goTabs, -1) self.ProfileLabel = wx.StaticText(self.X2goSessionTab, -1, "Profile name") self.ProfileName = wx.TextCtrl(self.X2goSessionTab, -1, "", size=wx.Size(200,20)) - if 'icon' in self.selected: + if 'icon' in self.profile_config: if platform.system() == 'Windows': - path_to_icon = self.selected['icon'].replace(':','/usr/share/') + path_to_icon = self.profile_config['icon'].replace(':','/usr/share/') elif platform.system() == 'Linux': - path_to_icon = self.selected['icon'].replace(':','/usr/share/') + path_to_icon = self.profile_config['icon'].replace(':','/usr/share/') elif platform.system() == 'Mac': - path_to_icon = self.selected['icon'].replace(':','/usr/share/') + path_to_icon = self.profile_config['icon'].replace(':','/usr/share/') self.IconButton = wx.BitmapButton(self.X2goSessionTab, -1, wx.Bitmap(path_to_icon, wx.BITMAP_TYPE_ANY)) self.IconLabel = wx.StaticText(self.X2goSessionTab, -1, "<< Change Icon") self.HostLabel = wx.StaticText(self.X2goSessionTab, -1, "Host:") @@ -202,126 +213,126 @@ class X2goMaintProfile(wx.Frame): def __updFields(self): - self.ProfileName.SetValue(self.selected['name']) - self.hostname.SetValue(self.selected['host']) - self.username.SetValue(self.selected['user']) - self.Default.SetValue(self.selected['default']) - self.sshport.SetValue(self.selected['sshport']) - self.sshkeylocation.SetLabel(self.selected['key']) + self.ProfileName.SetValue(self.profile_config['name']) + self.hostname.SetValue(self.profile_config['host']) + self.username.SetValue(self.profile_config['user']) + self.Default.SetValue(self.profile_config['default']) + self.sshport.SetValue(self.profile_config['sshport']) + self.sshkeylocation.SetLabel(self.profile_config['key']) try: - sessionType = self.sessionChoices.index(self.selected['session_type']) + sessionType = self.sessionChoices.index(self.profile_config['session_type']) except ValueError: sessionType = 0 self.SessionType.SetValue(self.sessionChoicesText[sessionType]) try: - commandNr = self.applicationList.index(self.selected['command']) + commandNr = self.applicationList.index(self.profile_config['command']) except ValueError: commandNr = 3 self.Command.SetValue(self.applicationListText[commandNr]) try: - speedNr = self.linkText.index(self.selected['link']) + speedNr = self.linkText.index(self.profile_config['link']) except ValueError: speedNr = 2 self.connectionSpeed.SetValue(speedNr) - self.Compression.SetValue(self.selected['pack']) - self.ImageQuality.SetValue(self.selected['quality']) - self.DisplayTypeFullScreen.SetValue(self.selected['fullscreen']) - self.DisplayTypeCustom.SetValue(not self.selected['fullscreen']) - self.ScrnWidth.SetValue(self.selected['width']) - self.ScrnHeight.SetValue(self.selected['height']) - if self.selected['fullscreen']: + self.Compression.SetValue(self.profile_config['pack']) + self.ImageQuality.SetValue(self.profile_config['quality']) + self.DisplayTypeFullScreen.SetValue(self.profile_config['fullscreen']) + self.DisplayTypeCustom.SetValue(not self.profile_config['fullscreen']) + self.ScrnWidth.SetValue(self.profile_config['width']) + self.ScrnHeight.SetValue(self.profile_config['height']) + if self.profile_config['fullscreen']: self.ScrnWidth.Enable(False) self.ScrnHeight.Enable(False) - self.SetDisplayDPI.SetValue(self.selected['setdpi']) + self.SetDisplayDPI.SetValue(self.profile_config['setdpi']) # TODO Fill in the actual DPI - self.CurrentKeyBoard.SetValue(self.selected['usekbd']) - self.KeyboardLayout.SetValue(self.selected['layout']) - self.Keyboardmodel.SetValue(self.selected['type']) - if self.selected['usekbd']: + self.CurrentKeyBoard.SetValue(self.profile_config['usekbd']) + self.KeyboardLayout.SetValue(self.profile_config['layout']) + self.Keyboardmodel.SetValue(self.profile_config['type']) + if self.profile_config['usekbd']: self.KeyboardLayout.Enable(False) self.Keyboardmodel.Enable(False) - self.EnableSound.SetValue(self.selected['sound']) - self.soundtunnel.SetValue(self.selected['soundtunnel']) - self.DefaultSoundPort.SetValue(self.selected['defsndport']) - self.SoundPort.SetValue(self.selected['sndport']) - if self.selected['soundsystem'] == 'pulse': + self.EnableSound.SetValue(self.profile_config['sound']) + self.soundtunnel.SetValue(self.profile_config['soundtunnel']) + self.DefaultSoundPort.SetValue(self.profile_config['defsndport']) + self.SoundPort.SetValue(self.profile_config['sndport']) + if self.profile_config['soundsystem'] == 'pulse': self.PulseAudio.SetValue(True) - elif self.selected['soundsystem'] == 'arts': + elif self.profile_config['soundsystem'] == 'arts': self.Arts.SetValue(True) - elif self.selected['soundsystem'] == 'esd': + elif self.profile_config['soundsystem'] == 'esd': self.esd.SetValue(True) - if not self.selected['sound']: + if not self.profile_config['sound']: self.PulseAudio.Enable(False) self.soundtunnel.Enable(False) self.Arts.Enable(False) self.esd.Enable(False) self.DefaultSoundPort.Enable(False) self.SoundPort.Enable(False) - elif not self.selected['defsndport']: + elif not self.profile_config['defsndport']: self.SoundPort.Enable(False) - self.ClientSidePrinting.SetValue(self.selected['printing']) - self.SSHPortforwarding.SetValue(self.selected['fstunnel']) + self.ClientSidePrinting.SetValue(self.profile_config['printing']) + self.SSHPortforwarding.SetValue(self.profile_config['fstunnel']) def __updateFromScreen(self): - self.selected['name'] = self.ProfileName.GetValue() - self.selected['host'] = self.hostname.GetValue() - self.selected['user'] = self.username.GetValue() - self.selected['default'] = self.Default.GetValue() - self.selected['sshport'] = self.sshport.GetValue() - self.selected['key'] = self.sshkeylocation.GetLabel() + self.profile_config['name'] = self.ProfileName.GetValue() + self.profile_config['host'] = self.hostname.GetValue() + self.profile_config['user'] = self.username.GetValue() + self.profile_config['default'] = self.Default.GetValue() + self.profile_config['sshport'] = self.sshport.GetValue() + self.profile_config['key'] = self.sshkeylocation.GetLabel() sessionText = self.SessionType.GetValue() try: sessionNr = self.sessionChoicesText.index(sessionText) except ValueError: sessionNr = 0 - self.selected['session_type'] = self.sessionChoices[sessionNr] + self.profile_config['session_type'] = self.sessionChoices[sessionNr] commandText = self.Command.GetValue() try: commandNr = self.applicationListText.index(commandText) except ValueError: commandNr = 3 - self.selected['command'] = self.applicationList[commandNr] + self.profile_config['command'] = self.applicationList[commandNr] speedNr = self.connectionSpeed.GetValue() - self.selected['link'] = self.linkText[speedNr] + self.profile_config['link'] = self.linkText[speedNr] - self.selected['pack'] = self.Compression.GetValue() - self.selected['quality'] = self.ImageQuality.GetValue() - self.selected['fullscreen'] = self.DisplayTypeFullScreen.GetValue() - self.selected['width'] = self.ScrnWidth.GetValue() - self.selected['height'] = self.ScrnHeight.GetValue() + self.profile_config['pack'] = self.Compression.GetValue() + self.profile_config['quality'] = self.ImageQuality.GetValue() + self.profile_config['fullscreen'] = self.DisplayTypeFullScreen.GetValue() + self.profile_config['width'] = self.ScrnWidth.GetValue() + self.profile_config['height'] = self.ScrnHeight.GetValue() - self.selected['setdpi'] = self.SetDisplayDPI.GetValue() + self.profile_config['setdpi'] = self.SetDisplayDPI.GetValue() # TODO Fill in the actual DPI - self.selected['usekbd'] = self.CurrentKeyBoard.GetValue() - self.selected['kbdlayout'] = self.KeyboardLayout.GetValue() - self.selected['kbdtype'] = self.Keyboardmodel.GetValue() - - self.selected['sound'] = self.EnableSound.GetValue() - self.selected['soundtunnel'] = self.soundtunnel.GetValue() - self.selected['defsndport'] = self.DefaultSoundPort.GetValue() - self.selected['sndport'] = self.SoundPort.GetValue() + self.profile_config['usekbd'] = self.CurrentKeyBoard.GetValue() + self.profile_config['kbdlayout'] = self.KeyboardLayout.GetValue() + self.profile_config['kbdtype'] = self.Keyboardmodel.GetValue() + + self.profile_config['sound'] = self.EnableSound.GetValue() + self.profile_config['soundtunnel'] = self.soundtunnel.GetValue() + self.profile_config['defsndport'] = self.DefaultSoundPort.GetValue() + self.profile_config['sndport'] = self.SoundPort.GetValue() if self.PulseAudio.GetValue(): - self.selected['soundsystem'] = 'pulse' + self.profile_config['soundsystem'] = 'pulse' elif self.Arts.GetValue(): - self.selected['soundsystem'] = 'arts' + self.profile_config['soundsystem'] = 'arts' elif self.esd.GetValue(): - self.selected['soundsystem'] = 'esd' + self.profile_config['soundsystem'] = 'esd' - self.selected['printing'] = self.ClientSidePrinting.GetValue() - self.selected['fstunnel'] = self.SSHPortforwarding.GetValue() + self.profile_config['printing'] = self.ClientSidePrinting.GetValue() + self.profile_config['fstunnel'] = self.SSHPortforwarding.GetValue() def __validate(self): validateOk = True - if len(self.selected['name'].strip()) == 0: + if len(self.profile_config['name'].strip()) == 0: Message(self,6) validateOk = False return validateOk @@ -473,8 +484,7 @@ class X2goMaintProfile(wx.Frame): def onOKButton(self, event): # wxGlade: X2goMaintProfile.<event_handler> self.__updateFromScreen() if self.__validate(): - self.Profiles.write() - self.callback(self.action, self.selected) + self.session_profiles.write() def onCancel(self, event): # wxGlade: X2goMaintProfile.<event_handler> self.Close() @@ -545,5 +555,4 @@ class X2goMaintProfile(wx.Frame): print "Event handler `onDefault' not implemented" event.Skip() -# end of class X2goMaintProfile diff --git a/pyhoca/wxgui/x2go b/pyhoca/wxgui/x2go deleted file mode 120000 index b700370..0000000 --- a/pyhoca/wxgui/x2go +++ /dev/null @@ -1 +0,0 @@ -../../../../python/python-x2go/trunk/x2go \ No newline at end of file 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)).