Skip to content

Commit 824d7ce

Browse files
committed
Merge branch 'master' of https://github.com/cztomczak/cefpython
# Conflicts: # examples/wxpython.py # src/compile_time_constants.pxi
2 parents 896b0df + 8c5904a commit 824d7ce

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

examples/wxpython.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This example has a top menu and a browser widget without navigation bar.
33

44
# Tested configurations:
5-
# - wxPython 4.0 on Windows/Linux
5+
# - wxPython 4.0 on Windows/Mac/Linux
66
# - wxPython 3.0 on Windows/Mac
77
# - wxPython 2.8 on Linux
88
# - CEF Python v55.4+
@@ -189,14 +189,31 @@ class CefApp(wx.App):
189189
def __init__(self, redirect):
190190
self.timer = None
191191
self.timer_id = 1
192+
self.is_initialized = False
192193
super(CefApp, self).__init__(redirect=redirect)
193194

195+
def OnPreInit(self):
196+
super(CefApp, self).OnPreInit()
197+
# On Mac with wxPython 4.0 the OnInit() event never gets
198+
# called. Doing wx window creation in OnPreInit() seems to
199+
# resolve the problem (Issue #350).
200+
if MAC and wx.version().startswith("4."):
201+
print("[wxpython.py] OnPreInit: initialize here"
202+
" (wxPython 4.0 fix)")
203+
self.initialize()
204+
194205
def OnInit(self):
206+
self.initialize()
207+
return True
208+
209+
def initialize(self):
210+
if self.is_initialized:
211+
return
212+
self.is_initialized = True
195213
self.create_timer()
196214
frame = MainFrame()
197215
self.SetTopWindow(frame)
198216
frame.Show()
199-
return True
200217

201218
def create_timer(self):
202219
# See also "Making a render loop":

tools/common.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@ def get_python_include_path():
242242
try_dirs = ["{base_dir}/include",
243243
"{base_dir}/../include/python{ver}",
244244
"{base_dir}/../include/python{ver}*",
245+
("{base_dir}/../Frameworks/Python.framework/Versions/{ver}"
246+
"/include/python{ver}*"),
245247
"/usr/include/python{ver}"]
246248
ver_tuple = sys.version_info[:2]
247249
ver = "{major}.{minor}".format(major=ver_tuple[0], minor=ver_tuple[1])

0 commit comments

Comments
 (0)