[X2Go-Commits] pyhoca-gui.git - master (branch) updated: 0.4.0.1-12-gaeb4143

X2Go dev team git-admin at x2go.org
Sun Apr 21 21:43:49 CEST 2013


The branch, master has been updated
       via  aeb4143ad02160bd081a02acb19335f6b71bd326 (commit)
      from  18e7c0a8a11ae17a1002fb36d83de8da7d54972b (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 aeb4143ad02160bd081a02acb19335f6b71bd326
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Sun Apr 21 21:43:46 2013 +0200

    make taskbar.MakeIcon a function

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

Summary of changes:
 pyhoca/wxgui/notify.py  |    4 +--
 pyhoca/wxgui/taskbar.py |   67 +++++++++++++++++++++++------------------------
 2 files changed, 35 insertions(+), 36 deletions(-)

The diff of changes is:
diff --git a/pyhoca/wxgui/notify.py b/pyhoca/wxgui/notify.py
index c155e77..62c5b7b 100644
--- a/pyhoca/wxgui/notify.py
+++ b/pyhoca/wxgui/notify.py
@@ -25,7 +25,7 @@ if X2GOCLIENT_OS in ('Linux', 'Mac'):
     import pynotify
 import exceptions
 import basepath
-from taskbar import PyHocaGUI_TaskBarIcon
+from taskbar import MakeIcon
 
 import x2go.utils as utils
 
@@ -277,7 +277,7 @@ class notificationmessage_NotifierPopup(object):
                 _notification_msg.SetMessage(text)
                 _notification_msg.SetParent(self._PyHocaGUI.about)
                 _notification_msg.SetFlags(icon)
-                notification_icon = PyHocaGUI_TaskBarIcon.MakeIcon('pyhoca-trayicon')
+                notification_icon = MakeIcon('pyhoca-trayicon')
                 _notification_msg.UseTaskBarIcon(notification_icon)
                 _notification_msg.Show(timeout=timeout)
         except:
diff --git a/pyhoca/wxgui/taskbar.py b/pyhoca/wxgui/taskbar.py
index 18391c7..2f00454 100644
--- a/pyhoca/wxgui/taskbar.py
+++ b/pyhoca/wxgui/taskbar.py
@@ -50,6 +50,35 @@ import basepath
 
 _icons_location = basepath.icons_basepath
 
+def MakeIcon(self, icon_name, fallback_name='pyhoca-trayicon'):
+    """\
+    The various platforms have different requirements for the
+    icon size...
+
+    @param icon_name: rel. file name of the icon image
+    @type icon_name: C{str}
+    @param fallback_name: a fallback icon file name in case C{icon_name} cannot be found
+    @type fallback_name: C{str}
+
+    """
+    if "wxMSW" in wx.PlatformInfo:
+        icon_size = '16x16'
+    elif "wxGTK" in wx.PlatformInfo:
+        icon_size = '22x22'
+    elif "wxMAC" in wx.PlatformInfo:
+        icon_size = '128x128'
+
+    if icon_name is None:
+        icon_name = fallback_name
+
+    icon_file = '%s/PyHoca/%s/%s.png' % (_icons_location, icon_size, icon_name)
+    if not (os.path.isfile(str(icon_file)) or os.path.islink(str(icon_file))):
+        icon_file = '%s/PyHoca/%s/%s.png' % (_icons_location, icon_size, fallback_name)
+
+    img = wx.Image(icon_file)
+    icon = wx.IconFromBitmap(img.ConvertToBitmap())
+    return icon
+
 
 class PyHocaGUI_TaskBarIcon(wx.TaskBarIcon):
     """\
@@ -85,11 +114,11 @@ class PyHocaGUI_TaskBarIcon(wx.TaskBarIcon):
         """
         if x2go.X2GOCLIENT_OS == 'Windows':
             icon_name = self._PyHocaGUI.tray_icon_connecting or self._PyHocaGUI.tray_icon
-            self.icon = self.MakeIcon(icon_name=icon_name, fallback_name='x2go-logo-ubuntu')
+            self.icon = MakeIcon(icon_name=icon_name, fallback_name='x2go-logo-ubuntu')
             self.SetIcon(self.icon, _(u"PyHoca-GUI\nConnecting you to ,,%s\'\'") % profile_name)
         else:
             icon_name = self._PyHocaGUI.tray_icon_connecting or self._PyHocaGUI.tray_icon
-            self.icon = self.MakeIcon(icon_name=icon_name, fallback_name='pyhoca-trayicon')
+            self.icon = MakeIcon(icon_name=icon_name, fallback_name='pyhoca-trayicon')
             self.SetIcon(self.icon, _(u"PyHoca-GUI (Python X2Go Client)\nCurrently connecting you to remote X2Go server ,,%s\'\'") % profile_name)
 
     def SetIconIdle(self):
@@ -99,11 +128,11 @@ class PyHocaGUI_TaskBarIcon(wx.TaskBarIcon):
         """
         if x2go.X2GOCLIENT_OS == 'Windows':
             icon_name = self._PyHocaGUI.tray_icon
-            self.icon = self.MakeIcon(icon_name=icon_name, fallback_name='x2go-logo-ubuntu')
+            self.icon = MakeIcon(icon_name=icon_name, fallback_name='x2go-logo-ubuntu')
             self.SetIcon(self.icon, _(u"PyHoca-GUI\nConnecting you to X2Go..."))
         else:
             icon_name = self._PyHocaGUI.tray_icon
-            self.icon = self.MakeIcon(icon_name=icon_name, fallback_name='pyhoca-trayicon')
+            self.icon = MakeIcon(icon_name=icon_name, fallback_name='pyhoca-trayicon')
             self.SetIcon(self.icon, _(u"PyHoca-GUI (Python X2Go Client)\nClient for connecting you to a remote X2Go server"))
 
     def CreateSessionManagerPopupMenu(self, evt):
@@ -148,36 +177,6 @@ class PyHocaGUI_TaskBarIcon(wx.TaskBarIcon):
         self.menu_optionsmanager = self.PopupMenu(menus_taskbar.PyHocaGUI_Menu_TaskbarOptionsManager(self._PyHocaGUI, caller=self,))
         return self.menu_optionsmanager
 
-    @classmethod
-    def MakeIcon(self, icon_name, fallback_name='pyhoca-trayicon'):
-        """\
-        The various platforms have different requirements for the
-        icon size...
-
-        @param icon_name: rel. file name of the icon image
-        @type icon_name: C{str}
-        @param fallback_name: a fallback icon file name in case C{icon_name} cannot be found
-        @type fallback_name: C{str}
-
-        """
-        if "wxMSW" in wx.PlatformInfo:
-            icon_size = '16x16'
-        elif "wxGTK" in wx.PlatformInfo:
-            icon_size = '22x22'
-        elif "wxMAC" in wx.PlatformInfo:
-            icon_size = '128x128'
-
-        if icon_name is None:
-            icon_name = fallback_name
-
-        icon_file = '%s/PyHoca/%s/%s.png' % (_icons_location, icon_size, icon_name)
-        if not (os.path.isfile(str(icon_file)) or os.path.islink(str(icon_file))):
-            icon_file = '%s/PyHoca/%s/%s.png' % (_icons_location, icon_size, fallback_name)
-
-        img = wx.Image(icon_file)
-        icon = wx.IconFromBitmap(img.ConvertToBitmap())
-        return icon
-
     def Close(self):
         """\
         Remove the applet icon from the system tray.


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