[X2go-Commits] pyhoca-gui.git - master (branch) updated: 0.2.1.1-12-gb40455d

X2Go dev team git-admin at x2go.org
Fri Jan 11 10:51:12 CET 2013


The branch, master has been updated
       via  b40455ddce61dc0f8eab116018b2378d1f84ca66 (commit)
       via  450197e2ac67b5e90e22f1b37912653e93e6a6f8 (commit)
      from  490ca0fd74802eef615fdede4e91ca657822482f (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 -----------------------------------------------------------------
commit b40455ddce61dc0f8eab116018b2378d1f84ca66
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Fri Jan 11 10:52:34 2013 +0100

    Add support for exporting session profiles and session profile groups. Versioned Depend: on python-x2go (>= 0.2.1.2-0~).

commit 450197e2ac67b5e90e22f1b37912653e93e6a6f8
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Fri Jan 11 10:51:10 2013 +0100

    fix icon file names

-----------------------------------------------------------------------

Summary of changes:
 debian/changelog                                   |    2 +
 debian/control                                     |    2 +-
 .../PyHoca/32x32/{auth_success.png => success.png} |  Bin 1572 -> 1572 bytes
 icons/PyHoca/64x64/{audio_error.png => error.png}  |  Bin 3973 -> 3973 bytes
 .../PyHoca/64x64/{auth_success.png => success.png} |  Bin 3213 -> 3213 bytes
 ...r-network.svg => gnome-dev-printer-network.png} |    0
 icons_symlinked/PyHoca/32x32/session_printing.png  |    1 +
 icons_symlinked/PyHoca/32x32/session_printing.svg  |    1 -
 .../PyHoca/32x32/{auth_success.png => success.png} |    0
 .../{32x32/audio_error.png => 64x64/error.png}     |    0
 .../{32x32/auth_success.png => 64x64/success.png}  |    0
 pyhoca/wxgui/frontend.py                           |   76 ++++++++++++++++++++
 pyhoca/wxgui/menus_taskbar.py                      |   20 +++++-
 13 files changed, 99 insertions(+), 3 deletions(-)
 copy icons/PyHoca/32x32/{auth_success.png => success.png} (100%)
 copy icons/PyHoca/64x64/{audio_error.png => error.png} (100%)
 copy icons/PyHoca/64x64/{auth_success.png => success.png} (100%)
 rename icons_symlinked/PyHoca/32x32/{gnome-dev-printer-network.svg => gnome-dev-printer-network.png} (100%)
 create mode 120000 icons_symlinked/PyHoca/32x32/session_printing.png
 delete mode 120000 icons_symlinked/PyHoca/32x32/session_printing.svg
 copy icons_symlinked/PyHoca/32x32/{auth_success.png => success.png} (100%)
 copy icons_symlinked/PyHoca/{32x32/audio_error.png => 64x64/error.png} (100%)
 copy icons_symlinked/PyHoca/{32x32/auth_success.png => 64x64/success.png} (100%)

The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index 89b80a2..659476f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,8 +11,10 @@ pyhoca-gui (0.2.1.2-0~x2go1) UNRELEASED; urgency=low
     - Add rules to setup.py that install PyHoca-GUI's data files under Linux
       (i.e. icons, images, man page, etc.). Thanks to Orion Poplawski for
       coming up with an inspiring patch. (Fixes: #92).
+    - Add support for exporting session profiles and session profile groups.
   * /debian/control:
     + Thanks to Orion's patch in bug #91 we can drop many build dependencies.
+    + Versioned Depend: on python-x2go (>= 0.2.1.2-0~).
 
  -- Mike Gabriel <mike.gabriel at das-netzwerkteam.de>  Thu, 20 Dec 2012 08:51:50 +0100
 
diff --git a/debian/control b/debian/control
index 4716516..14aad2c 100644
--- a/debian/control
+++ b/debian/control
@@ -23,7 +23,7 @@ Architecture: all
 Depends: 
  ${misc:Depends},
  python,
- python-x2go (>=0.2.1.1-0~),
+ python-x2go (>=0.2.1.2-0~),
  python-argparse,
  python-notify,
  python-setproctitle,
diff --git a/icons/PyHoca/32x32/auth_success.png b/icons/PyHoca/32x32/success.png
similarity index 100%
copy from icons/PyHoca/32x32/auth_success.png
copy to icons/PyHoca/32x32/success.png
diff --git a/icons/PyHoca/64x64/audio_error.png b/icons/PyHoca/64x64/error.png
similarity index 100%
copy from icons/PyHoca/64x64/audio_error.png
copy to icons/PyHoca/64x64/error.png
diff --git a/icons/PyHoca/64x64/auth_success.png b/icons/PyHoca/64x64/success.png
similarity index 100%
copy from icons/PyHoca/64x64/auth_success.png
copy to icons/PyHoca/64x64/success.png
diff --git a/icons_symlinked/PyHoca/32x32/gnome-dev-printer-network.svg b/icons_symlinked/PyHoca/32x32/gnome-dev-printer-network.png
similarity index 100%
rename from icons_symlinked/PyHoca/32x32/gnome-dev-printer-network.svg
rename to icons_symlinked/PyHoca/32x32/gnome-dev-printer-network.png
diff --git a/icons_symlinked/PyHoca/32x32/session_printing.png b/icons_symlinked/PyHoca/32x32/session_printing.png
new file mode 120000
index 0000000..70a342f
--- /dev/null
+++ b/icons_symlinked/PyHoca/32x32/session_printing.png
@@ -0,0 +1 @@
+gnome-dev-printer-network.png
\ No newline at end of file
diff --git a/icons_symlinked/PyHoca/32x32/session_printing.svg b/icons_symlinked/PyHoca/32x32/session_printing.svg
deleted file mode 120000
index 519c84b..0000000
--- a/icons_symlinked/PyHoca/32x32/session_printing.svg
+++ /dev/null
@@ -1 +0,0 @@
-gnome-dev-printer-network.svg
\ No newline at end of file
diff --git a/icons_symlinked/PyHoca/32x32/auth_success.png b/icons_symlinked/PyHoca/32x32/success.png
similarity index 100%
copy from icons_symlinked/PyHoca/32x32/auth_success.png
copy to icons_symlinked/PyHoca/32x32/success.png
diff --git a/icons_symlinked/PyHoca/32x32/audio_error.png b/icons_symlinked/PyHoca/64x64/error.png
similarity index 100%
copy from icons_symlinked/PyHoca/32x32/audio_error.png
copy to icons_symlinked/PyHoca/64x64/error.png
diff --git a/icons_symlinked/PyHoca/32x32/auth_success.png b/icons_symlinked/PyHoca/64x64/success.png
similarity index 100%
copy from icons_symlinked/PyHoca/32x32/auth_success.png
copy to icons_symlinked/PyHoca/64x64/success.png
diff --git a/pyhoca/wxgui/frontend.py b/pyhoca/wxgui/frontend.py
index 328941c..68dd026 100644
--- a/pyhoca/wxgui/frontend.py
+++ b/pyhoca/wxgui/frontend.py
@@ -312,6 +312,7 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
         self._logon_windows = {}
         self._hide_notifications_map = {}
         self._eventid_profilenames_map = {}
+        self._eventid_exportprofiles_map = {}
         self._eventid_sessionnames_map = {}
         self._eventid_applications_map = {}
         self._eventid_shared_folders_map = {}
@@ -1058,6 +1059,81 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
                 pass
         self._temp_disabled_profile_names.remove(profile_name)
 
+    def OnProfileExport(self, evt):
+        """\
+        Gets called if the user request a session profile (group) export.
+
+        @param evt: event
+        @type evt: C{obj}
+
+        """
+        try:
+            profile_name = self._eventid_profilenames_map[evt.GetId()]
+        except KeyError:
+            profile_name = None
+
+        try:
+            profile_group = self._eventid_exportprofiles_map[evt.GetId()]
+        except KeyError:
+            profile_group = None
+
+        if profile_group:
+
+            # This returns a Python list of files that were selected.
+            filtered_profile_names = [ pn for pn in self._X2goClient__get_profiles().profile_names if pn.startswith(unicode(profile_group)) ]
+
+            dlg = wx.FileDialog(
+                self.about, message=_(u"%s - export session profiles") % profile_group, wildcard="*.x2go", style=wx.FD_SAVE)
+
+        if profile_name:
+
+            dlg = wx.FileDialog(
+                self.about, message=_(u"%s - export session profile") % profile_name, wildcard="*.x2go", style=wx.FD_SAVE)
+            filtered_profile_names = [profile_name]
+
+        # Show the dialog and retrieve the user response. If it is the OK response,
+        # process the data.
+        if dlg.ShowModal() == wx.ID_OK:
+
+            _export_file = dlg.GetPath()
+            if not _export_file.endswith(".x2go"): _export_file += ".x2go"
+
+            if os.path.exists(_export_file):
+                m = messages.PyHoca_MessageWindow_NoYes(self,
+                                                        title=_(u'%s: Export file already exists') % self.appname,
+                                                        msg=_(u"The file »%s« already exists in this folder.\n\nDo you want to replace it?") % os.path.basename(_export_file),
+                                                        icon='warning',
+                                                        profile_name=profile_name)
+                m.ShowModal()
+                if not m.Yes(): return
+                else: os.remove(_export_file)
+
+            exported_sessions = x2go.X2goSessionProfiles(config_files=[_export_file])
+            for profile_name in filtered_profile_names:
+                this_profile = self._X2goClient__get_profile_config(profile_name)
+
+                # clean up session profile options that are unknown to Python X2Go
+                for key in copy.deepcopy(this_profile).keys():
+                    if key not in x2go.defaults.X2GO_SESSIONPROFILE_DEFAULTS:
+                        del this_profile[key]
+
+                exported_sessions.add_profile(**this_profile)
+
+            exported_sessions.write_user_config = True
+            if exported_sessions.write():
+                if profile_group:
+                    self.notifier.send(_(u'%s - profiles exported') % profile_group, _(u'Successfully exported session profile group »%s« to file »%s«.') % (profile_group, os.path.basename(_export_file)), icon='success', timeout=10000)
+                elif profile_name:
+                    self.notifier.send(_(u'%s - profile exported') % profile_name, _(u'Successfully exported single session profile »%s« to file »%s«.') % (profile_name, os.path.basename(_export_file)), icon='success', timeout=10000)
+            else:
+                self._pyhoca_logger('Exporting session profile(s) to file %s failed.' % _export_file, loglevel=x2go.loglevel_ERROR)
+                m = messages.PyHoca_MessageWindow_Ok(self,
+                                                        title=_(u'%s: Exporting session profile(s) failed') % self.appname,
+                                                        msg=_(u"The selected session profile(s) could not be exported to the \nfile »%s«.\n\nCheck for common problems (disk full, insufficient access, etc.).") % os.path.normpath(_export_file),
+                                                        icon='error',
+                                                        profile_name=profile_name)
+                m.ShowModal()
+
     def OnShareCustomLocalFolder(self, evt):
         """\
         Gets called if the user chooses to share a non-configured local folder with the running X2Go session.
diff --git a/pyhoca/wxgui/menus_taskbar.py b/pyhoca/wxgui/menus_taskbar.py
index e7c07cf..68cd3f3 100644
--- a/pyhoca/wxgui/menus_taskbar.py
+++ b/pyhoca/wxgui/menus_taskbar.py
@@ -64,21 +64,26 @@ class PyHocaGUI_Menu_TaskbarManageProfile(wx.Menu):
 
         ID_EDITPROFILE = wx.NewId()
         ID_COPYPROFILE = wx.NewId()
+        ID_EXPORTPROFILE = 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_EXPORTPROFILE] = \
             self._PyHocaGUI._eventid_profilenames_map[ID_DELETEPROFILE] = profile_name
 
         self.Append(text=_(u"Edit Profile"), id=ID_EDITPROFILE)
         if not self._PyHocaGUI.args.single_session_profile:
             self.AppendSeparator()
             self.Append(text=_(u"Use as Template for New Profile"), id=ID_COPYPROFILE)
+            self.AppendSeparator()
+            self.Append(text=_(u"Export Profile"), id=ID_EXPORTPROFILE)
             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.OnProfileExport, id=ID_EXPORTPROFILE)
         self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnProfileDelete, id=ID_DELETEPROFILE)
 
 
@@ -886,8 +891,8 @@ class PyHocaGUI_Menu_TaskbarProfileNames(wx.Menu):
                                                                                 group_name=profile_group,
                                                                                 parent_group=_parent_group,
                                                                                 group_menus=True)
-                                    )
 
+                                    )
         if filter_profiles:
             _profile_names = [ p for p in _profile_names if p not in filter_profiles ]
 
@@ -921,6 +926,19 @@ class PyHocaGUI_Menu_TaskbarProfileNames(wx.Menu):
             _dummy = self.Append(text=_(u'No session profiles defined'), id=wx.NewId())
             _dummy.Enable(False)
 
+        else:
+            if bind_method is None:
+                self.AppendSeparator()
+                _export_id = wx.NewId()
+                _export_group_name = "%s/%s" % (parent_group, group_name)
+                _export_group_name = _export_group_name.strip("/")
+                self._PyHocaGUI._eventid_exportprofiles_map[_export_id] = _export_group_name
+                if not group_name:
+                    self.Append(text=_(u'Export all profiles'), id=_export_id)
+                else:
+                    self.Append(text=_(u'Export profile group'), id=_export_id)
+                self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnProfileExport, id=_export_id)
+
     def OnUpdateUI(self, evt):
         profile_name = self._PyHocaGUI._eventid_profilenames_map[evt.GetId()]
         if profile_name in self._PyHocaGUI._temp_disabled_profile_names:


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