Changes to how overridable C++ methods are virtualized for Python.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37369 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2006-02-07 03:56:44 +00:00
parent e4c37d10dd
commit a7a0141800
25 changed files with 890 additions and 766 deletions

View File

@@ -541,10 +541,10 @@ class SetPrintout(wx.Printout):
self.end_pg = 1
def OnBeginDocument(self, start, end):
return self.base_OnBeginDocument(start, end)
return super(SetPrintout, self).OnBeginDocument(start, end)
def OnEndDocument(self):
self.base_OnEndDocument()
super(SetPrintout, self).OnEndDocument()
def HasPage(self, page):
if page <= self.end_pg:
@@ -564,7 +564,7 @@ class SetPrintout(wx.Printout):
return (str_pg, end_pg, str_pg, end_pg)
def OnPreparePrinting(self):
self.base_OnPreparePrinting()
super(SetPrintout, self).OnPreparePrinting()
def OnBeginPrinting(self):
dc = self.GetDC()
@@ -581,7 +581,7 @@ class SetPrintout(wx.Printout):
scaleY = float(h) / 1000
self.printUserScale = min(scaleX, scaleY)
self.base_OnBeginPrinting()
super(SetPrintout, self).OnBeginPrinting()
def GetSize(self):
self.psizew, self.psizeh = self.GetPPIPrinter()

View File

@@ -11,15 +11,6 @@ class MyCellEditor(gridlib.PyGridCellEditor):
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.
"""
def __init__(self, log):
self.log = log
@@ -58,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):
@@ -126,7 +117,7 @@ class MyCellEditor(gridlib.PyGridCellEditor):
self.log.write("MyCellEditor: IsAcceptedKey: %d\n" % (evt.GetKeyCode()))
## We can ask the base class to do it
#return self.base_IsAcceptedKey(evt)
#return super(MyCellEditor, self).IsAcceptedKey(evt)
# or do it ourselves
return (not (evt.ControlDown() or evt.AltDown()) and
@@ -172,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):

View File

@@ -16,33 +16,25 @@ class MyHtmlWindow(html.HtmlWindow):
def __init__(self, parent, id, log):
html.HtmlWindow.__init__(self, parent, id, style=wx.NO_FULL_REPAINT_ON_RESIZE)
self.log = log
self.Bind(wx.EVT_SCROLLWIN, self.OnScroll )
if "gtk2" in wx.PlatformInfo:
self.SetStandardFonts()
def OnScroll( self, event ):
#print 'event.GetOrientation()',event.GetOrientation()
#print 'event.GetPosition()',event.GetPosition()
event.Skip()
def OnLinkClicked(self, linkinfo):
self.log.WriteText('OnLinkClicked: %s\n' % linkinfo.GetHref())
# Virtuals in the base class have been renamed with base_ on the front.
self.base_OnLinkClicked(linkinfo)
super(MyHtmlWindow, self).OnLinkClicked(linkinfo)
def OnSetTitle(self, title):
self.log.WriteText('OnSetTitle: %s\n' % title)
self.base_OnSetTitle(title)
super(MyHtmlWindow, self).OnSetTitle(title)
def OnCellMouseHover(self, cell, x, y):
self.log.WriteText('OnCellMouseHover: %s, (%d %d)\n' % (cell, x, y))
self.base_OnCellMouseHover(cell, x, y)
super(MyHtmlWindow, self).OnCellMouseHover(cell, x, y)
def OnCellClicked(self, cell, x, y, evt):
self.log.WriteText('OnCellClicked: %s, (%d %d)\n' % (cell, x, y))
self.base_OnCellClicked(cell, x, y, evt)
super(MyHtmlWindow, self).OnCellClicked(cell, x, y, evt)
# This filter doesn't really do anything but show how to use filters

View File

@@ -418,14 +418,6 @@ Pierre Hj
less likely to get rusty because nobody cares about the C++ lib any
more.
<p>The Python version should be mostly drop-in compatible with the
wrapped C++ version, except for the location of the package
(wx.lib.ogl instead of wx.ogl) and that the base class methods are
called the normal Python way (superclass.Method(self, ...)) instead of the
hacky way that had to be done to support overloaded methods with the
old SWIG (self.base_Method(...))
"""
if __name__ == '__main__':

View File

@@ -15,38 +15,38 @@ class MyPrintout(wx.Printout):
self.log = log
def OnBeginDocument(self, start, end):
self.log.WriteText("wx.Printout.OnBeginDocument\n")
return self.base_OnBeginDocument(start, end)
self.log.WriteText("MyPrintout.OnBeginDocument\n")
return super(MyPrintout, self).OnBeginDocument(start, end)
def OnEndDocument(self):
self.log.WriteText("wx.Printout.OnEndDocument\n")
self.base_OnEndDocument()
self.log.WriteText("MyPrintout.OnEndDocument\n")
super(MyPrintout, self).OnEndDocument()
def OnBeginPrinting(self):
self.log.WriteText("wx.Printout.OnBeginPrinting\n")
self.base_OnBeginPrinting()
self.log.WriteText("MyPrintout.OnBeginPrinting\n")
super(MyPrintout, self).OnBeginPrinting()
def OnEndPrinting(self):
self.log.WriteText("wx.Printout.OnEndPrinting\n")
self.base_OnEndPrinting()
self.log.WriteText("MyPrintout.OnEndPrinting\n")
super(MyPrintout, self).OnEndPrinting()
def OnPreparePrinting(self):
self.log.WriteText("wx.Printout.OnPreparePrinting\n")
self.base_OnPreparePrinting()
self.log.WriteText("MyPrintout.OnPreparePrinting\n")
super(MyPrintout, self).OnPreparePrinting()
def HasPage(self, page):
self.log.WriteText("wx.Printout.HasPage: %d\n" % page)
self.log.WriteText("MyPrintout.HasPage: %d\n" % page)
if page <= 2:
return True
else:
return False
def GetPageInfo(self):
self.log.WriteText("wx.Printout.GetPageInfo\n")
self.log.WriteText("MyPrintout.GetPageInfo\n")
return (1, 2, 1, 2)
def OnPrintPage(self, page):
self.log.WriteText("wx.Printout.OnPrintPage: %d\n" % page)
self.log.WriteText("MyPrintout.OnPrintPage: %d\n" % page)
dc = self.GetDC()
#-------------------------------------------
@@ -128,7 +128,7 @@ class TestPrintPanel(wx.Panel):
def OnPrintSetup(self, event):
data = wx.PrintDialogData(self.printData)
printerDialog = wx.PrintDialog(self, data)
printerDialog.GetPrintDialogData().SetSetupDialog(True)
#printerDialog.GetPrintDialogData().SetSetupDialog(True)
printerDialog.ShowModal();
# this makes a copy of the wx.PrintData instead of just saving

View File

@@ -25,6 +25,59 @@ wx.EventLoop is now implemented for wxMac.
Added wxPython wrappers for the new wx.Treebook and wx.Toolbook
classes.
Solved a problem that has been around for a very long time in how C++
methods are virtualized for overriding in derived Python classes.
Previously we couldn't do it for methods that needed to exist in the
base class wrappers such that they could be called normally. (The
reasons are long and complex, but suffice it to say that it was due to
mixing C++'s dynamic dispatch, and Python's runtime lookup of the
method attributes resulting in endless recursion of function calls.)
Because of this problem I used a hack that I have always hated, and
that is renaming the base class methods with a "base_" prefix, for
example wx.Printout.base_OnBeginDocument. Now that the problem has
finally been solved I have replaced all the base_Whatever() methods
with the real Whatever() method as well as a simple wrapper named
base_Whatever that is marked as deprecated. So now instead of writing
your overridden methods like this:
def OnBeginDocument(self, start, end):
# do something here
return self.base_OnBeginDocument(start, end)
You can do it the *right way* like this:
def OnBeginDocument(self, start, end):
# do something here
return super(MyPrintout, self).OnBeginDocument(start, end)
Note that the old way still works, but you will get a
DeprecationWarning from calling base_OnBeginDocument. The classes
affected by this are:
* wx.DropSource
* wx.DropTarget
* wx.TextDropTarget
* wx.FileDropTarget
* wx.PyLog (also added the ability to override Flush)
* wx.PyApp (also added the ability to override ExitMainLoop)
* wx.Printout
* wx.PyPrintPreview
* wx.PyPreviewFrame
* wx.PreviewControlBar
* wx.Process
* wx.PyControl
* wx.PyPanel
* wx.PyScrolledWindow
* wx.PyWindow
* wx.Timer
* wx.grid.PyGridCellRenderer
* wx.grid.PyGridCellEditor
* wx.grid.PyGridCellAttrProvider
* wx.grid.PyGridTableBase
* wx.html.HtmlWindow
* wx.wizard.PyWizardPage

View File

@@ -32,7 +32,6 @@ public:
// Since this one would be tough and ugly to do with the Macros...
void GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo);
void base_GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo);
PYPRIVATE;
DECLARE_ABSTRACT_CLASS(wxPyPrintout)

File diff suppressed because it is too large Load Diff

View File

@@ -381,6 +381,23 @@ typedef unsigned long wxUIntPtr;
%enddef
#endif
//---------------------------------------------------------------------------
// Generates a base_On* method that just wraps a call to the On*, and mark it
// deprecated. We need this because there is no longer any need for a
// base_On* method to be able to call the C++ base class method, since our
// virtualization code can now sense when an attempt is being made to call
// the base class version from the derived class override.
%define %MAKE_BASE_FUNC(Class, Method)
%pythoncode {
def base_##Method(*args, **kw):
return Class.Method(*args, **kw)
base_##Method = wx._deprecated(base_##Method,
"Please use Class.Method instead.")
}
%enddef
//---------------------------------------------------------------------------
// Forward declarations and %renames for some classes, so the autodoc strings
// will be able to use the right types even when the real class declaration is

View File

@@ -84,7 +84,8 @@ public:
wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly);
bool base_GiveFeedback(wxDragResult effect);
bool GiveFeedback(wxDragResult effect);
%MAKE_BASE_FUNC(DropSource, GiveFeedback);
};
@@ -151,10 +152,16 @@ public:
%cleardisown( wxDataObject *dataObject );
wxDragResult base_OnEnter(wxCoord x, wxCoord y, wxDragResult def);
wxDragResult base_OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
void base_OnLeave();
bool base_OnDrop(wxCoord x, wxCoord y);
wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def);
wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
void OnLeave();
bool OnDrop(wxCoord x, wxCoord y);
%MAKE_BASE_FUNC(DropTarget, OnEnter);
%MAKE_BASE_FUNC(DropTarget, OnDragOver);
%MAKE_BASE_FUNC(DropTarget, OnLeave);
%MAKE_BASE_FUNC(DropTarget, OnDrop);
// may be called *only* from inside OnData() and will fill m_dataObject
// with the data from the drop source if it returns True
@@ -213,12 +220,19 @@ public:
wxPyTextDropTarget();
void _setCallbackInfo(PyObject* self, PyObject* _class);
//bool OnDropText(wxCoord x, wxCoord y, const wxString& text) = 0;
wxDragResult base_OnEnter(wxCoord x, wxCoord y, wxDragResult def);
wxDragResult base_OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
void base_OnLeave();
bool base_OnDrop(wxCoord x, wxCoord y);
wxDragResult base_OnData(wxCoord x, wxCoord y, wxDragResult def);
bool OnDropText(wxCoord x, wxCoord y, const wxString& text);
wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def);
wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
void OnLeave();
bool OnDrop(wxCoord x, wxCoord y);
wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);
%MAKE_BASE_FUNC(TextDropTarget, OnDropText);
%MAKE_BASE_FUNC(TextDropTarget, OnEnter);
%MAKE_BASE_FUNC(TextDropTarget, OnDragOver);
%MAKE_BASE_FUNC(TextDropTarget, OnLeave);
%MAKE_BASE_FUNC(TextDropTarget, OnDrop);
%MAKE_BASE_FUNC(TextDropTarget, OnData);
};
//---------------------------------------------------------------------------
@@ -275,12 +289,19 @@ public:
wxPyFileDropTarget();
void _setCallbackInfo(PyObject* self, PyObject* _class);
// bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames) = 0;
wxDragResult base_OnEnter(wxCoord x, wxCoord y, wxDragResult def);
wxDragResult base_OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
void base_OnLeave();
bool base_OnDrop(wxCoord x, wxCoord y);
wxDragResult base_OnData(wxCoord x, wxCoord y, wxDragResult def);
bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames);
wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def);
wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
void OnLeave();
bool OnDrop(wxCoord x, wxCoord y);
wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);
%MAKE_BASE_FUNC(FileDropTarget, OnDropFiles);
%MAKE_BASE_FUNC(FileDropTarget, OnEnter);
%MAKE_BASE_FUNC(FileDropTarget, OnDragOver);
%MAKE_BASE_FUNC(FileDropTarget, OnLeave);
%MAKE_BASE_FUNC(FileDropTarget, OnDrop);
%MAKE_BASE_FUNC(FileDropTarget, OnData);
};

View File

@@ -154,6 +154,9 @@ public:
%pythonAppend Destroy "args[0].thisown = 0";
%extend { void Destroy() { delete self; } }
void DoLog(wxLogLevel level, const wxChar *szString, long t);
void DoLogString(const wxChar *szString, long t);
};
@@ -388,8 +391,10 @@ public:
wxLog::DoLogString(szString, t);
}
DEC_PYCALLBACK_VOID_(Flush);
PYPRIVATE;
};
IMP_PYCALLBACK_VOID_(wxPyLog, wxLog, Flush);
%}
// Now tell SWIG about it

View File

@@ -393,9 +393,6 @@ void wxPyPrintout::GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *p
wxPrintout::GetPageInfo(minPage, maxPage, pageFrom, pageTo);
}
void wxPyPrintout::base_GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo) {
wxPrintout::GetPageInfo(minPage, maxPage, pageFrom, pageTo);
}
IMP_PYCALLBACK_BOOL_INTINT(wxPyPrintout, wxPrintout, OnBeginDocument);
@@ -452,15 +449,22 @@ public:
void SetIsPreview(bool p);
bool base_OnBeginDocument(int startPage, int endPage);
void base_OnEndDocument();
void base_OnBeginPrinting();
void base_OnEndPrinting();
void base_OnPreparePrinting();
bool base_HasPage(int page);
bool OnBeginDocument(int startPage, int endPage);
void OnEndDocument();
void OnBeginPrinting();
void OnEndPrinting();
void OnPreparePrinting();
bool HasPage(int page);
DocDeclA(
void, base_GetPageInfo(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT),
"base_GetPageInfo() -> (minPage, maxPage, pageFrom, pageTo)");
void, GetPageInfo(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT),
"GetPageInfo() -> (minPage, maxPage, pageFrom, pageTo)");
%MAKE_BASE_FUNC(Printout, OnBeginDocument);
%MAKE_BASE_FUNC(Printout, OnEndDocument);
%MAKE_BASE_FUNC(Printout, OnBeginPrinting);
%MAKE_BASE_FUNC(Printout, OnEndPrinting);
%MAKE_BASE_FUNC(Printout, OnPreparePrinting);
%MAKE_BASE_FUNC(Printout, GetPageInfo);
};
//---------------------------------------------------------------------------
@@ -617,8 +621,7 @@ public:
%{
#define DEC_PYCALLBACK_BOOL_PREWINDC(CBNAME) \
bool CBNAME(wxPreviewCanvas* a, wxDC& b); \
bool base_##CBNAME(wxPreviewCanvas* a, wxDC& b)
bool CBNAME(wxPreviewCanvas* a, wxDC& b)
#define IMP_PYCALLBACK_BOOL_PREWINDC(CLASS, PCLASS, CBNAME) \
@@ -637,9 +640,6 @@ public:
if (! found) \
rval = PCLASS::CBNAME(a, b); \
return rval; \
} \
bool CLASS::base_##CBNAME(wxPreviewCanvas* a, wxDC& b) { \
return PCLASS::CBNAME(a, b); \
}
@@ -706,13 +706,21 @@ public:
void _setCallbackInfo(PyObject* self, PyObject* _class);
bool base_SetCurrentPage(int pageNum);
bool base_PaintPage(wxPreviewCanvas *canvas, wxDC& dc);
bool base_DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc);
bool base_RenderPage(int pageNum);
void base_SetZoom(int percent);
bool base_Print(bool interactive);
void base_DetermineScaling();
bool SetCurrentPage(int pageNum);
bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc);
bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc);
bool RenderPage(int pageNum);
void SetZoom(int percent);
bool Print(bool interactive);
void DetermineScaling();
%MAKE_BASE_FUNC(PyPrintPreview, SetCurrentPage);
%MAKE_BASE_FUNC(PyPrintPreview, PaintPage);
%MAKE_BASE_FUNC(PyPrintPreview, DrawBlankPage);
%MAKE_BASE_FUNC(PyPrintPreview, RenderPage);
%MAKE_BASE_FUNC(PyPrintPreview, SetZoom);
%MAKE_BASE_FUNC(PyPrintPreview, Print);
%MAKE_BASE_FUNC(PyPrintPreview, DetermineScaling);
};
@@ -769,9 +777,13 @@ public:
void SetPreviewCanvas(wxPreviewCanvas* canvas);
void SetControlBar(wxPreviewControlBar* bar);
void base_Initialize();
void base_CreateCanvas();
void base_CreateControlBar();
void Initialize();
void CreateCanvas();
void CreateControlBar();
%MAKE_BASE_FUNC(PyPreviewFrame, Initialize);
%MAKE_BASE_FUNC(PyPreviewFrame, CreateCanvas);
%MAKE_BASE_FUNC(PyPreviewFrame, CreateControlBar);
};
@@ -825,8 +837,11 @@ public:
void SetPrintPreview(wxPrintPreview* preview);
void base_CreateButtons();
void base_SetZoomControl(int zoom);
void CreateButtons();
void SetZoomControl(int zoom);
%MAKE_BASE_FUNC(PreviewControlBar, CreateButtons);
%MAKE_BASE_FUNC(PreviewControlBar, SetZoomControl);
};
//---------------------------------------------------------------------------

View File

@@ -104,7 +104,8 @@ public:
void _setCallbackInfo(PyObject* self, PyObject* _class);
void base_OnTerminate(int pid, int status);
void OnTerminate(int pid, int status);
%MAKE_BASE_FUNC(Process, OnTerminate);
// call Redirect before passing the object to wxExecute() to redirect the
// launched process stdin/stdout, then use GetInputStream() and

View File

@@ -136,41 +136,63 @@ public:
void SetBestSize(const wxSize& size);
bool DoEraseBackground(wxDC* dc);
void base_DoMoveWindow(int x, int y, int width, int height);
void base_DoSetSize(int x, int y, int width, int height,
void DoMoveWindow(int x, int y, int width, int height);
void DoSetSize(int x, int y, int width, int height,
int sizeFlags = wxSIZE_AUTO);
void base_DoSetClientSize(int width, int height);
void base_DoSetVirtualSize( int x, int y );
void DoSetClientSize(int width, int height);
void DoSetVirtualSize( int x, int y );
DocDeclA(
void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const,
"base_DoGetSize() -> (width, height)");
void, DoGetSize( int *OUTPUT, int *OUTPUT ) const,
"DoGetSize() -> (width, height)");
DocDeclA(
void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
"base_DoGetClientSize() -> (width, height)");
void, DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
"DoGetClientSize() -> (width, height)");
DocDeclA(
void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
"base_DoGetPosition() -> (x,y)");
void, DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
"DoGetPosition() -> (x,y)");
wxSize base_DoGetVirtualSize() const;
wxSize base_DoGetBestSize() const;
wxSize DoGetVirtualSize() const;
wxSize DoGetBestSize() const;
void base_InitDialog();
bool base_TransferDataToWindow();
bool base_TransferDataFromWindow();
bool base_Validate();
void InitDialog();
bool TransferDataToWindow();
bool TransferDataFromWindow();
bool Validate();
bool base_AcceptsFocus() const;
bool base_AcceptsFocusFromKeyboard() const;
wxSize base_GetMaxSize() const;
bool AcceptsFocus() const;
bool AcceptsFocusFromKeyboard() const;
wxSize GetMaxSize() const;
void base_AddChild(wxWindow* child);
void base_RemoveChild(wxWindow* child);
void AddChild(wxWindow* child);
void RemoveChild(wxWindow* child);
bool base_ShouldInheritColours() const;
wxVisualAttributes base_GetDefaultAttributes();
bool ShouldInheritColours() const;
wxVisualAttributes GetDefaultAttributes();
void base_OnInternalIdle();
void OnInternalIdle();
%MAKE_BASE_FUNC(PyScrolledWindow, DoMoveWindow);
%MAKE_BASE_FUNC(PyScrolledWindow, DoSetSize);
%MAKE_BASE_FUNC(PyScrolledWindow, DoSetClientSize);
%MAKE_BASE_FUNC(PyScrolledWindow, DoSetVirtualSize);
%MAKE_BASE_FUNC(PyScrolledWindow, DoGetSize);
%MAKE_BASE_FUNC(PyScrolledWindow, DoGetClientSize);
%MAKE_BASE_FUNC(PyScrolledWindow, DoGetPosition);
%MAKE_BASE_FUNC(PyScrolledWindow, DoGetVirtualSize);
%MAKE_BASE_FUNC(PyScrolledWindow, DoGetBestSize);
%MAKE_BASE_FUNC(PyScrolledWindow, InitDialog);
%MAKE_BASE_FUNC(PyScrolledWindow, TransferDataToWindow);
%MAKE_BASE_FUNC(PyScrolledWindow, TransferDataFromWindow);
%MAKE_BASE_FUNC(PyScrolledWindow, Validate);
%MAKE_BASE_FUNC(PyScrolledWindow, AcceptsFocus);
%MAKE_BASE_FUNC(PyScrolledWindow, AcceptsFocusFromKeyboard);
%MAKE_BASE_FUNC(PyScrolledWindow, GetMaxSize);
%MAKE_BASE_FUNC(PyScrolledWindow, AddChild);
%MAKE_BASE_FUNC(PyScrolledWindow, RemoveChild);
%MAKE_BASE_FUNC(PyScrolledWindow, ShouldInheritColours);
%MAKE_BASE_FUNC(PyScrolledWindow, GetDefaultAttributes);
%MAKE_BASE_FUNC(PyScrolledWindow, OnInternalIdle);
};

View File

@@ -163,41 +163,63 @@ public:
void SetBestSize(const wxSize& size);
bool DoEraseBackground(wxDC* dc);
void base_DoMoveWindow(int x, int y, int width, int height);
void base_DoSetSize(int x, int y, int width, int height,
void DoMoveWindow(int x, int y, int width, int height);
void DoSetSize(int x, int y, int width, int height,
int sizeFlags = wxSIZE_AUTO);
void base_DoSetClientSize(int width, int height);
void base_DoSetVirtualSize( int x, int y );
void DoSetClientSize(int width, int height);
void DoSetVirtualSize( int x, int y );
DocDeclA(
void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const,
"base_DoGetSize() -> (width, height)");
void, DoGetSize( int *OUTPUT, int *OUTPUT ) const,
"DoGetSize() -> (width, height)");
DocDeclA(
void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
"base_DoGetClientSize() -> (width, height)");
void, DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
"DoGetClientSize() -> (width, height)");
DocDeclA(
void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
"base_DoGetPosition() -> (x,y)");
void, DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
"DoGetPosition() -> (x,y)");
wxSize base_DoGetVirtualSize() const;
wxSize base_DoGetBestSize() const;
wxSize DoGetVirtualSize() const;
wxSize DoGetBestSize() const;
void base_InitDialog();
bool base_TransferDataToWindow();
bool base_TransferDataFromWindow();
bool base_Validate();
void InitDialog();
bool TransferDataToWindow();
bool TransferDataFromWindow();
bool Validate();
bool base_AcceptsFocus() const;
bool base_AcceptsFocusFromKeyboard() const;
wxSize base_GetMaxSize() const;
bool AcceptsFocus() const;
bool AcceptsFocusFromKeyboard() const;
wxSize GetMaxSize() const;
void base_AddChild(wxWindow* child);
void base_RemoveChild(wxWindow* child);
void AddChild(wxWindow* child);
void RemoveChild(wxWindow* child);
bool base_ShouldInheritColours() const;
wxVisualAttributes base_GetDefaultAttributes();
bool ShouldInheritColours() const;
wxVisualAttributes GetDefaultAttributes();
void base_OnInternalIdle();
void OnInternalIdle();
%MAKE_BASE_FUNC(PyWindow, DoMoveWindow);
%MAKE_BASE_FUNC(PyWindow, DoSetSize);
%MAKE_BASE_FUNC(PyWindow, DoSetClientSize);
%MAKE_BASE_FUNC(PyWindow, DoSetVirtualSize);
%MAKE_BASE_FUNC(PyWindow, DoGetSize);
%MAKE_BASE_FUNC(PyWindow, DoGetClientSize);
%MAKE_BASE_FUNC(PyWindow, DoGetPosition);
%MAKE_BASE_FUNC(PyWindow, DoGetVirtualSize);
%MAKE_BASE_FUNC(PyWindow, DoGetBestSize);
%MAKE_BASE_FUNC(PyWindow, InitDialog);
%MAKE_BASE_FUNC(PyWindow, TransferDataToWindow);
%MAKE_BASE_FUNC(PyWindow, TransferDataFromWindow);
%MAKE_BASE_FUNC(PyWindow, Validate);
%MAKE_BASE_FUNC(PyWindow, AcceptsFocus);
%MAKE_BASE_FUNC(PyWindow, AcceptsFocusFromKeyboard);
%MAKE_BASE_FUNC(PyWindow, GetMaxSize);
%MAKE_BASE_FUNC(PyWindow, AddChild);
%MAKE_BASE_FUNC(PyWindow, RemoveChild);
%MAKE_BASE_FUNC(PyWindow, ShouldInheritColours);
%MAKE_BASE_FUNC(PyWindow, GetDefaultAttributes);
%MAKE_BASE_FUNC(PyWindow, OnInternalIdle);
};
@@ -324,42 +346,63 @@ public:
void SetBestSize(const wxSize& size);
bool DoEraseBackground(wxDC* dc);
void base_DoMoveWindow(int x, int y, int width, int height);
void base_DoSetSize(int x, int y, int width, int height,
void DoMoveWindow(int x, int y, int width, int height);
void DoSetSize(int x, int y, int width, int height,
int sizeFlags = wxSIZE_AUTO);
void base_DoSetClientSize(int width, int height);
void base_DoSetVirtualSize( int x, int y );
void DoSetClientSize(int width, int height);
void DoSetVirtualSize( int x, int y );
DocDeclA(
void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const,
"base_DoGetSize() -> (width, height)");
void, DoGetSize( int *OUTPUT, int *OUTPUT ) const,
"DoGetSize() -> (width, height)");
DocDeclA(
void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
"base_DoGetClientSize() -> (width, height)");
void, DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
"DoGetClientSize() -> (width, height)");
DocDeclA(
void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
"base_DoGetPosition() -> (x,y)");
void, DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
"DoGetPosition() -> (x,y)");
wxSize base_DoGetVirtualSize() const;
wxSize base_DoGetBestSize() const;
wxSize DoGetVirtualSize() const;
wxSize DoGetBestSize() const;
void base_InitDialog();
bool base_TransferDataToWindow();
bool base_TransferDataFromWindow();
bool base_Validate();
void InitDialog();
bool TransferDataToWindow();
bool TransferDataFromWindow();
bool Validate();
bool base_AcceptsFocus() const;
bool base_AcceptsFocusFromKeyboard() const;
wxSize base_GetMaxSize() const;
bool AcceptsFocus() const;
bool AcceptsFocusFromKeyboard() const;
wxSize GetMaxSize() const;
void base_AddChild(wxWindow* child);
void base_RemoveChild(wxWindow* child);
void AddChild(wxWindow* child);
void RemoveChild(wxWindow* child);
bool base_ShouldInheritColours() const ;
wxVisualAttributes base_GetDefaultAttributes();
bool ShouldInheritColours() const ;
wxVisualAttributes GetDefaultAttributes();
void base_OnInternalIdle();
void OnInternalIdle();
%MAKE_BASE_FUNC(PyPanel, DoMoveWindow);
%MAKE_BASE_FUNC(PyPanel, DoSetSize);
%MAKE_BASE_FUNC(PyPanel, DoSetClientSize);
%MAKE_BASE_FUNC(PyPanel, DoSetVirtualSize);
%MAKE_BASE_FUNC(PyPanel, DoGetSize);
%MAKE_BASE_FUNC(PyPanel, DoGetClientSize);
%MAKE_BASE_FUNC(PyPanel, DoGetPosition);
%MAKE_BASE_FUNC(PyPanel, DoGetVirtualSize);
%MAKE_BASE_FUNC(PyPanel, DoGetBestSize);
%MAKE_BASE_FUNC(PyPanel, InitDialog);
%MAKE_BASE_FUNC(PyPanel, TransferDataToWindow);
%MAKE_BASE_FUNC(PyPanel, TransferDataFromWindow);
%MAKE_BASE_FUNC(PyPanel, Validate);
%MAKE_BASE_FUNC(PyPanel, AcceptsFocus);
%MAKE_BASE_FUNC(PyPanel, AcceptsFocusFromKeyboard);
%MAKE_BASE_FUNC(PyPanel, GetMaxSize);
%MAKE_BASE_FUNC(PyPanel, AddChild);
%MAKE_BASE_FUNC(PyPanel, RemoveChild);
%MAKE_BASE_FUNC(PyPanel, ShouldInheritColours);
%MAKE_BASE_FUNC(PyPanel, GetDefaultAttributes);
%MAKE_BASE_FUNC(PyPanel, OnInternalIdle);
};
//---------------------------------------------------------------------------
@@ -478,41 +521,63 @@ public:
void SetBestSize(const wxSize& size);
bool DoEraseBackground(wxDC* dc);
void base_DoMoveWindow(int x, int y, int width, int height);
void base_DoSetSize(int x, int y, int width, int height,
void DoMoveWindow(int x, int y, int width, int height);
void DoSetSize(int x, int y, int width, int height,
int sizeFlags = wxSIZE_AUTO);
void base_DoSetClientSize(int width, int height);
void base_DoSetVirtualSize( int x, int y );
void DoSetClientSize(int width, int height);
void DoSetVirtualSize( int x, int y );
DocDeclA(
void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const,
"base_DoGetSize() -> (width, height)");
void, DoGetSize( int *OUTPUT, int *OUTPUT ) const,
"DoGetSize() -> (width, height)");
DocDeclA(
void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
"base_DoGetClientSize() -> (width, height)");
void, DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
"DoGetClientSize() -> (width, height)");
DocDeclA(
void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
"base_DoGetPosition() -> (x,y)");
void, DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
"DoGetPosition() -> (x,y)");
wxSize base_DoGetVirtualSize() const;
wxSize base_DoGetBestSize() const;
wxSize DoGetVirtualSize() const;
wxSize DoGetBestSize() const;
void base_InitDialog();
bool base_TransferDataToWindow();
bool base_TransferDataFromWindow();
bool base_Validate();
void InitDialog();
bool TransferDataToWindow();
bool TransferDataFromWindow();
bool Validate();
bool base_AcceptsFocus() const;
bool base_AcceptsFocusFromKeyboard() const;
wxSize base_GetMaxSize() const;
bool AcceptsFocus() const;
bool AcceptsFocusFromKeyboard() const;
wxSize GetMaxSize() const;
void base_AddChild(wxWindow* child);
void base_RemoveChild(wxWindow* child);
void AddChild(wxWindow* child);
void RemoveChild(wxWindow* child);
bool base_ShouldInheritColours() const;
wxVisualAttributes base_GetDefaultAttributes();
bool ShouldInheritColours() const;
wxVisualAttributes GetDefaultAttributes();
void base_OnInternalIdle();
void OnInternalIdle();
%MAKE_BASE_FUNC(PyScrolledWindow, DoMoveWindow);
%MAKE_BASE_FUNC(PyScrolledWindow, DoSetSize);
%MAKE_BASE_FUNC(PyScrolledWindow, DoSetClientSize);
%MAKE_BASE_FUNC(PyScrolledWindow, DoSetVirtualSize);
%MAKE_BASE_FUNC(PyScrolledWindow, DoGetSize);
%MAKE_BASE_FUNC(PyScrolledWindow, DoGetClientSize);
%MAKE_BASE_FUNC(PyScrolledWindow, DoGetPosition);
%MAKE_BASE_FUNC(PyScrolledWindow, DoGetVirtualSize);
%MAKE_BASE_FUNC(PyScrolledWindow, DoGetBestSize);
%MAKE_BASE_FUNC(PyScrolledWindow, InitDialog);
%MAKE_BASE_FUNC(PyScrolledWindow, TransferDataToWindow);
%MAKE_BASE_FUNC(PyScrolledWindow, TransferDataFromWindow);
%MAKE_BASE_FUNC(PyScrolledWindow, Validate);
%MAKE_BASE_FUNC(PyScrolledWindow, AcceptsFocus);
%MAKE_BASE_FUNC(PyScrolledWindow, AcceptsFocusFromKeyboard);
%MAKE_BASE_FUNC(PyScrolledWindow, GetMaxSize);
%MAKE_BASE_FUNC(PyScrolledWindow, AddChild);
%MAKE_BASE_FUNC(PyScrolledWindow, RemoveChild);
%MAKE_BASE_FUNC(PyScrolledWindow, ShouldInheritColours);
%MAKE_BASE_FUNC(PyScrolledWindow, GetDefaultAttributes);
%MAKE_BASE_FUNC(PyScrolledWindow, OnInternalIdle);
};

View File

@@ -32,7 +32,7 @@ enum {
%{
//IMP_PYCALLBACK__(wxPyTimer, wxTimer, Notify);
IMP_PYCALLBACK__(wxPyTimer, wxTimer, Notify);
IMPLEMENT_ABSTRACT_CLASS(wxPyTimer, wxTimer);
@@ -41,21 +41,6 @@ wxPyTimer::wxPyTimer(wxEvtHandler *owner, int id)
{
if (owner == NULL) SetOwner(this);
}
void wxPyTimer::Notify() {
bool found;
wxPyBlock_t blocked = wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "Notify")))
wxPyCBH_callCallback(m_myInst, Py_BuildValue("()"));
wxPyEndBlockThreads(blocked);
if (! found)
wxTimer::Notify();
}
void wxPyTimer::base_Notify() {
wxTimer::Notify();
}
%}
@@ -101,7 +86,7 @@ public:
// override this in your wxTimer-derived class if you want to process timer
// messages in it, use non default ctor or SetOwner() otherwise
//virtual void Notify();
virtual void Notify();
// return True if the timer is running
virtual bool IsRunning() const;

View File

@@ -114,13 +114,9 @@ wxPyMake_TEMPLATE(wxGridTableBase)
if (! found) \
rval = PCLASS::CBNAME(a, b, c); \
return rval; \
} \
wxGridCellAttr *base_##CBNAME(int a, int b, wxGridCellAttr::wxAttrKind c) { \
return PCLASS::CBNAME(a, b, c); \
}
#define PYCALLBACK__GCAINTINT(PCLASS, CBNAME) \
void CBNAME(wxGridCellAttr *attr, int a, int b) { \
wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
@@ -133,9 +129,6 @@ wxPyMake_TEMPLATE(wxGridTableBase)
wxPyEndBlockThreads(blocked); \
if (! found) \
PCLASS::CBNAME(attr, a, b); \
} \
void base_##CBNAME(wxGridCellAttr *attr, int a, int b) { \
PCLASS::CBNAME(attr, a, b); \
}
@@ -152,9 +145,6 @@ wxPyMake_TEMPLATE(wxGridTableBase)
wxPyEndBlockThreads(blocked); \
if (! found) \
PCLASS::CBNAME(attr, val); \
} \
void base_##CBNAME(wxGridCellAttr *attr, int val) { \
PCLASS::CBNAME(attr, val); \
}
@@ -228,9 +218,6 @@ wxPyMake_TEMPLATE(wxGridTableBase)
if (! found) \
rval = PCLASS::CBNAME(a, b); \
return rval; \
} \
wxString base_##CBNAME(int a, int b) { \
return PCLASS::CBNAME(a, b); \
}
@@ -248,9 +235,6 @@ wxPyMake_TEMPLATE(wxGridTableBase)
if (! found) \
rval = PCLASS::CBNAME(a,b,c); \
return rval; \
} \
bool base_##CBNAME(int a, int b, const wxString& c) { \
return PCLASS::CBNAME(a,b,c); \
}
@@ -267,13 +251,9 @@ wxPyMake_TEMPLATE(wxGridTableBase)
if (! found) \
rval = PCLASS::CBNAME(a,b); \
return rval; \
} \
long base_##CBNAME(int a, int b) { \
return PCLASS::CBNAME(a,b); \
}
#define PYCALLBACK_BOOL_INTINT(PCLASS, CBNAME) \
bool CBNAME(int a, int b) { \
bool rval = 0; \
@@ -285,9 +265,6 @@ wxPyMake_TEMPLATE(wxGridTableBase)
if (! found) \
rval = PCLASS::CBNAME(a,b); \
return rval; \
} \
bool base_##CBNAME(int a, int b) { \
return PCLASS::CBNAME(a,b); \
}
@@ -310,9 +287,6 @@ wxPyMake_TEMPLATE(wxGridTableBase)
if (! found) \
rval = PCLASS::CBNAME(a, b); \
return rval; \
} \
double base_##CBNAME(int a, int b) { \
return PCLASS::CBNAME(a, b); \
}
@@ -326,14 +300,10 @@ wxPyMake_TEMPLATE(wxGridTableBase)
wxPyEndBlockThreads(blocked); \
if (! found) \
PCLASS::CBNAME(); \
} \
void base_##CBNAME() { \
PCLASS::CBNAME(); \
}
#define PYCALLBACK_BOOL_SIZETSIZET(PCLASS, CBNAME) \
bool CBNAME(size_t a, size_t b) { \
bool rval = 0; \
@@ -345,9 +315,6 @@ wxPyMake_TEMPLATE(wxGridTableBase)
if (! found) \
rval = PCLASS::CBNAME(a,b); \
return rval; \
} \
bool base_##CBNAME(size_t a, size_t b) { \
return PCLASS::CBNAME(a,b); \
}
@@ -363,9 +330,6 @@ wxPyMake_TEMPLATE(wxGridTableBase)
if (! found) \
rval = PCLASS::CBNAME(a); \
return rval; \
} \
bool base_##CBNAME(size_t a) { \
return PCLASS::CBNAME(a); \
}
@@ -386,9 +350,6 @@ wxPyMake_TEMPLATE(wxGridTableBase)
if (! found) \
rval = PCLASS::CBNAME(a); \
return rval; \
} \
wxString base_##CBNAME(int a) { \
return PCLASS::CBNAME(a); \
}
@@ -404,9 +365,6 @@ wxPyMake_TEMPLATE(wxGridTableBase)
wxPyEndBlockThreads(blocked); \
if (! found) \
PCLASS::CBNAME(a,c); \
} \
void base_##CBNAME(int a, const wxString& c) { \
PCLASS::CBNAME(a,c); \
}
@@ -423,9 +381,6 @@ wxPyMake_TEMPLATE(wxGridTableBase)
if (! found) \
rval = PCLASS::CBNAME(); \
return rval; \
} \
bool base_##CBNAME() { \
return PCLASS::CBNAME(); \
}
@@ -439,9 +394,6 @@ wxPyMake_TEMPLATE(wxGridTableBase)
wxPyEndBlockThreads(blocked); \
if (! found) \
PCLASS::CBNAME(a,b); \
} \
void base_##CBNAME(size_t a, int b) { \
PCLASS::CBNAME(a,b); \
}
@@ -456,9 +408,6 @@ wxPyMake_TEMPLATE(wxGridTableBase)
wxPyEndBlockThreads(blocked); \
if (! found) \
PCLASS::CBNAME(a,b,c); \
} \
void base_##CBNAME(int a, int b, long c) { \
PCLASS::CBNAME(a,b,c); \
}
@@ -473,9 +422,6 @@ wxPyMake_TEMPLATE(wxGridTableBase)
wxPyEndBlockThreads(blocked); \
if (! found) \
PCLASS::CBNAME(a,b,c); \
} \
void base_##CBNAME(int a, int b, double c) { \
PCLASS::CBNAME(a,b,c); \
}
@@ -489,14 +435,10 @@ wxPyMake_TEMPLATE(wxGridTableBase)
wxPyEndBlockThreads(blocked); \
if (! found) \
PCLASS::CBNAME(a,b,c); \
} \
void base_##CBNAME(int a, int b, bool c) { \
PCLASS::CBNAME(a,b,c); \
}
%}
//---------------------------------------------------------------------------
@@ -688,7 +630,8 @@ public:
wxPyGridCellRenderer();
void _setCallbackInfo(PyObject* self, PyObject* _class);
void base_SetParameters(const wxString& params);
void SetParameters(const wxString& params);
%MAKE_BASE_FUNC(PyGridCellRenderer, SetParameters);
};
//---------------------------------------------------------------------------
@@ -878,9 +821,6 @@ public:
if (! found)
wxGridCellEditor::Show(show, attr);
}
void base_Show(bool show, wxGridCellAttr *attr) {
wxGridCellEditor::Show(show, attr);
}
void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr) {
@@ -899,9 +839,6 @@ public:
if (! found)
wxGridCellEditor::PaintBackground(rectCell, attr);
}
void base_PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr) {
wxGridCellEditor::PaintBackground(rectCell, attr);
}
DEC_PYCALLBACK___pure(Reset);
@@ -939,15 +876,25 @@ public:
wxPyGridCellEditor();
void _setCallbackInfo(PyObject* self, PyObject* _class);
void base_SetSize(const wxRect& rect);
void base_Show(bool show, wxGridCellAttr *attr = NULL);
void base_PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr);
bool base_IsAcceptedKey(wxKeyEvent& event);
void base_StartingKey(wxKeyEvent& event);
void base_StartingClick();
void base_HandleReturn(wxKeyEvent& event);
void base_Destroy();
void base_SetParameters(const wxString& params);
void SetSize(const wxRect& rect);
void Show(bool show, wxGridCellAttr *attr = NULL);
void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr);
bool IsAcceptedKey(wxKeyEvent& event);
void StartingKey(wxKeyEvent& event);
void StartingClick();
void HandleReturn(wxKeyEvent& event);
void Destroy();
void SetParameters(const wxString& params);
%MAKE_BASE_FUNC(PyGridCellEditor, SetSize);
%MAKE_BASE_FUNC(PyGridCellEditor, Show);
%MAKE_BASE_FUNC(PyGridCellEditor, PaintBackground);
%MAKE_BASE_FUNC(PyGridCellEditor, IsAcceptedKey);
%MAKE_BASE_FUNC(PyGridCellEditor, StartingKey);
%MAKE_BASE_FUNC(PyGridCellEditor, StartingClick);
%MAKE_BASE_FUNC(PyGridCellEditor, HandleReturn);
%MAKE_BASE_FUNC(PyGridCellEditor, Destroy);
%MAKE_BASE_FUNC(PyGridCellEditor, SetParameters);
};
//---------------------------------------------------------------------------
@@ -1144,11 +1091,16 @@ public:
wxPyGridCellAttrProvider();
void _setCallbackInfo(PyObject* self, PyObject* _class);
wxGridCellAttr *base_GetAttr(int row, int col,
wxGridCellAttr *GetAttr(int row, int col,
wxGridCellAttr::wxAttrKind kind);
void base_SetAttr(wxGridCellAttr *attr, int row, int col);
void base_SetRowAttr(wxGridCellAttr *attr, int row);
void base_SetColAttr(wxGridCellAttr *attr, int col);
void SetAttr(wxGridCellAttr *attr, int row, int col);
void SetRowAttr(wxGridCellAttr *attr, int row);
void SetColAttr(wxGridCellAttr *attr, int col);
%MAKE_BASE_FUNC(PyGridCellAttrProvider, GetAttr);
%MAKE_BASE_FUNC(PyGridCellAttrProvider, SetAttr);
%MAKE_BASE_FUNC(PyGridCellAttrProvider, SetRowAttr);
%MAKE_BASE_FUNC(PyGridCellAttrProvider, SetColAttr);
};
@@ -1367,26 +1319,46 @@ public:
%pythonAppend Destroy "args[0].thisown = 0"
%extend { void Destroy() { delete self; } }
wxString base_GetTypeName( int row, int col );
bool base_CanGetValueAs( int row, int col, const wxString& typeName );
bool base_CanSetValueAs( int row, int col, const wxString& typeName );
void base_Clear();
bool base_InsertRows( size_t pos = 0, size_t numRows = 1 );
bool base_AppendRows( size_t numRows = 1 );
bool base_DeleteRows( size_t pos = 0, size_t numRows = 1 );
bool base_InsertCols( size_t pos = 0, size_t numCols = 1 );
bool base_AppendCols( size_t numCols = 1 );
bool base_DeleteCols( size_t pos = 0, size_t numCols = 1 );
wxString base_GetRowLabelValue( int row );
wxString base_GetColLabelValue( int col );
void base_SetRowLabelValue( int row, const wxString& value );
void base_SetColLabelValue( int col, const wxString& value );
bool base_CanHaveAttributes();
wxGridCellAttr *base_GetAttr( int row, int col,
wxString GetTypeName( int row, int col );
bool CanGetValueAs( int row, int col, const wxString& typeName );
bool CanSetValueAs( int row, int col, const wxString& typeName );
void Clear();
bool InsertRows( size_t pos = 0, size_t numRows = 1 );
bool AppendRows( size_t numRows = 1 );
bool DeleteRows( size_t pos = 0, size_t numRows = 1 );
bool InsertCols( size_t pos = 0, size_t numCols = 1 );
bool AppendCols( size_t numCols = 1 );
bool DeleteCols( size_t pos = 0, size_t numCols = 1 );
wxString GetRowLabelValue( int row );
wxString GetColLabelValue( int col );
void SetRowLabelValue( int row, const wxString& value );
void SetColLabelValue( int col, const wxString& value );
bool CanHaveAttributes();
wxGridCellAttr *GetAttr( int row, int col,
wxGridCellAttr::wxAttrKind kind );
void base_SetAttr(wxGridCellAttr* attr, int row, int col);
void base_SetRowAttr(wxGridCellAttr *attr, int row);
void base_SetColAttr(wxGridCellAttr *attr, int col);
void SetAttr(wxGridCellAttr* attr, int row, int col);
void SetRowAttr(wxGridCellAttr *attr, int row);
void SetColAttr(wxGridCellAttr *attr, int col);
%MAKE_BASE_FUNC(PyGridTableBase, GetTypeName);
%MAKE_BASE_FUNC(PyGridTableBase, CanGetValueAs);
%MAKE_BASE_FUNC(PyGridTableBase, CanSetValueAs);
%MAKE_BASE_FUNC(PyGridTableBase, Clear);
%MAKE_BASE_FUNC(PyGridTableBase, InsertRows);
%MAKE_BASE_FUNC(PyGridTableBase, AppendRows);
%MAKE_BASE_FUNC(PyGridTableBase, DeleteRows);
%MAKE_BASE_FUNC(PyGridTableBase, InsertCols);
%MAKE_BASE_FUNC(PyGridTableBase, AppendCols);
%MAKE_BASE_FUNC(PyGridTableBase, DeleteCols);
%MAKE_BASE_FUNC(PyGridTableBase, GetRowLabelValue);
%MAKE_BASE_FUNC(PyGridTableBase, GetColLabelValue);
%MAKE_BASE_FUNC(PyGridTableBase, SetRowLabelValue);
%MAKE_BASE_FUNC(PyGridTableBase, SetColLabelValue);
%MAKE_BASE_FUNC(PyGridTableBase, CanHaveAttributes);
%MAKE_BASE_FUNC(PyGridTableBase, GetAttr);
%MAKE_BASE_FUNC(PyGridTableBase, SetAttr);
%MAKE_BASE_FUNC(PyGridTableBase, SetRowAttr);
%MAKE_BASE_FUNC(PyGridTableBase, SetColAttr);
};

View File

@@ -177,6 +177,18 @@ int wxPyApp::OnExit() {
}
void wxPyApp::ExitMainLoop() {
bool found;
wxPyBlock_t blocked = wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "ExitMainLoop")))
wxPyCBH_callCallback(m_myInst, Py_BuildValue("()"));
wxPyEndBlockThreads(blocked);
if (! found)
wxApp::ExitMainLoop();
}
#ifdef __WXDEBUG__
void wxPyApp::OnAssert(const wxChar *file,
int line,
@@ -468,6 +480,7 @@ void wxPyApp::_BootstrapApp()
PyObject* method = m_myInst.GetLastFound();
PyObject* argTuple = PyTuple_New(0);
retval = PyEval_CallObject(method, argTuple);
m_myInst.clearRecursionGuard(method);
Py_DECREF(argTuple);
Py_DECREF(method);
if (retval == NULL)
@@ -1717,45 +1730,80 @@ PyObject* PyFindClassWithAttr(PyObject *klass, PyObject *name)
static
PyObject* PyMethod_GetDefiningClass(PyObject* method, const char* name)
PyObject* PyMethod_GetDefiningClass(PyObject* method, PyObject* nameo)
{
PyObject* mgc = PyMethod_GET_CLASS(method);
#if PYTHON_API_VERSION <= 1010 // prior to Python 2.2, the easy way
return mgc;
#else // 2.2 and after, the hard way...
PyObject* nameo = PyString_FromString(name);
PyObject* klass = PyFindClassWithAttr(mgc, nameo);
Py_DECREF(nameo);
return klass;
return PyFindClassWithAttr(mgc, nameo);
#endif
}
// To avoid recursion when an overridden virtual method wants to call the base
// class version, temporarily set an attribute in the instance with the same
// name as the method. Then the PyObject_GetAttr in the next findCallback
// will return this attribute and the PyMethod_Check will fail.
void wxPyCallbackHelper::setRecursionGuard(PyObject* method) const
{
PyFunctionObject* func = (PyFunctionObject*)PyMethod_Function(method);
PyObject_SetAttr(m_self, func->func_name, Py_None);
}
void wxPyCallbackHelper::clearRecursionGuard(PyObject* method) const
{
PyFunctionObject* func = (PyFunctionObject*)PyMethod_Function(method);
if (PyObject_HasAttr(m_self, func->func_name)) {
PyObject_DelAttr(m_self, func->func_name);
}
}
// bool wxPyCallbackHelper::hasRecursionGuard(PyObject* method) const
// {
// PyFunctionObject* func = (PyFunctionObject*)PyMethod_Function(method);
// if (PyObject_HasAttr(m_self, func->func_name)) {
// PyObject* attr = PyObject_GetAttr(m_self, func->func_name);
// bool retval = (attr == Py_None);
// Py_DECREF(attr);
// return retval;
// }
// return false;
// }
bool wxPyCallbackHelper::findCallback(const char* name) const {
wxPyCallbackHelper* self = (wxPyCallbackHelper*)this; // cast away const
PyObject *method, *klass;
PyObject* nameo = PyString_FromString(name);
self->m_lastFound = NULL;
// If the object (m_self) has an attibute of the given name...
if (m_self && PyObject_HasAttrString(m_self, (char*)name)) {
PyObject *method, *klass;
method = PyObject_GetAttrString(m_self, (char*)name);
if (m_self && PyObject_HasAttr(m_self, nameo)) {
method = PyObject_GetAttr(m_self, nameo);
// ...and if that attribute is a method, and if that method's class is
// not from a base class...
// not from the registered class or a base class...
if (PyMethod_Check(method) &&
(klass = PyMethod_GetDefiningClass(method, (char*)name)) != NULL &&
((klass == m_class) || PyObject_IsSubclass(klass, m_class))) {
(klass = PyMethod_GetDefiningClass(method, nameo)) != NULL &&
(klass != m_class) &&
PyObject_IsSubclass(klass, m_class)) {
// ...then we'll save a pointer to the method so callCallback can call it.
// ...then we'll save a pointer to the method so callCallback can
// call it. But first, set a recursion guard in case the
// overridden method wants to call the base class version.
setRecursionGuard(method);
self->m_lastFound = method;
}
else {
Py_DECREF(method);
}
}
Py_DECREF(nameo);
return m_lastFound != NULL;
}
@@ -1784,6 +1832,8 @@ PyObject* wxPyCallbackHelper::callCallbackObj(PyObject* argTuple) const {
PyObject* method = m_lastFound;
result = PyEval_CallObject(method, argTuple);
clearRecursionGuard(method);
Py_DECREF(argTuple);
Py_DECREF(method);
if (!result) {

View File

@@ -50,7 +50,6 @@ MAKE_CONST_WXSTRING2(HtmlPrintingTitleStr, wxT("Printing"))
// TODO: Split this file into multiple %included files that coresponds to the
// wx/html include files (more or less.)
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
%newgroup
@@ -730,7 +729,7 @@ public:
}
void OnLinkClicked(const wxHtmlLinkInfo& link);
void base_OnLinkClicked(const wxHtmlLinkInfo& link);
//- void base_OnLinkClicked(const wxHtmlLinkInfo& link);
wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType type,
const wxString& url,
@@ -760,9 +759,9 @@ void wxPyHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link) {
if (! found)
wxHtmlWindow::OnLinkClicked(link);
}
void wxPyHtmlWindow::base_OnLinkClicked(const wxHtmlLinkInfo& link) {
wxHtmlWindow::OnLinkClicked(link);
}
// void wxPyHtmlWindow::base_OnLinkClicked(const wxHtmlLinkInfo& link) {
// wxHtmlWindow::OnLinkClicked(link);
// }
wxHtmlOpeningStatus wxPyHtmlWindow::OnOpeningURL(wxHtmlURLType type,
@@ -939,12 +938,16 @@ public:
// Converts current page to text:
wxString ToText();
void base_OnLinkClicked(const wxHtmlLinkInfo& link);
void base_OnSetTitle(const wxString& title);
void base_OnCellMouseHover(wxHtmlCell *cell, wxCoord x, wxCoord y);
void base_OnCellClicked(wxHtmlCell *cell,
void OnLinkClicked(const wxHtmlLinkInfo& link);
void OnSetTitle(const wxString& title);
void OnCellMouseHover(wxHtmlCell *cell, wxCoord x, wxCoord y);
void OnCellClicked(wxHtmlCell *cell,
wxCoord x, wxCoord y,
const wxMouseEvent& event);
%MAKE_BASE_FUNC(HtmlWindow, OnLinkClicked);
%MAKE_BASE_FUNC(HtmlWindow, OnSetTitle);
%MAKE_BASE_FUNC(HtmlWindow, OnCellMouseHover);
%MAKE_BASE_FUNC(HtmlWindow, OnCellClicked);
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);

View File

@@ -242,36 +242,64 @@ public:
void _setCallbackInfo(PyObject* self, PyObject* _class);
void base_DoMoveWindow(int x, int y, int width, int height);
void base_DoSetSize(int x, int y, int width, int height,
void DoMoveWindow(int x, int y, int width, int height);
void DoSetSize(int x, int y, int width, int height,
int sizeFlags = wxSIZE_AUTO);
void base_DoSetClientSize(int width, int height);
void base_DoSetVirtualSize( int x, int y );
void DoSetClientSize(int width, int height);
void DoSetVirtualSize( int x, int y );
DocDeclA(
void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const,
"base_DoGetSize() -> (width, height)");
void, DoGetSize( int *OUTPUT, int *OUTPUT ) const,
"DoGetSize() -> (width, height)");
DocDeclA(
void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
"base_DoGetClientSize() -> (width, height)");
void, DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
"DoGetClientSize() -> (width, height)");
DocDeclA(
void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
"base_DoGetPosition() -> (x,y)");
void, DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
"DoGetPosition() -> (x,y)");
wxSize base_DoGetVirtualSize() const;
wxSize base_DoGetBestSize() const;
wxSize DoGetVirtualSize() const;
wxSize DoGetBestSize() const;
void base_InitDialog();
bool base_TransferDataToWindow();
bool base_TransferDataFromWindow();
bool base_Validate();
void InitDialog();
bool TransferDataToWindow();
bool TransferDataFromWindow();
bool Validate();
bool base_AcceptsFocus() const;
bool base_AcceptsFocusFromKeyboard() const;
wxSize base_GetMaxSize() const;
bool AcceptsFocus() const;
bool AcceptsFocusFromKeyboard() const;
wxSize GetMaxSize() const;
void AddChild(wxWindow* child);
void RemoveChild(wxWindow* child);
bool ShouldInheritColours() const;
wxVisualAttributes GetDefaultAttributes();
void OnInternalIdle();
%MAKE_BASE_FUNC(PyWizardPage, DoMoveWindow);
%MAKE_BASE_FUNC(PyWizardPage, DoSetSize);
%MAKE_BASE_FUNC(PyWizardPage, DoSetClientSize);
%MAKE_BASE_FUNC(PyWizardPage, DoSetVirtualSize);
%MAKE_BASE_FUNC(PyWizardPage, DoGetSize);
%MAKE_BASE_FUNC(PyWizardPage, DoGetClientSize);
%MAKE_BASE_FUNC(PyWizardPage, DoGetPosition);
%MAKE_BASE_FUNC(PyWizardPage, DoGetVirtualSize);
%MAKE_BASE_FUNC(PyWizardPage, DoGetBestSize);
%MAKE_BASE_FUNC(PyWizardPage, InitDialog);
%MAKE_BASE_FUNC(PyWizardPage, TransferDataToWindow);
%MAKE_BASE_FUNC(PyWizardPage, TransferDataFromWindow);
%MAKE_BASE_FUNC(PyWizardPage, Validate);
%MAKE_BASE_FUNC(PyWizardPage, AcceptsFocus);
%MAKE_BASE_FUNC(PyWizardPage, AcceptsFocusFromKeyboard);
%MAKE_BASE_FUNC(PyWizardPage, GetMaxSize);
%MAKE_BASE_FUNC(PyWizardPage, AddChild);
%MAKE_BASE_FUNC(PyWizardPage, RemoveChild);
%MAKE_BASE_FUNC(PyWizardPage, ShouldInheritColours);
%MAKE_BASE_FUNC(PyWizardPage, GetDefaultAttributes);
%MAKE_BASE_FUNC(PyWizardPage, OnInternalIdle);
void base_AddChild(wxWindow* child);
void base_RemoveChild(wxWindow* child);
};
//----------------------------------------------------------------------

View File

@@ -135,7 +135,7 @@ def axw_OEB(self, event):
def axw_Cleanup(self):
del self._wnd
#del self._wnd
self.close()
pass

View File

@@ -2896,7 +2896,7 @@ class DocPrintout(wx.Printout):
"""
Not quite sure why this was overridden, but it was in wxWindows! :)
"""
if not wx.Printout.base_OnBeginDocument(self, startPage, endPage):
if not wx.Printout.OnBeginDocument(self, startPage, endPage):
return False
return True

View File

@@ -17,10 +17,18 @@ import wx
import wx.activex
clsID = '{CA8A9780-280D-11CF-A24D-444553540000}'
progID = 'PDF.PdfCtrl.5'
progID = 'AcroPDF.PDF.1'
# Create eventTypes and event binders
wxEVT_Error = wx.activex.RegisterActiveXEvent('OnError')
wxEVT_Message = wx.activex.RegisterActiveXEvent('OnMessage')
EVT_Error = wx.PyEventBinder(wxEVT_Error, 1)
EVT_Message = wx.PyEventBinder(wxEVT_Message, 1)
# Derive a new class from ActiveXWindow
class PDFWindow(wx.activex.ActiveXWindow):
def __init__(self, parent, ID=-1, pos=wx.DefaultPosition,
@@ -30,6 +38,27 @@ class PDFWindow(wx.activex.ActiveXWindow):
ID, pos, size, style, name)
# Methods exported by the ActiveX object
def QueryInterface(self, riid):
return self.CallAXMethod('QueryInterface', riid)
def AddRef(self):
return self.CallAXMethod('AddRef')
def Release(self):
return self.CallAXMethod('Release')
def GetTypeInfoCount(self):
return self.CallAXMethod('GetTypeInfoCount')
def GetTypeInfo(self, itinfo, lcid):
return self.CallAXMethod('GetTypeInfo', itinfo, lcid)
def GetIDsOfNames(self, riid, rgszNames, cNames, lcid):
return self.CallAXMethod('GetIDsOfNames', riid, rgszNames, cNames, lcid)
def Invoke(self, dispidMember, riid, lcid, wFlags, pdispparams):
return self.CallAXMethod('Invoke', dispidMember, riid, lcid, wFlags, pdispparams)
def LoadFile(self, fileName):
return self.CallAXMethod('LoadFile', fileName)
@@ -102,28 +131,120 @@ class PDFWindow(wx.activex.ActiveXWindow):
def setShowScrollbars(self, On):
return self.CallAXMethod('setShowScrollbars', On)
def AboutBox(self):
return self.CallAXMethod('AboutBox')
def GetVersions(self):
return self.CallAXMethod('GetVersions')
def setCurrentHightlight(self, a, b, c, d):
return self.CallAXMethod('setCurrentHightlight', a, b, c, d)
def setCurrentHighlight(self, a, b, c, d):
return self.CallAXMethod('setCurrentHighlight', a, b, c, d)
def postMessage(self, strArray):
return self.CallAXMethod('postMessage', strArray)
# Getters, Setters and properties
def _get_src(self):
return self.GetAXProp('src')
def _set_src(self, src):
self.SetAXProp('src', src)
src = property(_get_src, _set_src)
def _get_messageHandler(self):
return self.GetAXProp('messageHandler')
def _set_messageHandler(self, messageHandler):
self.SetAXProp('messageHandler', messageHandler)
messagehandler = property(_get_messageHandler, _set_messageHandler)
# PROPERTIES
# --------------------
# src
# type:string arg:string canGet:True canSet:True
#
# messagehandler
# type:VT_VARIANT arg:VT_VARIANT canGet:True canSet:True
#
#
#
#
# METHODS
# --------------------
# QueryInterface
# retType: VT_VOID
# params:
# riid
# in:True out:False optional:False type:unsupported type 29
# ppvObj
# in:False out:True optional:False type:unsupported type 26
#
# AddRef
# retType: int
#
# Release
# retType: int
#
# GetTypeInfoCount
# retType: VT_VOID
# params:
# pctinfo
# in:False out:True optional:False type:int
#
# GetTypeInfo
# retType: VT_VOID
# params:
# itinfo
# in:True out:False optional:False type:int
# lcid
# in:True out:False optional:False type:int
# pptinfo
# in:False out:True optional:False type:unsupported type 26
#
# GetIDsOfNames
# retType: VT_VOID
# params:
# riid
# in:True out:False optional:False type:unsupported type 29
# rgszNames
# in:True out:False optional:False type:unsupported type 26
# cNames
# in:True out:False optional:False type:int
# lcid
# in:True out:False optional:False type:int
# rgdispid
# in:False out:True optional:False type:int
#
# Invoke
# retType: VT_VOID
# params:
# dispidMember
# in:True out:False optional:False type:int
# riid
# in:True out:False optional:False type:unsupported type 29
# lcid
# in:True out:False optional:False type:int
# wFlags
# in:True out:False optional:False type:int
# pdispparams
# in:True out:False optional:False type:unsupported type 29
# pvarResult
# in:False out:True optional:False type:VT_VARIANT
# pexcepinfo
# in:False out:True optional:False type:unsupported type 29
# puArgErr
# in:False out:True optional:False type:int
#
# LoadFile
# retType: bool
# params:
# fileName
# in:False out:False optional:False type:string
# in:True out:False optional:False type:string
#
# setShowToolbar
# retType: VT_VOID
# params:
# On
# in:False out:False optional:False type:bool
# in:True out:False optional:False type:bool
#
# gotoFirstPage
# retType: VT_VOID
@@ -141,7 +262,7 @@ class PDFWindow(wx.activex.ActiveXWindow):
# retType: VT_VOID
# params:
# n
# in:False out:False optional:False type:int
# in:True out:False optional:False type:int
#
# goForwardStack
# retType: VT_VOID
@@ -153,19 +274,19 @@ class PDFWindow(wx.activex.ActiveXWindow):
# retType: VT_VOID
# params:
# pageMode
# in:False out:False optional:False type:string
# in:True out:False optional:False type:string
#
# setLayoutMode
# retType: VT_VOID
# params:
# layoutMode
# in:False out:False optional:False type:string
# in:True out:False optional:False type:string
#
# setNamedDest
# retType: VT_VOID
# params:
# namedDest
# in:False out:False optional:False type:string
# in:True out:False optional:False type:string
#
# Print
# retType: VT_VOID
@@ -177,61 +298,61 @@ class PDFWindow(wx.activex.ActiveXWindow):
# retType: VT_VOID
# params:
# percent
# in:False out:False optional:False type:double
# in:True out:False optional:False type:double
#
# setZoomScroll
# retType: VT_VOID
# params:
# percent
# in:False out:False optional:False type:double
# in:True out:False optional:False type:double
# left
# in:False out:False optional:False type:double
# in:True out:False optional:False type:double
# top
# in:False out:False optional:False type:double
# in:True out:False optional:False type:double
#
# setView
# retType: VT_VOID
# params:
# viewMode
# in:False out:False optional:False type:string
# in:True out:False optional:False type:string
#
# setViewScroll
# retType: VT_VOID
# params:
# viewMode
# in:False out:False optional:False type:string
# in:True out:False optional:False type:string
# offset
# in:False out:False optional:False type:double
# in:True out:False optional:False type:double
#
# setViewRect
# retType: VT_VOID
# params:
# left
# in:False out:False optional:False type:double
# in:True out:False optional:False type:double
# top
# in:False out:False optional:False type:double
# in:True out:False optional:False type:double
# width
# in:False out:False optional:False type:double
# in:True out:False optional:False type:double
# height
# in:False out:False optional:False type:double
# in:True out:False optional:False type:double
#
# printPages
# retType: VT_VOID
# params:
# from
# in:False out:False optional:False type:int
# in:True out:False optional:False type:int
# to
# in:False out:False optional:False type:int
# in:True out:False optional:False type:int
#
# printPagesFit
# retType: VT_VOID
# params:
# from
# in:False out:False optional:False type:int
# in:True out:False optional:False type:int
# to
# in:False out:False optional:False type:int
# in:True out:False optional:False type:int
# shrinkToFit
# in:False out:False optional:False type:bool
# in:True out:False optional:False type:bool
#
# printAll
# retType: VT_VOID
@@ -240,22 +361,58 @@ class PDFWindow(wx.activex.ActiveXWindow):
# retType: VT_VOID
# params:
# shrinkToFit
# in:False out:False optional:False type:bool
# in:True out:False optional:False type:bool
#
# setShowScrollbars
# retType: VT_VOID
# params:
# On
# in:False out:False optional:False type:bool
# in:True out:False optional:False type:bool
#
# AboutBox
# GetVersions
# retType: VT_VARIANT
#
# setCurrentHightlight
# retType: VT_VOID
# params:
# a
# in:True out:False optional:False type:int
# b
# in:True out:False optional:False type:int
# c
# in:True out:False optional:False type:int
# d
# in:True out:False optional:False type:int
#
# setCurrentHighlight
# retType: VT_VOID
# params:
# a
# in:True out:False optional:False type:int
# b
# in:True out:False optional:False type:int
# c
# in:True out:False optional:False type:int
# d
# in:True out:False optional:False type:int
#
# postMessage
# retType: VT_VOID
# params:
# strArray
# in:True out:False optional:False type:VT_VARIANT
#
#
#
#
# EVENTS
# --------------------
# Error
# retType: VT_VOID
#
# Message
# retType: VT_VOID
#
#
#
#

View File

@@ -1056,10 +1056,10 @@ class SetPrintout(wx.Printout):
self.end_pg = 1000
def OnBeginDocument(self, start, end):
return self.base_OnBeginDocument(start, end)
return super(SetPrintout, self).OnBeginDocument(start, end)
def OnEndDocument(self):
self.base_OnEndDocument()
super(SetPrintout, self).OnEndDocument()
def HasPage(self, page):
try:
@@ -1079,7 +1079,7 @@ class SetPrintout(wx.Printout):
return (str_pg, end_pg, str_pg, end_pg)
def OnPreparePrinting(self):
self.base_OnPreparePrinting()
super(SetPrintout, self).OnPreparePrinting()
def OnBeginPrinting(self):
dc = self.GetDC()
@@ -1095,7 +1095,7 @@ class SetPrintout(wx.Printout):
scaleY = float(h) / 1000
self.printUserScale = min(scaleX, scaleY)
self.base_OnBeginPrinting()
super(SetPrintout, self).OnBeginPrinting()
def GetSize(self):
self.psizew, self.psizeh = self.GetPPIPrinter()

View File

@@ -65,19 +65,19 @@ class CCellEditor(wx.grid.PyGridCellEditor):
""" Show or hide the edit control. Use the attr (if not None)
to set colors or fonts for the control.
NOTE: There is no need to everride this if you don't need
to do something out of the ordingary.
to do something out of the ordinary.
"""
self.base_Show(show, attr)
super(CCellEditor, self).Show(show, attr)
def PaintBackground(self, rect, attr):
""" 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.
NOTE: There is no need to everride this if you don't need
to do something out of the ordingary.
to do something out of the ordinary.
"""
# Call base class method.
self.base_PaintBackground(self, rect, attr)
super(CCellEditor, self).PaintBackground(self, rect, attr)
def BeginEdit(self, row, col, grid):
""" Fetch the value from the table and prepare edit control to begin editing.
@@ -152,9 +152,9 @@ class CCellEditor(wx.grid.PyGridCellEditor):
def Destroy(self):
""" Final cleanup
NOTE: There is no need to everride this if you don't need
to do something out of the ordingary.
to do something out of the ordinary.
"""
self.base_Destroy()
super(CCellEditor, self).Destroy()
def Clone(self):
""" Create a new object which is the copy of this one. Must Override. """