Skip to content

Commit 246cff2

Browse files
authored
Merge pull request #2894 from swt2c/fix_webview_stubs
Fix webview stubs for wxWidgets 3.3.x
2 parents c6d65b4 + ea62b77 commit 246cff2

3 files changed

Lines changed: 36 additions & 10 deletions

File tree

docs/sphinx/itemToModuleMap.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@
342342
"App":"wx.",
343343
"AppAssertMode":"wx.",
344344
"AppConsole":"wx.",
345+
"AppModal":"wx.",
345346
"AppTraits":"wx.",
346347
"Appearance":"wx.PyApp.",
347348
"AppearanceResult":"wx.PyApp.",
@@ -1516,6 +1517,7 @@
15161517
"GetSingleChoice":"wx.",
15171518
"GetSingleChoiceData":"wx.",
15181519
"GetSingleChoiceIndex":"wx.",
1520+
"GetStockHelpString":"wx.",
15191521
"GetStockLabel":"wx.",
15201522
"GetTextFromUser":"wx.",
15211523
"GetTextFromUserPromptStr":"wx.",
@@ -7286,6 +7288,7 @@
72867288
"STC_ZIG_STRING":"wx.stc.",
72877289
"STC_ZIG_STRINGEOL":"wx.stc.",
72887290
"STOCK_FOR_BUTTON":"wx.",
7291+
"STOCK_MENU":"wx.",
72897292
"STOCK_NOFLAGS":"wx.",
72907293
"STOCK_WITHOUT_ELLIPSIS":"wx.",
72917294
"STOCK_WITH_ACCELERATOR":"wx.",
@@ -7510,6 +7513,7 @@
75107513
"StayInProperty":"wx.propgrid.",
75117514
"StdDialogButtonSizer":"wx.",
75127515
"StockCursor":"wx.",
7516+
"StockHelpStringClient":"wx.",
75137517
"StockLabelQueryFlag":"wx.",
75147518
"StockPreferencesPage":"wx.",
75157519
"StopWatch":"wx.",
@@ -7527,6 +7531,7 @@
75277531
"StyledTextCtrl":"wx.stc.",
75287532
"StyledTextEvent":"wx.stc.",
75297533
"Swap":"wx.",
7534+
"SwapInterval":"wx.glcanvas.GLCanvas.",
75307535
"SymbolPickerDialog":"wx.richtext.",
75317536
"SysColourChangedEvent":"wx.",
75327537
"SysErrorCode":"wx.",
@@ -8319,6 +8324,8 @@
83198324
"WebViewFindFlags":"wx.html2.",
83208325
"WebViewHandler":"wx.html2.",
83218326
"WebViewHandlerRequest":"wx.html2.",
8327+
"WebViewHandlerResponse":"wx.html2.",
8328+
"WebViewHandlerResponseData":"wx.html2.",
83228329
"WebViewHistoryItem":"wx.html2.",
83238330
"WebViewIE_EmulationLevel":"wx.html2.",
83248331
"WebViewNameStr":"wx.html2.",
@@ -8340,7 +8347,9 @@
83408347
"WindowDisabler":"wx.",
83418348
"WindowID":"wx.",
83428349
"WindowIDRef":"wx.",
8350+
"WindowModal":"wx.",
83438351
"WindowModalDialogEvent":"wx.",
8352+
"WindowMode":"wx.",
83448353
"WindowVariant":"wx.",
83458354
"WithImages":"wx.",
83468355
"Wizard":"wx.adv.",

etg/webview.py

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@
2121
'wxWebViewHandler',
2222
'wxWebViewArchiveHandler',
2323
'wxWebViewFSHandler',
24+
'wxWebViewConfiguration',
25+
'wxWebViewFactory',
2426
'wxWebView',
2527
'wxWebViewEvent',
26-
'wxWebViewFactory',
2728
'wxWebViewIE',
2829
'wxWebViewHandlerRequest',
29-
'wxWebViewConfiguration',
30+
'wxWebViewHandlerResponse',
31+
'wxWebViewHandlerResponseData',
3032
'wxWebViewWindowFeatures',
3133
]
3234

@@ -99,20 +101,24 @@ def run():
99101
c.find('GetVersionInfo').ignore()
100102
c.find('CreateConfiguration').isPureVirtual = True
101103
c.find('CreateConfiguration').setCppCode_sip("""\
102-
PyErr_Clear();
103-
Py_BEGIN_ALLOW_THREADS
104-
wxWebViewConfiguration cfg = sipCpp->CreateConfiguration();
105-
sipRes = new wxWebViewConfiguration(cfg.GetBackend(), cfg.GetImpl());
106-
Py_END_ALLOW_THREADS
107-
if (PyErr_Occurred()) sipIsErr = 1;
104+
#if wxUSE_WEBVIEW
105+
PyErr_Clear();
106+
Py_BEGIN_ALLOW_THREADS
107+
wxWebViewConfiguration cfg = sipCpp->CreateConfiguration();
108+
sipRes = new wxWebViewConfiguration(cfg.GetBackend(), cfg.GetImpl());
109+
Py_END_ALLOW_THREADS
110+
if (PyErr_Occurred()) sipIsErr = 1;
111+
#else
112+
wxPyRaiseNotImplemented();
113+
#endif
108114
""")
109115

110116
tools.generateStubs('wxUSE_WEBVIEW', module,
111117
typeValMap={
112118
'wxWebViewNavigationActionFlags': 'wxWEBVIEW_NAV_ACTION_NONE',
113119
'wxWebViewZoom': 'wxWEBVIEW_ZOOM_MEDIUM',
114120
'wxVersionInfo': 'wxVersionInfo()',
115-
'wxWebViewConfiguration': 'wxWebViewConfiguration("", NULL)',
121+
'wxWebViewConfiguration': 'wxWebView::NewConfiguration()',
116122
})
117123

118124
c = module.find('wxWebView')
@@ -292,9 +298,18 @@ def run():
292298
c = module.find('wxWebViewHandlerRequest')
293299
c.find('GetDataString').ignore()
294300

301+
c = module.find('wxWebViewHandlerResponse')
302+
c.abstract = True
303+
for m in c.find('Finish').all():
304+
m.ignore()
305+
295306
c = module.find('wxWebViewConfiguration')
296307
c.abstract = True
297-
c.instanceCode = 'sipCpp = new wxWebViewConfiguration("", NULL);'
308+
c.instanceCode = """\
309+
#if wxUSE_WEBVIEW
310+
sipCpp = new wxWebViewConfiguration("", NULL);
311+
#endif
312+
"""
298313

299314
c = module.find('wxWebViewWindowFeatures')
300315
c.abstract = True

etgtools/tweaker_tools.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1925,6 +1925,8 @@ def _generateMethodStub(code, method, typeValMap):
19251925
decl += '{} {}'.format(method.type, method.name)
19261926
decl += method.argsString
19271927
if method.isPureVirtual:
1928+
if '=0' not in decl:
1929+
decl += '=0'
19281930
decl += ';'
19291931
code.hdr.append(decl)
19301932

0 commit comments

Comments
 (0)