I just came across TaskCoach (http://members.chello.nl/f.niessink/) and thought I'd give it a try on a Mac.
It does put up a splash window and then stops with the following trace:
Traceback (most recent call last):
File "taskcoach.py", line 40, in ?
App()
File "taskcoach.py", line 12, in __init__
self.init()
File "taskcoach.py", line 25, in init
searchFilteredTaskList)
File "/Volumes/Users/eric/Desktop/Task Coach-0.14/gui/mainwindow.py", line 13, in __init__
self.createWindowComponents()
File "/Volumes/Users/eric/Desktop/Task Coach-0.14/gui/mainwindow.py", line 26, in createWindowComponents
uiCommands)
File "/Volumes/Users/eric/Desktop/Task Coach-0.14/gui/viewer.py", line 8, in __init__
self.widget = self.createWidget()
File "/Volumes/Users/eric/Desktop/Task Coach-0.14/gui/viewer.py", line 163, in createWidget
widget.AssignImageList(self.createImageList(), wx.IMAGE_LIST_SMALL)
File "/Volumes/Users/eric/Desktop/Task Coach-0.14/gui/viewer.py", line 33, in createImageList
imageList.Add(wx.ArtProvider_GetBitmap(image, wx.ART_MENU, (16,16)))
File "//Library/Python/2.3/wx/_gdi.py", line 4359, in Add
return _gdi_.ImageList_Add(*args, **kwargs)
wx._core.PyAssertionError: C++ assertion "bitmap.GetWidth() == m_width && bitmap.GetHeight() == m_height" failed in /tmp/BUILD/wxPythonSrc-2.5.2.8/src/generic/imaglist.cpp(74): invalid bitmap size in wxImageList: this might work on this platform but definitely won't under Windows.
From fiddling with it I already know that wx.ArtProvider_GetBitmap(image, wx.ART_MENU, (16,16)) returns an invalid Bitmap object, i.e. it does identify as a C++ Bitmpa proxy, but fails on GetHeight telling me it is invalid.
Any idea what goes wrong? The calls seem to match the docs.
It's possible it's an empty bitmap object, which would occur if the developer used Win32 specific paths (instead of os.path.join(...) ). I've been bit by that several times. I'd look at the code that loads the image from the file.
Nathan R. Yergler
Eric Nieuwland wrote:
···
Hi All,
I just came across TaskCoach (http://members.chello.nl/f.niessink/) and thought I'd give it a try on a Mac.
It does put up a splash window and then stops with the following trace:
Traceback (most recent call last):
File "taskcoach.py", line 40, in ?
App()
File "taskcoach.py", line 12, in __init__
self.init()
File "taskcoach.py", line 25, in init
searchFilteredTaskList)
File "/Volumes/Users/eric/Desktop/Task Coach-0.14/gui/mainwindow.py", line 13, in __init__
self.createWindowComponents()
File "/Volumes/Users/eric/Desktop/Task Coach-0.14/gui/mainwindow.py", line 26, in createWindowComponents
uiCommands)
File "/Volumes/Users/eric/Desktop/Task Coach-0.14/gui/viewer.py", line 8, in __init__
self.widget = self.createWidget()
File "/Volumes/Users/eric/Desktop/Task Coach-0.14/gui/viewer.py", line 163, in createWidget
widget.AssignImageList(self.createImageList(), wx.IMAGE_LIST_SMALL)
File "/Volumes/Users/eric/Desktop/Task Coach-0.14/gui/viewer.py", line 33, in createImageList
imageList.Add(wx.ArtProvider_GetBitmap(image, wx.ART_MENU, (16,16)))
File "//Library/Python/2.3/wx/_gdi.py", line 4359, in Add
return _gdi_.ImageList_Add(*args, **kwargs)
wx._core.PyAssertionError: C++ assertion "bitmap.GetWidth() == m_width && bitmap.GetHeight() == m_height" failed in /tmp/BUILD/wxPythonSrc-2.5.2.8/src/generic/imaglist.cpp(74): invalid bitmap size in wxImageList: this might work on this platform but definitely won't under Windows.
From fiddling with it I already know that wx.ArtProvider_GetBitmap(image, wx.ART_MENU, (16,16)) returns an invalid Bitmap object, i.e. it does identify as a C++ Bitmpa proxy, but fails on GetHeight telling me it is invalid.
Any idea what goes wrong? The calls seem to match the docs.
--eric
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
I looked into that and all seems well. It turns out the app uses Windows icon files (.ico), which are not supported on the mac.
Thanks for trying.
--eric
···
On 3-nov-04, at 15:20, Nathan R. Yergler wrote:
It's possible it's an empty bitmap object, which would occur if the developer used Win32 specific paths (instead of os.path.join(...) ). I've been bit by that several times. I'd look at the code that loads the image from the file.
Nathan R. Yergler
Eric Nieuwland wrote:
[...]
imageList.Add(wx.ArtProvider_GetBitmap(image, wx.ART_MENU, (16,16)))
File "//Library/Python/2.3/wx/_gdi.py", line 4359, in Add
return _gdi_.ImageList_Add(*args, **kwargs)
wx._core.PyAssertionError: C++ assertion "bitmap.GetWidth() == m_width && bitmap.GetHeight() == m_height" failed in /tmp/BUILD/wxPythonSrc-2.5.2.8/src/generic/imaglist.cpp(74): invalid bitmap size in wxImageList: this might work on this platform but definitely won't under Windows.
From fiddling with it I already know that wx.ArtProvider_GetBitmap(image, wx.ART_MENU, (16,16)) returns an invalid Bitmap object, i.e. it does identify as a C++ Bitmpa proxy, but fails on GetHeight telling me it is invalid.
Any idea what goes wrong? The calls seem to match the docs.
I looked into that and all seems well. It turns out the app uses Windows icon files (.ico), which are not supported on the mac.
[I am the author of Task Coach]
What would be the most portable way of using images be, i.e. what works everywhere? Pngs?
On a related note, I find it difficult to predict how the app behaves on other platforms than Windows XP which is my development platform. For example, I knew TaskBarIcon is not supported on some platforms, so I put in an explicit platform check to only create it when the platform is windows. However, what I forgot to do was to put the 'import wx.TaskBarIcon' inside that check, so it (version 0.14) still crashes on linux. What I would prefer very much over these checks is when wxPython would use the NullObject pattern. This means that wx.TaskBarIcon exists an all platform, but as a dummy object on the platforms that don't support it. It would still have the TaskBarIcon interface (i.e. you can set the bitmap, menu, etc.) but do nothing. That would make developing portable apps with wxpython much easier I think.
BTW, the same goes for MenuItem.SetMarginWidth() which only works on Windows. I think it should do nothing on other platforms instead of crashing.
What would be the most portable way of using images be, i.e. what works
everywhere? Pngs?
If you don't use transparencies on them, I think so. Even with
transparencies they work with wxPython 2.4, but I had troubles with them
on 2.5 + Win98 machines.
windows. However, what I forgot to do was to put the 'import
wx.TaskBarIcon' inside that check, so it (version 0.14) still crashes on
linux. What I would prefer very much over these checks is when wxPython
would use the NullObject pattern. This means that wx.TaskBarIcon exists
an all platform, but as a dummy object on the platforms that don't
support it. It would still have the TaskBarIcon interface (i.e. you can
set the bitmap, menu, etc.) but do nothing. That would make developing
portable apps with wxpython much easier I think.
Indeed, but then it would also make it VERY difficult to debug things
due to inexistent packages.
How does the app crash? With an ImportError exception (this is what I
get here, Linux + Python 2.3.4 + wxPython 2.4.2.4...)?
BTW, the same goes for MenuItem.SetMarginWidth() which only works on
Windows. I think it should do nothing on other platforms instead of
crashing.
What do you think?
I'd rather have everything that doesn't exist to throw an exception and
handle it. There are times -- actually almost often -- when I want to
abort the application if some modules aren't available.
You can provide wrappers with 'noops' for the platforms where non
crucial features aren't supported.
On a related note, I find it difficult to predict how the app behaves on other platforms than Windows XP which is my development platform. For example, I knew TaskBarIcon is not supported on some platforms, so I put in an explicit platform check to only create it when the platform is windows. However, what I forgot to do was to put the 'import wx.TaskBarIcon' inside that check, so it (version 0.14) still crashes on linux. What I would prefer very much over these checks is when wxPython would use the NullObject pattern. This means that wx.TaskBarIcon exists an all platform, but as a dummy object on the platforms that don't support it. It would still have the TaskBarIcon interface (i.e. you can set the bitmap, menu, etc.) but do nothing. That would make developing portable apps with wxpython much easier I think.
Things in 2.5 are moving in that direction, but in most cases they are raising a NotImplemented exception rather than just silently failing.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!