def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. # In the C++ code the wxFSW_EVENT_UNMOUNT item is only part of the enum # for platforms that have INOTIFY so we need to fake it elsewhere. module.addHeaderCode(""" #include <wx/fswatcher.h> #if !defined(wxHAS_INOTIFY) && !defined(wxHAVE_FSEVENTS_FILE_NOTIFICATIONS) const int wxFSW_EVENT_UNMOUNT = 0x2000; #endif """) c = module.find('wxFileSystemWatcher') assert isinstance(c, etgtools.ClassDef) c = module.find('wxFileSystemWatcherEvent') tools.fixEventClass(c) module.addPyCode("""\ EVT_FSWATCHER = wx.PyEventBinder(wxEVT_FSWATCHER) """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode('#include <wx/sashwin.h>') c = module.find('wxSashWindow') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) c = module.find('wxSashEvent') tools.fixEventClass(c) module.addPyCode("""\ EVT_SASH_DRAGGED = wx.PyEventBinder( wxEVT_SASH_DRAGGED, 1 ) EVT_SASH_DRAGGED_RANGE = wx.PyEventBinder( wxEVT_SASH_DRAGGED, 2 ) """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. c = module.find('wxSpinButton') assert isinstance(c, etgtools.ClassDef) c.addPyMethod('GetRange', '(self)', 'return (self.GetMin(), self.GetMax())') c.addPyMethod('SetMin', '(self, minVal)', 'self.SetRange(minVal, self.GetMax())') c.addPyMethod('SetMax', '(self, maxVal)', 'self.SetRange(self.GetMin(), maxVal)') c.addPyCode("""\ EVT_SPIN_UP = wx.PyEventBinder( wxEVT_SPIN_UP, 1) EVT_SPIN_DOWN = wx.PyEventBinder( wxEVT_SPIN_DOWN, 1) EVT_SPIN = wx.PyEventBinder( wxEVT_SPIN, 1) """) tools.fixWindowClass(c) c = module.find('wxSpinEvent') tools.fixEventClass(c) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. c = module.find('wxAuiToolBar') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) c = module.find('wxAuiToolBarEvent') tools.fixEventClass(c) c.addPyCode("""\ EVT_AUITOOLBAR_TOOL_DROPDOWN = wx.PyEventBinder( wxEVT_AUITOOLBAR_TOOL_DROPDOWN, 1 ) EVT_AUITOOLBAR_OVERFLOW_CLICK = wx.PyEventBinder( wxEVT_AUITOOLBAR_OVERFLOW_CLICK, 1 ) EVT_AUITOOLBAR_RIGHT_CLICK = wx.PyEventBinder( wxEVT_AUITOOLBAR_RIGHT_CLICK, 1 ) EVT_AUITOOLBAR_MIDDLE_CLICK = wx.PyEventBinder( wxEVT_AUITOOLBAR_MIDDLE_CLICK, 1 ) EVT_AUITOOLBAR_BEGIN_DRAG = wx.PyEventBinder( wxEVT_AUITOOLBAR_BEGIN_DRAG, 1 ) """) module.addItem(tools.wxArrayWrapperTemplate( 'wxAuiToolBarItemArray', 'wxAuiToolBarItem', module)) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. c = module.find('wxCalendarEvent') assert isinstance(c, etgtools.ClassDef) tools.fixEventClass(c) c.addPyCode("""\ EVT_CALENDAR = wx.PyEventBinder( wxEVT_CALENDAR_DOUBLECLICKED, 1) EVT_CALENDAR_SEL_CHANGED = wx.PyEventBinder( wxEVT_CALENDAR_SEL_CHANGED, 1) EVT_CALENDAR_WEEKDAY_CLICKED = wx.PyEventBinder( wxEVT_CALENDAR_WEEKDAY_CLICKED, 1) EVT_CALENDAR_PAGE_CHANGED = wx.PyEventBinder( wxEVT_CALENDAR_PAGE_CHANGED, 1) """) # These are deprecated, get rid of them later... c.addPyCode("""\ EVT_CALENDAR_DAY = wx.PyEventBinder( wxEVT_CALENDAR_DAY_CHANGED, 1) EVT_CALENDAR_MONTH = wx.PyEventBinder( wxEVT_CALENDAR_MONTH_CHANGED, 1) EVT_CALENDAR_YEAR = wx.PyEventBinder( wxEVT_CALENDAR_YEAR_CHANGED, 1) """) for name in ['wxEVT_CALENDAR_DAY_CHANGED', 'wxEVT_CALENDAR_MONTH_CHANGED', 'wxEVT_CALENDAR_YEAR_CHANGED']: item = etgtools.GlobalVarDef(name=name, pyName=name, type='wxEventType') module.insertItemAfter(module.find('wxEVT_CALENDAR_WEEK_CLICKED'), item) cc = module.find('wxCalendarCtrl') gcc = tools.copyClassDef(cc, 'wxGenericCalendarCtrl') module.insertItemAfter(cc, gcc) for c in [cc, gcc]: tools.fixWindowClass(c) c.find('GetDateRange.lowerdate').out = True c.find('GetDateRange.upperdate').out = True c.find('HitTest.date').out = True c.find('HitTest.wd').out = True c.find('SetAttr.attr').transfer = True c.addPyCode("""\ {name}.PyGetDate = wx.deprecated({name}.GetDate, 'Use GetDate instead.') {name}.PySetDate = wx.deprecated({name}.SetDate, 'Use SetDate instead.') {name}.PySetDateRange = wx.deprecated({name}.SetDateRange, 'Use SetDateRange instead.') """.format(name=c.name[2:])) cc.find('EnableYearChange').ignore() gcc.addHeaderCode("#include <wx/generic/calctrlg.h>") module.addGlobalStr('wxCalendarNameStr', cc) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) module.addHeaderCode('#include "wx/mediactrl.h"') #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. c = module.find('wxMediaCtrl') c.addPrivateCopyCtor() c.find('wxMediaCtrl.id').default = '-1' c.find('Create.id').default = '-1' # the C++ class has three overloaded Load(...) methods # for now we ignore all than the first one for loading a filename for item in c.findAll("Load"): if not "fileName" in item.argsString: # ignore e.g. the Load with args '(const wxURI &uri)' # keep e.g. '(const wxString &fileName)' item.ignore() # Transplant the docstrings from the ignored Load methods into the # appropriate compatibility method if 'proxy' in item.argsString: m = c.find('LoadURIWithProxy') else: m = c.find('LoadURI') m.briefDoc = item.briefDoc m.detailedDoc = item.detailedDoc c = module.find('wxMediaEvent') tools.fixEventClass(c) module.addPyCode("""\ EVT_MEDIA_LOADED = wx.PyEventBinder( wxEVT_MEDIA_LOADED ) EVT_MEDIA_STOP = wx.PyEventBinder( wxEVT_MEDIA_STOP ) EVT_MEDIA_FINISHED = wx.PyEventBinder( wxEVT_MEDIA_FINISHED ) EVT_MEDIA_STATECHANGED = wx.PyEventBinder( wxEVT_MEDIA_STATECHANGED ) EVT_MEDIA_PLAY = wx.PyEventBinder( wxEVT_MEDIA_PLAY ) EVT_MEDIA_PAUSE = wx.PyEventBinder( wxEVT_MEDIA_PAUSE ) """) # See mediactrl.h: module.addPyCode("""\ MEDIABACKEND_DIRECTSHOW = "wxAMMediaBackend" MEDIABACKEND_MCI = "wxMCIMediaBackend" MEDIABACKEND_QUICKTIME = "wxQTMediaBackend" MEDIABACKEND_GSTREAMER = "wxGStreamerMediaBackend" MEDIABACKEND_REALPLAYER = "wxRealPlayerMediaBackend" MEDIABACKEND_WMP10 = "wxWMP10MediaBackend" """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. c = module.find('wxHtmlWindow') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) c.bases = ['wxScrolledWindow'] c.find('OnCellClicked').ignore(False) c.find('OnCellMouseHover').ignore(False) for name in ['SetDefaultHTMLCursor', 'GetDefaultHTMLCursor']: c.find(name).find('type').type = 'wxHtmlWindowInterface::HTMLCursor' tools.fixHtmlSetFonts(c) # Pure virtuals inherited from wxHtmlWindowInterface c.addItem(etgtools.WigCode("""\ virtual void SetHTMLWindowTitle(const wxString& title); virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link); virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type, const wxString& url, wxString *redirect) const; virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell, const wxPoint& pos) const; virtual wxWindow* GetHTMLWindow(); virtual wxColour GetHTMLBackgroundColour() const; virtual void SetHTMLBackgroundColour(const wxColour& clr); virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg); virtual void SetHTMLStatusText(const wxString& text); virtual wxCursor GetHTMLCursor(wxHtmlWindowInterface::HTMLCursor type) const; """)) c = module.find('wxHtmlLinkEvent') tools.fixEventClass(c) c = module.find('wxHtmlCellEvent') tools.fixEventClass(c) module.addPyCode("""\ EVT_HTML_CELL_CLICKED = wx.PyEventBinder( wxEVT_HTML_CELL_CLICKED, 1 ) EVT_HTML_CELL_HOVER = wx.PyEventBinder( wxEVT_HTML_CELL_HOVER, 1 ) EVT_HTML_LINK_CLICKED = wx.PyEventBinder( wxEVT_HTML_LINK_CLICKED, 1 ) # deprecated wxEVT aliases wxEVT_COMMAND_HTML_CELL_CLICKED = wxEVT_HTML_CELL_CLICKED wxEVT_COMMAND_HTML_CELL_HOVER = wxEVT_HTML_CELL_HOVER wxEVT_COMMAND_HTML_LINK_CLICKED = wxEVT_HTML_LINK_CLICKED """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode('#include <wx/ribbon/panel.h>') c = module.find('wxRibbonPanel') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) tools.ignoreConstOverloads(c) c = module.find('wxRibbonPanelEvent') tools.fixEventClass(c) module.addPyCode("""\ EVT_RIBBONPANEL_EXTBUTTON_ACTIVATED = wx.PyEventBinder(wxEVT_RIBBONPANEL_EXTBUTTON_ACTIVATED, 1) """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode(""" #include <wx/fswatcher.h> #ifndef wxHAS_INOTIFY #define wxFSW_EVENT_UNMOUNT 0x2000 #endif """) c = module.find('wxFileSystemWatcher') assert isinstance(c, etgtools.ClassDef) c = module.find('wxFileSystemWatcherEvent') tools.fixEventClass(c) c.addPyCode("""\ EVT_FSWATCHER = wx.PyEventBinder(wxEVT_FSWATCHER) """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode("#include <wx/dateevt.h>") c = module.find('wxDateEvent') assert isinstance(c, etgtools.ClassDef) tools.fixEventClass(c) module.addPyCode("""\ EVT_DATE_CHANGED = wx.PyEventBinder( wxEVT_DATE_CHANGED, 1 ) EVT_TIME_CHANGED = wx.PyEventBinder( wxEVT_TIME_CHANGED, 1 ) """) c.addPyMethod('PyGetDate', '(self)', doc="Return the date as a Python datetime.date object.", body="return wx.wxdate2pydate(self.GetDate())", deprecated="Use GetDate instead.") c.addPyCode("""\ DateEvent.PySetDate = wx.deprecated(DateEvent.SetDate, 'Use SetDate instead.') """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode('#include <wx/laywin.h>') c = module.find('wxSashLayoutWindow') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) c = module.find('wxQueryLayoutInfoEvent') tools.fixEventClass(c) c = module.find('wxCalculateLayoutEvent') tools.fixEventClass(c) module.addPyCode("""\ EVT_QUERY_LAYOUT_INFO = wx.PyEventBinder( wxEVT_QUERY_LAYOUT_INFO ) EVT_CALCULATE_LAYOUT = wx.PyEventBinder( wxEVT_CALCULATE_LAYOUT ) """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode("#include <wx/dateevt.h>") c = module.find('wxDateEvent') assert isinstance(c, etgtools.ClassDef) tools.fixEventClass(c) c.addPyCode("""\ EVT_DATE_CHANGED = wx.PyEventBinder( wxEVT_DATE_CHANGED, 1 ) EVT_TIME_CHANGED = wx.PyEventBinder( wxEVT_TIME_CHANGED, 1 ) """) c.addPyCode("""\ DateEvent.PyGetDate = wx.deprecated(DateEvent.GetDate, 'Use GetDate instead.') DateEvent.PySetDate = wx.deprecated(DateEvent.SetDate, 'Use SetDate instead.') """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode("#include <wx/colordlg.h>") c = module.find('wxColourDialog') assert isinstance(c, etgtools.ClassDef) tools.fixTopLevelWindowClass(c) c = module.find('wxGetColourFromUser') c.mustHaveApp() c = module.find('wxColourDialogEvent') tools.fixEventClass(c) module.addPyCode("""\ EVT_COLOUR_CHANGED = PyEventBinder(wxEVT_COLOUR_CHANGED, 1) """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. c = module.find('wxWizardPage') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c, False) module.addPyCode("PyWizardPage = wx.deprecated(WizardPage, 'Use WizardPage instead.')") c = module.find('wxWizardPageSimple') tools.fixWindowClass(c, False) c.addItem(etgtools.WigCode("""\ virtual wxWizardPage* GetNext() const; virtual wxWizardPage* GetPrev() const; """)) c = module.find('wxWizard') tools.fixWindowClass(c, False) # ShowPage is undocumented and labeled "implementation only" but it seems # too useful to ignore, so add a MethodDef for it here. m = MethodDef(name='ShowPage', type='bool', isVirtual=True, briefDoc="Show the given wizard page.", detailedDoc=["""\ Calls TransferDataFromWindow on the current page first, and returns false without changing the page if it returned false. Returns True/False to indicate if the page was actually changed."""], items=[ParamDef(name='page', type='wxWizardPage*'), ParamDef(name='goingForward', type='bool', default='true')]) c.addItem(m) # Same for IsRunning m = MethodDef(name='IsRunning', type='bool', isConst=True) c.addItem(m) c = module.find('wxWizardEvent') tools.fixEventClass(c) module.addPyCode("""\ EVT_WIZARD_BEFORE_PAGE_CHANGED = wx.PyEventBinder( wxEVT_WIZARD_BEFORE_PAGE_CHANGED, 1) EVT_WIZARD_PAGE_CHANGED = wx.PyEventBinder( wxEVT_WIZARD_PAGE_CHANGED, 1) EVT_WIZARD_PAGE_CHANGING = wx.PyEventBinder( wxEVT_WIZARD_PAGE_CHANGING, 1) EVT_WIZARD_CANCEL = wx.PyEventBinder( wxEVT_WIZARD_CANCEL, 1) EVT_WIZARD_HELP = wx.PyEventBinder( wxEVT_WIZARD_HELP, 1) EVT_WIZARD_FINISHED = wx.PyEventBinder( wxEVT_WIZARD_FINISHED, 1) EVT_WIZARD_PAGE_SHOWN = wx.PyEventBinder( wxEVT_WIZARD_PAGE_SHOWN, 1) """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. c = module.find('wxAuiToolBar') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) c = module.find('wxAuiToolBarEvent') tools.fixEventClass(c) module.addPyCode("""\ EVT_AUITOOLBAR_TOOL_DROPDOWN = wx.PyEventBinder( wxEVT_AUITOOLBAR_TOOL_DROPDOWN, 1 ) EVT_AUITOOLBAR_OVERFLOW_CLICK = wx.PyEventBinder( wxEVT_AUITOOLBAR_OVERFLOW_CLICK, 1 ) EVT_AUITOOLBAR_RIGHT_CLICK = wx.PyEventBinder( wxEVT_AUITOOLBAR_RIGHT_CLICK, 1 ) EVT_AUITOOLBAR_MIDDLE_CLICK = wx.PyEventBinder( wxEVT_AUITOOLBAR_MIDDLE_CLICK, 1 ) EVT_AUITOOLBAR_BEGIN_DRAG = wx.PyEventBinder( wxEVT_AUITOOLBAR_BEGIN_DRAG, 1 ) """) module.addItem( tools.wxArrayWrapperTemplate('wxAuiToolBarItemArray', 'wxAuiToolBarItem', module)) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode("#include <wx/hyperlink.h>") c = module.find('wxHyperlinkEvent') assert isinstance(c, etgtools.ClassDef) tools.fixEventClass(c) c.addPyCode("""\ EVT_HYPERLINK = wx.PyEventBinder( wxEVT_HYPERLINK, 1 ) # deprecated wxEVT alias wxEVT_COMMAND_HYPERLINK = wxEVT_HYPERLINK """) c = module.find('wxHyperlinkCtrl') tools.fixWindowClass(c) c.find('wxHyperlinkCtrl.label').default = 'wxEmptyString' c.find('wxHyperlinkCtrl.url').default = 'wxEmptyString' c.find('Create.label').default = 'wxEmptyString' c.find('Create.url').default = 'wxEmptyString' module.addGlobalStr('wxHyperlinkCtrlNameStr', c) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. c = module.find('wxFindDialogEvent') assert isinstance(c, etgtools.ClassDef) tools.fixEventClass(c) module.addPyCode("""\ EVT_FIND = wx.PyEventBinder( wxEVT_FIND, 1 ) EVT_FIND_NEXT = wx.PyEventBinder( wxEVT_FIND_NEXT, 1 ) EVT_FIND_REPLACE = wx.PyEventBinder( wxEVT_FIND_REPLACE, 1 ) EVT_FIND_REPLACE_ALL = wx.PyEventBinder( wxEVT_FIND_REPLACE_ALL, 1 ) EVT_FIND_CLOSE = wx.PyEventBinder( wxEVT_FIND_CLOSE, 1 ) # deprecated wxEVT aliases wxEVT_COMMAND_FIND = wxEVT_FIND wxEVT_COMMAND_FIND_NEXT = wxEVT_FIND_NEXT wxEVT_COMMAND_FIND_REPLACE = wxEVT_FIND_REPLACE wxEVT_COMMAND_FIND_REPLACE_ALL = wxEVT_FIND_REPLACE_ALL wxEVT_COMMAND_FIND_CLOSE = wxEVT_FIND_CLOSE """) c = module.find('wxFindReplaceDialog') tools.fixTopLevelWindowClass(c) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode('#include <wx/filectrl.h>') c = module.find('wxFileCtrl') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) module.addGlobalStr('wxFileCtrlNameStr', c) c.find('GetFilenames').ignore() c.addCppMethod('wxArrayString*', 'GetFilenames', '()', doc="""\ Returns a list of filenames selected in the control. This function should only be used with controls which have the wx.FC_MULTIPLE style, use GetFilename for the others.""", body="""\ wxArrayString* arr = new wxArrayString; self->GetFilenames(*arr); return arr;""", factory=True) c.find('GetPaths').ignore() c.addCppMethod('wxArrayString*', 'GetPaths', '()', doc="""\ Returns a list of the full paths (directory and filename) of the files chosen. This function should only be used with controlss which have the wx.FC_MULTIPLE style, use GetPath for the others. """, body="""\ wxArrayString* arr = new wxArrayString; self->GetPaths(*arr); return arr;""", factory=True) c = module.find('wxFileCtrlEvent') tools.fixEventClass(c) c.addPyCode("""\ EVT_FILECTRL_SELECTIONCHANGED = wx.PyEventBinder( wxEVT_FILECTRL_SELECTIONCHANGED, 1) EVT_FILECTRL_FILEACTIVATED = wx.PyEventBinder( wxEVT_FILECTRL_FILEACTIVATED, 1) EVT_FILECTRL_FOLDERCHANGED = wx.PyEventBinder( wxEVT_FILECTRL_FOLDERCHANGED, 1) EVT_FILECTRL_FILTERCHANGED = wx.PyEventBinder( wxEVT_FILECTRL_FILTERCHANGED, 1) """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. c = module.find('wxHtmlWindow') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) c.bases = ['wxScrolledWindow'] c.find('OnCellClicked').ignore(False) c.find('OnCellMouseHover').ignore(False) c.find('AddFilter.filter').transfer = True tools.fixHtmlSetFonts(c) # Pure virtuals inherited from wxHtmlWindowInterface c.addItem(etgtools.WigCode("""\ virtual void SetHTMLWindowTitle(const wxString& title); virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link); virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type, const wxString& url, wxString *redirect) const; virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell, const wxPoint& pos) const; virtual wxWindow* GetHTMLWindow(); virtual wxColour GetHTMLBackgroundColour() const; virtual void SetHTMLBackgroundColour(const wxColour& clr); virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg); virtual void SetHTMLStatusText(const wxString& text); virtual wxCursor GetHTMLCursor(wxHtmlWindowInterface::HTMLCursor type) const; """)) c = module.find('wxHtmlLinkEvent') tools.fixEventClass(c) c = module.find('wxHtmlCellEvent') tools.fixEventClass(c) module.addPyCode("""\ EVT_HTML_CELL_CLICKED = wx.PyEventBinder( wxEVT_HTML_CELL_CLICKED, 1 ) EVT_HTML_CELL_HOVER = wx.PyEventBinder( wxEVT_HTML_CELL_HOVER, 1 ) EVT_HTML_LINK_CLICKED = wx.PyEventBinder( wxEVT_HTML_LINK_CLICKED, 1 ) # deprecated wxEVT aliases wxEVT_COMMAND_HTML_CELL_CLICKED = wxEVT_HTML_CELL_CLICKED wxEVT_COMMAND_HTML_CELL_HOVER = wxEVT_HTML_CELL_HOVER wxEVT_COMMAND_HTML_LINK_CLICKED = wxEVT_HTML_LINK_CLICKED """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. c = module.find('wxAuiManager') assert isinstance(c, etgtools.ClassDef) c.find('ProcessDockResult').ignore(False) c = module.find('wxAuiPaneInfo') module.addItem( tools.wxArrayWrapperTemplate('wxAuiPaneInfoArray', 'wxAuiPaneInfo', module)) c = module.find('wxAuiManagerEvent') tools.fixEventClass(c) module.addPyCode("""\ EVT_AUI_PANE_BUTTON = wx.PyEventBinder( wxEVT_AUI_PANE_BUTTON ) EVT_AUI_PANE_CLOSE = wx.PyEventBinder( wxEVT_AUI_PANE_CLOSE ) EVT_AUI_PANE_MAXIMIZE = wx.PyEventBinder( wxEVT_AUI_PANE_MAXIMIZE ) EVT_AUI_PANE_RESTORE = wx.PyEventBinder( wxEVT_AUI_PANE_RESTORE ) EVT_AUI_PANE_ACTIVATED = wx.PyEventBinder( wxEVT_AUI_PANE_ACTIVATED ) EVT_AUI_RENDER = wx.PyEventBinder( wxEVT_AUI_RENDER ) EVT_AUI_FIND_MANAGER = wx.PyEventBinder( wxEVT_AUI_FIND_MANAGER ) """) module.addItem( tools.wxArrayWrapperTemplate('wxAuiDockInfoArray', 'wxAuiDockInfo', module)) module.addItem( tools.wxArrayWrapperTemplate('wxAuiDockUIPartArray', 'wxAuiDockUIPart', module)) module.addItem( tools.wxArrayWrapperTemplate('wxAuiPaneButtonArray', 'wxAuiPaneButton', module)) module.addItem( tools.wxArrayWrapperTemplate('wxAuiPaneInfoPtrArray', 'wxAuiPaneInfo', module, itemIsPtr=True)) module.addItem( tools.wxArrayWrapperTemplate('wxAuiDockInfoPtrArray', 'wxAuiDockInfo', module, itemIsPtr=True)) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode('#include <wx/power.h>') module.addHeaderCode("""\ #ifndef wxHAS_POWER_EVENTS // Dummy class and other definitions for platforms that don't have power events class wxPowerEvent : public wxEvent { public: wxPowerEvent() {} wxPowerEvent(wxEventType evtType) : wxEvent(wxID_NONE, evtType) {} void Veto() {} bool IsVetoed() const { return false; } virtual wxEvent *Clone() const { return new wxPowerEvent(*this); } }; enum { wxEVT_POWER_SUSPENDING, wxEVT_POWER_SUSPENDED, wxEVT_POWER_SUSPEND_CANCEL, wxEVT_POWER_RESUME, }; #endif """) c = module.find('wxPowerEvent') assert isinstance(c, etgtools.ClassDef) tools.fixEventClass(c) module.addPyCode("""\ EVT_POWER_SUSPENDING = wx.PyEventBinder( wxEVT_POWER_SUSPENDING , 1 ) EVT_POWER_SUSPENDED = wx.PyEventBinder( wxEVT_POWER_SUSPENDED , 1 ) EVT_POWER_SUSPEND_CANCEL = wx.PyEventBinder( wxEVT_POWER_SUSPEND_CANCEL , 1 ) EVT_POWER_RESUME = wx.PyEventBinder( wxEVT_POWER_RESUME , 1 ) """) c = module.find('wxPowerResourceBlocker') c.addPrivateCopyCtor() c.addPrivateAssignOp() # add context manager methods c.addPyMethod('__enter__', '(self)', 'return self') c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'pass') #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. c = module.find('wxAuiManager') assert isinstance(c, etgtools.ClassDef) c.find('ProcessDockResult').ignore(False) c = module.find('wxAuiPaneInfo') module.addItem( tools.wxArrayWrapperTemplate( 'wxAuiPaneInfoArray', 'wxAuiPaneInfo', module)) c = module.find('wxAuiManagerEvent') tools.fixEventClass(c) c.addPyCode("""\ EVT_AUI_PANE_BUTTON = wx.PyEventBinder( wxEVT_AUI_PANE_BUTTON ) EVT_AUI_PANE_CLOSE = wx.PyEventBinder( wxEVT_AUI_PANE_CLOSE ) EVT_AUI_PANE_MAXIMIZE = wx.PyEventBinder( wxEVT_AUI_PANE_MAXIMIZE ) EVT_AUI_PANE_RESTORE = wx.PyEventBinder( wxEVT_AUI_PANE_RESTORE ) EVT_AUI_PANE_ACTIVATED = wx.PyEventBinder( wxEVT_AUI_PANE_ACTIVATED ) EVT_AUI_RENDER = wx.PyEventBinder( wxEVT_AUI_RENDER ) EVT_AUI_FIND_MANAGER = wx.PyEventBinder( wxEVT_AUI_FIND_MANAGER ) """) module.addItem(tools.wxArrayWrapperTemplate( 'wxAuiDockInfoArray', 'wxAuiDockInfo', module)) module.addItem(tools.wxArrayWrapperTemplate( 'wxAuiDockUIPartArray', 'wxAuiDockUIPart', module)) module.addItem(tools.wxArrayWrapperTemplate( 'wxAuiPaneButtonArray', 'wxAuiPaneButton', module)) module.addItem(tools.wxArrayWrapperTemplate( 'wxAuiPaneInfoPtrArray', 'wxAuiPaneInfo', module, itemIsPtr=True)) module.addItem(tools.wxArrayWrapperTemplate( 'wxAuiDockInfoPtrArray', 'wxAuiDockInfo', module, itemIsPtr=True)) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. c = module.find('wxAuiNotebook') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) tools.fixBookctrlClass(c) c = module.find('wxAuiTabContainer') tools.ignoreConstOverloads(c) module.addItem(tools.wxArrayWrapperTemplate( 'wxAuiNotebookPageArray', 'wxAuiNotebookPage', module)) module.addItem(tools.wxArrayWrapperTemplate( 'wxAuiTabContainerButtonArray', 'wxAuiTabContainerButton', module)) c = module.find('wxAuiTabArt') c.abstract = True c = module.find('wxAuiNotebookEvent') tools.fixEventClass(c) c.addPyCode("""\ EVT_AUINOTEBOOK_PAGE_CLOSE = wx.PyEventBinder( wxEVT_AUINOTEBOOK_PAGE_CLOSE, 1 ) EVT_AUINOTEBOOK_PAGE_CLOSED = wx.PyEventBinder( wxEVT_AUINOTEBOOK_PAGE_CLOSED, 1 ) EVT_AUINOTEBOOK_PAGE_CHANGED = wx.PyEventBinder( wxEVT_AUINOTEBOOK_PAGE_CHANGED, 1 ) EVT_AUINOTEBOOK_PAGE_CHANGING = wx.PyEventBinder( wxEVT_AUINOTEBOOK_PAGE_CHANGING, 1 ) EVT_AUINOTEBOOK_BUTTON = wx.PyEventBinder( wxEVT_AUINOTEBOOK_BUTTON, 1 ) EVT_AUINOTEBOOK_BEGIN_DRAG = wx.PyEventBinder( wxEVT_AUINOTEBOOK_BEGIN_DRAG, 1 ) EVT_AUINOTEBOOK_END_DRAG = wx.PyEventBinder( wxEVT_AUINOTEBOOK_END_DRAG, 1 ) EVT_AUINOTEBOOK_DRAG_MOTION = wx.PyEventBinder( wxEVT_AUINOTEBOOK_DRAG_MOTION, 1 ) EVT_AUINOTEBOOK_ALLOW_DND = wx.PyEventBinder( wxEVT_AUINOTEBOOK_ALLOW_DND, 1 ) EVT_AUINOTEBOOK_DRAG_DONE = wx.PyEventBinder( wxEVT_AUINOTEBOOK_DRAG_DONE, 1 ) EVT_AUINOTEBOOK_TAB_MIDDLE_DOWN = wx.PyEventBinder( wxEVT_AUINOTEBOOK_TAB_MIDDLE_DOWN, 1 ) EVT_AUINOTEBOOK_TAB_MIDDLE_UP = wx.PyEventBinder( wxEVT_AUINOTEBOOK_TAB_MIDDLE_UP, 1 ) EVT_AUINOTEBOOK_TAB_RIGHT_DOWN = wx.PyEventBinder( wxEVT_AUINOTEBOOK_TAB_RIGHT_DOWN, 1 ) EVT_AUINOTEBOOK_TAB_RIGHT_UP = wx.PyEventBinder( wxEVT_AUINOTEBOOK_TAB_RIGHT_UP, 1 ) EVT_AUINOTEBOOK_BG_DCLICK = wx.PyEventBinder( wxEVT_AUINOTEBOOK_BG_DCLICK, 1 ) """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. c = module.find('wxAuiNotebook') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) tools.fixBookctrlClass(c) c = module.find('wxAuiTabContainer') tools.ignoreConstOverloads(c) module.addItem( tools.wxArrayWrapperTemplate('wxAuiNotebookPageArray', 'wxAuiNotebookPage', module)) module.addItem( tools.wxArrayWrapperTemplate('wxAuiTabContainerButtonArray', 'wxAuiTabContainerButton', module)) c = module.find('wxAuiTabArt') c.abstract = True c = module.find('wxAuiNotebookEvent') tools.fixEventClass(c) module.addPyCode("""\ EVT_AUINOTEBOOK_PAGE_CLOSE = wx.PyEventBinder( wxEVT_AUINOTEBOOK_PAGE_CLOSE, 1 ) EVT_AUINOTEBOOK_PAGE_CLOSED = wx.PyEventBinder( wxEVT_AUINOTEBOOK_PAGE_CLOSED, 1 ) EVT_AUINOTEBOOK_PAGE_CHANGED = wx.PyEventBinder( wxEVT_AUINOTEBOOK_PAGE_CHANGED, 1 ) EVT_AUINOTEBOOK_PAGE_CHANGING = wx.PyEventBinder( wxEVT_AUINOTEBOOK_PAGE_CHANGING, 1 ) EVT_AUINOTEBOOK_BUTTON = wx.PyEventBinder( wxEVT_AUINOTEBOOK_BUTTON, 1 ) EVT_AUINOTEBOOK_BEGIN_DRAG = wx.PyEventBinder( wxEVT_AUINOTEBOOK_BEGIN_DRAG, 1 ) EVT_AUINOTEBOOK_END_DRAG = wx.PyEventBinder( wxEVT_AUINOTEBOOK_END_DRAG, 1 ) EVT_AUINOTEBOOK_DRAG_MOTION = wx.PyEventBinder( wxEVT_AUINOTEBOOK_DRAG_MOTION, 1 ) EVT_AUINOTEBOOK_ALLOW_DND = wx.PyEventBinder( wxEVT_AUINOTEBOOK_ALLOW_DND, 1 ) EVT_AUINOTEBOOK_DRAG_DONE = wx.PyEventBinder( wxEVT_AUINOTEBOOK_DRAG_DONE, 1 ) EVT_AUINOTEBOOK_TAB_MIDDLE_DOWN = wx.PyEventBinder( wxEVT_AUINOTEBOOK_TAB_MIDDLE_DOWN, 1 ) EVT_AUINOTEBOOK_TAB_MIDDLE_UP = wx.PyEventBinder( wxEVT_AUINOTEBOOK_TAB_MIDDLE_UP, 1 ) EVT_AUINOTEBOOK_TAB_RIGHT_DOWN = wx.PyEventBinder( wxEVT_AUINOTEBOOK_TAB_RIGHT_DOWN, 1 ) EVT_AUINOTEBOOK_TAB_RIGHT_UP = wx.PyEventBinder( wxEVT_AUINOTEBOOK_TAB_RIGHT_UP, 1 ) EVT_AUINOTEBOOK_BG_DCLICK = wx.PyEventBinder( wxEVT_AUINOTEBOOK_BG_DCLICK, 1 ) """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode('#include <wx/ribbon/gallery.h>') module.insertItem( 0, etgtools.WigCode("""\ // forward declarations class wxRibbonGalleryItem; """)) c = module.find('wxRibbonGallery') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) # Ignore the methods setting and fetching client data as a void*. We have # a mapped type for the wxClientData alternatives that work well and are # hack free. c.find('Append').findOverload('void *').ignore() c.find('SetItemClientData').ignore() c.find('GetItemClientData').ignore() # Methods assigning wxClientData objects need to transfer ownership c.find('SetItemClientObject.data').transfer = True c.find('Append').findOverload('wxClientData').find( 'clientData').transfer = True # And let's change the names of the "Object" version of the methods c.find('SetItemClientObject').pyName = 'SetItemClientData' c.find('GetItemClientObject').pyName = 'GetItemClientData' c = module.find('wxRibbonGalleryEvent') tools.fixEventClass(c) module.addPyCode("""\ EVT_RIBBONGALLERY_HOVER_CHANGED = wx.PyEventBinder( wxEVT_RIBBONGALLERY_HOVER_CHANGED, 1 ) EVT_RIBBONGALLERY_SELECTED = wx.PyEventBinder( wxEVT_RIBBONGALLERY_SELECTED, 1 ) EVT_RIBBONGALLERY_CLICKED = wx.PyEventBinder( wxEVT_RIBBONGALLERY_CLICKED, 1 ) """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. c = module.find('wxFileSystemWatcherEvent') assert isinstance(c, etgtools.ClassDef) c.addItem( etgtools.MethodDef(name='Clone', type='wxEvent*', argsString='() const', isConst=True, isVirtual=True)) tools.generateStubs('wxUSE_FSWATCHER', module, extraHdrCode='static wxFileName _NullFileName;\n', typeValMap={ 'const wxFileName &': '_NullFileName', 'wxFSWWarningType': 'wxFSW_WARNING_NONE' }) # In the C++ code the wxFSW_EVENT_UNMOUNT item is only part of the enum # for platforms that have INOTIFY so we need to fake it elsewhere. module.addHeaderCode(""" #include <wx/fswatcher.h> #if wxUSE_FSWATCHER && !defined(wxHAS_INOTIFY) && !defined(wxHAVE_FSEVENTS_FILE_NOTIFICATIONS) const int wxFSW_EVENT_UNMOUNT = 0x2000; #endif """) c = module.find('wxFileSystemWatcher') assert isinstance(c, etgtools.ClassDef) c = module.find('wxFileSystemWatcherEvent') tools.fixEventClass(c) module.addPyCode("""\ EVT_FSWATCHER = wx.PyEventBinder(wxEVT_FSWATCHER) """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode("#include <wx/spinctrl.h>") c = module.find('wxSpinCtrl') assert isinstance(c, etgtools.ClassDef) c.addPyMethod('GetRange', '(self)', 'return (self.GetMin(), self.GetMax())') c.addPyMethod('SetMin', '(self, minVal)', 'self.SetRange(minVal, self.GetMax())') c.addPyMethod('SetMax', '(self, maxVal)', 'self.SetRange(self.GetMin(), maxVal)') c.find('SetSelection.from').name = 'from_' c.find('SetSelection.to').name = 'to_' tools.fixWindowClass(c) c = module.find('wxSpinCtrlDouble') c.addPyMethod('GetRange', '(self)', 'return (self.GetMin(), self.GetMax())') c.addPyMethod('SetMin', '(self, minVal)', 'self.SetRange(minVal, self.GetMax())') c.addPyMethod('SetMax', '(self, maxVal)', 'self.SetRange(self.GetMin(), maxVal)') tools.fixWindowClass(c) c = module.find('wxSpinDoubleEvent') tools.fixEventClass(c) module.addPyCode("""\ EVT_SPINCTRL = wx.PyEventBinder( wxEVT_SPINCTRL, 1) EVT_SPINCTRLDOUBLE = wx.PyEventBinder( wxEVT_SPINCTRLDOUBLE, 1) # deprecated wxEVT aliases wxEVT_COMMAND_SPINCTRL_UPDATED = wxEVT_SPINCTRL wxEVT_COMMAND_SPINCTRLDOUBLE_UPDATED = wxEVT_SPINCTRLDOUBLE """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode('#include <wx/ribbon/gallery.h>') module.insertItem(0, etgtools.WigCode("""\ // forward declarations class wxRibbonGalleryItem; """)) c = module.find('wxRibbonGallery') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) # Ignore the methods setting and fetching client data as a void*. We have # a mapped type for the wxClientData alternatives that work well and are # hack free. c.find('Append').findOverload('void *').ignore() c.find('SetItemClientData').ignore() c.find('GetItemClientData').ignore() # Methods assigning wxClientData objects need to transfer ownership c.find('SetItemClientObject.data').transfer = True c.find('Append').findOverload('wxClientData').find('clientData').transfer = True # And let's change the names of the "Object" version of the methods c.find('SetItemClientObject').pyName = 'SetItemClientData' c.find('GetItemClientObject').pyName = 'GetItemClientData' c = module.find('wxRibbonGalleryEvent') tools.fixEventClass(c) c.addPyCode("""\ EVT_RIBBONGALLERY_HOVER_CHANGED = wx.PyEventBinder( wxEVT_RIBBONGALLERY_HOVER_CHANGED, 1 ) EVT_RIBBONGALLERY_SELECTED = wx.PyEventBinder( wxEVT_RIBBONGALLERY_SELECTED, 1 ) EVT_RIBBONGALLERY_CLICKED = wx.PyEventBinder( wxEVT_RIBBONGALLERY_CLICKED, 1 ) """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) module.addHeaderCode("#include <wx/splitter.h>") #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. c = module.find('wxSplitterWindow') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) # We can do these with events so we may as well save the overhead of # virtual methods c.find('OnDoubleClickSash').ignore() c.find('OnSashPositionChange').ignore() c.find('OnUnsplit').ignore() c.addAutoProperties() c.addProperty('SashInvisible', 'IsSashInvisible', 'SetSashInvisible') c = module.find('wxSplitterEvent') tools.fixEventClass(c) module.addPyCode("""\ EVT_SPLITTER_SASH_POS_CHANGED = wx.PyEventBinder( wxEVT_SPLITTER_SASH_POS_CHANGED, 1 ) EVT_SPLITTER_SASH_POS_CHANGING = wx.PyEventBinder( wxEVT_SPLITTER_SASH_POS_CHANGING, 1 ) EVT_SPLITTER_DOUBLECLICKED = wx.PyEventBinder( wxEVT_SPLITTER_DOUBLECLICKED, 1 ) EVT_SPLITTER_UNSPLIT = wx.PyEventBinder( wxEVT_SPLITTER_UNSPLIT, 1 ) EVT_SPLITTER_DCLICK = EVT_SPLITTER_DOUBLECLICKED # deprecated wxEVT aliases wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED = wxEVT_SPLITTER_SASH_POS_CHANGED wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING = wxEVT_SPLITTER_SASH_POS_CHANGING wxEVT_COMMAND_SPLITTER_DOUBLECLICKED = wxEVT_SPLITTER_DOUBLECLICKED wxEVT_COMMAND_SPLITTER_UNSPLIT = wxEVT_SPLITTER_UNSPLIT """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. c = module.find('wxWizardPage') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c, False) module.addPyCode("PyWizardPage = wx.deprecated(WizardPage, 'Use WizardPage instead.')") c = module.find('wxWizardPageSimple') tools.fixWindowClass(c, False) c.addItem(etgtools.WigCode("""\ virtual wxWizardPage* GetNext() const; virtual wxWizardPage* GetPrev() const; """)) c = module.find('wxWizard') tools.fixWindowClass(c, False) c = module.find('wxWizardEvent') tools.fixEventClass(c) c.addPyCode("""\ EVT_WIZARD_BEFORE_PAGE_CHANGED = wx.PyEventBinder( wxEVT_WIZARD_BEFORE_PAGE_CHANGED, 1) EVT_WIZARD_PAGE_CHANGED = wx.PyEventBinder( wxEVT_WIZARD_PAGE_CHANGED, 1) EVT_WIZARD_PAGE_CHANGING = wx.PyEventBinder( wxEVT_WIZARD_PAGE_CHANGING, 1) EVT_WIZARD_CANCEL = wx.PyEventBinder( wxEVT_WIZARD_CANCEL, 1) EVT_WIZARD_HELP = wx.PyEventBinder( wxEVT_WIZARD_HELP, 1) EVT_WIZARD_FINISHED = wx.PyEventBinder( wxEVT_WIZARD_FINISHED, 1) EVT_WIZARD_PAGE_SHOWN = wx.PyEventBinder( wxEVT_WIZARD_PAGE_SHOWN, 1) """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode('#include <wx/ribbon/toolbar.h>') module.insertItem( 0, etgtools.WigCode("""\ // forward declarations class wxRibbonToolBarToolBase; """)) c = module.find('wxRibbonToolBar') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) # Use wxPyUserData for the clientData values instead of a plain wxObject for item in c.allItems(): if isinstance(item, etgtools.ParamDef) and item.name == 'clientData': item.type = 'wxPyUserData*' item.transfer = True meth = c.find('GetToolClientData') meth.type = 'wxPyUserData*' meth.setCppCode( 'return dynamic_cast<wxPyUserData*>(self->GetToolClientData(tool_id));' ) c = module.find('wxRibbonToolBarEvent') tools.fixEventClass(c) module.addPyCode("""\ EVT_RIBBONTOOLBAR_CLICKED = wx.PyEventBinder( wxEVT_RIBBONTOOLBAR_CLICKED, 1 ) EVT_RIBBONTOOLBAR_DROPDOWN_CLICKED = wx.PyEventBinder( wxEVT_RIBBONTOOLBAR_DROPDOWN_CLICKED, 1 ) """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. c = module.find('wxFileSystemWatcherEvent') assert isinstance(c, etgtools.ClassDef) c.addItem(etgtools.MethodDef(name='Clone', type='wxEvent*', argsString='() const', isConst=True, isVirtual=True)) tools.generateStubs('wxUSE_FSWATCHER', module, extraHdrCode='static wxFileName _NullFileName;\n', typeValMap={'const wxFileName &': '_NullFileName', 'wxFSWWarningType': 'wxFSW_WARNING_NONE'} ) # In the C++ code the wxFSW_EVENT_UNMOUNT item is only part of the enum # for platforms that have INOTIFY so we need to fake it elsewhere. module.addHeaderCode(""" #include <wx/fswatcher.h> #if wxUSE_FSWATCHER && !defined(wxHAS_INOTIFY) && !defined(wxHAVE_FSEVENTS_FILE_NOTIFICATIONS) const int wxFSW_EVENT_UNMOUNT = 0x2000; #endif """) c = module.find('wxFileSystemWatcher') assert isinstance(c, etgtools.ClassDef) c = module.find('wxFileSystemWatcherEvent') tools.fixEventClass(c) module.addPyCode("""\ EVT_FSWATCHER = wx.PyEventBinder(wxEVT_FSWATCHER) """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode('#include <wx/ribbon/toolbar.h>') module.insertItem(0, etgtools.WigCode("""\ // forward declarations class wxRibbonToolBarToolBase; """)) c = module.find('wxRibbonToolBar') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) # Use wxPyUserData for the clientData values instead of a plain wxObject for item in c.allItems(): if isinstance(item, etgtools.ParamDef) and item.name == 'clientData': item.type = 'wxPyUserData*' item.transfer = True meth = c.find('GetToolClientData') meth.type = 'wxPyUserData*' meth.setCppCode('return dynamic_cast<wxPyUserData*>(self->GetToolClientData(tool_id));') c = module.find('wxRibbonToolBarEvent') tools.fixEventClass(c) c.addPyCode("""\ EVT_RIBBONTOOLBAR_CLICKED = wx.PyEventBinder( wxEVT_RIBBONTOOLBAR_CLICKED, 1 ) EVT_RIBBONTOOLBAR_DROPDOWN_CLICKED = wx.PyEventBinder( wxEVT_RIBBONTOOLBAR_DROPDOWN_CLICKED, 1 ) """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode('#include <wx/ribbon/bar.h>') c = module.find('wxRibbonBar') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) c.find('SetArtProvider.art').transfer = True c = module.find('wxRibbonBarEvent') tools.fixEventClass(c) module.addPyCode("""\ EVT_RIBBONBAR_PAGE_CHANGED = wx.PyEventBinder(wxEVT_RIBBONBAR_PAGE_CHANGED, 1) EVT_RIBBONBAR_PAGE_CHANGING = wx.PyEventBinder(wxEVT_RIBBONBAR_PAGE_CHANGING,1) EVT_RIBBONBAR_TAB_MIDDLE_DOWN = wx.PyEventBinder(wxEVT_RIBBONBAR_TAB_MIDDLE_DOWN, 1) EVT_RIBBONBAR_TAB_MIDDLE_UP = wx.PyEventBinder(wxEVT_RIBBONBAR_TAB_MIDDLE_UP, 1) EVT_RIBBONBAR_TAB_RIGHT_DOWN = wx.PyEventBinder(wxEVT_RIBBONBAR_TAB_RIGHT_DOWN, 1) EVT_RIBBONBAR_TAB_RIGHT_UP = wx.PyEventBinder(wxEVT_RIBBONBAR_TAB_RIGHT_UP, 1) EVT_RIBBONBAR_TAB_LEFT_DCLICK = wx.PyEventBinder(wxEVT_RIBBONBAR_TAB_LEFT_DCLICK, 1) EVT_RIBBONBAR_TOGGLED = wx.PyEventBinder(wxEVT_RIBBONBAR_TOGGLED, 1) EVT_RIBBONBAR_HELP_CLICK = wx.PyEventBinder(wxEVT_RIBBONBAR_HELP_CLICK, 1) """) module.addItem( tools.wxArrayWrapperTemplate('wxRibbonPageTabInfoArray', 'wxRibbonPageTabInfo', module)) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode('#include <wx/ribbon/bar.h>') c = module.find('wxRibbonBar') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) c.find('SetArtProvider.art').transfer = True c = module.find('wxRibbonBarEvent') tools.fixEventClass(c) c.addPyCode("""\ EVT_RIBBONBAR_PAGE_CHANGED = wx.PyEventBinder(wxEVT_RIBBONBAR_PAGE_CHANGED, 1) EVT_RIBBONBAR_PAGE_CHANGING = wx.PyEventBinder(wxEVT_RIBBONBAR_PAGE_CHANGING,1) EVT_RIBBONBAR_TAB_MIDDLE_DOWN = wx.PyEventBinder(wxEVT_RIBBONBAR_TAB_MIDDLE_DOWN, 1) EVT_RIBBONBAR_TAB_MIDDLE_UP = wx.PyEventBinder(wxEVT_RIBBONBAR_TAB_MIDDLE_UP, 1) EVT_RIBBONBAR_TAB_RIGHT_DOWN = wx.PyEventBinder(wxEVT_RIBBONBAR_TAB_RIGHT_DOWN, 1) EVT_RIBBONBAR_TAB_RIGHT_UP = wx.PyEventBinder(wxEVT_RIBBONBAR_TAB_RIGHT_UP, 1) EVT_RIBBONBAR_TAB_LEFT_DCLICK = wx.PyEventBinder(wxEVT_RIBBONBAR_TAB_LEFT_DCLICK, 1) EVT_RIBBONBAR_TOGGLED = wx.PyEventBinder(wxEVT_RIBBONBAR_TOGGLED, 1) EVT_RIBBONBAR_HELP_CLICK = wx.PyEventBinder(wxEVT_RIBBONBAR_HELP_CLICK, 1) """) module.addItem( tools.wxArrayWrapperTemplate('wxRibbonPageTabInfoArray', 'wxRibbonPageTabInfo', module)) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. c = module.find('wxDialog') assert isinstance(c, etgtools.ClassDef) module.addGlobalStr('wxDialogNameStr', c) tools.fixTopLevelWindowClass(c) c.find('wxDialog.title').default = 'wxEmptyString' c.find('Create.title').default = 'wxEmptyString' # PocketPC only, don't think we'll need these ;) c.find('DoOK').ignore() c.find('GetToolBar').ignore() # Uses a template, but it would be easier to reimplement it in Python if # it is ever needed so don't bother complexifying the wrapper for it. c.find('ShowWindowModalThenDo').ignore() # Release the GIL for potentially blocking or long-running functions c.find('ShowModal').releaseGIL() # context manager methods c.addPyMethod('__enter__', '(self)', 'return self') c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'self.Destroy()') c.find('GetContentWindow').isVirtual = True c = module.find('wxWindowModalDialogEvent') tools.fixEventClass(c) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. c = module.find('wxWizardPage') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c, False) module.addPyCode( "PyWizardPage = wx.deprecated(WizardPage, 'Use WizardPage instead.')") c = module.find('wxWizardPageSimple') tools.fixWindowClass(c, False) c.addItem( etgtools.WigCode("""\ virtual wxWizardPage* GetNext() const; virtual wxWizardPage* GetPrev() const; """)) c = module.find('wxWizard') tools.fixWindowClass(c, False) c = module.find('wxWizardEvent') tools.fixEventClass(c) c.addPyCode("""\ EVT_WIZARD_BEFORE_PAGE_CHANGED = wx.PyEventBinder( wxEVT_WIZARD_BEFORE_PAGE_CHANGED, 1) EVT_WIZARD_PAGE_CHANGED = wx.PyEventBinder( wxEVT_WIZARD_PAGE_CHANGED, 1) EVT_WIZARD_PAGE_CHANGING = wx.PyEventBinder( wxEVT_WIZARD_PAGE_CHANGING, 1) EVT_WIZARD_CANCEL = wx.PyEventBinder( wxEVT_WIZARD_CANCEL, 1) EVT_WIZARD_HELP = wx.PyEventBinder( wxEVT_WIZARD_HELP, 1) EVT_WIZARD_FINISHED = wx.PyEventBinder( wxEVT_WIZARD_FINISHED, 1) EVT_WIZARD_PAGE_SHOWN = wx.PyEventBinder( wxEVT_WIZARD_PAGE_SHOWN, 1) """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode('#include <wx/html/webkit.h>') tools.generateStubs( 'wxUSE_WEBKIT', module, extraHdrCode='extern const char* wxWebKitCtrlNameStr;\n', extraCppCode='const char* wxWebKitCtrlNameStr = "";\n') c = module.find('wxWebKitCtrl') assert isinstance(c, etgtools.ClassDef) c.addPrivateCopyCtor() tools.fixWindowClass(c) c.find('wxWebKitCtrl.strURL').default = '""' c.find('Create.strURL').default = '""' module.addGlobalStr('wxWebKitCtrlNameStr', c) c = module.find('wxWebKitBeforeLoadEvent') tools.fixEventClass(c) c = module.find('wxWebKitStateChangedEvent') tools.fixEventClass(c) c = module.find('wxWebKitNewWindowEvent') tools.fixEventClass(c) module.addPyCode("""\ EVT_WEBKIT_BEFORE_LOAD = wx.PyEventBinder( wxEVT_WEBKIT_BEFORE_LOAD, 1 ) EVT_WEBKIT_STATE_CHANGED = wx.PyEventBinder( wxEVT_WEBKIT_STATE_CHANGED, 1 ) EVT_WEBKIT_NEW_WINDOW = wx.PyEventBinder( wxEVT_WEBKIT_NEW_WINDOW, 1 ) """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode('#include <wx/html/webkit.h>') c = module.find('wxWebKitCtrl') assert isinstance(c, etgtools.ClassDef) c.addPrivateCopyCtor() tools.fixWindowClass(c) c.find('wxWebKitCtrl.strURL').default = '""' c.find('Create.strURL').default = '""' module.addGlobalStr('wxWebKitCtrlNameStr', c) c = module.find('wxWebKitBeforeLoadEvent') tools.fixEventClass(c) c = module.find('wxWebKitStateChangedEvent') tools.fixEventClass(c) c = module.find('wxWebKitNewWindowEvent') tools.fixEventClass(c) module.addPyCode("""\ EVT_WEBKIT_BEFORE_LOAD = wx.PyEventBinder( wxEVT_WEBKIT_BEFORE_LOAD, 1 ) EVT_WEBKIT_STATE_CHANGED = wx.PyEventBinder( wxEVT_WEBKIT_STATE_CHANGED, 1 ) EVT_WEBKIT_NEW_WINDOW = wx.PyEventBinder( wxEVT_WEBKIT_NEW_WINDOW, 1 ) """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. c = module.find('wxPickerBase') assert isinstance(c, etgtools.ClassDef) c.find('CreateBase.id').default = 'wxID_ANY' c.find('GetTextCtrlStyle').ignore(False) c.find('GetPickerStyle').ignore(False) c.find('PostCreation').ignore(False) #----------------------------------------------------------------- module.addHeaderCode('#include <wx/clrpicker.h>') c = module.find('wxColourPickerCtrl') tools.fixWindowClass(c) module.addGlobalStr('wxColourPickerWidgetNameStr', c) module.addGlobalStr('wxColourPickerCtrlNameStr', c) c.addItem(etgtools.WigCode("""\ virtual void UpdatePickerFromTextCtrl(); virtual void UpdateTextCtrlFromPicker(); """)) c = module.find('wxColourPickerEvent') tools.fixEventClass(c) module.addPyCode("""\ EVT_COLOURPICKER_CHANGED = wx.PyEventBinder( wxEVT_COLOURPICKER_CHANGED, 1 ) # deprecated wxEVT alias wxEVT_COMMAND_COLOURPICKER_CHANGED = wxEVT_COLOURPICKER_CHANGED """) #----------------------------------------------------------------- module.addHeaderCode('#include <wx/filepicker.h>') c = module.find('wxFilePickerCtrl') tools.fixWindowClass(c) module.addGlobalStr('wxFilePickerWidgetLabel', c) module.addGlobalStr('wxFilePickerWidgetNameStr', c) module.addGlobalStr('wxFilePickerCtrlNameStr', c) module.addGlobalStr('wxFileSelectorPromptStr', c) module.addGlobalStr('wxFileSelectorDefaultWildcardStr', c) c.addItem(etgtools.WigCode("""\ virtual void UpdatePickerFromTextCtrl(); virtual void UpdateTextCtrlFromPicker(); """)) # we'll use the [G|S]etPath methods instead so we don't have to mess with wxFileName c.find('GetFileName').ignore() c.find('SetFileName').ignore() c = module.find('wxDirPickerCtrl') tools.fixWindowClass(c) module.addGlobalStr('wxDirPickerWidgetLabel', c) module.addGlobalStr('wxDirPickerWidgetNameStr', c) module.addGlobalStr('wxDirPickerCtrlNameStr', c) module.addGlobalStr('wxDirSelectorPromptStr', c) c.addItem(etgtools.WigCode("""\ virtual void UpdatePickerFromTextCtrl(); virtual void UpdateTextCtrlFromPicker(); """)) # we'll use the [G|S]etPath methods instead so we don't have to mess with wxFileName c.find('GetDirName').ignore() c.find('SetDirName').ignore() c = module.find('wxFileDirPickerEvent') tools.fixEventClass(c) module.addPyCode("""\ EVT_FILEPICKER_CHANGED = wx.PyEventBinder( wxEVT_FILEPICKER_CHANGED, 1 ) EVT_DIRPICKER_CHANGED = wx.PyEventBinder( wxEVT_DIRPICKER_CHANGED, 1 ) # deprecated wxEVT aliases wxEVT_COMMAND_FILEPICKER_CHANGED = wxEVT_FILEPICKER_CHANGED wxEVT_COMMAND_DIRPICKER_CHANGED = wxEVT_DIRPICKER_CHANGED """) #----------------------------------------------------------------- module.addHeaderCode('#include <wx/fontpicker.h>') c = module.find('wxFontPickerCtrl') tools.fixWindowClass(c) module.addGlobalStr('wxFontPickerWidgetNameStr', c) module.addGlobalStr('wxFontPickerCtrlNameStr', c) c.addItem(etgtools.WigCode("""\ virtual void UpdatePickerFromTextCtrl(); virtual void UpdateTextCtrlFromPicker(); """)) c = module.find('wxFontPickerEvent') tools.fixEventClass(c) module.addPyCode("""\ EVT_FONTPICKER_CHANGED = wx.PyEventBinder( wxEVT_FONTPICKER_CHANGED, 1 ) # deprecated wxEVT alias wxEVT_COMMAND_FONTPICKER_CHANGED = wxEVT_FONTPICKER_CHANGED """) #----------------------------------------------------------------- # The C++ wxColourPickerCtrl uses a wx.Button for the implementation, # but that looks and works very badly on Mac because the native # button can't change color. So for the Mac we'll implement our own # picker using a wx.BitmapButton instead. module.addPyCode("""\ if 'wxMac' in wx.PlatformInfo: class ColourPickerCtrl(PickerBase): ''' This control allows the user to select a colour. The implementation varies by platform but is usually a button which brings up a `wx.ColourDialog` when clicked. Window Styles ------------- ====================== ============================================ wx.CLRP_DEFAULT Default style. wx.CLRP_USE_TEXTCTRL Creates a text control to the left of the picker button which is completely managed by the `wx.ColourPickerCtrl` and which can be used by the user to specify a colour. The text control is automatically synchronized with the button's value. Use functions defined in `wx.PickerBase` to modify the text control. wx.CLRP_SHOW_LABEL Shows the colour in HTML form (AABBCC) as the colour button label (instead of no label at all). ====================== ============================================ Events ------ ======================== ========================================== EVT_COLOURPICKER_CHANGED The user changed the colour selected in the control either using the button or using the text control (see wx.CLRP_USE_TEXTCTRL; note that in this case the event is fired only if the user's input is valid, i.e. recognizable). ======================== ========================================== ''' # ColourData object to be shared by all colour pickers, so they can # share the custom colours _colourData = None #-------------------------------------------------- class ColourPickerButton(BitmapButton): def __init__(self, parent, id=-1, colour=wx.BLACK, pos=wx.DefaultPosition, size=wx.DefaultSize, style = CLRP_DEFAULT_STYLE, validator = wx.DefaultValidator, name = "colourpickerwidget"): wx.BitmapButton.__init__(self, parent, id, wx.Bitmap(1,1), pos, size, style, validator, name) self.SetColour(colour) self.InvalidateBestSize() self.SetInitialSize(size) self.Bind(wx.EVT_BUTTON, self.OnButtonClick) if ColourPickerCtrl._colourData is None: ColourPickerCtrl._colourData = wx.ColourData() ColourPickerCtrl._colourData.SetChooseFull(True) grey = 0 for i in range(16): c = wx.Colour(grey, grey, grey) ColourPickerCtrl._colourData.SetCustomColour(i, c) grey += 16 def SetColour(self, colour): # force a copy, in case the _colorData is shared self.colour = wx.Colour(colour) bmp = self._makeBitmap() self.SetBitmapLabel(bmp) def GetColour(self): return self.colour def OnButtonClick(self, evt): ColourPickerCtrl._colourData.SetColour(self.colour) dlg = wx.ColourDialog(self, ColourPickerCtrl._colourData) if dlg.ShowModal() == wx.ID_OK: ColourPickerCtrl._colourData = dlg.GetColourData() self.SetColour(ColourPickerCtrl._colourData.GetColour()) evt = wx.ColourPickerEvent(self, self.GetId(), self.GetColour()) self.GetEventHandler().ProcessEvent(evt) def _makeBitmap(self): width = height = 24 bg = self.GetColour() if self.HasFlag(CLRP_SHOW_LABEL): w, h = self.GetTextExtent(bg.GetAsString(wx.C2S_HTML_SYNTAX)) width += w bmp = wx.Bitmap(width, height) dc = wx.MemoryDC(bmp) dc.SetBackground(wx.Brush(self.colour)) dc.Clear() if self.HasFlag(CLRP_SHOW_LABEL): from wx.lib.colourutils import BestLabelColour fg = BestLabelColour(bg) dc.SetTextForeground(fg) dc.DrawText(bg.GetAsString(wx.C2S_HTML_SYNTAX), (width - w)/2, (height - h)/2) return bmp #-------------------------------------------------- def __init__(self, parent, id=-1, colour=wx.BLACK, pos=wx.DefaultPosition, size=wx.DefaultSize, style = CLRP_DEFAULT_STYLE, validator = wx.DefaultValidator, name = "colourpicker"): if type(colour) != wx.Colour: colour = wx.Colour(colour) wx.PickerBase.__init__(self) self.CreateBase(parent, id, colour.GetAsString(), pos, size, style, validator, name) widget = ColourPickerCtrl.ColourPickerButton( self, -1, colour, style=self.GetPickerStyle(style)) self.SetPickerCtrl(widget) widget.Bind(wx.EVT_COLOURPICKER_CHANGED, self.OnColourChange) self.PostCreation() def GetColour(self): '''Set the displayed colour.''' return self.GetPickerCtrl().GetColour() def SetColour(self, colour): '''Returns the currently selected colour.''' self.GetPickerCtrl().SetColour(colour) self.UpdateTextCtrlFromPicker() Colour = property(GetColour, SetColour) def UpdatePickerFromTextCtrl(self): col = wx.Colour(self.GetTextCtrl().GetValue()) if not col.IsOk(): return if self.GetColour() != col: self.GetPickerCtrl().SetColour(col) evt = wx.ColourPickerEvent(self, self.GetId(), self.GetColour()) self.GetEventHandler().ProcessEvent(evt) def UpdateTextCtrlFromPicker(self): if not self.GetTextCtrl(): return self.GetTextCtrl().SetValue(self.GetColour().GetAsString()) def GetPickerStyle(self, style): return style & CLRP_SHOW_LABEL def OnColourChange(self, evt): self.UpdateTextCtrlFromPicker() evt = wx.ColourPickerEvent(self, self.GetId(), self.GetColour()) self.GetEventHandler().ProcessEvent(evt) """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. c = module.find('wxPickerBase') assert isinstance(c, etgtools.ClassDef) c.find('CreateBase.id').default = 'wxID_ANY' c.find('GetTextCtrlStyle').ignore(False) c.find('GetPickerStyle').ignore(False) c.find('PostCreation').ignore(False) #----------------------------------------------------------------- module.addHeaderCode('#include <wx/clrpicker.h>') c = module.find('wxColourPickerCtrl') tools.fixWindowClass(c) module.addGlobalStr('wxColourPickerWidgetNameStr', c) module.addGlobalStr('wxColourPickerCtrlNameStr', c) c.addItem(etgtools.WigCode("""\ virtual void UpdatePickerFromTextCtrl(); virtual void UpdateTextCtrlFromPicker(); """)) c = module.find('wxColourPickerEvent') tools.fixEventClass(c) c.addPyCode("""\ EVT_COLOURPICKER_CHANGED = wx.PyEventBinder( wxEVT_COLOURPICKER_CHANGED, 1 ) # deprecated wxEVT alias wxEVT_COMMAND_COLOURPICKER_CHANGED = wxEVT_COLOURPICKER_CHANGED """) #----------------------------------------------------------------- module.addHeaderCode('#include <wx/filepicker.h>') c = module.find('wxFilePickerCtrl') tools.fixWindowClass(c) module.addGlobalStr('wxFilePickerWidgetLabel', c) module.addGlobalStr('wxFilePickerWidgetNameStr', c) module.addGlobalStr('wxFilePickerCtrlNameStr', c) module.addGlobalStr('wxFileSelectorPromptStr', c) module.addGlobalStr('wxFileSelectorDefaultWildcardStr', c) c.addItem(etgtools.WigCode("""\ virtual void UpdatePickerFromTextCtrl(); virtual void UpdateTextCtrlFromPicker(); """)) # we'll use the [G|S]etPath methods instead so we don't have to mess with wxFileName c.find('GetFileName').ignore() c.find('SetFileName').ignore() c = module.find('wxDirPickerCtrl') tools.fixWindowClass(c) module.addGlobalStr('wxDirPickerWidgetLabel', c) module.addGlobalStr('wxDirPickerWidgetNameStr', c) module.addGlobalStr('wxDirPickerCtrlNameStr', c) module.addGlobalStr('wxDirSelectorPromptStr', c) c.addItem(etgtools.WigCode("""\ virtual void UpdatePickerFromTextCtrl(); virtual void UpdateTextCtrlFromPicker(); """)) # we'll use the [G|S]etPath methods instead so we don't have to mess with wxFileName c.find('GetDirName').ignore() c.find('SetDirName').ignore() c = module.find('wxFileDirPickerEvent') tools.fixEventClass(c) c.addPyCode("""\ EVT_FILEPICKER_CHANGED = wx.PyEventBinder( wxEVT_FILEPICKER_CHANGED, 1 ) EVT_DIRPICKER_CHANGED = wx.PyEventBinder( wxEVT_DIRPICKER_CHANGED, 1 ) # deprecated wxEVT aliases wxEVT_COMMAND_FILEPICKER_CHANGED = wxEVT_FILEPICKER_CHANGED wxEVT_COMMAND_DIRPICKER_CHANGED = wxEVT_DIRPICKER_CHANGED """) #----------------------------------------------------------------- module.addHeaderCode('#include <wx/fontpicker.h>') c = module.find('wxFontPickerCtrl') tools.fixWindowClass(c) module.addGlobalStr('wxFontPickerWidgetNameStr', c) module.addGlobalStr('wxFontPickerCtrlNameStr', c) c.addItem(etgtools.WigCode("""\ virtual void UpdatePickerFromTextCtrl(); virtual void UpdateTextCtrlFromPicker(); """)) c = module.find('wxFontPickerEvent') tools.fixEventClass(c) c.addPyCode("""\ EVT_FONTPICKER_CHANGED = wx.PyEventBinder( wxEVT_FONTPICKER_CHANGED, 1 ) # deprecated wxEVT alias wxEVT_COMMAND_FONTPICKER_CHANGED = wxEVT_FONTPICKER_CHANGED """) #----------------------------------------------------------------- # The C++ wxColourPickerCtrl uses a wx.Button for the implementation, # but that looks and works very badly on Mac because the native # button can't change color. So for the Mac we'll implement our own # picker using a wx.BitmapButton instead. module.addPyCode("""\ if 'wxMac' in wx.PlatformInfo: class ColourPickerCtrl(PickerBase): ''' This control allows the user to select a colour. The implementation varies by platform but is usually a button which brings up a `wx.ColourDialog` when clicked. Window Styles ------------- ====================== ============================================ wx.CLRP_DEFAULT Default style. wx.CLRP_USE_TEXTCTRL Creates a text control to the left of the picker button which is completely managed by the `wx.ColourPickerCtrl` and which can be used by the user to specify a colour. The text control is automatically synchronized with the button's value. Use functions defined in `wx.PickerBase` to modify the text control. wx.CLRP_SHOW_LABEL Shows the colour in HTML form (AABBCC) as the colour button label (instead of no label at all). ====================== ============================================ Events ------ ======================== ========================================== EVT_COLOURPICKER_CHANGED The user changed the colour selected in the control either using the button or using the text control (see wx.CLRP_USE_TEXTCTRL; note that in this case the event is fired only if the user's input is valid, i.e. recognizable). ======================== ========================================== ''' # ColourData object to be shared by all colour pickers, so they can # share the custom colours _colourData = None #-------------------------------------------------- class ColourPickerButton(BitmapButton): def __init__(self, parent, id=-1, colour=wx.BLACK, pos=wx.DefaultPosition, size=wx.DefaultSize, style = CLRP_DEFAULT_STYLE, validator = wx.DefaultValidator, name = "colourpickerwidget"): wx.BitmapButton.__init__(self, parent, id, wx.Bitmap(1,1), pos, size, style, validator, name) self.SetColour(colour) self.InvalidateBestSize() self.SetInitialSize(size) self.Bind(wx.EVT_BUTTON, self.OnButtonClick) if ColourPickerCtrl._colourData is None: ColourPickerCtrl._colourData = wx.ColourData() ColourPickerCtrl._colourData.SetChooseFull(True) grey = 0 for i in range(16): c = wx.Colour(grey, grey, grey) ColourPickerCtrl._colourData.SetCustomColour(i, c) grey += 16 def SetColour(self, colour): # force a copy, in case the _colorData is shared self.colour = wx.Colour(colour) bmp = self._makeBitmap() self.SetBitmapLabel(bmp) def GetColour(self): return self.colour def OnButtonClick(self, evt): ColourPickerCtrl._colourData.SetColour(self.colour) dlg = wx.ColourDialog(self, ColourPickerCtrl._colourData) if dlg.ShowModal() == wx.ID_OK: ColourPickerCtrl._colourData = dlg.GetColourData() self.SetColour(ColourPickerCtrl._colourData.GetColour()) evt = wx.ColourPickerEvent(self, self.GetId(), self.GetColour()) self.GetEventHandler().ProcessEvent(evt) def _makeBitmap(self): width = height = 24 bg = self.GetColour() if self.HasFlag(CLRP_SHOW_LABEL): w, h = self.GetTextExtent(bg.GetAsString(wx.C2S_HTML_SYNTAX)) width += w bmp = wx.Bitmap(width, height) dc = wx.MemoryDC(bmp) dc.SetBackground(wx.Brush(self.colour)) dc.Clear() if self.HasFlag(CLRP_SHOW_LABEL): from wx.lib.colourutils import BestLabelColour fg = BestLabelColour(bg) dc.SetTextForeground(fg) dc.DrawText(bg.GetAsString(wx.C2S_HTML_SYNTAX), (width - w)/2, (height - h)/2) return bmp #-------------------------------------------------- def __init__(self, parent, id=-1, colour=wx.BLACK, pos=wx.DefaultPosition, size=wx.DefaultSize, style = CLRP_DEFAULT_STYLE, validator = wx.DefaultValidator, name = "colourpicker"): if type(colour) != wx.Colour: colour = wx.Colour(colour) wx.PickerBase.__init__(self) self.CreateBase(parent, id, colour.GetAsString(), pos, size, style, validator, name) widget = ColourPickerCtrl.ColourPickerButton( self, -1, colour, style=self.GetPickerStyle(style)) self.SetPickerCtrl(widget) widget.Bind(wx.EVT_COLOURPICKER_CHANGED, self.OnColourChange) self.PostCreation() def GetColour(self): '''Set the displayed colour.''' return self.GetPickerCtrl().GetColour() def SetColour(self, colour): '''Returns the currently selected colour.''' self.GetPickerCtrl().SetColour(colour) self.UpdateTextCtrlFromPicker() Colour = property(GetColour, SetColour) def UpdatePickerFromTextCtrl(self): col = wx.Colour(self.GetTextCtrl().GetValue()) if not col.IsOk(): return if self.GetColour() != col: self.GetPickerCtrl().SetColour(col) evt = wx.ColourPickerEvent(self, self.GetId(), self.GetColour()) self.GetEventHandler().ProcessEvent(evt) def UpdateTextCtrlFromPicker(self): if not self.GetTextCtrl(): return self.GetTextCtrl().SetValue(self.GetColour().GetAsString()) def GetPickerStyle(self, style): return style & CLRP_SHOW_LABEL def OnColourChange(self, evt): self.UpdateTextCtrlFromPicker() evt = wx.ColourPickerEvent(self, self.GetId(), self.GetColour()) self.GetEventHandler().ProcessEvent(evt) """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) module.check4unittest = False #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode('#include <wxpy_api.h>') module.addImport('_core') module.addPyCode('import wx', order=10) module.addInclude(INCLUDES) #----------------------------------------------------------------- module.addHeaderCode('#include <wx/stc/stc.h>') c = module.find('wxStyledTextCtrl') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c, False) module.addGlobalStr('wxSTCNameStr', c) c.find('GetCurLine.linePos').out = True c.find('GetCurLineRaw.linePos').out = True for name in ['Remove', 'Replace', 'SetSelection', 'GetSelection']: m = c.find(name) m.find('from').name = 'from_' m.find('to').name = 'to_' c.find('GetSelection.from_').out = True c.find('GetSelection.to_').out = True c.find('PositionToXY.x').out = True c.find('PositionToXY.y').out = True # Split the HitTest overloads into separately named methods since once # the output parameters are applied they will have the same function # signature. ht1 = c.find('HitTest') ht2 = ht1.overloads[0] ht1.overloads = [] c.insertItemAfter(ht1, ht2) ht1.pyName = 'HitTestPos' ht1.find('pos').out = True ht2.find('row').out = True ht2.find('col').out = True # Replace the *Pointer methods with ones that return a memoryview object instead. c.find('GetCharacterPointer').ignore() c.addCppMethod('PyObject*', 'GetCharacterPointer', '()', doc="""\ Compact the document buffer and return a read-only memoryview object of the characters in the document.""", body=""" const char* ptr = self->GetCharacterPointer(); Py_ssize_t len = self->GetLength(); PyObject* rv; wxPyBLOCK_THREADS( rv = wxPyMakeBuffer((void*)ptr, len, true) ); return rv; """) c.find('GetRangePointer').ignore() c.addCppMethod('PyObject*', 'GetRangePointer', '(int position, int rangeLength)', doc="""\ Return a read-only pointer to a range of characters in the document. May move the gap so that the range is contiguous, but will only move up to rangeLength bytes.""", body=""" const char* ptr = self->GetRangePointer(position, rangeLength); Py_ssize_t len = rangeLength; PyObject* rv; wxPyBLOCK_THREADS( rv = wxPyMakeBuffer((void*)ptr, len, true) ); return rv; """) # TODO: Add the UTF8 PyMethods from classic (see _stc_utf8_methods.py) #----------------------------------------------------------------- c = module.find('wxStyledTextEvent') tools.fixEventClass(c) c.addPyCode("""\ EVT_STC_CHANGE = wx.PyEventBinder( wxEVT_STC_CHANGE, 1 ) EVT_STC_STYLENEEDED = wx.PyEventBinder( wxEVT_STC_STYLENEEDED, 1 ) EVT_STC_CHARADDED = wx.PyEventBinder( wxEVT_STC_CHARADDED, 1 ) EVT_STC_SAVEPOINTREACHED = wx.PyEventBinder( wxEVT_STC_SAVEPOINTREACHED, 1 ) EVT_STC_SAVEPOINTLEFT = wx.PyEventBinder( wxEVT_STC_SAVEPOINTLEFT, 1 ) EVT_STC_ROMODIFYATTEMPT = wx.PyEventBinder( wxEVT_STC_ROMODIFYATTEMPT, 1 ) EVT_STC_KEY = wx.PyEventBinder( wxEVT_STC_KEY, 1 ) EVT_STC_DOUBLECLICK = wx.PyEventBinder( wxEVT_STC_DOUBLECLICK, 1 ) EVT_STC_UPDATEUI = wx.PyEventBinder( wxEVT_STC_UPDATEUI, 1 ) EVT_STC_MODIFIED = wx.PyEventBinder( wxEVT_STC_MODIFIED, 1 ) EVT_STC_MACRORECORD = wx.PyEventBinder( wxEVT_STC_MACRORECORD, 1 ) EVT_STC_MARGINCLICK = wx.PyEventBinder( wxEVT_STC_MARGINCLICK, 1 ) EVT_STC_NEEDSHOWN = wx.PyEventBinder( wxEVT_STC_NEEDSHOWN, 1 ) EVT_STC_PAINTED = wx.PyEventBinder( wxEVT_STC_PAINTED, 1 ) EVT_STC_USERLISTSELECTION = wx.PyEventBinder( wxEVT_STC_USERLISTSELECTION, 1 ) EVT_STC_URIDROPPED = wx.PyEventBinder( wxEVT_STC_URIDROPPED, 1 ) EVT_STC_DWELLSTART = wx.PyEventBinder( wxEVT_STC_DWELLSTART, 1 ) EVT_STC_DWELLEND = wx.PyEventBinder( wxEVT_STC_DWELLEND, 1 ) EVT_STC_START_DRAG = wx.PyEventBinder( wxEVT_STC_START_DRAG, 1 ) EVT_STC_DRAG_OVER = wx.PyEventBinder( wxEVT_STC_DRAG_OVER, 1 ) EVT_STC_DO_DROP = wx.PyEventBinder( wxEVT_STC_DO_DROP, 1 ) EVT_STC_ZOOM = wx.PyEventBinder( wxEVT_STC_ZOOM, 1 ) EVT_STC_HOTSPOT_CLICK = wx.PyEventBinder( wxEVT_STC_HOTSPOT_CLICK, 1 ) EVT_STC_HOTSPOT_DCLICK = wx.PyEventBinder( wxEVT_STC_HOTSPOT_DCLICK, 1 ) EVT_STC_CALLTIP_CLICK = wx.PyEventBinder( wxEVT_STC_CALLTIP_CLICK, 1 ) EVT_STC_AUTOCOMP_SELECTION = wx.PyEventBinder( wxEVT_STC_AUTOCOMP_SELECTION, 1 ) EVT_STC_INDICATOR_CLICK = wx.PyEventBinder( wxEVT_STC_INDICATOR_CLICK, 1 ) EVT_STC_INDICATOR_RELEASE = wx.PyEventBinder( wxEVT_STC_INDICATOR_RELEASE, 1 ) EVT_STC_AUTOCOMP_CANCELLED = wx.PyEventBinder( wxEVT_STC_AUTOCOMP_CANCELLED, 1 ) EVT_STC_AUTOCOMP_CHAR_DELETED = wx.PyEventBinder( wxEVT_STC_AUTOCOMP_CHAR_DELETED, 1 ) """) #----------------------------------------------------------------- #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)
def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. #------------------------------------------------------- c = module.find('wxTreeItemId') assert isinstance(c, etgtools.ClassDef) c.addCppMethod('int', '__nonzero__', '()', """\ return self->IsOk(); """) td = etgtools.TypedefDef(name='wxTreeItemIdValue', type='void*') module.insertItemBefore(c, td) #------------------------------------------------------- module.addPyCode("""\ def TreeItemData(data): return data TreeItemData = deprecated(TreeItemData, "The TreeItemData class no longer exists, just pass your object directly to the tree instead.") """) #------------------------------------------------------- c = module.find('wxTreeCtrl') tools.fixWindowClass(c) module.addGlobalStr('wxTreeCtrlNameStr', before=c) # Set all wxTreeItemData parameters to transfer ownership. Is this still needed with MappedTypes? for item in c.allItems(): if hasattr(item, 'type') and item.type == 'wxTreeItemData *' and \ isinstance(item, etgtools.ParamDef): item.transfer = True c.addPyCode("""\ TreeCtrl.GetItemPyData = wx.deprecated(TreeCtrl.GetItemData, 'Use GetItemData instead.') TreeCtrl.SetItemPyData = wx.deprecated(TreeCtrl.SetItemData, 'Use SetItemData instead.') TreeCtrl.GetPyData = wx.deprecated(TreeCtrl.GetItemData, 'Use GetItemData instead.') TreeCtrl.SetPyData = wx.deprecated(TreeCtrl.SetItemData, 'Use SetItemData instead.') """) # We can't use wxClassInfo c.find('EditLabel.textCtrlClass').ignore() # Replace GetSelections with a method that returns a Python list # size_t GetSelections(wxArrayTreeItemIds& selection) const; c.find('GetSelections').ignore() c.addCppMethod('PyObject*', 'GetSelections', '()', doc='Returns a list of currently selected items in the tree. This function ' 'can be called only if the control has the wx.TR_MULTIPLE style.', body="""\ wxPyThreadBlocker blocker; PyObject* rval = PyList_New(0); wxArrayTreeItemIds array; size_t num, x; num = self->GetSelections(array); for (x=0; x < num; x++) { wxTreeItemId *tii = new wxTreeItemId(array.Item(x)); PyObject* item = wxPyConstructObject((void*)tii, wxT("wxTreeItemId"), true); PyList_Append(rval, item); Py_DECREF(item); } return rval; """) # Change GetBoundingRect to return the rectangle instead of modifying the parameter. #bool GetBoundingRect(const wxTreeItemId& item, wxRect& rect, bool textOnly = false) const; c.find('GetBoundingRect').ignore() c.addCppMethod('PyObject*', 'GetBoundingRect', '(const wxTreeItemId& item, bool textOnly=false)', doc="""\ Returns the rectangle bounding the item. If textOnly is true, only the rectangle around the item's label will be returned, otherwise the item's image is also taken into account. The return value may be None if the rectangle was not successfully retrieved, such as if the item is currently not visible. """, isFactory=True, body="""\ wxRect rect; if (self->GetBoundingRect(*item, rect, textOnly)) { wxPyThreadBlocker blocker; wxRect* r = new wxRect(rect); PyObject* val = wxPyConstructObject((void*)r, wxT("wxRect"), true); return val; } else RETURN_NONE(); """) # switch the virtualness back on for those methods that need to have it. c.find('OnCompareItems').isVirtual = True # transfer imagelist ownership c.find('AssignImageList.imageList').transfer = True c.find('AssignStateImageList.imageList').transfer = True c.find('AssignButtonsImageList.imageList').transfer = True # Make the cookie values be returned, instead of setting it through the parameter c.find('GetFirstChild.cookie').out = True c.find('GetNextChild.cookie').inOut = True # TODO: These don't exist on MSW, Are they important enough that we # should provide them for the other platforms anyway? c.find('AssignButtonsImageList').ignore() c.find('GetButtonsImageList').ignore() c.find('SetButtonsImageList').ignore() #------------------------------------------------------- c = module.find('wxTreeEvent') tools.fixEventClass(c) c.addPyCode("""\ EVT_TREE_BEGIN_DRAG = PyEventBinder(wxEVT_TREE_BEGIN_DRAG , 1) EVT_TREE_BEGIN_RDRAG = PyEventBinder(wxEVT_TREE_BEGIN_RDRAG , 1) EVT_TREE_BEGIN_LABEL_EDIT = PyEventBinder(wxEVT_TREE_BEGIN_LABEL_EDIT , 1) EVT_TREE_END_LABEL_EDIT = PyEventBinder(wxEVT_TREE_END_LABEL_EDIT , 1) EVT_TREE_DELETE_ITEM = PyEventBinder(wxEVT_TREE_DELETE_ITEM , 1) EVT_TREE_GET_INFO = PyEventBinder(wxEVT_TREE_GET_INFO , 1) EVT_TREE_SET_INFO = PyEventBinder(wxEVT_TREE_SET_INFO , 1) EVT_TREE_ITEM_EXPANDED = PyEventBinder(wxEVT_TREE_ITEM_EXPANDED , 1) EVT_TREE_ITEM_EXPANDING = PyEventBinder(wxEVT_TREE_ITEM_EXPANDING , 1) EVT_TREE_ITEM_COLLAPSED = PyEventBinder(wxEVT_TREE_ITEM_COLLAPSED , 1) EVT_TREE_ITEM_COLLAPSING = PyEventBinder(wxEVT_TREE_ITEM_COLLAPSING , 1) EVT_TREE_SEL_CHANGED = PyEventBinder(wxEVT_TREE_SEL_CHANGED , 1) EVT_TREE_SEL_CHANGING = PyEventBinder(wxEVT_TREE_SEL_CHANGING , 1) EVT_TREE_KEY_DOWN = PyEventBinder(wxEVT_TREE_KEY_DOWN , 1) EVT_TREE_ITEM_ACTIVATED = PyEventBinder(wxEVT_TREE_ITEM_ACTIVATED , 1) EVT_TREE_ITEM_RIGHT_CLICK = PyEventBinder(wxEVT_TREE_ITEM_RIGHT_CLICK , 1) EVT_TREE_ITEM_MIDDLE_CLICK = PyEventBinder(wxEVT_TREE_ITEM_MIDDLE_CLICK, 1) EVT_TREE_END_DRAG = PyEventBinder(wxEVT_TREE_END_DRAG , 1) EVT_TREE_STATE_IMAGE_CLICK = PyEventBinder(wxEVT_TREE_STATE_IMAGE_CLICK, 1) EVT_TREE_ITEM_GETTOOLTIP = PyEventBinder(wxEVT_TREE_ITEM_GETTOOLTIP, 1) EVT_TREE_ITEM_MENU = PyEventBinder(wxEVT_TREE_ITEM_MENU, 1) # deprecated wxEVT aliases wxEVT_COMMAND_TREE_BEGIN_DRAG = wxEVT_TREE_BEGIN_DRAG wxEVT_COMMAND_TREE_BEGIN_RDRAG = wxEVT_TREE_BEGIN_RDRAG wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT = wxEVT_TREE_BEGIN_LABEL_EDIT wxEVT_COMMAND_TREE_END_LABEL_EDIT = wxEVT_TREE_END_LABEL_EDIT wxEVT_COMMAND_TREE_DELETE_ITEM = wxEVT_TREE_DELETE_ITEM wxEVT_COMMAND_TREE_GET_INFO = wxEVT_TREE_GET_INFO wxEVT_COMMAND_TREE_SET_INFO = wxEVT_TREE_SET_INFO wxEVT_COMMAND_TREE_ITEM_EXPANDED = wxEVT_TREE_ITEM_EXPANDED wxEVT_COMMAND_TREE_ITEM_EXPANDING = wxEVT_TREE_ITEM_EXPANDING wxEVT_COMMAND_TREE_ITEM_COLLAPSED = wxEVT_TREE_ITEM_COLLAPSED wxEVT_COMMAND_TREE_ITEM_COLLAPSING = wxEVT_TREE_ITEM_COLLAPSING wxEVT_COMMAND_TREE_SEL_CHANGED = wxEVT_TREE_SEL_CHANGED wxEVT_COMMAND_TREE_SEL_CHANGING = wxEVT_TREE_SEL_CHANGING wxEVT_COMMAND_TREE_KEY_DOWN = wxEVT_TREE_KEY_DOWN wxEVT_COMMAND_TREE_ITEM_ACTIVATED = wxEVT_TREE_ITEM_ACTIVATED wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK = wxEVT_TREE_ITEM_RIGHT_CLICK wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK = wxEVT_TREE_ITEM_MIDDLE_CLICK wxEVT_COMMAND_TREE_END_DRAG = wxEVT_TREE_END_DRAG wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK = wxEVT_TREE_STATE_IMAGE_CLICK wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP = wxEVT_TREE_ITEM_GETTOOLTIP wxEVT_COMMAND_TREE_ITEM_MENU = wxEVT_TREE_ITEM_MENU """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)