Skip to content

Commit

Permalink
Update docs for 56.2 release. Do not call client handlers nor
Browse files Browse the repository at this point in the history
javascript bindings in DevTools windows (#344). Update Tutorial
and tutorial.py example.
  • Loading branch information
cztomczak committed Apr 19, 2017
1 parent eeae125 commit 321b34a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 28 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ also download packages for offline installation available on the
[GitHub Releases](../../releases) pages.

```
pip install cefpython3==56.1
pip install cefpython3==56.2
```

## Tutorial
Expand Down
11 changes: 5 additions & 6 deletions docs/Migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,11 @@ Table of contents:

## v50+ Distribution packages

In latest CEF Python there are only two distribution packages
available. The first one is a wheel package distributed through
PyPI, which you can install using the pip tool (8.1+ required
on Linux). The second one is a setup package available for
download on the GitHub Releases pages, instructions on how to
install it are provided in README.txt.
In latest CEF Python there is only one distribution package
available: a wheel package. Wheel packages are distributed on
[PyPI](https://pypi.python.org/pypi/cefpython3) and you can
install it using the pip tool (8.1+ required on Linux). You
can also download wheel packages from [GitHub Releases](../../../releases).

**Windows**

Expand Down
6 changes: 1 addition & 5 deletions docs/Tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Run the commands below to install the cefpython3 package, clone
the repository and run the Hello World example:

```commandline
pip install cefpython3==56.1
pip install cefpython3==56.2
git clone https://github.com/cztomczak/cefpython.git
cd cefpython/examples/
python hello_world.py
Expand Down Expand Up @@ -320,10 +320,6 @@ def set_client_handlers(browser):
...
class LoadHandler(object):
def OnLoadingStateChange(self, browser, is_loading, **_):
# Issue #344 will fix this in next release, so that client
# handlers are not called for Developer Tools windows.
if browser.GetUrl().startswith("chrome-devtools://"):
return
# This callback is called twice, once when loading starts
# (is_loading=True) and second time when loading ends
# (is_loading=False).
Expand Down
2 changes: 1 addition & 1 deletion examples/Examples-README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Instructions to install the cefpython3 package, clone the repository
and run the hello_world.py example:

```
pip install cefpython3==56.1
pip install cefpython3==56.2
git clone https://github.com/cztomczak/cefpython.git
cd cefpython/examples/
python hello_world.py
Expand Down
18 changes: 3 additions & 15 deletions examples/tutorial.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Tutorial example. Doesn't depend on any third party GUI framework.
# Tested with CEF Python v56.1+
# Tested with CEF Python v56.2+

from cefpython3 import cefpython as cef
import base64
Expand Down Expand Up @@ -61,7 +61,7 @@ def main():
cef.Initialize()
set_global_handler()
browser = cef.CreateBrowserSync(url=html_to_data_uri(HTML_code),
window_title="Hello World!")
window_title="Tutorial")
set_client_handlers(browser)
set_javascript_bindings(browser)
cef.MessageLoop()
Expand All @@ -72,7 +72,7 @@ def check_versions():
print("[tutorial.py] CEF Python {ver}".format(ver=cef.__version__))
print("[tutorial.py] Python {ver} {arch}".format(
ver=platform.python_version(), arch=platform.architecture()[0]))
assert cef.__version__ >= "56.1", "CEF Python v56.1+ required to run this"
assert cef.__version__ >= "56.2", "CEF Python v56.2+ required to run this"


def html_to_data_uri(html, js_callback=None):
Expand Down Expand Up @@ -125,10 +125,6 @@ def js_print(browser, lang, event, msg):

class GlobalHandler(object):
def OnAfterCreated(self, browser, **_):
# Issue #344 will fix this in next release, so that client
# handlers are not called for Developer Tools windows.
if browser.GetUrl().startswith("chrome-devtools://"):
return
# DOM is not yet loaded. Using js_print at this moment will
# throw an error: "Uncaught ReferenceError: js_print is not defined".
# We make this error on purpose. This error will be intercepted
Expand All @@ -143,10 +139,6 @@ def OnAfterCreated(self, browser, **_):

class LoadHandler(object):
def OnLoadingStateChange(self, browser, is_loading, **_):
# Issue #344 will fix this in next release, so that client
# handlers are not called for Developer Tools windows.
if browser.GetUrl().startswith("chrome-devtools://"):
return
# This callback is called twice, once when loading starts
# (is_loading=True) and second time when loading ends
# (is_loading=False).
Expand All @@ -158,10 +150,6 @@ def OnLoadingStateChange(self, browser, is_loading, **_):

class DisplayHandler(object):
def OnConsoleMessage(self, browser, message, **_):
# Issue #344 will fix this in next release, so that client
# handlers are not called for Developer Tools windows.
if browser.GetUrl().startswith("chrome-devtools://"):
return
# This will intercept js errors, see comments in OnAfterCreated
if "error" in message.lower() or "uncaught" in message.lower():
# Prevent infinite recurrence in case something went wrong
Expand Down

0 comments on commit 321b34a

Please sign in to comment.