From 321b34abe4067195ed3d042beef211f2546182b1 Mon Sep 17 00:00:00 2001 From: cztomczak Date: Wed, 19 Apr 2017 21:29:10 +0200 Subject: [PATCH] Update docs for 56.2 release. Do not call client handlers nor javascript bindings in DevTools windows (#344). Update Tutorial and tutorial.py example. --- README.md | 2 +- docs/Migration-guide.md | 11 +++++------ docs/Tutorial.md | 6 +----- examples/Examples-README.md | 2 +- examples/tutorial.py | 18 +++--------------- 5 files changed, 11 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 114d2d35..7b4bbfaa 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/docs/Migration-guide.md b/docs/Migration-guide.md index 3bab17bc..d938e70d 100644 --- a/docs/Migration-guide.md +++ b/docs/Migration-guide.md @@ -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** diff --git a/docs/Tutorial.md b/docs/Tutorial.md index 91cc029a..c4a38ec2 100644 --- a/docs/Tutorial.md +++ b/docs/Tutorial.md @@ -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 @@ -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). diff --git a/examples/Examples-README.md b/examples/Examples-README.md index 2fae3e14..7be26d96 100644 --- a/examples/Examples-README.md +++ b/examples/Examples-README.md @@ -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 diff --git a/examples/tutorial.py b/examples/tutorial.py index 28d69ddb..a2b04ca8 100644 --- a/examples/tutorial.py +++ b/examples/tutorial.py @@ -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 @@ -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() @@ -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): @@ -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 @@ -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). @@ -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