From: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - 2008-10-12 13:31:11
|
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 |