From 5f04f3b0824bd54ba873629f1805fdb400c0e96a Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Mon, 23 Jan 2017 20:41:07 -0800 Subject: [PATCH] Add more mustHaveApp flags --- docs/sphinx/itemToModuleMap.json | 2 ++ etg/_glcanvas.py | 1 + etg/app.py | 2 ++ etg/busyinfo.py | 1 + etg/caret.py | 1 + etg/combo.py | 1 + etg/gdicmn.py | 3 +++ etg/graphics.py | 5 +++++ etg/help.py | 1 + etg/helpctrl.py | 1 + etg/htmlprint.py | 3 +++ etg/icon.py | 1 + etg/iconbndl.py | 2 +- etg/image.py | 1 + etg/imaglist.py | 1 + etg/joystick.py | 5 +++-- etg/menu.py | 2 ++ etg/pen.py | 5 +++++ etg/popupwin.py | 2 ++ etg/printfw.py | 5 +++++ etg/process.py | 2 +- etg/region.py | 2 ++ etg/renderer.py | 2 ++ etg/settings.py | 6 +++--- etg/sound.py | 1 + etg/taskbar.py | 1 + etg/timer.py | 2 ++ etg/tooltip.py | 1 + etg/utils.py | 5 +++++ etg/window.py | 4 ++++ 30 files changed, 64 insertions(+), 7 deletions(-) diff --git a/docs/sphinx/itemToModuleMap.json b/docs/sphinx/itemToModuleMap.json index 2d8b0f4f..3455902b 100644 --- a/docs/sphinx/itemToModuleMap.json +++ b/docs/sphinx/itemToModuleMap.json @@ -1239,6 +1239,7 @@ "GetLinuxDistributionInfo":"wx.", "GetMousePosition":"wx.", "GetMouseState":"wx.", +"GetNumberFromUser":"wx.", "GetOsDescription":"wx.", "GetOsVersion":"wx.", "GetPasswordFromUser":"wx.", @@ -6233,6 +6234,7 @@ "Year":"wx.DateTime.", "Yield":"wx.", "_":"wx.", +"_ScrolledWindowBase":"wx.", "__DECLARE_EVT0":"wx.", "__DECLARE_EVT1":"wx.", "__DECLARE_EVT2":"wx.", diff --git a/etg/_glcanvas.py b/etg/_glcanvas.py index 6de53078..2f67f931 100644 --- a/etg/_glcanvas.py +++ b/etg/_glcanvas.py @@ -63,6 +63,7 @@ def run(): c = module.find('wxGLContext') assert isinstance(c, etgtools.ClassDef) + c.mustHaveApp() c.addPrivateCopyCtor() diff --git a/etg/app.py b/etg/app.py index 46321704..3de58c80 100644 --- a/etg/app.py +++ b/etg/app.py @@ -535,6 +535,8 @@ def run(): item.ignore() + module.find('wxWakeUpIdle').mustHaveApp() + #----------------------------------------------------------------- tools.doCommonTweaks(module) diff --git a/etg/busyinfo.py b/etg/busyinfo.py index 9feb94d0..3d3c50b4 100644 --- a/etg/busyinfo.py +++ b/etg/busyinfo.py @@ -33,6 +33,7 @@ def run(): c = module.find('wxBusyInfo') assert isinstance(c, etgtools.ClassDef) + c.mustHaveApp() c.addPrivateCopyCtor() # context manager methods diff --git a/etg/caret.py b/etg/caret.py index 89d22327..5c272b89 100644 --- a/etg/caret.py +++ b/etg/caret.py @@ -33,6 +33,7 @@ def run(): c = module.find('wxCaret') assert isinstance(c, etgtools.ClassDef) + c.mustHaveApp() c.addPrivateCopyCtor() c.find('GetPosition').findOverload('int *').ignore() diff --git a/etg/combo.py b/etg/combo.py index a5be076d..fb8236b6 100644 --- a/etg/combo.py +++ b/etg/combo.py @@ -35,6 +35,7 @@ def run(): c = module.find('wxComboPopup') assert isinstance(c, etgtools.ClassDef) + c.mustHaveApp() c = module.find('wxComboCtrl') diff --git a/etg/gdicmn.py b/etg/gdicmn.py index de9034a0..931a4325 100644 --- a/etg/gdicmn.py +++ b/etg/gdicmn.py @@ -327,6 +327,7 @@ def run(): c = module.find('wxColourDatabase') + c.mustHaveApp() c.addPyMethod('FindColour', '(self, colour)', 'return self.Find(colour)') module.find('wxTheColourDatabase').ignore() @@ -367,6 +368,8 @@ def run(): 'wxGetDisplayPPI', 'wxClientDisplayRect', 'wxGetClientDisplayRect', + 'wxSetCursor', + #'wxGetXDisplay', ]: c = module.find(funcname) c.mustHaveApp() diff --git a/etg/graphics.py b/etg/graphics.py index 05856148..aa633d0c 100644 --- a/etg/graphics.py +++ b/etg/graphics.py @@ -55,6 +55,7 @@ def run(): #--------------------------------------------- c = module.find('wxGraphicsObject') assert isinstance(c, etgtools.ClassDef) + c.mustHaveApp() c.addCppMethod('bool', 'IsOk', '()', 'return !self->IsNull();') c.addCppMethod('int', '__nonzero__', '()', "return !self->IsNull();") @@ -65,6 +66,8 @@ def run(): markFactories(c) tools.removeVirtuals(c) c.abstract = True + c.mustHaveApp() + # Ensure that the target DC or image lives as long as the GC does. NOTE: # Since the Creates are static methods there is no self to associate the @@ -170,6 +173,7 @@ def run(): tools.removeVirtuals(c) c.find('GetBox').findOverload('wxDouble *x, wxDouble *y').ignore() c.find('GetCurrentPoint').findOverload('wxDouble *x, wxDouble *y').ignore() + c.mustHaveApp() #--------------------------------------------- @@ -191,6 +195,7 @@ def run(): #--------------------------------------------- c = module.find('wxGraphicsMatrix') tools.removeVirtuals(c) + c.mustHaveApp() c.find('Concat').overloads = [] c.find('IsEqual').overloads = [] diff --git a/etg/help.py b/etg/help.py index a9f869e6..5cd148e0 100644 --- a/etg/help.py +++ b/etg/help.py @@ -50,6 +50,7 @@ def run(): #c = module.find('wxHelpController') + #c.mustHaveApp() #c.addPrivateCopyCtor() ## Add pure virtuals with implemenations here #c.addItem(etgtools.WigCode("""\ diff --git a/etg/helpctrl.py b/etg/helpctrl.py index b4ebf323..a7b34f0a 100644 --- a/etg/helpctrl.py +++ b/etg/helpctrl.py @@ -34,6 +34,7 @@ def run(): c = module.find('wxHtmlHelpController') assert isinstance(c, etgtools.ClassDef) + c.mustHaveApp() c.addPrivateCopyCtor() c.find('CreateHelpDialog').ignore(False) diff --git a/etg/htmlprint.py b/etg/htmlprint.py index 440f96cc..0d2fd064 100644 --- a/etg/htmlprint.py +++ b/etg/htmlprint.py @@ -35,6 +35,7 @@ def run(): c = module.find('wxHtmlDCRenderer') assert isinstance(c, etgtools.ClassDef) + c.mustHaveApp() c.addPrivateCopyCtor() tools.fixHtmlSetFonts(c) @@ -42,9 +43,11 @@ def run(): c.find('Render.to').name = 'to_' c = module.find('wxHtmlEasyPrinting') + c.mustHaveApp() c.addPrivateCopyCtor() c = module.find('wxHtmlPrintout') + c.mustHaveApp() c.addPrivateCopyCtor() diff --git a/etg/icon.py b/etg/icon.py index 52ef5dc0..75d973c2 100644 --- a/etg/icon.py +++ b/etg/icon.py @@ -33,6 +33,7 @@ def run(): c = module.find('wxIcon') assert isinstance(c, etgtools.ClassDef) tools.removeVirtuals(c) + c.mustHaveApp() c.find('wxIcon').findOverload('*bits').ignore() c.find('wxIcon').findOverload('bits[]').ignore() diff --git a/etg/iconbndl.py b/etg/iconbndl.py index 13e92f18..1c6bcd0b 100644 --- a/etg/iconbndl.py +++ b/etg/iconbndl.py @@ -32,7 +32,7 @@ def run(): c = module.find('wxIconBundle') assert isinstance(c, etgtools.ClassDef) - + c.mustHaveApp() #----------------------------------------------------------------- tools.doCommonTweaks(module) diff --git a/etg/image.py b/etg/image.py index 3eaebb06..fb7d3997 100644 --- a/etg/image.py +++ b/etg/image.py @@ -51,6 +51,7 @@ def run(): c.find('wxImage').findOverload('int width, int height, unsigned char *data, unsigned char *alpha, bool static_data').ignore() c.find('wxImage').findOverload('const wxSize &sz, unsigned char *data, unsigned char *alpha, bool static_data').ignore() + c.addCppCtor_sip('(int width, int height, wxPyBuffer* data)', doc="Creates an image from RGB data in memory.", body="""\ diff --git a/etg/imaglist.py b/etg/imaglist.py index ed82cdc8..98e3db07 100644 --- a/etg/imaglist.py +++ b/etg/imaglist.py @@ -36,6 +36,7 @@ def run(): c.addPrivateCopyCtor() c.addPrivateAssignOp() tools.removeVirtuals(c) + c.mustHaveApp() c.find('GetSize').type = 'void' c.find('GetSize.width').out = True diff --git a/etg/joystick.py b/etg/joystick.py index f2ca8d57..5fad081d 100644 --- a/etg/joystick.py +++ b/etg/joystick.py @@ -92,8 +92,9 @@ def run(): """) - #c = module.find('') - #assert isinstance(c, etgtools.ClassDef) + c = module.find('wxJoystick') + assert isinstance(c, etgtools.ClassDef) + c.mustHaveApp() #----------------------------------------------------------------- diff --git a/etg/menu.py b/etg/menu.py index a193f708..cf9ea3c9 100644 --- a/etg/menu.py +++ b/etg/menu.py @@ -44,6 +44,7 @@ def run(): #----------------------------------------------------------------- c = module.find('wxMenu') assert isinstance(c, etgtools.ClassDef) + c.mustHaveApp() tools.removeVirtuals(c) addTransferAnnotations(c, 'menuItem') addTransferAnnotations(c, 'subMenu') @@ -96,6 +97,7 @@ def run(): #----------------------------------------------------------------- c = module.find('wxMenuBar') assert isinstance(c, etgtools.ClassDef) + c.mustHaveApp() tools.removeVirtuals(c) addTransferAnnotations(c, 'menu') c.find('wxMenuBar').findOverload('wxMenu *menus[], const wxString titles[], long style=0)').ignore() diff --git a/etg/pen.py b/etg/pen.py index 10e36c91..0768645f 100644 --- a/etg/pen.py +++ b/etg/pen.py @@ -34,6 +34,11 @@ def run(): assert isinstance(c, etgtools.ClassDef) tools.removeVirtuals(c) + # Set mustHaveApp on all ctors except the default ctor + for ctor in c.find('wxPen').all(): + if ctor.isCtor and ctor.argsString != '()': + ctor.mustHaveApp() + # The stipple bitmap ctor is not implemented on wxGTK c.find('wxPen').findOverload('wxBitmap').ignore() diff --git a/etg/popupwin.py b/etg/popupwin.py index 9838dd28..841e1d38 100644 --- a/etg/popupwin.py +++ b/etg/popupwin.py @@ -34,11 +34,13 @@ def run(): c = module.find('wxPopupWindow') assert isinstance(c, etgtools.ClassDef) + c.mustHaveApp() tools.fixWindowClass(c) c.find('Position').isVirtual = True c = module.find('wxPopupTransientWindow') + c.mustHaveApp() tools.fixWindowClass(c) c.find('Dismiss').isVirtual = True c.find('ProcessLeftDown').isVirtual = True diff --git a/etg/printfw.py b/etg/printfw.py index c0c62f77..8ff06142 100644 --- a/etg/printfw.py +++ b/etg/printfw.py @@ -66,6 +66,7 @@ def run(): c = module.find('wxPrintPreview') + c.mustHaveApp() for ctor in [c.find('wxPrintPreview').findOverload('wxPrintDialogData'), c.find('wxPrintPreview').findOverload('wxPrintData')]: ctor.find('printout').transfer = True @@ -82,6 +83,7 @@ def run(): c = module.find('wxPrintout') + c.mustHaveApp() c.addPrivateCopyCtor() c.find('GetPPIPrinter.w').out = True c.find('GetPPIPrinter.h').out = True @@ -102,6 +104,9 @@ def run(): tools.fixTopLevelWindowClass(c) + module.find('wxPrinter').mustHaveApp() + + # deprecated classes module.addPyCode("PyPrintPreview = wx.deprecated(PrintPreview, 'Use PrintPreview instead.')") module.addPyCode("PyPreviewFrame = wx.deprecated(PreviewFrame, 'Use PreviewFrame instead.')") diff --git a/etg/process.py b/etg/process.py index fc6593f8..a8de06c3 100644 --- a/etg/process.py +++ b/etg/process.py @@ -32,7 +32,7 @@ def run(): # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.find('wxProcess').mustHaveApp() module.addPyCode('EVT_END_PROCESS = wx.PyEventBinder( wxEVT_END_PROCESS )') diff --git a/etg/region.py b/etg/region.py index 8b4aea86..8f125edc 100644 --- a/etg/region.py +++ b/etg/region.py @@ -36,6 +36,7 @@ def run(): c = module.find('wxRegion') assert isinstance(c, etgtools.ClassDef) tools.removeVirtuals(c) + c.mustHaveApp() # Replace one of the constructors with one having a more python-friendly API c.find('wxRegion').findOverload('points').ignore() @@ -84,6 +85,7 @@ def run(): c = module.find('wxRegionIterator') + c.mustHaveApp() c.find('operator++').ignore() # SIP maps operator bool() to __int__, but Classic used __nonzero__. Does diff --git a/etg/renderer.py b/etg/renderer.py index b8447e9d..081dd4bd 100644 --- a/etg/renderer.py +++ b/etg/renderer.py @@ -37,6 +37,7 @@ def run(): c = module.find('wxRendererNative') assert isinstance(c, etgtools.ClassDef) + c.mustHaveApp() c.addPrivateCopyCtor() @@ -53,6 +54,7 @@ def run(): c = module.find('wxDelegateRendererNative') + c.mustHaveApp() c.addPrivateCopyCtor() diff --git a/etg/settings.py b/etg/settings.py index 5f8a6234..4f998a27 100644 --- a/etg/settings.py +++ b/etg/settings.py @@ -31,9 +31,9 @@ def run(): # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - #c = module.find('') - #assert isinstance(c, etgtools.ClassDef) - + c = module.find('wxSystemSettings') + assert isinstance(c, etgtools.ClassDef) + c.mustHaveApp() #----------------------------------------------------------------- tools.doCommonTweaks(module) diff --git a/etg/sound.py b/etg/sound.py index 20df711f..efa6b896 100644 --- a/etg/sound.py +++ b/etg/sound.py @@ -36,6 +36,7 @@ def run(): c = module.find('wxSound') assert isinstance(c, etgtools.ClassDef) + c.mustHaveApp() c.addPrivateCopyCtor() c.addPublic() diff --git a/etg/taskbar.py b/etg/taskbar.py index 4af5966c..ccae1959 100644 --- a/etg/taskbar.py +++ b/etg/taskbar.py @@ -53,6 +53,7 @@ def run(): c = module.find('wxTaskBarIcon') + c.mustHaveApp() method = c.find('CreatePopupMenu') method.ignore(False) method.transfer = True diff --git a/etg/timer.py b/etg/timer.py index 7f07495c..f744f511 100644 --- a/etg/timer.py +++ b/etg/timer.py @@ -35,8 +35,10 @@ def run(): c = module.find('wxTimer') assert isinstance(c, etgtools.ClassDef) + c.mustHaveApp() c = module.find('wxTimerRunner') + c.mustHaveApp() c.addPrivateCopyCtor() module.addPyCode('EVT_TIMER = wx.PyEventBinder( wxEVT_TIMER )') diff --git a/etg/tooltip.py b/etg/tooltip.py index 1be80061..3abf7b42 100644 --- a/etg/tooltip.py +++ b/etg/tooltip.py @@ -33,6 +33,7 @@ def run(): c = module.find('wxToolTip') assert isinstance(c, etgtools.ClassDef) + c.mustHaveApp() # TODO: This is MSW only c.find('SetMaxWidth').setCppCode("""\ diff --git a/etg/utils.py b/etg/utils.py index 1f389b17..9084c602 100644 --- a/etg/utils.py +++ b/etg/utils.py @@ -39,6 +39,7 @@ def run(): c = module.find('wxWindowDisabler') assert isinstance(c, etgtools.ClassDef) + c.mustHaveApp() c.addPrivateCopyCtor() module.find('wxQsort').ignore() @@ -66,6 +67,7 @@ def run(): # Keep just the first wxExecute overload f = module.find('wxExecute') f.overloads = [] + f.mustHaveApp() module.find('wxGetOsVersion.major').out = True module.find('wxGetOsVersion.minor').out = True @@ -83,6 +85,9 @@ def run(): 'wxShutdown', 'wxInfoMessageBox', 'wxIsBusy', + 'wxGetMousePosition', + 'wxGetKeyState', + 'wxGetMouseState', ]: c = module.find(funcname) c.mustHaveApp() diff --git a/etg/window.py b/etg/window.py index 1a1e0846..6f64af05 100644 --- a/etg/window.py +++ b/etg/window.py @@ -376,6 +376,10 @@ def run(): module.find('wxFindWindowAtPointer.pt').out = True + module.find('wxFindWindowAtPointer').mustHaveApp() + module.find('wxGetActiveWindow').mustHaveApp() + module.find('wxGetTopLevelParent').mustHaveApp() + module.addCppFunction('wxWindow*', 'FindWindowById', '(long id, const wxWindow* parent=NULL)', doc="""\