Skip to content

Commit ac701e3

Browse files
committed
Merge branch 'master' of https://github.com/cztomczak/cefpython
1 parent 940c28a commit ac701e3

File tree

7 files changed

+57
-30
lines changed

7 files changed

+57
-30
lines changed

examples/qt.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# bar and a browser.
44
#
55
# Tested configurations:
6-
# - PyQt 5.8.2 on Linux
6+
# - PyQt 5.8.2 on Windows/Linux/Mac
77
# - PyQt 4.11 (qt 4.8) on Windows/Linux
88
# - PySide 1.2 (qt 4.8) on Windows/Linux/Mac
99
# - CEF Python v55.4+
@@ -124,9 +124,22 @@ def setupLayout(self):
124124
frame = QFrame()
125125
frame.setLayout(layout)
126126
self.setCentralWidget(frame)
127+
128+
if PYQT5 and WINDOWS:
129+
# On Windows with PyQt5 main window must be shown first
130+
# before CEF browser is embedded, otherwise window is
131+
# not resized and application hangs during resize.
132+
self.show()
133+
127134
# Browser can be embedded only after layout was set up
128135
self.cef_widget.embedBrowser()
129-
if LINUX and PYQT5:
136+
137+
if PYQT5 and LINUX:
138+
# On Linux with PyQt5 the QX11EmbedContainer widget is
139+
# no more available. An equivalent in Qt5 is to create
140+
# a hidden window, embed CEF browser in it and then
141+
# create a container for that hidden window and replace
142+
# cef widget in the layout with the container.
130143
self.container = QWidget.createWindowContainer(
131144
self.cef_widget.hidden_window, parent=self)
132145
layout.addWidget(self.container, 1, 0)
@@ -166,7 +179,7 @@ def focusOutEvent(self, event):
166179
self.browser.SetFocus(False)
167180

168181
def embedBrowser(self):
169-
if LINUX and PYQT5:
182+
if PYQT5 and LINUX:
170183
self.hidden_window = QWindow()
171184
window_info = cef.WindowInfo()
172185
rect = [0, 0, self.width(), self.height()]
@@ -177,8 +190,8 @@ def embedBrowser(self):
177190
self.browser.SetClientHandler(FocusHandler(self))
178191

179192
def getHandle(self):
180-
# PyQt5 on Linux
181193
if self.hidden_window:
194+
# PyQt5 on Linux
182195
return int(self.hidden_window.winId())
183196
try:
184197
# PyQt4 and PyQt5

examples/tutorial.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
window.onload = function(){
4343
js_print("Javascript", "window.onload", "Called");
4444
js_print("Javascript", "python_property", python_property);
45+
js_print("Javascript", "navigator.userAgent", navigator.userAgent);
46+
js_print("Javascript", "cefpython_version", cefpython_version.version);
4547
html_to_data_uri("test", js_callback_1);
4648
external.test_multiple_callbacks(js_callback_2);
4749
};
@@ -113,6 +115,7 @@ def set_javascript_bindings(browser):
113115
bindings = cef.JavascriptBindings(
114116
bindToFrames=False, bindToPopups=False)
115117
bindings.SetProperty("python_property", "This property was set in Python")
118+
bindings.SetProperty("cefpython_version", cef.GetVersion())
116119
bindings.SetFunction("html_to_data_uri", html_to_data_uri)
117120
bindings.SetObject("external", external)
118121
browser.SetJavascriptBindings(bindings)

src/compile_time_constants.pxi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# This file was generated by setup.py
2-
DEF UNAME_SYSNAME = "Linux"
2+
DEF UNAME_SYSNAME = "Windows"
33
DEF PY_MAJOR_VERSION = 2

src/version/cef_version_mac.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@
3535
#ifndef CEF_INCLUDE_CEF_VERSION_H_
3636
#define CEF_INCLUDE_CEF_VERSION_H_
3737

38-
#define CEF_VERSION "3.2924.1575.g97389a9"
38+
#define CEF_VERSION "3.2987.1601.gf035232"
3939
#define CEF_VERSION_MAJOR 3
40-
#define CEF_COMMIT_NUMBER 1575
41-
#define CEF_COMMIT_HASH "97389a92ee2309ded830338d6afd61ba109d31d8"
40+
#define CEF_COMMIT_NUMBER 1601
41+
#define CEF_COMMIT_HASH "f035232c082f837d2b85bd7821a93a54fc742775"
4242
#define COPYRIGHT_YEAR 2017
4343

44-
#define CHROME_VERSION_MAJOR 56
44+
#define CHROME_VERSION_MAJOR 57
4545
#define CHROME_VERSION_MINOR 0
46-
#define CHROME_VERSION_BUILD 2924
47-
#define CHROME_VERSION_PATCH 76
46+
#define CHROME_VERSION_BUILD 2987
47+
#define CHROME_VERSION_PATCH 133
4848

4949
#define DO_MAKE_STRING(p) #p
5050
#define MAKE_STRING(p) DO_MAKE_STRING(p)
@@ -63,13 +63,13 @@ extern "C" {
6363
// universal hash value will change if any platform is affected whereas the
6464
// platform hash values will change only if that particular platform is
6565
// affected.
66-
#define CEF_API_HASH_UNIVERSAL "66de193ba22e1d92a99bb29d60f3107709aeefda"
66+
#define CEF_API_HASH_UNIVERSAL "b0a24e3e202f3d8b72f2fbc1ebc5864f96ec16ae"
6767
#if defined(OS_WIN)
68-
#define CEF_API_HASH_PLATFORM "8055740cd08db66cefe838a826dc90806fadfb33"
68+
#define CEF_API_HASH_PLATFORM "1c6a27f840ac87c8c971350c907edbe2c5fa0387"
6969
#elif defined(OS_MACOSX)
70-
#define CEF_API_HASH_PLATFORM "12d8ab423df369b68d37c3667123a1812bc0d345"
70+
#define CEF_API_HASH_PLATFORM "1567db600ee83cc2a59bb8c17ca416d11a7c9b8a"
7171
#elif defined(OS_LINUX)
72-
#define CEF_API_HASH_PLATFORM "86ab23c0d7dafbdff7f66764cf8dac5ec1712af4"
72+
#define CEF_API_HASH_PLATFORM "1f9f9e15bf7cf13de2557ddd411dfc9f694503b0"
7373
#endif
7474

7575
// Returns CEF version information for the libcef library. The |entry|

src/version/cef_version_win.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@
3535
#ifndef CEF_INCLUDE_CEF_VERSION_H_
3636
#define CEF_INCLUDE_CEF_VERSION_H_
3737

38-
#define CEF_VERSION "3.2924.1575.g97389a9"
38+
#define CEF_VERSION "3.2987.1601.gf035232"
3939
#define CEF_VERSION_MAJOR 3
40-
#define CEF_COMMIT_NUMBER 1575
41-
#define CEF_COMMIT_HASH "97389a92ee2309ded830338d6afd61ba109d31d8"
40+
#define CEF_COMMIT_NUMBER 1601
41+
#define CEF_COMMIT_HASH "f035232c082f837d2b85bd7821a93a54fc742775"
4242
#define COPYRIGHT_YEAR 2017
4343

44-
#define CHROME_VERSION_MAJOR 56
44+
#define CHROME_VERSION_MAJOR 57
4545
#define CHROME_VERSION_MINOR 0
46-
#define CHROME_VERSION_BUILD 2924
47-
#define CHROME_VERSION_PATCH 76
46+
#define CHROME_VERSION_BUILD 2987
47+
#define CHROME_VERSION_PATCH 133
4848

4949
#define DO_MAKE_STRING(p) #p
5050
#define MAKE_STRING(p) DO_MAKE_STRING(p)
@@ -63,13 +63,13 @@ extern "C" {
6363
// universal hash value will change if any platform is affected whereas the
6464
// platform hash values will change only if that particular platform is
6565
// affected.
66-
#define CEF_API_HASH_UNIVERSAL "66de193ba22e1d92a99bb29d60f3107709aeefda"
66+
#define CEF_API_HASH_UNIVERSAL "b0a24e3e202f3d8b72f2fbc1ebc5864f96ec16ae"
6767
#if defined(OS_WIN)
68-
#define CEF_API_HASH_PLATFORM "8055740cd08db66cefe838a826dc90806fadfb33"
68+
#define CEF_API_HASH_PLATFORM "1c6a27f840ac87c8c971350c907edbe2c5fa0387"
6969
#elif defined(OS_MACOSX)
70-
#define CEF_API_HASH_PLATFORM "12d8ab423df369b68d37c3667123a1812bc0d345"
70+
#define CEF_API_HASH_PLATFORM "1567db600ee83cc2a59bb8c17ca416d11a7c9b8a"
7171
#elif defined(OS_LINUX)
72-
#define CEF_API_HASH_PLATFORM "86ab23c0d7dafbdff7f66764cf8dac5ec1712af4"
72+
#define CEF_API_HASH_PLATFORM "1f9f9e15bf7cf13de2557ddd411dfc9f694503b0"
7373
#endif
7474

7575
// Returns CEF version information for the libcef library. The |entry|

tools/automate.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ def setup_options(docopt_args):
201201
Options.ninja_jobs = int(multiprocessing.cpu_count() / 2)
202202
if Options.ninja_jobs < 1:
203203
Options.ninja_jobs = 1
204+
Options.ninja_jobs = str(Options.ninja_jobs)
204205

205206

206207
def build_cef():
@@ -410,9 +411,11 @@ def build_cef_projects():
410411
# > cefclient_mac.mm:22:29: error: property 'mainMenu' not found
411412
if MAC:
412413
# Build only cefsimple
413-
command.extend(["ninja", "cefsimple"])
414+
command.extend(["ninja", "-j", Options.ninja_jobs,
415+
"cefsimple"])
414416
else:
415-
command.extend(["ninja", "cefclient", "cefsimple", "ceftests"])
417+
command.extend(["ninja", "-j", Options.ninja_jobs,
418+
"cefclient", "cefsimple", "ceftests"])
416419
run_command(command, build_cefclient_dir)
417420
print("[automate.py] OK")
418421
assert os.path.exists(cefclient_exe)
@@ -507,7 +510,8 @@ def build_wrapper_library_windows(runtime_library, msvs, vcvars):
507510

508511
# Run ninja
509512
ninja_wrapper = prepare_build_command(build_lib=True, vcvars=vcvars)
510-
ninja_wrapper.extend(["ninja", "libcef_dll_wrapper"])
513+
ninja_wrapper.extend(["ninja", "-j", Options.ninja_jobs,
514+
"libcef_dll_wrapper"])
511515
run_command(ninja_wrapper, working_dir=build_wrapper_dir)
512516
print("[automate.py] ninja OK")
513517
assert os.path.exists(wrapper_lib)
@@ -630,7 +634,8 @@ def build_wrapper_library_mac():
630634
print("[automate.py] cmake OK")
631635
# Ninja
632636
ninja_wrapper = prepare_build_command(build_lib=True)
633-
ninja_wrapper.extend(["ninja", "libcef_dll_wrapper"])
637+
ninja_wrapper.extend(["ninja", "-j", Options.ninja_jobs,
638+
"libcef_dll_wrapper"])
634639
run_command(ninja_wrapper, build_wrapper_dir)
635640
print("[automate.py] ninja OK")
636641
assert os.path.exists(wrapper_lib)

unittests/main_test.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import sys
1515

1616
# To show the window for an extended period of time increase this number.
17-
MESSAGE_LOOP_RANGE = 100 # each iteration is 0.01 sec
17+
MESSAGE_LOOP_RANGE = 200 # each iteration is 0.01 sec
1818

1919
g_datauri_data = """
2020
<!DOCTYPE html>
@@ -36,6 +36,11 @@
3636
window.onload = function(){
3737
print("window.onload() ok");
3838
39+
version = cefpython_version
40+
print("CEF Python: <b>"+version.version+"</b>");
41+
print("Chrome: <b>"+version.chrome_version+"</b>");
42+
print("CEF: <b>"+version.cef_version+"</b>");
43+
3944
// Test binding property: test_property1
4045
if (test_property1 == "Test binding property to the 'window' object") {
4146
print("test_property_1 ok");
@@ -140,6 +145,7 @@ def test_main(self):
140145
bindings.SetFunction("test_function", external.test_function)
141146
bindings.SetProperty("test_property1", external.test_property1)
142147
bindings.SetProperty("test_property2", external.test_property2)
148+
bindings.SetProperty("cefpython_version", cef.GetVersion())
143149
bindings.SetObject("external", external)
144150
browser.SetJavascriptBindings(bindings)
145151
subtest_message("browser.SetJavascriptBindings() ok")

0 commit comments

Comments
 (0)