From: Kevin A. <al...@se...> - 2008-10-13 18:50:33
|
I tried 2.8.9.1 with Python 2.5.2 universal install on my Tiger box and I see the nested wxDC error when resizing the window or when loading a sample that uses BitmapCanvas. I don't have any idea at this time how to get around this problem on the Mac as the use of the wxDCs is critical to how the resourceEditor and the BitmapCanvas component works. It might be that with the resourceEditor (layoutEditor) that the solution proposed below or another fix that guarantees the old DC is destroyed before a new one is created will solve the problem. This won't deal with projects that have a BitmapCanvas component. If anyone can dig for more info on the wxPython-users mailing list that would be great and in the meantime I'll experiment a bit myself. I also tried using Python 2.6, but that raises additional errors, most likely unicode-related. Anyone out there using 2.6 that has looked into issues it raises? ka p.s. My mail server was changed late Friday and there are still some name resolution errors that may prevent me from responding in a timely fashion. On Oct 12, 2008, at 6:30 AM, XXXXXXXXXXX wrote: > Any PythonCard gurus around to review and comment on this suggested > fix......? > > Earlier this year Leopard owners reported that the LayoutEditor was > not showing all of the window's contents in larger windows. This > was later replicated by Tiger owners who had upgraded to wxPython > 2.8. I have just done the same and seen the same problem and it > appears to be due to a switch to the Core Graphics API in wxPython > 2.7+. > > The change has enforced a restriction which means that you can no > longer have more than one device context per window. In both the > Layout- and Resource-Editor the device context is set with the > following method: > > def createDC(self): > dc = wx.ClientDC(self.panel) > dc.SetPen(wx.Pen('black', 1, wx.DOT)) > dc.SetBrush(wx.TRANSPARENT_BRUSH) > dc.SetLogicalFunction(wx.INVERT) > self.dc = dc > > This method is called when the editor is first opened, but it is > also called every time the main window is resized (on_size()). > Therefore a second device context is created at the start of the > method when a project is loaded and that project's window forces > the main window to resize. At this point an assesrtion thrown in > the OSX code causes the redraw of the contents to fail. > > This error seems to get thrown on my Tiger machine every time a > project is loaded into the editors and the resize attemnpted. If > you do not have the errors sent to a console however you do not > realize there is a problem unless the project's window is bigger > than the default size. My suggested fix is to initialize the device > context in the editor's on_initialize() to None and change the > createDC method to the following: > > def createDC(self): > if self.dc == None: > self.dc = wx.ClientDC(self.panel) > > self.dc.SetPen(wx.Pen('black', 1, wx.DOT)) > self.dc.SetBrush(wx.TRANSPARENT_BRUSH) > self.dc.SetLogicalFunction(wx.INVERT) > > Hopefully this will not break anything on the other platforms, > where multiple device contexts appear to still be OK and (following > a brief review of the wxWidgets' graphics.cpp platform-specific > module) still permitted. > > Fixing this still leaves a similar problem in the BitmapCanvas > component to be fixed. This is stopping projects with that > component from fully loading into the editors. > > Comments? Suggestions? I am hoping that a Leopard user on the users > list will try this fix out but in the meantime...have I missed > anything? > > -- > XXXXXXXXXXX > > ---------------------------------------------------------------------- > --- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win > great prizes > Grand prize is a trip for two to an Open Source event anywhere in > the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Pythoncard-devel mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/pythoncard-devel |