X Tutup
Skip to content

Commit c6178b4

Browse files
committed
Updated to CEF 3 revision 1352 on Windows. Chrome 27.0.1453.116.
Fixed compilation errors for CEF Python 3 on Windows. Added gitignore patterns to ignore binary files on Windows, this includes the static libraries in the setup directory. Fixed OVERRIDE warnings in the cefpython_app.h. Fixed wchar_t incomplete type problem, importing from libc.stddef now. Fixed many warnings during compilation like this one: "warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)" - these are mostly caused when using the cpp_bool type. See the comments in cefpython.pyx file regarding this. Though there are more undocumented cases. Minor tweaks to client_handler project files. Added libcefpythonapp visual studio projects, altered Cython setup.py to include it. Updated the wxpython examples on Linux to inform about the tcmalloc hook problem. Updated the example.py script on Windows. Updated the wxpython.py script on Windows - included advanced usage of javascript bindings, js and python callbacks, and client handlers. Updated and renamed the "make_installer.py" script to "make-installer.py", and the "create-setup.py" script to "make-setup.py" so that the naming is consistent across platforms. Added VK_ keyboard constants to CEF Python 3. Updated the inno setup template on Windows. Fixed focus problems in the chromectrl from the wx subpackage.
1 parent 97ae431 commit c6178b4

38 files changed

+1451
-285
lines changed

cefpython/browser_process_handler_cef3.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ cdef public void BrowserProcessHandler_OnRenderProcessThreadCreated(
1212
logFile = "debug.log"
1313
if "log_file" in g_applicationSettings:
1414
logFile = g_applicationSettings["log_file"]
15-
extra_info.get().SetBool(0, g_debug)
15+
extra_info.get().SetBool(0, bool(g_debug))
1616
extra_info.get().SetString(1, PyToCefStringValue(logFile))
1717
except:
1818
(exc_type, exc_value, exc_trace) = sys.exc_info()

cefpython/cef1/linux/installer/create-setup.py renamed to cefpython/cef1/linux/installer/make-setup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Copyright (c) 2012-2013 The CEF Python authors. All rights reserved.
2+
# License: New BSD License.
3+
# Website: http://code.google.com/p/cefpython/
4+
15
# Create a setup package.
26

37
import sys
@@ -23,7 +27,7 @@ def main():
2327
parser.add_argument("-v", "--version", help="cefpython version",
2428
required=True)
2529
args = parser.parse_args()
26-
assert re.search(r"^(v\d+)|(\d+\.\d+)$", args.version), (
30+
assert re.search(r"^\d+\.\d+$", args.version), (
2731
"Invalid version string")
2832

2933
vars = {}

cefpython/cef1/windows/installer/make_installer.py renamed to cefpython/cef1/windows/installer/make-installer.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# Copyright (c) 2012-2013 The CEF Python authors. All rights reserved.
2+
# License: New BSD License.
3+
# Website: http://code.google.com/p/cefpython/
4+
5+
# Create a Windows package installer.
6+
17
import sys
28
import os
39
import platform
@@ -16,7 +22,7 @@ def main():
1622
parser.add_argument("-v", "--version", help="cefpython version",
1723
required=True)
1824
args = parser.parse_args()
19-
assert re.search(r"^(\d+\.\d+)$", args.version), (
25+
assert re.search(r"^\d+\.\d+$", args.version), (
2026
"Invalid version string")
2127

2228
vars = {}

cefpython/cef3/client_handler/client_handler_py27.vcproj

Lines changed: 1 addition & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -16,67 +16,6 @@
1616
<ToolFiles>
1717
</ToolFiles>
1818
<Configurations>
19-
<Configuration
20-
Name="Debug|Win32"
21-
OutputDirectory="Debug_py27"
22-
IntermediateDirectory="Debug_py27"
23-
ConfigurationType="4"
24-
>
25-
<Tool
26-
Name="VCPreBuildEventTool"
27-
/>
28-
<Tool
29-
Name="VCCustomBuildTool"
30-
/>
31-
<Tool
32-
Name="VCXMLDataGeneratorTool"
33-
/>
34-
<Tool
35-
Name="VCWebServiceProxyGeneratorTool"
36-
/>
37-
<Tool
38-
Name="VCMIDLTool"
39-
/>
40-
<Tool
41-
Name="VCCLCompilerTool"
42-
Optimization="0"
43-
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;"
44-
MinimalRebuild="true"
45-
BasicRuntimeChecks="3"
46-
RuntimeLibrary="3"
47-
UsePrecompiledHeader="0"
48-
WarningLevel="3"
49-
Detect64BitPortabilityProblems="true"
50-
DebugInformationFormat="4"
51-
/>
52-
<Tool
53-
Name="VCManagedResourceCompilerTool"
54-
/>
55-
<Tool
56-
Name="VCResourceCompilerTool"
57-
/>
58-
<Tool
59-
Name="VCPreLinkEventTool"
60-
/>
61-
<Tool
62-
Name="VCLibrarianTool"
63-
/>
64-
<Tool
65-
Name="VCALinkTool"
66-
/>
67-
<Tool
68-
Name="VCXDCMakeTool"
69-
/>
70-
<Tool
71-
Name="VCBscMakeTool"
72-
/>
73-
<Tool
74-
Name="VCFxCopTool"
75-
/>
76-
<Tool
77-
Name="VCPostBuildEventTool"
78-
/>
79-
</Configuration>
8019
<Configuration
8120
Name="Release|Win32"
8221
OutputDirectory="Release_py27"
@@ -101,7 +40,7 @@
10140
<Tool
10241
Name="VCCLCompilerTool"
10342
AdditionalIncludeDirectories="../;$(PYTHON_INCLUDE_PATH);C:\Python27\include"
104-
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;"
43+
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;"
10544
ExceptionHandling="1"
10645
RuntimeLibrary="2"
10746
UsePrecompiledHeader="0"

cefpython/cef3/client_handler/client_handler_py32.vcproj

Lines changed: 1 addition & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -15,67 +15,6 @@
1515
<ToolFiles>
1616
</ToolFiles>
1717
<Configurations>
18-
<Configuration
19-
Name="Debug|Win32"
20-
OutputDirectory="Debug_py27"
21-
IntermediateDirectory="Debug_py27"
22-
ConfigurationType="4"
23-
>
24-
<Tool
25-
Name="VCPreBuildEventTool"
26-
/>
27-
<Tool
28-
Name="VCCustomBuildTool"
29-
/>
30-
<Tool
31-
Name="VCXMLDataGeneratorTool"
32-
/>
33-
<Tool
34-
Name="VCWebServiceProxyGeneratorTool"
35-
/>
36-
<Tool
37-
Name="VCMIDLTool"
38-
/>
39-
<Tool
40-
Name="VCCLCompilerTool"
41-
Optimization="0"
42-
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;"
43-
MinimalRebuild="true"
44-
BasicRuntimeChecks="3"
45-
RuntimeLibrary="3"
46-
UsePrecompiledHeader="0"
47-
WarningLevel="3"
48-
Detect64BitPortabilityProblems="true"
49-
DebugInformationFormat="4"
50-
/>
51-
<Tool
52-
Name="VCManagedResourceCompilerTool"
53-
/>
54-
<Tool
55-
Name="VCResourceCompilerTool"
56-
/>
57-
<Tool
58-
Name="VCPreLinkEventTool"
59-
/>
60-
<Tool
61-
Name="VCLibrarianTool"
62-
/>
63-
<Tool
64-
Name="VCALinkTool"
65-
/>
66-
<Tool
67-
Name="VCXDCMakeTool"
68-
/>
69-
<Tool
70-
Name="VCBscMakeTool"
71-
/>
72-
<Tool
73-
Name="VCFxCopTool"
74-
/>
75-
<Tool
76-
Name="VCPostBuildEventTool"
77-
/>
78-
</Configuration>
7918
<Configuration
8019
Name="Release|Win32"
8120
OutputDirectory="Release_py32"
@@ -100,7 +39,7 @@
10039
<Tool
10140
Name="VCCLCompilerTool"
10241
AdditionalIncludeDirectories="../;$(PYTHON_INCLUDE_PATH);C:\Python32\include"
103-
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;"
42+
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;"
10443
ExceptionHandling="1"
10544
RuntimeLibrary="2"
10645
UsePrecompiledHeader="0"

cefpython/cef3/linux/binaries_32bit/wxpython.html

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,29 +151,48 @@ <h3>Python callbacks</h3>
151151

152152

153153

154-
<h3>Display handler</h3>
155154

156-
See messages in the console.
155+
<h3>Display handler</h3>
157156

158157
<pre>
159158
def OnLoadingStateChange(self, browser, isLoading, canGoBack,
160159
canGoForward):
161160
print("ClientHandler::OnLoadingStateChange()")
162161
print("isLoading = %s, canGoBack = %s, canGoForward = %s" \
163162
% (isLoading, canGoBack, canGoForward))
163+
</pre>
164+
165+
See messages in the console during loading of a webpage.
164166

167+
<pre>
165168
def OnAddressChange(self, browser, frame, url):
166169
print("ClientHandler::OnAddressChange()")
167170
print("url = %s" % url)
171+
</pre>
172+
173+
See messages in the console during loading of a webpage.
168174

175+
<pre>
169176
def OnTitleChange(self, browser, title):
170177
print("ClientHandler::OnTitleChange()")
171178
print("title = %s" % title)
179+
</pre>
180+
181+
See messages in the console during loading of a webpage.
182+
183+
<pre>
184+
def OnTooltip(self, browser, textOut):
185+
# OnTooltip not yet implemented (both Linux and Windows),
186+
# will be fixed in next CEF release, see Issue 783:
187+
# https://code.google.com/p/chromiumembedded/issues/detail?id=783
188+
print("DisplayHandler::OnTooltip()")
189+
print("text = %s" % textOut[0])
190+
</pre>
172191

173-
def OnTooltip(self, browser, text):
174-
print("ClientHandler::OnTooltip()")
175-
print("text = %s")
192+
See messages in the console when hovering over a google logo:
193+
<a href="http://www.google.com/">http://www.google.com/</a>
176194

195+
<pre>
177196
def OnStatusMessage(self, browser, value):
178197
if not value:
179198
# Do not notify in the console about empty statuses.
@@ -184,21 +203,32 @@ <h3>Display handler</h3>
184203
return
185204
print("DisplayHandler::OnStatusMessage()")
186205
print("value = %s" % value)
206+
</pre>
207+
208+
See messages in the console when hovering over links.
187209

210+
<pre>
188211
def OnConsoleMessage(self, browser, message, source, line):
189212
print("ClientHandler::OnConsoleMessage()")
190213
print("message = %s" % message)
191214
print("source = %s" % source)
192215
print("line = %s" % line)
193216
</pre>
194217

218+
Try this:
219+
<a href="http://patik.com/code/console-log-polyfill/">
220+
http://patik.com/code/console-log-polyfill/</a>
221+
222+
195223

196224

197225

198226
<h3>Keyboard handler</h3>
199227
<p>
200-
Click anywhere in the window first to set keyboard focus.
201-
Next press F5 to reload the page.
228+
Press F5 to reload the page.<br>
229+
On Linux it is required to click anywhere in the window first
230+
so that keyboard focus is set. See Issue 77 in the CEF Python
231+
Issue Tracker.
202232
</p>
203233
<pre>
204234
def OnPreKeyEvent(self, browser, event, eventHandle,
@@ -429,9 +459,13 @@ <h3>Load Handler</h3>
429459
customErrorMessage = "My custom error message!"
430460
frame.LoadUrl("data:text/html,%s" % customErrorMessage)
431461
</pre>
462+
432463
Try this:
433464
<a href="http://www.non-existent.nono/">
434465
http://www.non-existent.nono/</a>
466+
<br>
467+
(After you see the custom error message you have to hit
468+
twice the Back from the context menu, to get back to this page)
435469

436470
<pre>
437471
def OnRendererProcessTerminated(self, browser, status):
@@ -457,4 +491,4 @@ <h3>Load Handler</h3>
457491
No test for that yet.
458492

459493
</body>
460-
</html>
494+
</html>

cefpython/cef3/linux/binaries_32bit/wxpython.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# An example of embedding CEF browser in wxPython on Linux.
22

3+
# Important:
4+
# On Linux importing the cefpython module must be
5+
# the very first in your application. This is because CEF makes
6+
# a global tcmalloc hook for memory allocation/deallocation.
7+
# See Issue 73 that is to provide CEF builds with tcmalloc disabled:
8+
# https://code.google.com/p/cefpython/issues/detail?id=73
9+
310
import ctypes, os, sys
411
libcef_so = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'libcef.so')
512
if os.path.exists(libcef_so):
@@ -262,8 +269,8 @@ def OnTitleChange(self, browser, title):
262269
print("title = %s" % title)
263270

264271
def OnTooltip(self, browser, textOut):
265-
# OnTooltip does not work on Linux, will be fixed in next
266-
# CEF release, see Issue 783:
272+
# OnTooltip not yet implemented (both Linux and Windows),
273+
# will be fixed in next CEF release, see Issue 783:
267274
# https://code.google.com/p/chromiumembedded/issues/detail?id=783
268275
print("DisplayHandler::OnTooltip()")
269276
print("text = %s" % textOut[0])

0 commit comments

Comments
 (0)
X Tutup