Discussion:
[Bitpim-devel] bitpim (CVS) and wxPython 2.5.x (CVS) do not get along...
Steven Palm
2003-12-03 16:19:35 UTC
Permalink
A thousand curses on me for not using the mail-list before I filed this
as a bug, but I have no time machine so apologies will have to do.

Here is my issue:

Maybe this something nobody has interest in, but I am using wxWindows
for other programs on MacOSX and I required the latest CVS version
(2.5.x) to make them work.

So, in trying to get bitpim to work with that version of
wxWindows/wxPython I am running into a few problems, and it all appears
to be based on this note from the migration notes file in wxPython:

"The import-startup-bootstrap process employed by wxPython was changed
such that wxWindows and the underlying gui toolkit are not initialized
until the wx.App object is created (but before wx.App.OnInit is
called.) This was required because of some changes that were made to
the C++ wxApp class.

There are both benefits and potential problems with this change. The
benefits are that you can import wxPython without requiring access to a
GUI (for checking version numbers, etc.) and that in a multi-threaded
environment the thread that creates the app object will now be the GUI
thread instead of the one that imports wxPython. Some potential
problems are that the C++ side of the "stock-objects" (wx.BLUE_PEN,
wx.TheColourDatabase, etc.) are not initialized until the wx.App object
is created, so you should not use them until after you have created
your wx.App object. (In fact, until I find a better solution trying to
use one of the stock objects before the app is created will probably
result in a crash.)

Also, you will probably not be able to do any kind of GUI or bitmap
operation unless you first have created an app object, (even on Windows
where most anything was possible before.)"

Indeed, this is the case, becuase the calendarcontrol.py module is
causing a segfault when it is imported due to the following:

class CalendarCellAttributes:
def __init__(self):
# Set some defaults

self.cellbackground=wxTheBrushList.FindOrCreateBrush(wx
Colour(230,255,255), wxSOLID)
.
.
.

This happens even when trying to run the calendarcontrol.py module
standalone. However, when running standalone, if you create the wxApp
instance at the top of the module, it doesn't crash which is in line
with the notes posted above.

I am just learning Python, and don't know enough yet to find a
workaround for this issue. Is there any interest in making this forward
compatible with the upcoming 2.5.x release of wxPython?? It shouldn't
affect it's ability to run with 2.4.x at all.

Thanks!

-. ----. -.-- - -.--
Steve Palm - ***@n9yty.com
-. ----. -.-- - -.--
Steven Palm
2003-12-03 21:21:58 UTC
Permalink
Post by Steven Palm
I am just learning Python, and don't know enough yet to find a
workaround for this issue. Is there any interest in making this
forward compatible with the upcoming 2.5.x release of wxPython?? It
shouldn't affect it's ability to run with 2.4.x at all.
I've surprised myself and managed to plod along enough to figure it out.

Here are my changes (so far!) to get it working. By removing the pubsub
stuff, I can get basic functionality to work with these changes. I
don't have a phone yet, so I cannot test serial communications and the
like, but the program itself seems to operate now with wxPython 2.5.1
fromCVS.

These are cryptic notes, I admit, but hopefully enough to go by....

Global in all .py files:
DrawText( becomes DrawTextXY(
DrawBitmap( becomes DrawBitmapXY(
DrawRotatedText( becomes DrawRotatedTextXY(
DrawLine(x1, y1, x2, y2) becomes DrawLine((x1, y1), (x2, y2))

pubsub.py:
from wx.lib.pubsub import Publication

calendarcontrol.py:
Class Calendar(wxPanel):
.
.
.
def initvars(self):
Calendar.attrevenmonth=CalendarCellAttributes()
Calendar.attroddmonth=CalendarCellAttributes()

Calendar.attroddmonth.cellbackground=wxTheBrushList.FindOrCreateBrush(
wxColour(255, 255, 230), wxSOLID)
Calendar.attrselectedcell=CalendarCellAttributes()


Calendar.attrselectedcell.cellbackground=wxTheBrushList.FindOrCreateBrus
h( wxColour(240,240,240), wxSOLID)
Calendar.attrselectedcell.labelfont=wxFont(17, wxSWISS, wxNORMAL,
wxBOLD )
Calendar.attrselectedcell.labelforeground=wxNamedColour("BLACK")

gui.py:
+ import sys
#import wxPython.help
# import wxPython.gizmosc as gizmosc

- from wxPython.htmlhelp import wxHtmlHelpController
+ from wxPython.html import wxHtmlHelpController

dc.DrawText( becomes dc.DrawTextXY

phonebook.py / phonebookeditor.py:
remove pubsub references for now

I have to look into the pubsub stuff....

-. ----. -.-- - -.--
Steve Palm - ***@n9yty.com
-. ----. -.-- - -.--
Steven Palm
2003-12-03 21:33:06 UTC
Permalink
Post by Steven Palm
.
.
.
Calendar.attrevenmonth=CalendarCellAttributes()
Calendar.attroddmonth=CalendarCellAttributes()
Calendar.attroddmonth.cellbackground=wxTheBrushList.FindOrCreateBrush(
wxColour(255, 255, 230), wxSOLID)
Calendar.attrselectedcell=CalendarCellAttributes()
Calendar.attrselectedcell.cellbackground=wxTheBrushList.FindOrCreateBru
sh( wxColour(240,240,240), wxSOLID)
Calendar.attrselectedcell.labelfont=wxFont(17, wxSWISS, wxNORMAL,
wxBOLD )
Calendar.attrselectedcell.labelforeground=wxNamedColour("BLACK")
Oh yeah! And also add:

in def __init__(self):
self.initvars()

I also had to change two wxTextAttr(font=f) to wxTextAttr(wxBLACK,
wxNullColour, f) in guiwidgets.py because it wasn't recognizing font=
as a valid parameter label.

-. ----. -.-- - -.--
Steve Palm - ***@n9yty.com
-. ----. -.-- - -.--
Roger Binns
2003-12-03 22:04:39 UTC
Permalink
Post by Steven Palm
Is there any interest in making this
forward compatible with the upcoming 2.5.x release of wxPython??
There haven't been any releases of 2.5 yet (not even betas) so
I haven't been touching it (yet). Once 2.5 is available I
do want to move to it quickly.
Post by Steven Palm
It shouldn't affect it's ability to run with 2.4.x at all.
Sadly that isn't true.
Post by Steven Palm
DrawText( becomes DrawTextXY(
DrawBitmap( becomes DrawBitmapXY(
DrawRotatedText( becomes DrawRotatedTextXY(
DrawLine(x1, y1, x2, y2) becomes DrawLine((x1, y1), (x2, y2))
The XY methods are not present in 2.4 so there would have to
be conditional code depending on the wx version. I am definitely
not going to put that in while developers would still have to
compile their own copy of wxPython.
Post by Steven Palm
from wx.lib.pubsub import Publication
It looks like pubsub is being changed somewhat drastically.
Post by Steven Palm
Calendar.attrevenmonth=CalendarCellAttributes()
Calendar.attroddmonth=CalendarCellAttributes()
I can see the wx issues with having those as class variables and
will put in a fix.
Post by Steven Palm
remove pubsub references for now
pubsub is needed for things to work correctly. The program
will appear to run without it, but the category list will
end up being blank and being saved out that way. I am
also about to use it for maintaining the lists of wallpaper
and ringtones.

Roger
Steven Palm
2003-12-04 01:07:53 UTC
Permalink
Post by Roger Binns
Post by Steven Palm
It shouldn't affect it's ability to run with 2.4.x at all.
Sadly that isn't true.
I meant more in line with the issue of using wx functions before the
wxApp is initialized. That part should be compatible across versions of
wx. What I wasn't sure of when I wrote/thought that was how much extra
changes would be required.
Post by Roger Binns
Post by Steven Palm
DrawText( becomes DrawTextXY(
DrawBitmap( becomes DrawBitmapXY(
DrawRotatedText( becomes DrawRotatedTextXY(
DrawLine(x1, y1, x2, y2) becomes DrawLine((x1, y1), (x2, y2))
The XY methods are not present in 2.4 so there would have to
be conditional code depending on the wx version. I am definitely
not going to put that in while developers would still have to
compile their own copy of wxPython.
I understand that, but is conditional code that difficult in Python?
I ask not to be a wise guy, but I really don't know. I just started
working with Python last night when trying to get this thing running on
my system.
Post by Roger Binns
Post by Steven Palm
from wx.lib.pubsub import Publication
It looks like pubsub is being changed somewhat drastically.
I dunno, I never used the old version.
Post by Roger Binns
Post by Steven Palm
Calendar.attrevenmonth=CalendarCellAttributes()
Calendar.attroddmonth=CalendarCellAttributes()
I can see the wx issues with having those as class variables and
will put in a fix.
Thanks.
Post by Roger Binns
Post by Steven Palm
remove pubsub references for now
pubsub is needed for things to work correctly. The program
will appear to run without it, but the category list will
end up being blank and being saved out that way. I am
also about to use it for maintaining the lists of wallpaper
and ringtones.
Understandable. I assume they are something like the NSNotification
objects in MacOS X. Very nice stuff, I use them all the time.

Anyway, here is the error dump I get:

An unexpected exception has occurred.
Please see the help for details on what to do.

Traceback (most recent call last):
File "/Users/n9yty/my_cvs/bitpim/bitpim/gui.py", line 239, in OnClose
self.goforit()
File "/Users/n9yty/my_cvs/bitpim/bitpim/gui.py", line 236, in goforit
self.app.makemainwindow()
File "/Users/n9yty/my_cvs/bitpim/bitpim/gui.py", line 315, in
makemainwindow
frame=MainWindow(None, -1, "BitPim", self.config)
File "/Users/n9yty/my_cvs/bitpim/bitpim/gui.py", line 524, in __init__
self.OnPopulateEverythingFromDisk()
File "/Users/n9yty/my_cvs/bitpim/bitpim/gui.py", line 792, in
OnPopulateEverythingFromDisk
self.phonewidget.populate(results)
File "/Users/n9yty/my_cvs/bitpim/bitpim/phonebook.py", line 542, in
populate
pubsub.publish(pubsub.MERGE_CATEGORIES, dict.get('groups', []))
File "/Users/n9yty/my_cvs/bitpim/bitpim/pubsub.py", line 72, in
publish
Publisher.sendMessage(topic, data)
File
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/site-packages/wx/lib/pubsub.py", line 141, in sendMessage
subscriber[2](message)
File
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/site-packages/wx/lib/pubsub.py", line 169, in <lambda>
return lambda m, f=function: f(m)
File "/Users/n9yty/my_cvs/bitpim/bitpim/pubsub.py", line 57, in call
return self.__call__(argument)
File "/Users/n9yty/my_cvs/bitpim/bitpim/pubsub.py", line 51, in
__call__
return getattr(obj, self.methodname)(*args, **kwargs)
File "/Users/n9yty/my_cvs/bitpim/bitpim/phonebook.py", line 312, in
OnMergeCategories
cats=msg.data[:]
TypeError: unhashable type

Variables by last 6 frames, innermost last

Frame publish in /Users/n9yty/my_cvs/bitpim/bitpim/pubsub.py at line 72
topic = ('request', 'mergecategories')
data = {}

Frame sendMessage in
/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/
site-packages/wx/lib/pubsub.py at line 141
topic = ('request', 'mergecategories')
self = <wx.lib.pubsub.Publisher instance at 0x50e22d8>
aTopic = <Topic>'request', 'mergecategories'</Topic>
subscriber = (<bound method _weaklistener.call of
<pubsub._weaklistener i
topicList = [(<bound method _weaklistener.call of
<pubsub._weaklistener
message = <wx.lib.pubsub.Message instance at 0x891e8f0>
data = {}

Frame <lambda> in
/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/
site-packages/wx/lib/pubsub.py at line 169
m = <wx.lib.pubsub.Message instance at 0x891e8f0>
f = <bound method _weaklistener.call of
<pubsub._weaklistener in

Frame call in /Users/n9yty/my_cvs/bitpim/bitpim/pubsub.py at line 57
self = <pubsub._weaklistener instance at 0x50eb5d0>
argument = <wx.lib.pubsub.Message instance at 0x891e8f0>

Frame __call__ in /Users/n9yty/my_cvs/bitpim/bitpim/pubsub.py at line 51
self = <pubsub._weaklistener instance at 0x50eb5d0>
args = (<wx.lib.pubsub.Message instance at 0x891e8f0>,)
obj = <phonebook.CategoryManager instance at 0x50b3ad0>
kwargs = {}

Frame OnMergeCategories in
/Users/n9yty/my_cvs/bitpim/bitpim/phonebook.py at line 312
msg = <wx.lib.pubsub.Message instance at 0x891e8f0>
self = <phonebook.CategoryManager instance at 0x50b3ad0>


-. ----. -.-- - -.--
Steve Palm - ***@n9yty.com
-. ----. -.-- - -.--
Roger Binns
2003-12-04 08:18:57 UTC
Permalink
Post by Steven Palm
I understand that, but is conditional code that difficult in Python?
Not really but given two different wxPython versions on 3 plarforms
it becomes a pain.
Post by Steven Palm
Post by Roger Binns
Post by Steven Palm
from wx.lib.pubsub import Publication
It looks like pubsub is being changed somewhat drastically.
I dunno, I never used the old version.
The old version doesn't even have a Publication class/member whatever that is.
Post by Steven Palm
Post by Roger Binns
Post by Steven Palm
Calendar.attrevenmonth=CalendarCellAttributes()
Calendar.attroddmonth=CalendarCellAttributes()
That fix is commited.
Post by Steven Palm
Understandable. I assume they are something like the NSNotification
objects in MacOS X. Very nice stuff, I use them all the time.
If NSNotification is limited to the same process, then they are pretty
much identical.
Post by Steven Palm
File "/Users/n9yty/my_cvs/bitpim/bitpim/phonebook.py", line 312, in
OnMergeCategories
cats=msg.data[:]
TypeError: unhashable type
I think your code is a little behind. Do another CVS update. Note
that the anonymous repository is around 5 hours behind the real one.

I am not going to switch over to wxPython probably until 2.5.1
is release (the .0 versions always have issues). You are welcome
to maintain your own set of patches to work with 2.5 but I don't
think it is a particularly good use of your time, especially since
there haven't even been any beta releases yet.

Something that is desperately needed on the Mac is to package
everything up into a normal Mac package. The instructions at
http://videogamexchange.com/sites/lg4400/ aren't really acceptable.
On Windows you just run the setup.exe and on Linux you just
install the RPM. Neither has any external dependencies (Python,
wxPython and the other libraries are all bundled inside). I
would do this on the Mac myself except I don't have one and they
are way to expensive for me to acquire.

If you know how to build Mac packages, your assistance will be
greatly appreciated. I have collected some links on how to
do it, I just need someone to do it.

Roger
Steven Palm
2003-12-04 16:10:19 UTC
Permalink
Post by Roger Binns
Post by Steven Palm
Post by Roger Binns
Post by Steven Palm
from wx.lib.pubsub import Publication
It looks like pubsub is being changed somewhat drastically.
I dunno, I never used the old version.
The old version doesn't even have a Publication class/member whatever that is.
VERY Strange... I didn't change that bit of code except to make it
wx.lib.pubsub isntead of wxPython.lib.pubsub. It was importing
Publication in the code I had downloaded from CVS.

Anyway, this is irrelevant since we're not going to be concerned about
compatibility between versions at this time anyway. :-)
Post by Roger Binns
I am not going to switch over to wxPython probably until 2.5.1
is release (the .0 versions always have issues). You are welcome
to maintain your own set of patches to work with 2.5 but I don't
think it is a particularly good use of your time, especially since
there haven't even been any beta releases yet.
Well, it's a good use of my time if it allows me to use the project on
my system, which I cannot use otherwise. ;-) I had tried to install the
other versions of wxWindows/wxPython/etc and it didn't work, which is
why I started down this road to make a version that did. But you are
right, as far as the project itself goes, it is a waste of time because
any changes that have no chance (any time soon) of getting into the
development tree are indeed a waste of time to keep re-implementing.
But for me, it works.
Post by Roger Binns
Something that is desperately needed on the Mac is to package
everything up into a normal Mac package.
I will see what I can do. Theoretically, if everything is bundled
right, you may even be able to take a given package and just drop the
new .py modules into it to do an update. Maybe. I'm not sure. I'll get
back to you on it.

Thanks for all your great work, it *IS* much appreciated.

Steve

-. ----. -.-- - -.--
Steve Palm - ***@n9yty.com
-. ----. -.-- - -.--
Roger Binns
2003-12-04 21:27:08 UTC
Permalink
Post by Steven Palm
VERY Strange... I didn't change that bit of code except to make it
wx.lib.pubsub isntead of wxPython.lib.pubsub. It was importing
Publication in the code I had downloaded from CVS.
The word 'Publication' doesn't show up in any greps. It does
import Publisher.

I am very happy to change stuff from 'from wxPython.wx import*'
to 'import wx'. All the new code has been written that way and
I have been slowly changing over the old code.
Post by Steven Palm
Well, it's a good use of my time if it allows me to use the project on
my system, which I cannot use otherwise. ;-)
You seem to be saying that standard wxPython 2.4 doesn't work.
I was under the impression it does work fine on Macs. There
may be some glitches, but I will happily fix those. One
example is that multi-line text boxes on Windows default to
about 10 lines in length, whereas on Linux they defautl to zero.
There will be stuff like that and I will certainly fix it
if I know about it!

The preferred versions are Python 2.3(.x) and wxPython 2.4.2.4
on all platforms. (On Linux I actually ship with Python 2.2
but that is because it is what Redhat ships.)
Post by Steven Palm
I will see what I can do. Theoretically, if everything is bundled
right, you may even be able to take a given package and just drop the
new .py modules into it to do an update. Maybe. I'm not sure. I'll get
back to you on it.
The bundling isn't done that way. What happens is that a copy
of interpretter is taken, and all the .py files it imports
are compiled to .pyc/.pyo and placed in a zip and appended to
the Python exe. The Python exe is frigged to do an import
from the zip file. Any shared libraries are placed alongside
the Python executable and the import process suitably frigged
to find them. This makes everything standalone and independent
of anything the user may already have installed on their machine.
Here is what the Windows installation looks like:

09/09/2003 03:18 PM 437 bitpim.css
12/02/2003 02:47 PM 887,712 bitpim.exe
08/20/2003 01:26 PM 655 bitpim.exe.manifest
10/01/2003 12:40 PM 61,440 calendarc.pyd
10/02/2003 08:03 PM 45,116 datetime.pyd
10/01/2003 12:40 PM 286,720 gizmosc.pyd
10/01/2003 12:40 PM 299,008 gridc.pyd
10/01/2003 12:40 PM 36,864 helpc.pyd
10/01/2003 12:40 PM 196,608 htmlc.pyd
10/02/2003 08:03 PM 45,114 parser.pyd
10/02/2003 08:02 PM 974,908 python23.dll
09/02/2003 11:01 AM 86,084 PyWinTypes23.dll
12/02/2003 02:47 PM <DIR> resources
10/02/2003 08:04 PM 20,538 select.pyd
09/02/2003 11:01 AM 61,497 win32api.pyd
09/02/2003 11:01 AM 28,731 win32event.pyd
09/02/2003 11:01 AM 73,786 win32file.pyd
10/01/2003 12:40 PM 2,240,512 wxc.pyd
10/01/2003 10:43 AM 3,239,936 wxmsw24h.dll
10/02/2003 08:04 PM 61,496 zlib.pyd
10/02/2003 08:02 PM 49,211 _socket.pyd
10/02/2003 08:03 PM 57,400 _sre.pyd
10/02/2003 08:03 PM 495,616 _ssl.pyd
10/02/2003 08:04 PM 36,864 _winreg.pyd

This is what the Linux installation looks like:

-r-xr-xr-x 1 root root 21083 Aug 30 2002 binascii.so
-rw-r--r-- 1 root root 432 Sep 10 10:33 bitpim.css
-rwxr-xr-x 1 root root 3376339 Sep 10 10:33 bp
-r-xr-xr-x 1 root root 21857 Aug 30 2002 cStringIO.so
-r-xr-xr-x 1 root root 11875 Aug 30 2002 errnomodule.so
-r-xr-xr-x 1 root root 16192 Aug 30 2002 fcntlmodule.so
-rwxr-xr-x 1 root root 7041941 Jun 17 16:10 libwx_gtkd-2.4.so
-r-xr-xr-x 1 root root 16640 Aug 30 2002 _localemodule.so
-r-xr-xr-x 1 root root 16985 Aug 30 2002 mathmodule.so
-r-xr-xr-x 1 root root 20997 Aug 30 2002 operator.so
-rwxr-xr-x 1 root root 115593 Aug 30 2002 pcre.so
-r-xr-xr-x 1 root root 9656 Aug 30 2002 pwdmodule.so
-r-xr-xr-x 1 root root 22615 Aug 30 2002 readline.so
drwxr-xr-x 2 root root 4096 Sep 10 10:50 resources
-r-xr-xr-x 1 root root 17193 Aug 30 2002 selectmodule.so
-rwxr-xr-x 1 root root 67015 Aug 30 2002 strop.so
-r-xr-xr-x 1 root root 26886 Aug 30 2002 structmodule.so
-r-xr-xr-x 1 root root 20064 Aug 30 2002 termios.so
-r-xr-xr-x 1 root root 19939 Aug 30 2002 timemodule.so
-rwxr-xr-x 1 root root 241542 Sep 10 10:33 wxPython.calendarc.so
-rwxr-xr-x 1 root root 1443747 Sep 10 10:33 wxPython.gizmosc.so
-rwxr-xr-x 1 root root 820765 Sep 10 10:33 wxPython.gridc.so
-rwxr-xr-x 1 root root 174711 Sep 10 10:33 wxPython.helpc.so
-rwxr-xr-x 1 root root 608397 Sep 10 10:33 wxPython.htmlc.so
-rwxr-xr-x 1 root root 6277757 Sep 10 10:33 wxPython.wxc.so
-r-xr-xr-x 1 root root 21882 Aug 30 2002 zlibmodule.so

On Windows I use py2exe to build this. On Linux I use cxFreeze.
The cxFreeze author was trying to port it to Mac, but doesn't own
one himself and so was using the SourceForge Mac servers which
don't have very good availability.

For what to do on Macs, see this message:

http://mail.python.org/pipermail/pythonmac-sig/2003-November/009246.html

Roger
Steven Palm
2003-12-05 03:30:56 UTC
Permalink
Post by Roger Binns
Post by Steven Palm
VERY Strange... I didn't change that bit of code except to make it
wx.lib.pubsub isntead of wxPython.lib.pubsub. It was importing
Publication in the code I had downloaded from CVS.
The word 'Publication' doesn't show up in any greps. It does
import Publisher.
I must have made a typo when I composed the original email. Sorry for
the confusion. ;-)
Post by Roger Binns
Post by Steven Palm
Well, it's a good use of my time if it allows me to use the project on
my system, which I cannot use otherwise. ;-)
You seem to be saying that standard wxPython 2.4 doesn't work.
I was under the impression it does work fine on Macs. There
may be some glitches, but I will happily fix those. One
example is that multi-line text boxes on Windows default to
about 10 lines in length, whereas on Linux they defautl to zero.
There will be stuff like that and I will certainly fix it
if I know about it!
I installed all the packages/binaries as described on the MacOS X page
link on the bitpim page. It would not run. I don't know what
dependency/etc the problem was with, I just know that I am doing
development work (wxWindows on the Mac) that requires features only in
the 2.5.x tree, so that is why I'm down this road. I'm not implying
anything about the other versions, I haven't tested them extensively
nor did I spend time trying to ferret out the problems.

One last question, and if you think this is due to 2.5.x changes, I'll
punt...

Still errors when doing the pubsub stuff, updated to CVS file versions:

pubsub.py,v 1.3 2003/12/03 10:55:22 rogerb
phonebook.py,v 1.33 2003/12/04 04:27:39 rogerb
phonebookentryeditor.py,v 1.9 2003/12/03 10:54:56

I receive this error still: (again, I'm just learning Python, so I'm
having a hard time grokking some bits)

An unexpected exception has occurred.
Please see the help for details on what to do.

Traceback (most recent call last):
File "/Users/n9yty/my_cvs/bitpim/bitpim/gui.py", line 239, in OnClose
self.goforit()
File "/Users/n9yty/my_cvs/bitpim/bitpim/gui.py", line 236, in goforit
self.app.makemainwindow()
File "/Users/n9yty/my_cvs/bitpim/bitpim/gui.py", line 315, in
makemainwindow
frame=MainWindow(None, -1, "BitPim", self.config)
File "/Users/n9yty/my_cvs/bitpim/bitpim/gui.py", line 524, in __init__
self.OnPopulateEverythingFromDisk()
File "/Users/n9yty/my_cvs/bitpim/bitpim/gui.py", line 792, in
OnPopulateEverythingFromDisk
self.phonewidget.populate(results)
File "/Users/n9yty/my_cvs/bitpim/bitpim/phonebook.py", line 542, in
populate
pubsub.publish(pubsub.MERGE_CATEGORIES, dict.get('categories', []))
File "/Users/n9yty/my_cvs/bitpim/bitpim/pubsub.py", line 72, in
publish
Publisher.sendMessage(topic, data)
File
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/site-packages/wx/lib/pubsub.py", line 141, in sendMessage
subscriber[2](message)
File
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/site-packages/wx/lib/pubsub.py", line 169, in <lambda>
return lambda m, f=function: f(m)
File "/Users/n9yty/my_cvs/bitpim/bitpim/pubsub.py", line 57, in call
return self.__call__(argument)
File "/Users/n9yty/my_cvs/bitpim/bitpim/pubsub.py", line 51, in
__call__
return getattr(obj, self.methodname)(*args, **kwargs)
File "/Users/n9yty/my_cvs/bitpim/bitpim/phonebook.py", line 312, in
OnMergeCategories
cats=msg.data[:]
TypeError: unhashable type

Variables by last 6 frames, innermost last

Frame publish in /Users/n9yty/my_cvs/bitpim/bitpim/pubsub.py at line 72
topic = ('request', 'mergecategories')
data = {}

Frame sendMessage in
/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/
site-packages/wx/lib/pubsub.py at line 141
topic = ('request', 'mergecategories')
self = <wx.lib.pubsub.Publisher instance at 0x50e3328>
aTopic = <Topic>'request', 'mergecategories'</Topic>
subscriber = (<bound method _weaklistener.call of
<pubsub._weaklistener i
topicList = [(<bound method _weaklistener.call of
<pubsub._weaklistener
message = <wx.lib.pubsub.Message instance at 0x8918918>
data = {}

Frame <lambda> in
/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/
site-packages/wx/lib/pubsub.py at line 169
m = <wx.lib.pubsub.Message instance at 0x8918918>
f = <bound method _weaklistener.call of
<pubsub._weaklistener in

Frame call in /Users/n9yty/my_cvs/bitpim/bitpim/pubsub.py at line 57
self = <pubsub._weaklistener instance at 0x50e9620>
argument = <wx.lib.pubsub.Message instance at 0x8918918>

Frame __call__ in /Users/n9yty/my_cvs/bitpim/bitpim/pubsub.py at line 51
self = <pubsub._weaklistener instance at 0x50e9620>
args = (<wx.lib.pubsub.Message instance at 0x8918918>,)
obj = <phonebook.CategoryManager instance at 0x50b3b70>
kwargs = {}

Frame OnMergeCategories in
/Users/n9yty/my_cvs/bitpim/bitpim/phonebook.py at line 312
msg = <wx.lib.pubsub.Message instance at 0x8918918>
self = <phonebook.CategoryManager instance at 0x50b3b70>


It seems to hinge on this part:

File "/Users/n9yty/my_cvs/bitpim/bitpim/phonebook.py", line 312, in
OnMergeCategories
cats=msg.data[:]
TypeError: unhashable type
Roger Binns
2003-12-05 04:27:45 UTC
Permalink
Post by Steven Palm
I installed all the packages/binaries as described on the MacOS X page
link on the bitpim page.
You will need to follow the developer page as that stuff is out of
date for BitPim 0.7:

http://bitpim.sourceforge.net/developer.html
Post by Steven Palm
File "/Users/n9yty/my_cvs/bitpim/bitpim/phonebook.py", line 312, in
OnMergeCategories
cats=msg.data[:]
TypeError: unhashable type
Delete the index.idx file from ~/.bitpim-files/phonebook. I changed the
format amongst other things.

Roger
Steven Palm
2003-12-05 15:03:49 UTC
Permalink
Post by Roger Binns
Post by Steven Palm
File "/Users/n9yty/my_cvs/bitpim/bitpim/phonebook.py", line 312, in
OnMergeCategories
cats=msg.data[:]
TypeError: unhashable type
Delete the index.idx file from ~/.bitpim-files/phonebook. I changed the
format amongst other things.
It does the same thing when run with a clean ~/.bitpim-files directory.

-. ----. -.-- - -.--
Steve Palm - ***@n9yty.com
-. ----. -.-- - -.--
Steven Palm
2003-12-05 03:47:43 UTC
Permalink
Post by Roger Binns
You seem to be saying that standard wxPython 2.4 doesn't work.
I was under the impression it does work fine on Macs. There
may be some glitches, but I will happily fix those. One
example is that multi-line text boxes on Windows default to
about 10 lines in length, whereas on Linux they defautl to zero.
There will be stuff like that and I will certainly fix it
if I know about it!
Here is the relevant section of the crashlog when, under Panther
(MacOS X 10.3.1) I install the wxPython 2.4.2 kit from the wxPython.org
web page and the MacPython stuff for Panther.

Date/Time: 2003-12-04 21:42:29 -0600
OS Version: 10.3.1 (Build 7C107)

Command: Python
(/System/Library/Frameworks/Python.framework/Versions/2.3/Resources/
Python.app/Contents/MacOS/Python)
PID: 1127
Thread: 0

Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_INVALID_ADDRESS (0x0001) at 0xfffffff8

Thread 0 Crashed:
#0 0x03019ed0 in wxChoice::GetString(int) const
(wxChoice::GetString(int) const + 36)
#1 0x0301bf88 in wxComboBox::GetValue() const
(wxComboBox::GetValue() const + 112)
#2 0x01370fd4 in _wrap_wxComboBox_GetValue
(_wrap_wxComboBox_GetValue + 220)
#3 0x95f4a8d0 in 0x95f4a8d0
#4 0x95fa9df0 in 0x95fa9df0
#5 0x95fa6d44 in 0x95fa6d44
#6 0x95fa7e30 in 0x95fa7e30
#7 0x95fa97dc in 0x95fa97dc
#8 0x95fa9580 in 0x95fa9580
#9 0x95fa6c64 in 0x95fa6c64
#10 0x95fa9728 in 0x95fa9728
#11 0x95fa9580 in 0x95fa9580
#12 0x95fa6c64 in 0x95fa6c64
#13 0x95fa7e30 in 0x95fa7e30
#14 0x95f5f354 in 0x95f5f354
#15 0x95f4a8d0 in 0x95f4a8d0
#16 0x95f529e8 in 0x95f529e8
#17 0x95f4a8d0 in 0x95f4a8d0
#18 0x95fa91ec in 0x95fa91ec
#19 0x95f4de40 in 0x95f4de40
#20 0x95f4a8d0 in 0x95f4a8d0
#21 0x95fa9ba8 in 0x95fa9ba8
#22 0x95fa9598 in 0x95fa9598
#23 0x95fa6c64 in 0x95fa6c64
#24 0x95fa7e30 in 0x95fa7e30
#25 0x95f5f354 in 0x95f5f354
#26 0x95f4a8d0 in 0x95f4a8d0
#27 0x95f529e8 in 0x95f529e8
#28 0x95f4a8d0 in 0x95f4a8d0
#29 0x95fa91ec in 0x95fa91ec
#30 0x95f4de40 in 0x95f4de40
#31 0x95f4a8d0 in 0x95f4a8d0
#32 0x95fa9ba8 in 0x95fa9ba8
#33 0x95fa9598 in 0x95fa9598
#34 0x95fa6c64 in 0x95fa6c64
#35 0x95fa9728 in 0x95fa9728
#36 0x95fa9580 in 0x95fa9580
#37 0x95fa6c64 in 0x95fa6c64
#38 0x95fa9728 in 0x95fa9728
#39 0x95fa9580 in 0x95fa9580
#40 0x95fa6c64 in 0x95fa6c64
#41 0x95fa7e30 in 0x95fa7e30
#42 0x95f5f354 in 0x95f5f354
#43 0x95f4a8d0 in 0x95f4a8d0
#44 0x95f529e8 in 0x95f529e8
#45 0x95f4a8d0 in 0x95f4a8d0
#46 0x95fa91ec in 0x95fa91ec
#47 0x012daab4 in wxPyCallback::EventThunker(wxEvent&)
(wxPyCallback::EventThunker(wxEvent&) + 224)
#48 0x03082680 in wxEvtHandler::SearchDynamicEventTable(wxEvent&)
(wxEvtHandler::SearchDynamicEventTable(wxEvent&) + 208)
#49 0x0308208c in wxEvtHandler::ProcessEvent(wxEvent&)
(wxEvtHandler::ProcessEvent(wxEvent&) + 124)
#50 0x030fb9c8 in wxWindowBase::Close(bool)
(wxWindowBase::Close(bool) + 132)
#51 0x03082328 in wxEvtHandler::SearchEventTable(wxEventTable&,
wxEvent&) (wxEvtHandler::SearchEventTable(wxEventTable&, wxEvent&) +
232)
#52 0x03082128 in wxEvtHandler::ProcessEvent(wxEvent&)
(wxEvtHandler::ProcessEvent(wxEvent&) + 280)
#53 0x030e929c in wxTimerBase::Notify() (wxTimerBase::Notify() + 132)
#54 0x0304dc94 in wxProcessTimer(unsigned long, void*)
(wxProcessTimer(unsigned long, void*) + 104)
#55 0x0303673c in wxMacProcessNotifierEvents
(wxMacProcessNotifierEvents + 192)
#56 0x03036784 in wxMacProcessNotifierAndPendingEvents
(wxMacProcessNotifierAndPendingEvents + 28)
#57 0x030117d0 in wxApp::OnIdle(wxIdleEvent&)
(wxApp::OnIdle(wxIdleEvent&) + 132)
#58 0x03082328 in wxEvtHandler::SearchEventTable(wxEventTable&,
wxEvent&) (wxEvtHandler::SearchEventTable(wxEventTable&, wxEvent&) +
232)
#59 0x03082128 in wxEvtHandler::ProcessEvent(wxEvent&)
(wxEvtHandler::ProcessEvent(wxEvent&) + 280)
#60 0x030116ac in wxApp::ProcessIdle() (wxApp::ProcessIdle() + 108)
#61 0x03011e3c in wxApp::MacDoOneEvent() (wxApp::MacDoOneEvent() +
160)
#62 0x0301161c in wxApp::MainLoop() (wxApp::MainLoop() + 148)
#63 0x012d8288 in wxPyApp::MainLoop() (wxPyApp::MainLoop() + 84)
#64 0x012e1610 in _wrap_wxPyApp_MainLoop (_wrap_wxPyApp_MainLoop +
208)
#65 0x95f4a8d0 in 0x95f4a8d0
#66 0x95fa9df0 in 0x95fa9df0
#67 0x95fa6d44 in 0x95fa6d44
#68 0x95fa7e30 in 0x95fa7e30
#69 0x95f5f354 in 0x95f5f354
#70 0x95f4a8d0 in 0x95f4a8d0
#71 0x95f529e8 in 0x95f529e8
#72 0x95f4a8d0 in 0x95f4a8d0
#73 0x95fa9ba8 in 0x95fa9ba8
#74 0x95fa9598 in 0x95fa9598
#75 0x95fa6c64 in 0x95fa6c64
#76 0x95fa9728 in 0x95fa9728
#77 0x95fa9580 in 0x95fa9580
#78 0x95fa6c64 in 0x95fa6c64
#79 0x95fa7e30 in 0x95fa7e30
#80 0x95fa97dc in 0x95fa97dc
#81 0x95fa9580 in 0x95fa9580
#82 0x95fa6c64 in 0x95fa6c64
#83 0x95fa7e30 in 0x95fa7e30
#84 0x95fa4734 in 0x95fa4734
#85 0x95fc85f0 in 0x95fc85f0
#86 0x95fc7668 in 0x95fc7668
#87 0x95fd1ec0 in 0x95fd1ec0
#88 0x00003c78 in 0x3c78
#89 0x00003aec in 0x3aec
Post by Roger Binns
The preferred versions are Python 2.3(.x) and wxPython 2.4.2.4
on all platforms. (On Linux I actually ship with Python 2.2
but that is because it is what Redhat ships.)
This would be Python 2.3, wxPython 2.4.2.4.

So, this seems to indicate that this combination (at least in regard
to my local install/reinstall) does not work on a Macintosh.

-. ----. -.-- - -.--
Steve Palm - ***@n9yty.com
-. ----. -.-- - -.--
Roger Binns
2003-12-05 04:33:36 UTC
Permalink
Post by Steven Palm
#0 0x03019ed0 in wxChoice::GetString(int) const
(wxChoice::GetString(int) const + 36)
I had a similar problem using wxPython 2.4.2.4 on Linux
with GTK2 in Unicode mode. Does the wxPython demo
run for you?

You might want to start with this stuff:

http://wiki.wxpython.org/index.cgi/wxPythonOSX_20Issues

ComboBox isn't listed as having any issues.

What was the exact sequence of actions to cause the crash?

Roger
Steven Palm
2003-12-05 15:09:36 UTC
Permalink
Post by Roger Binns
Post by Steven Palm
#0 0x03019ed0 in wxChoice::GetString(int) const
(wxChoice::GetString(int) const + 36)
I had a similar problem using wxPython 2.4.2.4 on Linux
with GTK2 in Unicode mode. Does the wxPython demo
run for you?
Yes, it does. I haven't stepped through every test, but it comes up
and a few randomly picked tests do run fine.
Post by Roger Binns
http://wiki.wxpython.org/index.cgi/wxPythonOSX_20Issues
ComboBox isn't listed as having any issues.
What was the exact sequence of actions to cause the crash?
I ran `pythonw bp.py` and it crashed after the splash screen came up
but before the main window was put on screen.

-. ----. -.-- - -.--
Steve Palm - ***@n9yty.com
-. ----. -.-- - -.--
Steven Palm
2003-12-05 21:41:35 UTC
Permalink
Post by Roger Binns
Post by Steven Palm
#0 0x03019ed0 in wxChoice::GetString(int) const
(wxChoice::GetString(int) const + 36)
What was the exact sequence of actions to cause the crash?
Sorry, Roger... I'm just getting used to Python stuff. I just found
the debugger. ;-)

It's crashing in this section of guiwidgets.py:

def setdefaults(self):
if self.diskbox.GetValue()==self.setme:
if guihelper.IsMSWindows(): # we want subdir of my
documents on wind
ows
# nice and painful
import _winreg
x=_winreg.ConnectRegistry(None,
_winreg.HKEY_CURRENT_USER)
y=_winreg.OpenKey(x,
r"Software\Microsoft\Windows\CurrentVer
sion\Explorer\Shell Folders")
str=_winreg.QueryValueEx(y, "Personal")[0]
_winreg.CloseKey(y)
_winreg.CloseKey(x)
path=os.path.join(str, "bitpim")
else:
path=os.path.expanduser("~/.bitpim-files")
self.diskbox.SetValue(path)
if self.commbox.GetValue()==self.setme:
comm="auto"
self.commbox.SetValue(comm)
print "pb=",self.phonebox.GetValue()
if self.phonebox.GetValue()=="":
self.phonebox.SetValue("LG-VX4400")


It segfaults with the above crash when it tries to execute the
following line:

print "pb=",self.phonebox.GetValue()

If I comment out (just for testing) that and the two lines following
it (so that self.phonebox.GetValue() is never called at this point) it
gets past that point....

And I get the same crash with the same pubsub issue I was having with
2.5.1. Again, this is all on a CLEAN install, there is NOTHING in my
~/.bitpim-files directory. Can you verify that something hasn't changed
when run in the first-run config?

Thanks!

Just for reference, here is the pubsub crash this time around:

An unexpected exception has occurred.
Please see the help for details on what to do.

Traceback (most recent call last):
File "/Users/n9yty/my_cvs/bitpim/bitpim/gui.py", line 237, in OnClose
self.goforit()
File "/Users/n9yty/my_cvs/bitpim/bitpim/gui.py", line 234, in goforit
self.app.makemainwindow()
File "/Users/n9yty/my_cvs/bitpim/bitpim/gui.py", line 312, in
makemainwindow
frame=MainWindow(None, -1, "BitPim", self.config)
File "/Users/n9yty/my_cvs/bitpim/bitpim/gui.py", line 521, in __init__
self.OnPopulateEverythingFromDisk()
File "/Users/n9yty/my_cvs/bitpim/bitpim/gui.py", line 789, in
OnPopulateEverythingFromDisk
self.phonewidget.populate(results)
File "/Users/n9yty/my_cvs/bitpim/bitpim/phonebook.py", line 542, in
populate
pubsub.publish(pubsub.MERGE_CATEGORIES, dict.get('categories', []))
File "/Users/n9yty/my_cvs/bitpim/bitpim/pubsub.py", line 72, in
publish
Publisher.sendMessage(topic, data)
File
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/site-packages/wxPython/lib/pubsub.py", line 141, in
sendMessage
subscriber[2](message)
File
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/site-packages/wxPython/lib/pubsub.py", line 169, in <lambda>
return lambda m, f=function: f(m)
File "/Users/n9yty/my_cvs/bitpim/bitpim/pubsub.py", line 57, in call
return self.__call__(argument)
File "/Users/n9yty/my_cvs/bitpim/bitpim/pubsub.py", line 51, in
__call__
return getattr(obj, self.methodname)(*args, **kwargs)
File "/Users/n9yty/my_cvs/bitpim/bitpim/phonebook.py", line 312, in
OnMergeCategories
cats=msg.data[:]
TypeError: unhashable type

Variables by last 6 frames, innermost last

Frame publish in /Users/n9yty/my_cvs/bitpim/bitpim/pubsub.py at line 72
topic = ('request', 'mergecategories')
data = {}

Frame sendMessage in
/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/
site-packages/wxPython/lib/pubsub.py at line 141
topic = ('request', 'mergecategories')
self = <wxPython.lib.pubsub.Publisher instance at 0x504ead0>
aTopic = <Topic>'request', 'mergecategories'</Topic>
subscriber = (<bound method _weaklistener.call of
<pubsub._weaklistener i
topicList = [(<bound method _weaklistener.call of
<pubsub._weaklistener
message = <wxPython.lib.pubsub.Message instance at 0x6a32e18>
data = {}

Frame <lambda> in
/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/
site-packages/wxPython/lib/pubsub.py at line 169
m = <wxPython.lib.pubsub.Message instance at 0x6a32e18>
f = <bound method _weaklistener.call of
<pubsub._weaklistener in

Frame call in /Users/n9yty/my_cvs/bitpim/bitpim/pubsub.py at line 57
self = <pubsub._weaklistener instance at 0x505c828>
argument = <wxPython.lib.pubsub.Message instance at 0x6a32e18>

Frame __call__ in /Users/n9yty/my_cvs/bitpim/bitpim/pubsub.py at line 51
self = <pubsub._weaklistener instance at 0x505c828>
args = (<wxPython.lib.pubsub.Message instance at
0x6a32e18>,)
obj = <phonebook.CategoryManager instance at 0x27b5530>
kwargs = {}

Frame OnMergeCategories in
/Users/n9yty/my_cvs/bitpim/bitpim/phonebook.py at line 312
msg = <wxPython.lib.pubsub.Message instance at 0x6a32e18>
self = <phonebook.CategoryManager instance at 0x27b5530>

-. ----. -.-- - -.--
Steve Palm - ***@n9yty.com
-. ----. -.-- - -.--
Steven Palm
2003-12-05 23:22:55 UTC
Permalink
Post by Roger Binns
Post by Steven Palm
#0 0x03019ed0 in wxChoice::GetString(int) const
(wxChoice::GetString(int) const + 36)
What was the exact sequence of actions to cause the crash?
Also worth mentioning.... v0.62 works fine.

-. ----. -.-- - -.--
Steve Palm - ***@n9yty.com
-. ----. -.-- - -.--
Roger Binns
2003-12-06 05:36:20 UTC
Permalink
I have committed fixes for both the issues you are seeing.
The coredump was because I didn't supply an initial value
for the combobox. On Windows and Linux it then defaults
to the empty string. On Mac it defaults to a coredump :-)

The other pubsub stuff was because I changed the format of
the categories from a dictionary to a list, but missed it
in one place.

BTW debuggers are for wimps :-) I actually just use
print statements etc. I do use them on C/C++ code however.

Linus' opinions are interesting:

http://lwn.net/2000/0914/a/lt-debugger.php3

I would agree with him in the context of the kernel. In
BitPim I do want development to be really easy, and Python
is definitely a different programming style. Prior to 0.7
the stack traces only gave line numbers. I could usually
figure out exactly what the problem was as a result.

0.7 now also has the groovy feature of including local
variables in each frame which goes a long way to almost
making this trivial :-) They work fine for issues in
the Python code, but not for C code issues such as coredumps
like you had.

Thanks for nailing down the issue.

Roger
Steven Palm
2003-12-06 14:34:22 UTC
Permalink
Post by Roger Binns
I have committed fixes for both the issues you are seeing.
The coredump was because I didn't supply an initial value
for the combobox. On Windows and Linux it then defaults
to the empty string. On Mac it defaults to a coredump :-)
The problem still remained... I did a little more work on it and have
a fix for you...

Try something like this:

if self.phonebox.GetSelection() == -1 and \
self.phonebox.GetCount() >= 1:
self.phonebox.SetSelection(0)
print "pb=",self.phonebox.GetValue()
if self.phonebox.GetValue()=="":
self.phonebox.SetValue("LG-VX4400")

You were initializing the combobox, but apparently it still didn't
have a default selected item, which... causes a coredump on wxMac. ;-)
Post by Roger Binns
Thanks for nailing down the issue.
I think that if you incorporate the above, or something that
accomplishes the same thing elsewhere, it will nail it down. The
program now runs on MacOS X 10.3.1, so all is happy here. Now on to see
about bundling it up for a Mac application.

-. ----. -.-- - -.--
Steve Palm - ***@n9yty.com
-. ----. -.-- - -.--
Roger Binns
2003-12-07 11:34:51 UTC
Permalink
[2nd try - SourceForge is getting confused about my email address]
Post by Steven Palm
You were initializing the combobox, but apparently it still didn't
have a default selected item, which... causes a coredump on wxMac. ;-)
Ok, the root cause would appear to be that the combobox is
readonly, and the default value supplied is not in the list
of choices. Try this as the line instead (uses LG-VX4400 as
the value).
self.phonebox=wxComboBox(self, -1, "LG-VX4400", style=wxCB_DROPDOWN|wxCB_READONLY|wxCB_SORT, choices=self.phonemodels.keys())
I have committed it as that.
Roger
Steven Palm
2003-12-07 14:45:23 UTC
Permalink
Ok, the root cause would appear to be that the combobox is
readonly, and the default value supplied is not in the list
of choices. Try this as the line instead (uses LG-VX4400 as
the value).
self.phonebox=wxComboBox(self, -1, "LG-VX4400",
style=wxCB_DROPDOWN|wxCB_READONLY|wxCB_SORT,
choices=self.phonemodels.keys())
I have committed it as that.
...and I still get a segfault.

If that were guaranteed to work, anyway, what is the point of this
statement later on?

print "pb=",self.phonebox.GetValue()
if self.phonebox.GetValue()=="":
self.phonebox.SetValue("LG-VX4400")

Basically, aren't you saying... If no choice was made, set it to the
LG-VX4400. But if you are initializing that with the default choice,
why is this necessary?

If i put in something like:

print "Selected Item: ",self.phonebox.GetSelection()

right before the print "pb=" line, it still returns a -1 which shows
that nothing has been selected, and therefore the call the
self.phonebox.GetValue() causes the segfault becuase there is no
default selected item to get a value from.

This was the whole point of my suggest changes... When it arrives at
this point, much like you were checking and setting a value if one did
not exist, I was checking for and setting the selected item if one did
not exist. I simply chose the first one in the list, but if you'd
rather code in the index for the LG-VX4400 that is fine.

I think this is clearly a bug in the wxMac implementation, because the
default selected item *SHOULD* be properly set with the code you are
using. However, reality is that it is not being set.

Sorry for rambling. I guess either a mac-specific workaround can be
put in the code here, or else someone will have to submit a bug to the
wxMac group and wait it out.

-. ----. -.-- - -.--
Steve Palm - ***@n9yty.com
-. ----. -.-- - -.--
Roger Binns
2003-12-08 11:32:43 UTC
Permalink
Post by Steven Palm
If that were guaranteed to work, anyway, what is the point of this
statement later on?
It would be redundant as you point out.
Post by Steven Palm
This was the whole point of my suggest changes...
I was trying to figure out the minimal number of changes to make it
work (ie finding exactly what was tickling the bug).

I have just comitted another change which may also have contributed.
Even though the CB_SORT flag was present, the choices were not
being sorted on Linux. I have now removed that flag and pre-sorted
the entries. Maybe it was the sort flag that was causing the crashes?
Post by Steven Palm
I think this is clearly a bug in the wxMac implementation, because the
default selected item *SHOULD* be properly set with the code you are
using. However, reality is that it is not being set.
Yup. However there are various little bugs on all the platforms that
BitPim already works around. Once we are sure what the actual cause
is and have reported it, whatever code works around it will be fine.
Comboboxes obviously work on the Mac so it is some minor detail we
do that the demos etc don't do.

Roger
Steven Palm
2003-12-08 15:44:29 UTC
Permalink
Post by Roger Binns
I was trying to figure out the minimal number of changes to make it
work (ie finding exactly what was tickling the bug).
Okay, I'll focus on that as a goal.
Post by Roger Binns
the entries. Maybe it was the sort flag that was causing the crashes?
That has made no change here.
Post by Roger Binns
Comboboxes obviously work on the Mac so it is some minor detail we
do that the demos etc don't do.
Can you please insert a check line?

print "Selected = ", self.phonebox.GetSelection()

I'd be curious to see what that does on a Windows or Linux install. I
have a hunch that calling the GetValue() method for an undefined
selection is not causing a coredump on Linux/Windows, but instead
returns an empty string. Then, when you call SetValue(), everything is
fine.

I inserted the statement right above here:

print "pb=",self.phonebox.GetValue()
if self.phonebox.GetValue()=="":
self.phonebox.SetValue("LG-VX4400")

To test this theory, I inserted the line:

self.phonebox.SetValue("LG-VX4400")

right after the line where the box is created:

self.phonebox=wxComboBox(self, -1, 'LG-VX4400',
style=wxCB_DROPDOWN|wxCB_READONLY,choices=keys)

And now it no longer crashes. To narrow it down, it would be helpful
to know if Linux and/or Windows are properly setting the selection when
the combobox is being initialized. If they are, then this is where the
Mac is deviating. If they are not, then the error on the Mac would seem
to be when the GetValue() method is called when the combobox selection
is not valid.

Make sense?

-. ----. -.-- - -.--
Steve Palm - ***@n9yty.com
-. ----. -.-- - -.--
Roger Binns
2003-12-09 07:23:52 UTC
Permalink
Post by Steven Palm
I'd be curious to see what that does on a Windows or Linux install. I
I have added a file as experiments/combobox.py that goes through all
the possible variations. There is also a copy attached.

This is the Windows output:

cb1: GetSelection() = -1
cb1: GetValue() = ''
cb2: GetSelection() = -1
cb2: GetValue() = ''
cb3: GetSelection() = -1
cb3: GetValue() = ''
cb4: GetSelection() = -1
cb4: GetValue() = ''
cb5: GetSelection() = 2
cb5: GetValue() = '3'
cb6: GetSelection() = -1
cb6: GetValue() = ''
cb7: GetSelection() = -1
cb7: GetValue() = ''
cb8: GetSelection() = 2
cb8: GetValue() = '3'

This is the Linux output:

cb1: GetSelection() = -1
cb1: GetValue() = ''
cb2: GetSelection() = -1
cb2: GetValue() = ''
cb3: GetSelection() = -1
cb3: GetValue() = ''
cb4: GetSelection() = -1
cb4: GetValue() = ''
cb5: GetSelection() = -1
cb5: GetValue() = '3'
cb6: GetSelection() = -1
cb6: GetValue() = ''
cb7: GetSelection() = -1
cb7: GetValue() = ''
cb8: GetSelection() = -1
cb8: GetValue() = '3'

Roger
Steven Palm
2003-12-09 14:04:26 UTC
Permalink
Post by Roger Binns
Post by Steven Palm
I'd be curious to see what that does on a Windows or Linux install. I
I have added a file as experiments/combobox.py that goes through all
the possible variations. There is also a copy attached.
cb1: GetSelection() = -1
cb1: GetValue() = ''
cb2: GetSelection() = -1
cb2: GetValue() = ''
cb3: GetSelection() = -1
cb3: GetValue() = ''
cb4: GetSelection() = -1
cb4: GetValue() = ''
cb5: GetSelection() = 2
cb5: GetValue() = '3'
cb6: GetSelection() = -1
cb6: GetValue() = ''
cb7: GetSelection() = -1
cb7: GetValue() = ''
cb8: GetSelection() = 2
cb8: GetValue() = '3'
cb1: GetSelection() = -1
cb1: GetValue() = ''
cb2: GetSelection() = -1
cb2: GetValue() = ''
cb3: GetSelection() = -1
cb3: GetValue() = ''
cb4: GetSelection() = -1
cb4: GetValue() = ''
cb5: GetSelection() = -1
cb5: GetValue() = '3'
cb6: GetSelection() = -1
cb6: GetValue() = ''
cb7: GetSelection() = -1
cb7: GetValue() = ''
cb8: GetSelection() = -1
cb8: GetValue() = '3'
Mac Output:

cb1: GetSelection() = -1
cb1: GetValue() = ''
cb2: GetSelection() = -1
cb2: GetValue() = ''
cb3: GetSelection() = -1
Segmentation fault

-. ----. -.-- - -.--
Steve Palm - ***@n9yty.com
-. ----. -.-- - -.--
Roger Binns
2003-12-10 02:42:47 UTC
Permalink
Post by Roger Binns
cb1: GetSelection() = -1
cb1: GetValue() = ''
cb2: GetSelection() = -1
cb2: GetValue() = ''
cb3: GetSelection() = -1
Segmentation fault
Thanks for that. I have now passed it on to the wxPython maintainers
and it is now their problem (tm) :-)

I have also corrected BitPim so it should work fine and you won't
get the coredump.

Roger

Loading...