X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8fa876ca9ec87e90605808bfcab4d4226965dbad..30e24d9dd5a5abf1c9a375ea259eb239b122b7f7:/wxPython/demo/GridCustEditor.py diff --git a/wxPython/demo/GridCustEditor.py b/wxPython/demo/GridCustEditor.py index 71b62a7a46..c111a179ad 100644 --- a/wxPython/demo/GridCustEditor.py +++ b/wxPython/demo/GridCustEditor.py @@ -1,7 +1,3 @@ -# 11/6/2003 - Jeff Grimmett (grimmtooth@softhome.net) -# -# Modified for wx namespace -# import string @@ -12,18 +8,9 @@ import wx.grid as gridlib class MyCellEditor(gridlib.PyGridCellEditor): """ This is a sample GridCellEditor that shows you how to make your own custom - grid editors. All the methods that can be overridden are show here. The + grid editors. All the methods that can be overridden are shown here. The ones that must be overridden are marked with "*Must Override*" in the docstring. - - Notice that in order to call the base class version of these special - methods we use the method name preceded by "base_". This is because these - methods are "virtual" in C++ so if we try to call wxGridCellEditor.Create - for example, then when the wxPython extension module tries to call - ptr->Create(...) then it actually calls the derived class version which - looks up the method in this class and calls it, causing a recursion loop. - If you don't understand any of this, don't worry, just call the "base_" - version instead. """ def __init__(self, log): self.log = log @@ -62,7 +49,7 @@ class MyCellEditor(gridlib.PyGridCellEditor): to set colours or fonts for the control. """ self.log.write("MyCellEditor: Show(self, %s, %s)\n" % (show, attr)) - self.base_Show(show, attr) + super(MyCellEditor, self).Show(show, attr) def PaintBackground(self, rect, attr): @@ -129,9 +116,10 @@ class MyCellEditor(gridlib.PyGridCellEditor): """ self.log.write("MyCellEditor: IsAcceptedKey: %d\n" % (evt.GetKeyCode())) - ## Oops, there's a bug here, we'll have to do it ourself.. - ##return self.base_IsAcceptedKey(evt) + ## We can ask the base class to do it + #return super(MyCellEditor, self).IsAcceptedKey(evt) + # or do it ourselves return (not (evt.ControlDown() or evt.AltDown()) and evt.GetKeyCode() != wx.WXK_SHIFT) @@ -153,8 +141,6 @@ class MyCellEditor(gridlib.PyGridCellEditor): elif key < 256 and key >= 0 and chr(key) in string.printable: ch = chr(key) - if not evt.ShiftDown(): - ch = ch.lower() if ch is not None: # For this example, replace the text. Normally we would append it. @@ -177,7 +163,7 @@ class MyCellEditor(gridlib.PyGridCellEditor): def Destroy(self): """final cleanup""" self.log.write("MyCellEditor: Destroy\n") - self.base_Destroy() + super(MyCellEditor, self).Destroy() def Clone(self):