From: Kevin A. <ka...@us...> - 2004-05-01 16:26:09
|
Update of /cvsroot/pythoncard/PythonCard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8381 Modified Files: model.py Added Files: fixdc.py Log Message: added fixdc.py - wxPython 2.5.1.5 DC methods workaround modified bitmapcanvas.py methods to use Point Size variations of names Index: model.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/model.py,v retrieving revision 1.161 retrieving revision 1.162 diff -C2 -d -r1.161 -r1.162 *** model.py 29 Apr 2004 23:59:23 -0000 1.161 --- model.py 1 May 2004 16:26:00 -0000 1.162 *************** *** 16,19 **** --- 16,23 ---- assert wx.VERSION >= (2, 5) + # KEA 2004-05-01 + # temporary fix for wxPython 2.5.1.5 + import fixdc + import configuration import log --- NEW FILE: fixdc.py --- """ This module will do surgery on the wx.DC class in wxPython 2.5.1.5 to make it act like the wx.DC class in later versions will. In a nutshell, the old 2.4.x style of method names, where the 'normal' name takes separate parameters for x, y, width and height will be restored, and the new methods that take wx.Point and/or wx.Size (which can also be converted from 2-element sequences) will be given new non-default method names. The new names are: * FloodFillPoint * GetPixelPoint * DrawLinePoint * CrossHairPoint * DrawArcPoint * DrawCheckMarkRect * DrawEllipticArcPointSize * DrawPointPoint * DrawRectanglePointSize * DrawRoundedRectanglePointSize * DrawCirclePoint * DrawEllipsePointSize * DrawIconPoint * DrawBitmapPoint * DrawTextPoint * DrawRotatedTextPoint * BlitPointSize WARNING: If you import this module the the wx.DC class will be changed for the entire application, so if you use code from the wx.lib package or 3rd party modules that have already been converted to the doomed 2.5.1.5 implementaion of the DC Draw methods then that code will break. This is an all-or-nothing fix, (just like the next version of wxPython will be,) so you *will* need to do something to resolve this situation if you run into it. The best thing to do of course is to correct the library module to work with the corrected DC semantics and then send me a patch. --Robin """ import wx _names = [ ("FloodFillXY", "FloodFill", "FloodFillPoint"), ("GetPixelXY", "GetPixel", "GetPixelPoint"), ("DrawLineXY", "DrawLine", "DrawLinePoint"), ("CrossHairXY", "CrossHair", "CrossHairPoint"), ("DrawArcXY", "DrawArc", "DrawArcPoint"), ("DrawCheckMarkXY", "DrawCheckMark", "DrawCheckMarkRect"), ("DrawEllipticArcXY", "DrawEllipticArc", "DrawEllipticArcPointSize"), ("DrawPointXY", "DrawPoint", "DrawPointPoint"), ("DrawRectangleXY", "DrawRectangle", "DrawRectanglePointSize"), ("DrawRoundedRectangleXY", "DrawRoundedRectangle", "DrawRoundedRectanglePointSize"), ("DrawCircleXY", "DrawCircle", "DrawCirclePoint"), ("DrawEllipseXY", "DrawEllipse", "DrawEllipsePointSize"), ("DrawIconXY", "DrawIcon", "DrawIconPoint"), ("DrawBitmapXY", "DrawBitmap", "DrawBitmapPoint"), ("DrawTextXY", "DrawText", "DrawTextPoint"), ("DrawRotatedTextXY", "DrawRotatedText", "DrawRotatedTextPoint"), ("BlitXY", "Blit", "BlitPointSize"), ] if wx.VERSION[:4] == (2,5,1,5): cls = wx.DC for old, norm, new in _names: m_old = getattr(cls, old) m_norm = getattr(cls, norm) setattr(cls, new, m_norm) setattr(cls, norm, m_old) delattr(cls, old) |