[X2Go-Commits] [pyhoca-gui] 01/01: Catch a wx._core.PyAssertionError (C++ assertion "IsOk()" failed at ../src/common/image.cpp(429) in Scale(): invalid image) when rendering icons in the published applications menu.

git-admin at x2go.org git-admin at x2go.org
Sat Jan 2 07:43:43 CET 2016


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository pyhoca-gui.

commit 63359b0c5dfee9adb101cff9e00f5db28c02cde7
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Sat Jan 2 07:43:38 2016 +0100

    Catch a wx._core.PyAssertionError (C++ assertion "IsOk()" failed at ../src/common/image.cpp(429) in Scale(): invalid image) when rendering icons in the published applications menu.
---
 debian/changelog              |    3 +++
 pyhoca/wxgui/menus_taskbar.py |   18 +++++++++++++-----
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 2e756a7..865d057 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,9 @@ pyhoca-gui (0.5.0.5-0x2go1) UNRELEASED; urgency=medium
 
   * New upstream version (0.5.0.5):
     - Handle notification the GTK3-way. (Fixes: #769).
+    - Catch a wx._core.PyAssertionError (C++ assertion "IsOk()" failed at
+      ../src/common/image.cpp(429) in Scale(): invalid image) when
+      rendering icons in the published applications menu.
   * debian/control,pyhoca-gui.specs:
     + Pull-in gobject introspection packages for libnotify support.
       Fallback to pynotify (GTK2 based notifcations) only if
diff --git a/pyhoca/wxgui/menus_taskbar.py b/pyhoca/wxgui/menus_taskbar.py
index b48593e..0b10c44 100644
--- a/pyhoca/wxgui/menus_taskbar.py
+++ b/pyhoca/wxgui/menus_taskbar.py
@@ -493,11 +493,19 @@ def _generate_Menu_PublishedApplications(_PyHocaGUI, caller=None, profile_name=N
                 else:
                     _menu_entry_icon_decoded = base64.b64decode(_item['icon'])
                     _icon_image = wx.ImageFromStream(StringIO.StringIO(_menu_entry_icon_decoded))
-                    if x2go.defaults.X2GOCLIENT_OS == 'Windows':
-                        _icon_bitmap = wx.BitmapFromImage(_icon_image.Scale(16,16))
-                    else:
-                        _icon_bitmap = wx.BitmapFromImage(_icon_image.Scale(22,22))
-                    _menu_item.SetBitmap(_icon_bitmap)
+                    _icon_bitmap = None
+                    try:
+                        if x2go.defaults.X2GOCLIENT_OS == 'Windows':
+                            _icon_bitmap = wx.BitmapFromImage(_icon_image.Scale(16,16))
+                        else:
+                            _icon_bitmap = wx.BitmapFromImage(_icon_image.Scale(22,22))
+                    except:
+                        # catch: wx._core.PyAssertionError: C++ assertion "IsOk()" failed at
+                        # ../src/common/image.cpp(429) in Scale(): invalid image
+                        continue
+
+                    if _icon_bitmap:
+                        _menu_item.SetBitmap(_icon_bitmap)
 
                 _wx_menu_map[_category_name_translator[cat][0]][0].AppendItem(_menu_item)
                 _PyHocaGUI.Bind(wx.EVT_MENU, _PyHocaGUI.OnPubAppExecution, id=_pubapp_id)

--
Alioth's /srv/git/code.x2go.org/pyhoca-gui.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/pyhoca-gui.git


More information about the x2go-commits mailing list