The branch, build-59a18b6e3b5d3f1dd8f07f26433d37fe5984a57d has been updated via cfe41758290b30cf1eb07ddb0fc23db2a708cd2e (commit) from 48069d455581d22d4e48283f5056cfa325ef53ff (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: X2goMaintProfile.py | 185 +++++++++++++++++++++++++++++---------------------- pyhoca-gui.py | 3 +- x2goLogon.py | 63 ++++++++++++------ 3 files changed, 146 insertions(+), 105 deletions(-) The diff of changes is: diff --git a/X2goMaintProfile.py b/X2goMaintProfile.py index 17a018a..320dfbb 100644 --- a/X2goMaintProfile.py +++ b/X2goMaintProfile.py @@ -25,6 +25,7 @@ """ import wx +import platform # begin wxGlade: extracode # end wxGlade @@ -46,7 +47,8 @@ class X2goMaintProfile(wx.Frame): if self.action == 'Add': self.selected = self.Profiles.createDefaultProfile() - wx.Frame.__init__(self, parent, -1, style=wx.DEFAULT_FRAME_STYLE) + wx.Frame.__init__(self, parent, -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) self.X2goSettingsTab = wx.Panel(self.X2goTabs, -1) @@ -62,20 +64,20 @@ class X2goMaintProfile(wx.Frame): self.sizer_11_staticbox = wx.StaticBox(self.X2goTabs_pane_4, -1, "Folders") self.X2goSessionTab = wx.Panel(self.X2goTabs, -1) self.ProfileLabel = wx.StaticText(self.X2goSessionTab, -1, "Profile name") - self.Name = wx.TextCtrl(self.X2goSessionTab, -1, "", name='Name') - if self.selected.icon: + self.ProfileName = wx.TextCtrl(self.X2goSessionTab, -1, "", size=wx.Size(200,20)) + if 'icon' in self.selected: if platform.system() == 'Windows': - path_to_icon = self.selected.icon.replace(':','/usr/share/') + path_to_icon = self.selected['icon'].replace(':','/usr/share/') elif platform.system() == 'Linux': - path_to_icon = self.selected.icon.replace(':','/usr/share/') + path_to_icon = self.selected['icon'].replace(':','/usr/share/') elif platform.system() == 'Mac': - path_to_icon = self.selected.icon.replace(':','/usr/share/') + path_to_icon = self.selected['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:") - self.hostname = wx.TextCtrl(self.X2goSessionTab, -1, "") + self.hostname = wx.TextCtrl(self.X2goSessionTab, -1, "", size=wx.Size(200,20)) self.UserLabel = wx.StaticText(self.X2goSessionTab, -1, "User:") - self.username = wx.TextCtrl(self.X2goSessionTab, -1, "") + self.username = wx.TextCtrl(self.X2goSessionTab, -1, "", size=wx.Size(200,20)) self.DefaultLabel = wx.StaticText(self.X2goSessionTab, -1, "Is defaultprofile:") self.Default = wx.CheckBox(self.X2goSessionTab, -1, "") self.LoginLabel = wx.StaticText(self.X2goConnectionTab, -1, "Login") @@ -92,7 +94,7 @@ class X2goMaintProfile(wx.Frame): self.ISDNLabel = wx.StaticText(self.X2goConnectionTab, -1, " |\nISDN", style=wx.ALIGN_CENTRE) self.ADSLLabel = wx.StaticText(self.X2goConnectionTab, -1, "|\nADSL", style=wx.ALIGN_CENTRE) self.WanLabel = wx.StaticText(self.X2goConnectionTab, -1, "|\nWAN", style=wx.ALIGN_CENTRE) - self.LanLabel = wx.StaticText(self.X2goConnectionTab, -1, "|\nLAN") + self.LanLabel = wx.StaticText(self.X2goConnectionTab, -1, "|\nLAN", style=wx.ALIGN_RIGHT) self.MethodLabel = wx.StaticText(self.X2goConnectionTab, -1, "Method") self.Compression = wx.ComboBox(self.X2goConnectionTab, -1, choices=self.compText, style=wx.CB_DROPDOWN) self.ImageQualityLabel = wx.StaticText(self.X2goConnectionTab, -1, "Image quality:") @@ -140,17 +142,20 @@ class X2goMaintProfile(wx.Frame): self.Bind(wx.EVT_CHECKBOX, self.onSoundEnable, self.EnableSound) self.Bind(wx.EVT_CHECKBOX, self.onSoundPort, self.DefaultSoundPort) self.Bind(wx.EVT_BUTTON, self.onAddFolder, self.AddFolderButton) - self.Bind(wx.EVT_BUTTON, self.onOK, self.OKButton) + self.Bind(wx.EVT_BUTTON, self.onOKButton, self.OKButton) self.Bind(wx.EVT_BUTTON, self.onCancel, self.CancelButton) self.Bind(wx.EVT_BUTTON, self.onDefault, self.DefaultButton) # end wxGlade + self.SetSize(self.GetBestSize()) + self.Show(True) + def __set_properties(self): # begin wxGlade: X2goMaintProfile.__set_properties - self.SetTitle("frame_1") + self.SetTitle("Maintain the profile") self.SetFont(wx.Font(9, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "")) self.ProfileLabel.SetMinSize((200, 15)) - self.Name.SetMinSize((180, 23)) + self.ProfileName.SetMinSize((180, 23)) self.IconButton.SetSize(self.IconButton.GetBestSize()) self.HostLabel.SetMinSize((200, 15)) self.hostname.SetMinSize((180, 23)) @@ -203,113 +208,128 @@ class X2goMaintProfile(wx.Frame): def __updFields(self): - self.Name.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) - - sessionType = self.sessionChoices.index(self.selected.session_type) + 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']) + + try: + sessionType = self.sessionChoices.index(self.selected['session_type']) + except ValueError: + sessionType = 0 self.SessionType.SetValue(self.sessionChoicesText[sessionType]) - commandNr = self.applicationList.index(self.selected.command) + try: + commandNr = self.applicationList.index(self.selected['command']) + except ValueError: + commandNr = 3 self.Command.SetValue(self.applicationListText[commandNr]) - speedNr = self.linkText.index(self.selected.link) + try: + speedNr = self.linkText.index(self.selected['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.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.ScrnWidth.Enable(False) self.ScrnHeight.Enable(False) - self.SetDisplayDPI.SetValue(self.selected.setdpi) + self.SetDisplayDPI.SetValue(self.selected['setdpi']) # TODO Fill in the actual DPI - self.CurrentKeyBoard.SetValue(self.selected.usekbd) - self.KeyboardLayout.SetValue(self.selected.kbdlayout) - self.Keyboardmodel.SetValue(self.selected.kbdtype) - if self.selected.usekbd: + self.CurrentKeyBoard.SetValue(self.selected['usekbd']) + self.KeyboardLayout.SetValue(self.selected['layout']) + self.Keyboardmodel.SetValue(self.selected['type']) + if self.selected['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.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.PulseAudio.SetValue(True) - elif self.selected.soundsystem == 'arts': + elif self.selected['soundsystem'] == 'arts': self.Arts.SetValue(True) - elif self.selected.soundsystem == 'esd': + elif self.selected['soundsystem'] == 'esd': self.esd.SetValue(True) - if not self.selected.sound: + if not self.selected['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.selected['defsndport']: self.SoundPort.Enable(False) - self.ClientSidePrinting.SetValue(self.selected.printing) - self.SSHPortforwarding.SetValue(self.selected.fstunnel) + self.ClientSidePrinting.SetValue(self.selected['printing']) + self.SSHPortforwarding.SetValue(self.selected['fstunnel']) def __updateFromScreen(self): - self.selected.name = self.Name.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.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() sessionText = self.SessionType.GetValue() - sessionNr = self.sessionChoicesText.index(sessionText) - self.selected.session_type = self.sessionChoices[sessionNr] + try: + sessionNr = self.sessionChoicesText.index(sessionText) + except ValueError: + sessionNr = 0 + self.selected['session_type'] = self.sessionChoices[sessionNr] commandText = self.Command.GetValue() - commandNr = self.applicationListText.index(commandText) - self.selected.command = self.applicationList[commandNr] + try: + commandNr = self.applicationListText.index(commandText) + except ValueError: + commandNr = 3 + self.selected['command'] = self.applicationList[commandNr] speedNr = self.connectionSpeed.GetValue() - self.selected.link = self.linkText[speedNr] + self.selected['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.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.selected.setdpi = self.SetDisplayDPI.GetValue() + self.selected['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.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() if self.PulseAudio.GetValue(): - self.selected.soundsystem = 'pulse' + self.selected['soundsystem'] = 'pulse' elif self.Arts.GetValue(): - self.selected.soundsystem = 'arts' + self.selected['soundsystem'] = 'arts' elif self.esd.GetValue(): - self.selected.soundsystem = 'esd' + self.selected['soundsystem'] = 'esd' - self.selected.printing = self.ClientSidePrinting.GetValue() - self.selected.fstunnel = self.SSHPortforwarding.GetValue() + self.selected['printing'] = self.ClientSidePrinting.GetValue() + self.selected['fstunnel'] = self.SSHPortforwarding.GetValue() def __validate(self): validateOk = True - if len(self.selected.name.strip()) == 0: + if len(self.selected['name'].strip()) == 0: Message(self,6) - validateOk = True + validateOk = False return validateOk def __do_layout(self): @@ -347,7 +367,7 @@ class X2goMaintProfile(wx.Frame): grid_sizer_2 = wx.FlexGridSizer(1, 2, 0, 0) grid_sizer_1 = wx.FlexGridSizer(11, 2, 0, 0) grid_sizer_1.Add(self.ProfileLabel, 0, wx.FIXED_MINSIZE, 0) - grid_sizer_1.Add(self.Name, 2, wx.FIXED_MINSIZE, 0) + grid_sizer_1.Add(self.ProfileName, 2, wx.FIXED_MINSIZE, 0) grid_sizer_1.Add(self.IconButton, 0, 0, 0) grid_sizer_1.Add(self.IconLabel, 0, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_1.Add(self.HostLabel, 0, 0, 0) @@ -450,16 +470,16 @@ class X2goMaintProfile(wx.Frame): bottomsizer.Add(grid_sizer_4, 1, wx.EXPAND, 0) MainSizer.Add(bottomsizer, 0, wx.EXPAND, 0) self.SetSizer(MainSizer) - MainSizer.Fit(self) + #MainSizer.Fit(self) MainSizer.SetSizeHints(self) + self.SetAutoLayout(True) self.Layout() # end wxGlade def onOKButton(self, event): # wxGlade: X2goMaintProfile.<event_handler> self.__updateFromScreen() if self.__validate(): - self.Profiles.updProfileByNumber(self.selected) - self.Profiles.writeIni() + self.Profiles.write() self.callback(self.action, self.selected) def onCancel(self, event): # wxGlade: X2goMaintProfile.<event_handler> @@ -516,6 +536,9 @@ class X2goMaintProfile(wx.Frame): self.SoundPort.Enable(False) self.DefaultSoundPort.Enable(False) + def onSoundPort(self, event): + pass + def onAddFolder(self, event): # wxGlade: X2goMaintProfile.<event_handler> print "Event handler `onAddFolder' not implemented" event.Skip() diff --git a/pyhoca-gui.py b/pyhoca-gui.py index aa3ea23..aadf9a9 100644 --- a/pyhoca-gui.py +++ b/pyhoca-gui.py @@ -159,7 +159,7 @@ def check_running(logger): if platform.system() in ('Linux', 'Mac'): p = Popen(['ps', '-A'], stdout=PIPE) psA_out = p.communicate() - logger('psa_out %s' % (psA_out,), x2go.loglevel_DEBUG ) + #logger('psa_out %s' % (psA_out,), x2go.loglevel_DEBUG ) return psA_out[0].count(PROG_NAME) > 1 elif platform.system() == 'Windows': return False @@ -172,4 +172,3 @@ def main(): if __name__ == '__main__': main() - \ No newline at end of file diff --git a/x2goLogon.py b/x2goLogon.py index 7d3aac5..f4e7d67 100644 --- a/x2goLogon.py +++ b/x2goLogon.py @@ -39,6 +39,7 @@ import pyhocaguiImages import platform import types + try: from agw import knobctrl as KC knobctrlavailable = True @@ -104,7 +105,7 @@ class menuActions(wx.Menu): 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) + 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) @@ -209,7 +210,7 @@ class X2GoPasswordScrn(sc.SizedFrame): self.settingsProfile = parent.settingsProfile self.SessionProfiles = parent.SessionProfiles self.current_profile = parent.current_profile - self.registeredSessions = parent.registeredSessions + self.registeredSessions = parent.registeredSessions self.printProfile = parent.printProfile self.parent = parent self.logger = parent.logger @@ -254,22 +255,40 @@ class X2GoPasswordScrn(sc.SizedFrame): 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','key','applications', 'sshport', 'setdpi', 'startsoundsystem'] error = True profile_name = self.current_profile['name'] profile_id = self.SessionProfiles.to_profile_id(profile_name) - try: - session_uuid = self.registeredSessions.register(profile_id, profile_name) - 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'] )) + _params = self.SessionProfiles.get_profile_config(profile_name) + if 'export' in _params: + _params['share_local_folders'] = _params['export'] + 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(): @@ -427,16 +446,17 @@ class X2GoChooseSessionScrn(wx.Frame): def OnItemSelected(self, event): ##print event.GetItem().GetTextColour() self.currentItem = event.m_itemIndex - self.selected_profile = self.parent.SessionProfiles.get_profile_config(self.list.GetItemText(self.currentItem)) + 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 OnItemActivated(self, event): - self.currentItem = event.m_itemIndex - self.selected_profile = self.SessionProfiles.get_profile_config(self.list.GetItemText(self.currentItem)) - def OnRightClick(self, event): # only do this part the first time so the events are only bound once @@ -461,7 +481,7 @@ class X2GoChooseSessionScrn(wx.Frame): if action == 'Add': self.addRow(profile.name, False, False) else: - self.list.SetStringItem(self.currentItem, 0, profile.name) + self.list.SetStringItem(self.currentItem, 0, profile['name']) class X2GoLogonTaskBarIcon(wx.TaskBarIcon): @@ -586,4 +606,3 @@ def startX2Go(parent): else: parent.logger('Start Profile Definition', x2go.loglevel_INFO, ) defScrn = X2GoSessionDefScrn(parent, directCall=True) - \ 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)).