[X2Go-Commits] pyhoca-gui.git - build-59a18b6e3b5d3f1dd8f07f26433d37fe5984a57d (branch) updated: 0.1.0.10-12-g1d71591

X2Go dev team git-admin at x2go.org
Tue Aug 27 13:21:53 CEST 2013


The branch, build-59a18b6e3b5d3f1dd8f07f26433d37fe5984a57d has been updated
       via  1d7159183901e1627af9c3d75fbf5a518b39bab8 (commit)
      from  a7df5d3b05ed3f5c46b8ca19d6811fd4f2302d22 (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:
 debian/changelog               |    1 +
 pyhoca/wxgui/frontend.py       |    9 +++++++++
 pyhoca/wxgui/menus_taskbar.py  |    4 ++++
 pyhoca/wxgui/profilemanager.py |   24 ++++++++++++++++--------
 4 files changed, 30 insertions(+), 8 deletions(-)

The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index 55cd981..ca59836 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,7 @@ pyhoca-gui (0.1.0.11-0~x2go1) UNRELEASED; urgency=low
     - Update of i18n files: en, de, es.
     - Drop handling of session icon, not used in pyhoca-gui, anyway.
     - Fix profile manager window size (shrinking for usage on netbooks).
+    - Existing profiles can be used as templates for new session profiles.
   * Depend on Python X2Go 0.1.1.9.
 
  -- Mike Gabriel <mike.gabriel at das-netzwerkteam.de>  Wed, 09 Nov 2011 03:13:09 +0100
diff --git a/pyhoca/wxgui/frontend.py b/pyhoca/wxgui/frontend.py
index 74f5939..6cd11e5 100644
--- a/pyhoca/wxgui/frontend.py
+++ b/pyhoca/wxgui/frontend.py
@@ -597,6 +597,15 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
         self._pyhoca_logger('editing session profile %s' % self.current_profile_name, loglevel=x2go.log.loglevel_INFO, )
         profilemanager.PyHocaGUI_ProfileManager(self, 'EDIT', profile_name=self.current_profile_name)
 
+    def OnProfileCopy(self, evt):
+        """\
+        STILL UNDOCUMENTED
+
+        """
+        self.current_profile_name = self._eventid_profilenames_map[evt.GetId()]
+        self._pyhoca_logger('using session profile %s as template for new profile' % self.current_profile_name, loglevel=x2go.log.loglevel_INFO, )
+        profilemanager.PyHocaGUI_ProfileManager(self, 'COPY', profile_name=self.current_profile_name)
+
     def OnProfileEditWhileConnected(self, evt):
         """\
         STILL UNDOCUMENTED
diff --git a/pyhoca/wxgui/menus_taskbar.py b/pyhoca/wxgui/menus_taskbar.py
index c817c7d..5278858 100644
--- a/pyhoca/wxgui/menus_taskbar.py
+++ b/pyhoca/wxgui/menus_taskbar.py
@@ -46,17 +46,21 @@ class PyHocaGUI_Menu_TaskbarManageProfile(wx.Menu):
         wx.Menu.__init__(self)
 
         ID_EDITPROFILE = wx.NewId()
+        ID_COPYPROFILE = wx.NewId()
         ID_DELETEPROFILE = wx.NewId()
 
         # preparing profile_name information for the main PyHocaGUI instance
         self._PyHocaGUI._eventid_profilenames_map[ID_EDITPROFILE] = \
+            self._PyHocaGUI._eventid_profilenames_map[ID_COPYPROFILE] = \
             self._PyHocaGUI._eventid_profilenames_map[ID_DELETEPROFILE] = profile_name
 
         self.Append(text=_(u"Edit Profile"), id=ID_EDITPROFILE)
         self.AppendSeparator()
+        self.Append(text=_(u"Use as Template for New Profile"), id=ID_COPYPROFILE)
         self.Append(text=_(u"Delete Profile"), id=ID_DELETEPROFILE)
 
         self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnProfileEdit, id=ID_EDITPROFILE)
+        self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnProfileCopy, id=ID_COPYPROFILE)
         self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnProfileDelete, id=ID_DELETEPROFILE)
 
 
diff --git a/pyhoca/wxgui/profilemanager.py b/pyhoca/wxgui/profilemanager.py
index 91f1ef3..c1d0d95 100644
--- a/pyhoca/wxgui/profilemanager.py
+++ b/pyhoca/wxgui/profilemanager.py
@@ -113,17 +113,25 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
         self.session_profiles = self._PyHocaGUI.session_profiles
         self.action = action
 
-        if self.action in ('EDIT', 'EDIT_CONNECTED'):
-            if profile_id is not None:
-                self.profile_id = profile_id
-            elif profile_name is not None:
-                self.profile_id = self.session_profiles.check_profile_id_or_name(profile_name)
-            self.profile_config = self.session_profiles.get_profile_config(self.profile_id)
+        if profile_id is not None:
+            self.profile_id = profile_id
+        elif profile_name is not None:
+            self.profile_id = self.session_profiles.check_profile_id_or_name(profile_name)
 
-        if self.action == 'ADD':
+        if self.profile_id:
+            self.profile_name = self.session_profiles.to_profile_name(self.profile_id)
+
+        if self.action in ('EDIT', 'EDIT_CONNECTED') and self.profile_id:
+            self.profile_config = self.session_profiles.get_profile_config(self.profile_id)
+        elif self.action == 'COPY' and self.profile_id:
+            self.profile_config = self.session_profiles.get_profile_config(self.profile_id)
+            self.profile_config['name'] = '<%s %s>' % (_('derived from '), self.profile_name)
+        else:
+            # if self.action == 'ADD' ...
             self.profile_config = self.session_profiles.default_profile_config()
             self.profile_config['name'] = '<%s>' %_('new session profile')
 
+
         # we create a backup dict of our profile_config immediately (for being able to reset erroneously made changes)
         self.profile_config_bak = copy.deepcopy(self.profile_config)
 
@@ -1513,7 +1521,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
 
             if self.profile_config != self.profile_config_bak:
 
-                if self.action == 'ADD':
+                if self.action in ('ADD', 'COPY'):
                     self.profile_id = self.session_profiles.add_profile()
 
                 for k in self.profile_config.keys():


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