Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/cztomczak/cefpython
Browse files Browse the repository at this point in the history
# Conflicts:
#	examples/wxpython.py
#	src/compile_time_constants.pxi
  • Loading branch information
cztomczak committed Apr 19, 2017
2 parents 896b0df + 8c5904a commit 824d7ce
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
21 changes: 19 additions & 2 deletions examples/wxpython.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This example has a top menu and a browser widget without navigation bar.

# Tested configurations:
# - wxPython 4.0 on Windows/Linux
# - wxPython 4.0 on Windows/Mac/Linux
# - wxPython 3.0 on Windows/Mac
# - wxPython 2.8 on Linux
# - CEF Python v55.4+
Expand Down Expand Up @@ -189,14 +189,31 @@ class CefApp(wx.App):
def __init__(self, redirect):
self.timer = None
self.timer_id = 1
self.is_initialized = False
super(CefApp, self).__init__(redirect=redirect)

def OnPreInit(self):
super(CefApp, self).OnPreInit()
# On Mac with wxPython 4.0 the OnInit() event never gets
# called. Doing wx window creation in OnPreInit() seems to
# resolve the problem (Issue #350).
if MAC and wx.version().startswith("4."):
print("[wxpython.py] OnPreInit: initialize here"
" (wxPython 4.0 fix)")
self.initialize()

def OnInit(self):
self.initialize()
return True

def initialize(self):
if self.is_initialized:
return
self.is_initialized = True
self.create_timer()
frame = MainFrame()
self.SetTopWindow(frame)
frame.Show()
return True

def create_timer(self):
# See also "Making a render loop":
Expand Down
2 changes: 2 additions & 0 deletions tools/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ def get_python_include_path():
try_dirs = ["{base_dir}/include",
"{base_dir}/../include/python{ver}",
"{base_dir}/../include/python{ver}*",
("{base_dir}/../Frameworks/Python.framework/Versions/{ver}"
"/include/python{ver}*"),
"/usr/include/python{ver}"]
ver_tuple = sys.version_info[:2]
ver = "{major}.{minor}".format(major=ver_tuple[0], minor=ver_tuple[1])
Expand Down

0 comments on commit 824d7ce

Please sign in to comment.