;ò }×Cc@s¼dkZdkZdkiZdeifd„ƒYZdeifd„ƒYZdei fd„ƒYZ e djoBdk Z ei ƒZe ee iƒZeieƒeiƒndS(Ns MyCellEditorcBsƒtZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z d „Z d „Zd „ZRS(s& This is a sample GridCellEditor that shows you how to make your own custom 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 wx.GridCellEditor.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. cCs-||_|iidƒtii|ƒdS(NsMyCellEditor ctor (slogsselfswritesgridlibsPyGridCellEditors__init__(sselfslog((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/GridCustEditor.pys__init__s cCsg|iidƒti||dƒ|_|iidƒ|i |iƒ|o|ii |ƒndS(sj Called to create the control, which must derive from wx.Control. *Must Override* sMyCellEditor: Create siN( sselfslogswriteswxsTextCtrlsparentsids_tcsSetInsertionPoints SetControls evtHandlersPushEventHandler(sselfsparentsids evtHandler((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/GridCustEditor.pysCreatescCsK|iid|ƒ|ii|i|i|id|i dt i ƒdS(s× Called to position/size the edit control within the cell rectangle. If you don't fill the cell (the rect) then be sure to override PaintBackground and do something meaningful there. sMyCellEditor: SetSize %s iN( sselfslogswritesrects_tcs SetDimensionssxsyswidthsheightswxsSIZE_ALLOW_MINUS_ONE(sselfsrect((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/GridCustEditor.pysSetSize,s)cCs.|iid||fƒ|i||ƒdS(s… Show or hide the edit control. You can use the attr (if not None) to set colours or fonts for the control. s!MyCellEditor: Show(self, %s, %s) N(sselfslogswritesshowsattrs base_Show(sselfsshowsattr((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/GridCustEditor.pysShow7scCs|iidƒdS(s% Draws the part of the cell not occupied by the edit control. The base class version just fills it with background colour from the attribute. In this class the edit control fills the whole cell so don't do anything at all in order to reduce flicker. sMyCellEditor: PaintBackground N(sselfslogswrite(sselfsrectsattr((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/GridCustEditor.pysPaintBackground@scCs‚|iid||fƒ|iƒi||ƒ|_|i i |iƒ|i i ƒ|i i ƒ|i i d|i iƒƒdS(s£ Fetch the value from the table and prepare the edit control to begin editing. Set the focus to the edit control. *Must Override* s MyCellEditor: BeginEdit (%d,%d) iN(sselfslogswritesrowscolsgridsGetTablesGetValues startValues_tcsSetValuesSetInsertionPointEndsSetFocuss SetSelectionsGetLastPosition(sselfsrowscolsgrid((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/GridCustEditor.pys BeginEditJs  cCsƒ|iid||fƒt}|iiƒ}||i jo#t }|i ƒi|||ƒnd|_ |iidƒ|SdS(s¯ Complete the editing of the current cell. Returns True if the value has changed. If necessary, the control may be destroyed. *Must Override* sMyCellEditor: EndEdit (%d,%d) sN(sselfslogswritesrowscolsFalseschangeds_tcsGetValuesvals startValuesTruesgridsGetTablesSetValue(sselfsrowscolsgridsvalschanged((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/GridCustEditor.pysEndEditZs cCs4|iidƒ|ii|iƒ|iiƒdS(sd Reset the value in the control back to its starting value. *Must Override* sMyCellEditor: Reset N(sselfslogswrites_tcsSetValues startValuesSetInsertionPointEnd(sself((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/GridCustEditor.pysResetnscCsL|iid|iƒƒ|iƒp |iƒ o|iƒtijSdS(sË Return True to allow the given key to start editing: the base class version only checks that the event has no modifiers. F2 is special and will always start the editor. s MyCellEditor: IsAcceptedKey: %d N( sselfslogswritesevts GetKeyCodes ControlDownsAltDownswxs WXK_SHIFT(sselfsevt((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/GridCustEditor.pys IsAcceptedKeyxsc Cs|iid|iƒƒ|iƒ}t}|ti ti ti ti ti tititititig jo%ttdƒ|ti ƒ}}nA|djo |djot|ƒtijot|ƒ}n|tj o!|ii|ƒ|iiƒn |iƒdS(s¤ If the editor is enabled by pressing keys on the grid, this will be called to let the editor do something about that first key if desired. sMyCellEditor: StartingKey %d s0iiN(sselfslogswritesevts GetKeyCodeskeysNoneschswxs WXK_NUMPAD0s WXK_NUMPAD1s WXK_NUMPAD2s WXK_NUMPAD3s WXK_NUMPAD4s WXK_NUMPAD5s WXK_NUMPAD6s WXK_NUMPAD7s WXK_NUMPAD8s WXK_NUMPAD9schrsordsstrings printables_tcsSetValuesSetInsertionPointEndsSkip(sselfsevtschskey((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/GridCustEditor.pys StartingKeyˆs I%0 cCs|iidƒdS(s² If the editor is enabled by clicking on the cell, this method will be called to allow the editor to simulate the click on the control if needed. sMyCellEditor: StartingClick N(sselfslogswrite(sself((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/GridCustEditor.pys StartingClick£scCs|iidƒ|iƒdS(s final cleanupsMyCellEditor: Destroy N(sselfslogswrites base_Destroy(sself((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/GridCustEditor.pysDestroy¬scCs!|iidƒt|iƒSdS(s[ Create a new object which is the copy of this one *Must Override* sMyCellEditor: Clone N(sselfslogswrites MyCellEditor(sself((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/GridCustEditor.pysClone²s(s__name__s __module__s__doc__s__init__sCreatesSetSizesShowsPaintBackgrounds BeginEditsEndEditsResets IsAcceptedKeys StartingKeys StartingClicksDestroysClone(((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/GridCustEditor.pys MyCellEditors        sGridEditorTestcBstZd„ZRS(NcCs×tii||dƒ||_|iddƒ|iddt|iƒƒ|i dddƒti ƒ}|i t|iƒƒ|i d|ƒ|i dddƒ|idd ƒ|idd ƒ|idd ƒdS( Niÿÿÿÿi iiisTry to edit this boxisor any in this columni–(sgridlibsGrids__init__sselfsparentslogs CreateGrids SetCellEditors MyCellEditors SetCellValues GridCellAttrsattrs SetEditors SetColAttrs SetColSize(sselfsparentslogsattr((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/GridCustEditor.pys__init__½s  (s__name__s __module__s__init__(((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/GridCustEditor.pysGridEditorTest¼ss TestFramecBstZd„ZRS(NcCs8tii||dddddfƒt||ƒ}dS(NiÿÿÿÿsCustom Grid Cell Editor Testssizei€ià(swxsFrames__init__sselfsparentsGridEditorTestslogsgrid(sselfsparentslogsgrid((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/GridCustEditor.pys__init__âs(s__name__s __module__s__init__(((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/GridCustEditor.pys TestFrameáss__main__(sstringswxswx.gridsgridsgridlibsPyGridCellEditors MyCellEditorsGridsGridEditorTestsFrames TestFrames__name__ssyss PySimpleAppsappsNonesstdoutsframesShowsTruesMainLoop( sstringsapps TestFramessyssgridlibs MyCellEditorswxsframesGridEditorTest((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/GridCustEditor.pys?s   ´%