[X2Go-Commits] pyhoca-gui.git - build-59a18b6e3b5d3f1dd8f07f26433d37fe5984a57d (branch) updated: 0.1.0.10-274-gdf14fe3
X2Go dev team
git-admin at x2go.org
Tue Aug 27 13:22:26 CEST 2013
The branch, build-59a18b6e3b5d3f1dd8f07f26433d37fe5984a57d has been updated
via df14fe3300c259f228c05dca265eeba5ac094bb4 (commit)
from 33c9583bfe8b14569224ef28995c8006e6d10205 (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/wxgui/profilemanager.py | 285 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 280 insertions(+), 5 deletions(-)
The diff of changes is:
diff --git a/pyhoca/wxgui/profilemanager.py b/pyhoca/wxgui/profilemanager.py
index 8789778..e73a625 100644
--- a/pyhoca/wxgui/profilemanager.py
+++ b/pyhoca/wxgui/profilemanager.py
@@ -50,12 +50,21 @@ class CheckListCtrl(wx.ListCtrl, CheckListCtrlMixin):
class PyHocaGUI_ProfileManager(wx.Dialog):
"""\
- STILL UNDOCUMENTED
+ L{PyHocaGUI}'s profile manager window that allows to tweak all session related settings.
"""
def __init__(self, _PyHocaGUI, action, profile_id=None, profile_name=None):
"""\
- STILL UNDOCUMENTED
+ Profile manager window (constructor).
+
+ @param _PyHocaGUI: main application instance
+ @type _PyHocaGUI: C{obj}
+ @param action: profile manager action (use either of C{ADD}, C{ADD_EXPLICITLY}, C{EDIT}, C{EDIT_CONNECTED}, (C{EDIT_EXPLICITLY})
+ @type action: C{str}
+ @param profile_id: X2Go session profile ID
+ @type profile_id: C{str}
+ @param profile_name: X2Go session profile name
+ @type profile_name: C{str}
"""
self._PyHocaGUI = _PyHocaGUI
@@ -167,7 +176,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.ProfileNameLabel = wx.StaticText(self.tab_Profile, -1, _(u"Name")+":")
self.ProfileName = wx.TextCtrl(self.tab_Profile, -1, "")
- if self.action in ("EDIT_EXPLICITLY", "EDIT_EXPLICITLY"):
+ if self.action in ("ADD_EXPLICITLY", "EDIT_EXPLICITLY"):
self.ProfileNameLabel.Enable(False)
self.ProfileName.Enable(False)
@@ -359,6 +368,10 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.SharedFoldersList.OnCheckItem = _SharedFoldersList_OnCheckItem
def __set_properties(self):
+ """\
+ Set hard-coded widget properties.
+
+ """
if self.action == 'ADD':
self.SetTitle(_(u"PyHoca-GUI Profile Manager - new profile"))
elif self.action == 'EDIT_CONNECTED':
@@ -458,7 +471,10 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.DefaultButton.SetMinSize((-1, 30))
def __do_layout(self):
+ """\
+ Arrange/layout widgets on screen.
+ """
# PROFILE TAB
sizer_1 = wx.BoxSizer(wx.VERTICAL)
sizer_1_1 = wx.StaticBoxSizer(self.staticbox_Profile, wx.VERTICAL)
@@ -772,7 +788,10 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.SharedFoldersList.SetColumnWidth(1, abs(_sizer_width*.3))
def __update_fields(self):
+ """\
+ Update widget fields/values from session profile configuration.
+ """
self.ProfileName.SetValue(self.profile_config['name'])
self.SetSessionWindowTitle.SetValue(self.profile_config['setsessiontitle'])
self.CustomSessionWindowTitle.SetValue(self.profile_config['sessiontitle'])
@@ -1086,6 +1105,11 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.disable_EditConnected_options()
def disable_EditConnected_options(self):
+ """\
+ If C{action} in the constructor has been set to C{EDIT_CONNECTED} this
+ method will disable several profile manager widgets.
+
+ """
# disable widgets when editing connected sessions
if self.action == 'EDIT_CONNECTED':
@@ -1120,6 +1144,10 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.tab_SharedFilesAndFolders.Enable(False)
def __update_from_screen(self):
+ """\
+ Update session profile configuration from the widget fields and their values.
+
+ """
self.profile_config['name'] = self.ProfileName.GetValue()
self.profile_config['setsessiontitle'] = self.SetSessionWindowTitle.GetValue()
if self.UseDefaultSessionWindowTitle.GetValue():
@@ -1242,12 +1270,19 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.profile_config['mimeboxaction'] = _mimebox_action
def OnIconChange(self, event):
+ """\
+ Gets called on profile icon change requests.
+
+ @param event: event
+ @type event: C{obj}
+
+ """
_share_location = os.path.split(_icons_location)[0]
iconsdir = _icons_location
if not os.path.exists(iconsdir):
iconsdir = os.getcwd()
- wildcard = _(u"Icon Files (*.png)|*.png|" \
- "All files (*.*)|*")
+ wildcard = _(u"Icon Files (*.png)|*.png|" \
+ u"All files (*.*)|*")
dlg = wx.FileDialog(
self, message=_(u"Choose an icon for this session profile"), defaultDir=iconsdir,
defaultFile="", wildcard=wildcard, style=wx.OPEN | wx.CHANGE_DIR )
@@ -1262,6 +1297,13 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.IconPath = rel_path
def OnSetSessionWindowTitle(self, event):
+ """\
+ Gets called if the change-session-window-title checkbox gets marked.
+
+ @param event: event
+ @type event: C{obj}
+
+ """
if self.SetSessionWindowTitle.GetValue():
self.UseDefaultSessionWindowTitle.Enable(True)
if not self.UseDefaultSessionWindowTitle.GetValue():
@@ -1273,6 +1315,13 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.CustomSessionWindowTitle.Enable(False)
def OnUseDefaultSessionWindowTitle(self, event):
+ """\
+ Gets called if the use-default-session-window-title checkbox gets marked.
+
+ @param event: event
+ @type event: C{obj}
+
+ """
if self.UseDefaultSessionWindowTitle.GetValue():
self.CustomSessionWindowTitleLabel.Enable(False)
self.CustomSessionWindowTitle.Enable(False)
@@ -1281,6 +1330,13 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.CustomSessionWindowTitle.Enable(True)
def enable_DirectRDP(self):
+ """\
+ Gets called if the use-direct-RDP checkbox gets marked.
+
+ @param event: event
+ @type event: C{obj}
+
+ """
self.HostLabel.Enable(False)
self.Host.Enable(False)
self.SSHPortLabel.Enable(False)
@@ -1303,6 +1359,13 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.tab_SharedFilesAndFolders.Enable(False)
def disable_DirectRDP(self):
+ """\
+ Gets called if the use-direct-RDP checkbox gets unmarked.
+
+ @param event: event
+ @type event: C{obj}
+
+ """
if not self.UseSSHProxy.GetValue():
self.HostLabel.Enable(True)
self.Host.Enable(True)
@@ -1326,6 +1389,13 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.tab_SharedFilesAndFolders.Enable(True)
def OnSessionTypeSelected(self, event):
+ """\
+ Gets called if another session type gets selected.
+
+ @param event: event
+ @type event: C{obj}
+
+ """
_session_type = [ i for i in self.sessionChoices.keys() if self.sessionChoices[i] == self.SessionType.GetValue() ][0]
self.UsePublishedApplications.Enable(True)
self.AutoStartSession.Enable(True)
@@ -1412,7 +1482,13 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.disable_EditConnected_options()
def OnCompressionSelected(self, event):
+ """\
+ Gets called if another compression method gets selected.
+
+ @param event: event
+ @type event: C{obj}
+ """
_pack = self.Compression.GetValue()
if _pack.endswith('-%'):
self.ImageQuality.Enable(True)
@@ -1420,6 +1496,13 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.ImageQuality.Enable(False)
def OnSSHKeyFileBrowse(self, event):
+ """\
+ Gets called if the user requests to browse for an SSH key file (for X2Go client/server connection).
+
+ @param event: event
+ @type event: C{obj}
+
+ """
sshdir = os.path.expanduser('~/.ssh')
if not os.path.exists(sshdir):
sshdir = os.getcwd()
@@ -1435,6 +1518,13 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.SSHKeyFile.SetValue(path)
def OnSSHProxyKeyFileBrowse(self, event):
+ """\
+ Gets called if the user requests to browse for an SSH key file (for SSH proxy client/server connection).
+
+ @param event: event
+ @type event: C{obj}
+
+ """
sshdir = os.path.expanduser('~/.ssh')
if not os.path.exists(sshdir):
sshdir = os.getcwd()
@@ -1450,6 +1540,13 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.SSHProxyKeyFile.SetValue(path)
def OnUseSSHProxy(self, event):
+ """\
+ Gets called if the use-ssh-proxy checkbox gets marked.
+
+ @param event: event
+ @type event: C{obj}
+
+ """
if self.UseSSHProxy.GetValue():
self.SSHProxyHostLabel.Enable(True)
self.SSHProxyHost.Enable(True)
@@ -1492,12 +1589,33 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.SSHPort.SetValue(self.profile_config_bak['sshport'])
def OnUpdateSSHProxyTunnelFromHost(self, event):
+ """\
+ Gets called whenever the ssh-proxy-tunnel-from-host gets modified.
+
+ @param event: event
+ @type event: C{obj}
+
+ """
self.Host.SetValue(self.SSHProxyTunnelFromHost.GetValue())
def OnUpdateSSHProxyTunnelFromPort(self, event):
+ """\
+ Gets called whenever the ssh-proxy-tunnel-from-port gets modified.
+
+ @param event: event
+ @type event: C{obj}
+
+ """
self.SSHPort.SetValue(self.SSHProxyTunnelFromPort.GetValue())
def OnSetKeyboard(self, event):
+ """\
+ Gets called whenever the either of the keyboard-settings radio buttons is selected.
+
+ @param event: event
+ @type event: C{obj}
+
+ """
if self.CustomSetKeyboard.GetValue():
self.KeyboardModelLabel.Enable(True)
self.KeyboardLayoutLabel.Enable(True)
@@ -1514,6 +1632,13 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.KeyboardVariant.Enable(False)
def OnSoundEnable(self, event): # wxGlade: X2goMaintProfile.<event_handler>
+ """\
+ Gets called whenever the enable-sound checkbox gets marked.
+
+ @param event: event
+ @type event: C{obj}
+
+ """
if self.EnableSound.GetValue():
self.PulseAudio.Enable(True)
self.Esd.Enable(True)
@@ -1530,32 +1655,74 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
def OnSetDisplayFullscreen(self, event):
+ """\
+ Gets called whenever the fullscreen-display radion button gets checked.
+
+ @param event: event
+ @type event: C{obj}
+
+ """
self.ScreenWidthLabel.Enable(False)
self.ScreenWidth.Enable(False)
self.ScreenHeightLabel.Enable(False)
self.ScreenHeight.Enable(False)
def OnSetDisplayCustom(self, event):
+ """\
+ Gets called whenever the custom-size-display radion button gets checked.
+
+ @param event: event
+ @type event: C{obj}
+
+ """
self.ScreenWidthLabel.Enable(True)
self.ScreenWidth.Enable(True)
self.ScreenHeightLabel.Enable(True)
self.ScreenHeight.Enable(True)
def OnSetDisplayDPI(self, event):
+ """\
+ Gets called whenever the set-dpi checkbox gets marked.
+
+ @param event: event
+ @type event: C{obj}
+
+ """
if self.SetDisplayDPI.GetValue():
self.DisplayDPI.Enable(True)
else:
self.DisplayDPI.Enable(False)
def OnPulseAudio(self, event):
+ """\
+ Gets called whenever the pulseaudio system is seleced.
+
+ @param event: event
+ @type event: C{obj}
+
+ """
if self.DefaultSoundPort.GetValue():
self.SoundPort.SetValue(self.audioPorts['pulse'])
def OnEsd(self, event):
+ """\
+ Gets called whenever the esound system is seleced.
+
+ @param event: event
+ @type event: C{obj}
+
+ """
if self.DefaultSoundPort.GetValue():
self.SoundPort.SetValue(self.audioPorts['esd'])
def OnDefaultSoundPort(self, event):
+ """\
+ Gets called if the user chooses to use the audio system's default audio port.
+
+ @param event: event
+ @type event: C{obj}
+
+ """
if not self.DefaultSoundPort.GetValue():
self.SoundPortLabel.Enable(True)
self.SoundPort.Enable(True)
@@ -1568,6 +1735,10 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.SoundPort.Enable(False)
def _toggle_localFolderSharing(self):
+ """\
+ Helper method for L{OnToggleLocalFolderSharing}.
+
+ """
if self.UseLocalFolderSharing.GetValue():
self.SharedFolderPathLabel.Enable(True)
self.SharedFolderPath.Enable(True)
@@ -1589,9 +1760,23 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.ServerEncoding.Enable(False)
def OnToggleLocalFolderSharing(self, event):
+ """\
+ Gets called on activation/deactivation of client-side local folder sharing.
+
+ @param event: event
+ @type event: C{obj}
+
+ """
self._toggle_localFolderSharing()
def OnSelectSharedFolderPath(self, event):
+ """\
+ Gets called whenever the uses evokes a file browser dialog that allows to choose a folder for sharing.
+
+ @param event: event
+ @type event: C{obj}
+
+ """
shared_folder = os.path.expanduser('~')
if not os.path.exists(shared_folder):
shared_folder = os.getcwd()
@@ -1604,15 +1789,43 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.SharedFolderPath.SetValue(dlg.GetPath())
def OnSharedFolderListItemSelected(self, event):
+ """\
+ Gets called whenever a shared folder in the list of already configured locally shared folders is selected.
+
+ @param event: event
+ @type event: C{obj}
+
+ """
self.DeleteSharedFolderPathButton.Enable(True)
def OnSharedFolderListItemDeselected(self, event):
+ """\
+ Gets called whenever a shared folder in the list of already configured locally shared folders is deselected.
+
+ @param event: event
+ @type event: C{obj}
+
+ """
self.DeleteSharedFolderPathButton.Enable(False)
def OnSharedFolderPathKeyPressed(self, event):
+ """\
+ Gets called whenever something gets typed in the sharable folder path field.
+
+ @param event: event
+ @type event: C{obj}
+
+ """
self.AddSharedFolderPathButton.Enable(True)
def OnAddSharedFolderPath(self, event):
+ """\
+ Gets called whenever the user requests to add a folder name to the list of locally shared folders.
+
+ @param event: event
+ @type event: C{obj}
+
+ """
_shared_folder_path = self.SharedFolderPath.GetValue()
if _shared_folder_path and (self.SharedFoldersList.FindItem(0, _shared_folder_path) == -1):
idx = self.SharedFoldersList.InsertStringItem(0, _shared_folder_path)
@@ -1622,11 +1835,22 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.AddSharedFolderPathButton.Enable(False)
def OnDeleteSharedFolderPath(self, event):
+ """\
+ Gets called whenever the user requests to remove a folder name from the list of locally shared folders.
+
+ @param event: event
+ @type event: C{obj}
+
+ """
_item = self.SharedFoldersList.GetFocusedItem()
self.SharedFoldersList.DeleteItem(_item)
self.DeleteSharedFolderPathButton.Enable(False)
def _toggle_useEncodingConverter(self):
+ """\
+ Helper method for L{OnToggleEncodingConverter}.
+
+ """
if self.UseEncodingConverter.GetValue():
self.ClientEncodingLabel.Enable(True)
self.ClientEncoding.Enable(True)
@@ -1639,9 +1863,20 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.ServerEncoding.Enable(False)
def OnToggleEncodingConverter(self, event):
+ """\
+ Gets called whenever the encoding conversion gets enabled/disabled.
+
+ @param event: event
+ @type event: C{obj}
+
+ """
self._toggle_useEncodingConverter()
def _toggle_useFileMIMEbox(self):
+ """\
+ Helper method for L{OnToggleFileMIMEbox}.
+
+ """
if self.UseFileMIMEbox.GetValue():
self.FileMIMEboxExtensionsLabel.Enable(True)
self.FileMIMEboxExtensions.Enable(True)
@@ -1654,9 +1889,23 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.FileMIMEboxAction.Enable(False)
def OnToggleFileMIMEbox(self, event):
+ """\
+ Gets called whenever the user enables/disabled the MIME box feature.
+
+ @param event: event
+ @type event: C{obj}
+
+ """
self._toggle_useFileMIMEbox()
def __validate(self):
+ """\
+ Validation of all widget fields, called when the user requests to save the session profile.
+
+ @return: status of validation; C{True} for successfully validated, C{False} otherwise
+ @rtype: C{bool}
+
+ """
validateOk = True
if len(self.profile_config['name'].strip()) == 0:
validateOk = False
@@ -1685,6 +1934,13 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
return validateOk
def OnOKButton(self, event):
+ """\
+ Gets called if the users clicks on the ,,Save'' button.
+
+ @param event: event
+ @type event: C{obj}
+
+ """
wx.BeginBusyCursor()
self.__update_from_screen()
if self.__validate():
@@ -1721,14 +1977,33 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
except: pass
def OnCancel(self, event):
+ """\
+ Gets called if the users clicks on the ,,Cancel'' button.
+
+ @param event: event
+ @type event: C{obj}
+
+ """
self.Close()
self.Destroy()
def OnDefault(self, event):
+ """\
+ Gets called if the users clicks on the ,,Defaults'' button.
+
+ @param event: event
+ @type event: C{obj}
+
+ """
self.profile_config = copy.deepcopy(self.profile_config_bak)
self.__update_fields()
def Destroy(self):
+ """\
+ Tidy up some stuff in the main application instances before allowing desctruction of the
+ profile manager window.
+
+ """
try:
self._PyHocaGUI._sub_windows.remove(self)
except ValueError:
hooks/post-receive
--
pyhoca-gui.git (Python X2Go Client (wxPython GUI))
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "pyhoca-gui.git" (Python X2Go Client (wxPython GUI)).
More information about the x2go-commits
mailing list