From: Phil E. <ph...@li...> - 2004-04-07 16:56:44
|
On Wednesday 07 Apr 2004 12:22 pm, Phil Edwards wrote: > > I've got a hard drive problem on one of my machines - I've got backups so > it's an inconvenience as opposed to a major disaster, but it means the new > RPM's won't be ready until the end of today at the earliest. :-( Okay, back up and running, thank $DEITY for recordable DVD's.... Now, I have a problem with 0.7.3 when running with python 2.2.2 and wxPython 2.5. I've installed 0.7.3 from the tarball and wxPython from the RPM on wxpython.org. When I run the resource editor from a command line prompt, I get this: -----begin----- [phile@localhost phile]$ /usr/lib/python2.2/site-packages/PythonCardPrototype/tools/resourceEditor/resourceEditor.py Traceback (most recent call last): File "/usr/lib/python2.2/site-packages/PythonCardPrototype/binding.py", line 268, in dispatchOpenBackground self.scriptable.dispatch.eventOccurred( event.OpenBackgroundEvent( self.scriptable ) ) File "/usr/lib/python2.2/site-packages/PythonCardPrototype/dispatch.py", line 83, in eventOccurred handler.getFunction()(self._scriptable, nativeEvent) File "/usr/lib/python2.2/site-packages/PythonCardPrototype/tools/resourceEditor/resourceEditor.py", line 134, in on_openBackground self.updatePanel(self.rsrc) File "/usr/lib/python2.2/site-packages/PythonCardPrototype/tools/resourceEditor/resourceEditor.py", line 1243, in updatePanel self.menuBar.setEnabled('menuFileRun', 1) File "/usr/lib/python2.2/site-packages/PythonCardPrototype/menu.py", line 309, in setEnabled self.Enable(id, aBoolean) File "/usr/lib/python2.2/site-packages/wx/core.py", line 7602, in Enable return _core.MenuBar_Enable(*args, **kwargs) wx.core.PyAssertionError: C++ assertion "wxAssertFailure" failed in ../src/common/menucmn.cpp(896): attempt to enable an item which doesn't exist ------end------ The problem is that at line 309 (line 316 in the code below) of menu.py, the value of 'id' is set to -1 when it tries to call self.Enable(). As far as I can see, the code in this part of menu.py hasn't changed between 0.7.2 and 0.7.3, so I'm stumped as to what's going on. I put a bunch of print statements into menu.py so it looks like this: 299 def setEnabled( self, aString, aBoolean=1) : 300 print 'setEnabled, aString = [%s], aBoolean = [%s]' % (aString, aBoolean) 301 i = 0 302 for m in self.menus: 303 print 'm is now [%s]' % m 304 menuLabel = m.label.strip('&') 305 print 'm.label = [%s], menuLabel = [%s]' % (m.label, menuLabel) 306 if m.name == aString: 307 print 'm.name == aString' 308 self.EnableTop(i, aBoolean) 309 break 310 for mi in m.items: 311 print 'mi is now [%s]' % mi 312 if mi.name == aString: 313 print 'mi.name == aString, menuLabel = [%s]' % menuLabel 314 id = self.FindMenuItem(menuLabel, mi.label) 315 print 'found menu id [%s]' % id 316 self.Enable(id, aBoolean) 317 break 318 i += 1 When I run with this code, my output is: m.label = [&File], menuLabel = [File] mi is now [MenuItem={'_listeners': [<PythonCardPrototype.dispatch.EventDispatch instance at 0x87d3d6c>], 'checked': 0, 'name': 'menuFileNew', 'this': '_783a7d08_p_wxMenuItem', 'checkable': 0, 'thisown': 1, 'enabled': 1, 'command': None, 'label': '&New...\tCtrl+N'}] mi is now [MenuItem={'_listeners': [<PythonCardPrototype.dispatch.EventDispatch instance at 0x87d4e14>], 'checked': 0, 'name': 'menuFileOpen', 'this': '_90587d08_p_wxMenuItem', 'checkable': 0, 'thisown': 1, 'enabled': 1, 'command': None, 'label': '&Open...\tCtrl+O'}] mi is now [MenuItem={'_listeners': [<PythonCardPrototype.dispatch.EventDispatch instance at 0x87d592c>], 'checked': 0, 'name': 'menuFileSave', 'this': '_585d7d08_p_wxMenuItem', 'checkable': 0, 'thisown': 1, 'enabled': 1, 'command': None, 'label': 'Save\tCtrl+S'}] mi is now [MenuItem={'_listeners': [<PythonCardPrototype.dispatch.EventDispatch instance at 0x87d5ffc>], 'checked': 0, 'name': 'menuFileSaveAs', 'this': '_10627d08_p_wxMenuItem', 'checkable': 0, 'thisown': 1, 'enabled': 1, 'command': None, 'label': 'Save &As...'}] mi is now [MenuItem={'_listeners': [<PythonCardPrototype.dispatch.EventDispatch instance at 0x87d647c>], 'checked': 0, 'name': 'menuFileRevert', 'this': '_d06e7d08_p_wxMenuItem', 'checkable': 0, 'thisown': 1, 'enabled': 1, 'command': None, 'label': 'Revert'}] mi is now [MenuItem={'_listeners': [<PythonCardPrototype.dispatch.EventDispatch instance at 0x87d6e8c>], 'checked': 0, 'name': 'fileSep1', 'this': '_08747d08_p_wxMenuItem', 'checkable': 0, 'thisown': 1, 'enabled': 1, 'command': None, 'label': '-'}] mi is now [MenuItem={'_listeners': [<PythonCardPrototype.dispatch.EventDispatch instance at 0x87d7604>], 'checked': 0, 'name': 'menuFileRun', 'this': '_08787d08_p_wxMenuItem', 'checkable': 0, 'thisown': 1, 'enabled': 1, 'command': 'fileRun', 'label': '&Run\tCtrl+R'}] mi.name == aString, menuLabel = [File] found menu id [-1] Traceback (most recent call last): File "/usr/lib/python2.2/site-packages/PythonCardPrototype/binding.py", line 268, in dispatchOpenBackground self.scriptable.dispatch.eventOccurred( event.OpenBackgroundEvent( self.scriptable ) ) File "/usr/lib/python2.2/site-packages/PythonCardPrototype/dispatch.py", line 83, in eventOccurred handler.getFunction()(self._scriptable, nativeEvent) File "/usr/lib/python2.2/site-packages/PythonCardPrototype/tools/resourceEditor/resourceEditor.py", line 134, in on_openBackground self.updatePanel(self.rsrc) File "/usr/lib/python2.2/site-packages/PythonCardPrototype/tools/resourceEditor/resourceEditor.py", line 1243, in updatePanel self.menuBar.setEnabled('menuFileRun', 1) File "/usr/lib/python2.2/site-packages/PythonCardPrototype/menu.py", line 316, in setEnabled self.Enable(id, aBoolean) File "/usr/lib/python2.2/site-packages/wx/core.py", line 7602, in Enable return _core.MenuBar_Enable(*args, **kwargs) wx.core.PyAssertionError: C++ assertion "wxAssertFailure" failed in ../src/common/menucmn.cpp(896): attempt to enable an item which doesn't exist I've tried some of the other samples (proof, addresses, etc) and these run without any problems, it looks like its just the resource editor in this case. -- Regards Phil Edwards Brighton, UK |