[X2Go-Commits] pyhoca-gui.git - twofactorauth (branch) updated: 0.1.0.10-245-g05d7b35

X2Go dev team git-admin at x2go.org
Sat Sep 14 15:56:10 CEST 2013


The branch, twofactorauth has been updated
       via  05d7b359e15775162ea1d0c47fd909c5cecbaf6a (commit)
      from  b15b026507355da01f19925b1c864a7d82f3579f (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         |    2 ++
 pyhoca-gui               |    3 ++-
 pyhoca/wxgui/about.py    |   47 +++++++++++++++++++++++++++++++++-------------
 pyhoca/wxgui/frontend.py |    8 +++++++-
 4 files changed, 45 insertions(+), 15 deletions(-)

The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index ddd42e5..87b9095 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -133,6 +133,8 @@ pyhoca-gui (0.1.2.0-0~x2go1) UNRELEASED; urgency=low
     - Do not crash if a provided system tray icon cannot be found. Use a
       fallback icon instead.
     - os.path.is<type> require string option, not Unicode.
+    - Add option --about-image. Allow changing the application's name by
+      renaming the ,,pyhoca-gui'' script.
   * Depend on Python X2Go 0.1.2.0.
   * Install GNOME icons via dh_links.
   * Install X2Go icons with explicit install paths.
diff --git a/pyhoca-gui b/pyhoca-gui
index f3c6b31..8972fc3 100755
--- a/pyhoca-gui
+++ b/pyhoca-gui
@@ -214,6 +214,7 @@ x2go_gui_options = [
                    {'args':['--disconnect-on-suspend'], 'default': False, 'action': 'store_true', 'help': 'disconnect a server if a session has been suspended', },
                    {'args':['--disconnect-on-terminate'], 'default': False, 'action': 'store_true', 'help': 'disconnect a server if a session has been terminated', },
                    {'args':['--splash-image'], 'default': None, 'metavar': '<your-splash-image>', 'help': 'define an alternative splash image that gets shown on application startup (PNG files only, full path or filename as found in <share>/img)', },
+                   {'args':['--about-image'], 'default': None, 'metavar': '<your-about-window-image>', 'help': 'define an alternative image for the application\'s ,,About\'\' window (PNG files only, full path or filename as found in <share>/img)', },
                    {'args':['--disable-splash'], 'default': False, 'action': 'store_true', 'help': 'disable the applications splash screen', },
                    {'args':['--disable-options'], 'default': False, 'action': 'store_true', 'help': 'disable the client options configuration window', },
                    {'args':['--disable-printingprefs'], 'default': False, 'action': 'store_true', 'help': 'disable the client\'s printing preferences window', },
@@ -359,7 +360,7 @@ def main():
         version()
 
     try:
-        thisPyHocaGUI = PyHocaGUI(args, logger, liblogger, version=VERSION)
+        thisPyHocaGUI = PyHocaGUI(args, logger, liblogger, appname=PROG_NAME, version=VERSION)
         thisPyHocaGUI.MainLoop()
     except KeyboardInterrupt:
         thisPyHocaGUI.WakeUpIdle()
diff --git a/pyhoca/wxgui/about.py b/pyhoca/wxgui/about.py
index eccd08f..72865b1 100644
--- a/pyhoca/wxgui/about.py
+++ b/pyhoca/wxgui/about.py
@@ -46,32 +46,53 @@ class PyHocaGUI_AboutFrame(wx.Frame):
     STILL UNDOCUMENTED
 
     """
-    def __init__(self, _PyHocaGUI, caller=None): 
+    def __init__(self, _PyHocaGUI, caller=None, about_image=None, icon_name='pyhoca-winicon.png'):
 
         self._PyHocaGUI = _PyHocaGUI
         self._pyhoca_logger = self._PyHocaGUI._pyhoca_logger
 
+        fallback_about_image = 'pyhoca-about-logo.png'
+
+        if about_image is None:
+            about_image = fallback_about_image
+
+        if os.path.basename(about_image) == about_image:
+            about_image = os.path.join(basepath.images_basepath, about_image)
+
+        if not (os.path.isfile(about_image) or os.path.islink(about_image)):
+            about_image = os.path.join(basepath.images_basepath, fallback_about_image)
+
         if x2go.X2GOCLIENT_OS == 'Windows':
-            wx.Frame.__init__(self, None, -1, _('About %s ...') % 'PyHoca-GUI', size=(403,319))
+            wx.Frame.__init__(self, None, -1, _(u'About %s ...') % self._PyHocaGUI.appname, size=(403,319))
         else:
-            wx.Frame.__init__(self, None, -1, _('About %s ...') % 'PyHoca-GUI', size=(400,298))
+            wx.Frame.__init__(self, None, -1, _(u'About %s ...') % self._PyHocaGUI.appname, size=(400,298))
         self.Bind(wx.EVT_CLOSE, self.OnHide)
 
-        panel = wx.Panel(self, -1, pos=(0,3))
-        panel.SetBackgroundColour("White")
+        panel = wx.Panel(self, -1, pos=(0,0), size=(0,0), )
         panel.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
         panel.SetFocus()
 
-        _logo_bitmap = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap(os.path.join(basepath.images_basepath, 'pyhoca-about-logo.png')), (0, 0))
+        about_wximage = wx.Image(about_image, wx.BITMAP_TYPE_PNG, )
+        about_wximage.Rescale(400, int(float(400)/about_wximage.Width*about_wximage.Height))
+        about_wxbitmap = about_wximage.ConvertToBitmap()
+
+        _logo_bitmap = wx.StaticBitmap(self, wx.ID_ANY, about_wxbitmap, (0, 0))
         self.bitmap = _logo_bitmap
 
-        if x2go.X2GOCLIENT_OS == 'Windows':
-            _icon = wx.Bitmap(os.path.join(basepath.icons_basepath, os.path.normpath('PyHoca/16x16/pyhoca-winicon.png')))
-        elif x2go.X2GOCLIENT_OS == 'Mac':
-            _icon = wx.Bitmap(os.path.join(basepath.icons_basepath, os.path.normpath('PyHoca/128x128/pyhoca-winicon.png')))
-        else:
-            _icon = wx.Bitmap(os.path.join(basepath.icons_basepath, os.path.normpath('PyHoca/22x22/pyhoca-winicon.png')))
-        self.icon = self.SetIcon(wx.IconFromBitmap(_icon))
+        if "wxMSW" in wx.PlatformInfo:
+            icon_size = '16x16'
+        elif "wxGTK" in wx.PlatformInfo:
+            icon_size = '22x22'
+        elif "wxMAC" in wx.PlatformInfo:
+            icon_size = '128x128'
+
+        icon_file = os.path.normpath('%s/PyHoca/%s/%s.png' % (basepath.icons_basepath, icon_size, icon_name))
+        if not (os.path.isfile(str(icon_file)) or os.path.islink(str(icon_file))):
+            icon_file = os.path.normpath('%s/PyHoca/%s/%s.png' % (basepath.icons_basepath, icon_size, 'pyhoca-winicon.png'))
+
+        img = wx.Image(icon_file)
+        icon = wx.IconFromBitmap(img.ConvertToBitmap())
+        self.icon = self.SetIcon(icon)
 
         self.CenterOnScreen()
 
diff --git a/pyhoca/wxgui/frontend.py b/pyhoca/wxgui/frontend.py
index 43518e2..a97f18a 100644
--- a/pyhoca/wxgui/frontend.py
+++ b/pyhoca/wxgui/frontend.py
@@ -100,6 +100,9 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
         STILL UNDOCUMENTED
 
         """
+        if appname == 'pyhoca-gui':
+            # capitalize the application's name
+            appname = 'PyHoca-GUI'
         self.appname = appname
         self.vendorname = vendorname
         self.version = version
@@ -242,7 +245,10 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
         self._pyhoca_logger('PyHoca GUI is starting up', loglevel=x2go.log.loglevel_INFO, )
         self._pyhoca_logger('registering PyHocaGUI control sessions', loglevel=x2go.log.loglevel_INFO, )
 
-        self.about = about.PyHocaGUI_AboutFrame(self)
+        if self.args.tray_icon:
+            self.about = about.PyHocaGUI_AboutFrame(self, about_image=self.args.about_image, icon_name=self.args.tray_icon)
+        else:
+            self.about = about.PyHocaGUI_AboutFrame(self, about_image=self.args.about_image)
         self.about.Show(False)
 
         self.taskbar = taskbar.PyHocaGUI_TaskBarIcon(self.about)


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