[X2Go-Commits] [pyhoca-gui] 01/04: Session profile manager: the host parameter will be of type ListType for future versions of Python X2Go (>= 0.5.0.0).
git-admin at x2go.org
git-admin at x2go.org
Tue Mar 18 01:12:13 CET 2014
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository pyhoca-gui.
commit 402cb1f02d10a647ccfb31e26ee1a2d994ffa0a6
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Mon Mar 17 13:53:47 2014 +0100
Session profile manager: the host parameter will be of type ListType for future versions of Python X2Go (>= 0.5.0.0).
---
debian/changelog | 2 ++
pyhoca/wxgui/profilemanager.py | 61 +++++++++++++++++++++++-----------------
2 files changed, 37 insertions(+), 26 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index a54d8be..378d92c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -21,6 +21,8 @@ pyhoca-gui (0.5.0.0-0x2go1) UNRELEASED; urgency=low
* NSIS script: make sure SetOutPath gets called at the beginning of
every section.
* Show printing preferences when tray icon is in restricted mode.
+ * Session profile manager: the host parameter will be of type ListType
+ for future versions of Python X2Go (>= 0.5.0.0).
-- Mike Gabriel <mike.gabriel at das-netzwerkteam.de> Wed, 08 Jan 2014 21:28:37 +0100
diff --git a/pyhoca/wxgui/profilemanager.py b/pyhoca/wxgui/profilemanager.py
index 071b413..130f5f7 100644
--- a/pyhoca/wxgui/profilemanager.py
+++ b/pyhoca/wxgui/profilemanager.py
@@ -21,7 +21,7 @@
import wx
import os
import copy
-
+import types
import re
import x2go.log as log
@@ -162,7 +162,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
elif self.profile_config['sshproxytunnel'].count(':') == 3:
_from_host, _from_port, _to_host, _to_port = self.profile_config['sshproxytunnel'].split(':')
- if _to_host: self.profile_config['host'] = _to_host
+ if _to_host: self.profile_config['host'] = [_to_host]
if _to_port: self.profile_config['sshport'] = int(_to_port)
self.profile_config['sshproxytunnel'] = 'DEPRECATED_CAN_BE_SAFELY_REMOVE'
@@ -185,6 +185,15 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.tab_MediaResources = wx.Panel(self.X2GoTabs, -1)
self.tab_SharedResources = wx.Panel(self.X2GoTabs, -1)
+ if not self.session_profiles.is_writable(self.profile_id):
+ self.tab_Profile.Enable(False)
+ self.tab_Session.Enable(False)
+ self.tab_Connection.Enable(False)
+ self.tab_LinkQuality.Enable(False)
+ self.tab_IO.Enable(False)
+ self.tab_MediaResources.Enable(False)
+ self.tab_SharedResources.Enable(False)
+
# boxes for all tabs
self.staticbox_Profile = wx.StaticBox(self.tab_Profile, -1, ' %s ' % _(u'Session Title'))
self.staticbox_Window = wx.StaticBox(self.tab_Profile, -1, ' %s ' % _(u'Session Window'))
@@ -374,6 +383,9 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.OKButton.SetDefault()
self.ApplyButton = wx.Button(self, -1, _(u"Apply"))
self.CancelButton = wx.Button(self, -1, _(u"Cancel"))
+ if not self.session_profiles.is_writable(self.profile_id):
+ self.OKButton.Enable(False)
+ self.ApplyButton.Enable(False)
self.__set_properties()
self.__do_layout()
@@ -855,7 +867,10 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.ProfileName.SetValue(self.profile_config['name'])
self.SetSessionWindowTitle.SetValue(self.profile_config['setsessiontitle'])
self.CustomSessionWindowTitle.SetValue(self.profile_config['sessiontitle'])
- self.Host.SetValue(self.profile_config['host'])
+ if type(self.profile_config['host']) is types.ListType:
+ self.Host.SetValue(",".join(self.profile_config['host']))
+ else:
+ self.Host.SetValue(self.profile_config['host'])
self.UserName.SetValue(self.profile_config['user'])
self.SSHPort.SetValue(self.profile_config['sshport'])
self.SSHAutoLogin.SetValue(self.profile_config['autologin'])
@@ -1119,26 +1134,15 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
# export = "{string(path_1)}:{boolint(autoconnect_1);...;string(path_n)}:{boolint(autoconnect_n)};"
# rewrite path separator from "," to ";" to correct pyhoca-gui (<0.1.0.9)
- if ',' in self.profile_config['export']:
- self.profile_config['export'] = self.profile_config['export'].replace(',', ';')
+ #if ',' in self.profile_config['export']:
+ # self.profile_config['export'] = self.profile_config['export'].replace(',', ';')
# strip off whitespaces and ";" from beginning and end of string
- _shared_folders = self.profile_config['export'].strip().strip(';').strip()
- # strip off '"' from beginning and end of string
- _shared_folders = _shared_folders.strip('"')
- # again: strip off whitespaces and ";" from beginning and end of string
- _shared_folders = _shared_folders.strip().strip(';').strip()
-
- _shared_folders = [ sf for sf in _shared_folders.split(';') if sf ]
-
- for _shared_folder in _shared_folders:
+ _shared_folders = self.profile_config['export'].keys()
- # support path names with and without ":" as separator between path and autoconnect flag (pyhoca-gui < 0.1.0.9)
- if not re.match('^.*:(1|0)$', _shared_folder):
- _shared_folder = "%s:1" % _shared_folder
+ for _shared_folder_path in _shared_folders:
- _shared_folder_path = ":".join(_shared_folder.split(':')[:-1])
- if int(_shared_folder.split(':')[-1]):
+ if self.profile_config['export'][_shared_folder_path]:
_shared_folder_autoconnect = _("automatically")
else:
_shared_folder_autoconnect = _("manually")
@@ -1147,7 +1151,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
idx = self.SharedFoldersList.InsertStringItem(0, _shared_folder_path)
self.SharedFoldersList.SetStringItem(idx, 1, _shared_folder_autoconnect)
- if int(_shared_folder.split(':')[-1]):
+ if self.profile_config['export'][_shared_folder_path]:
self.SharedFoldersList.CheckItem(idx)
self.AddSharedFolderPathButton.Enable(False)
@@ -1305,7 +1309,8 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.profile_config['icon'] = ':icons/128x128/x2gosession.png'
self.profile_config['user'] = self.UserName.GetValue()
self.profile_config['key'] = self.SSHKeyFile.GetValue()
- self.profile_config['host'] = self.Host.GetValue()
+ _hosts = self.Host.GetValue()
+ self.profile_config['host'] = _hosts.split(',')
self.profile_config['usesshproxy'] = self.UseSSHProxy.GetValue()
if _session_type != 'DirectRDP':
self.profile_config['sshport'] = self.SSHPort.GetValue()
@@ -1557,9 +1562,12 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.SoundPortLabel.Enable(False)
self.SoundPort.Enable(False)
self.Esd.Enable(False)
- self.tab_SharedResources.Enable(True)
+ if self.session_profiles.is_writable(self.profile_id):
+ self.tab_SharedResources.Enable(True)
self.RDPServer.Enable(False)
- self.RDPServer.SetValue(self.Host.GetValue())
+ _hosts = self.Host.GetValue()
+ # only one host address supported
+ self.RDPServer.SetValue(_hosts.split(',')[0])
self.RDPOptions.SetValue(self.profile_config_bak['directrdpsettings'])
if self.Application.GetValue() in self.applicationChoices.keys():
self._last_application = self.Application.GetValue()
@@ -1612,7 +1620,8 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.DefaultSoundPort.Enable(True)
self.DefaultSoundPort.SetValue(True)
self.Esd.Enable(True)
- self.tab_SharedResources.Enable(True)
+ if self.session_profiles.is_writable(self.profile_id):
+ self.tab_SharedResources.Enable(True)
self.RDPServer.SetValue(self.profile_config_bak['rdpserver'])
self.RDPOptions.SetValue(self.profile_config_bak['rdpoptions'])
if self.Application.GetValue() in self.rdpclientChoices.keys():
@@ -1761,7 +1770,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
else:
self.profile_config_bak['rdpport'] = self.SSHPort.GetValue()
self.profile_config_bak['directrdpsettings'] = self.RDPOptions.GetValue()
- if self.RDPServer.GetValue() != self.Host.GetValue():
+ if self.RDPServer.GetValue() != self.Host.GetValue().split(',')[0]:
self.profile_config_bak['rdpserver'] = self.RDPServer.GetValue()
self.profile_config_bak['rdpoptions'] = self.RDPOptions.GetValue()
self.disable_DirectRDP()
@@ -1889,7 +1898,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
"""
if [ k for k in self.sessionChoices.keys() if self.sessionChoices[k] == self.SessionType.GetValue() ][0] == 'DirectRDP':
- self.RDPServer.SetValue(self.Host.GetValue())
+ self.RDPServer.SetValue(self.Host.GetValue().split(',')[0])
def OnSSHKeyFileBrowse(self, event):
"""\
--
Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/pyhoca-gui.git
More information about the x2go-commits
mailing list