Skip to content

Commit

Permalink
Tutorial is almost complete (#256)
Browse files Browse the repository at this point in the history
Detect invalid arguments passed to cef.Initialize
and cef.CreateBrowserSync.
  • Loading branch information
cztomczak committed Apr 6, 2017
1 parent 9853a1e commit 850ac55
Show file tree
Hide file tree
Showing 12 changed files with 574 additions and 164 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ build/
__pycache__/
*.pyc
cefclient
webcache/
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ also download packages for offline installation available on the
pip install cefpython3==56.1
```

## Tutorial

See the [Tutorial.md](docs/Tutorial.md) file.


## Examples

See the [Examples-README.md](examples/Examples-README.md) file.
Expand All @@ -53,8 +58,15 @@ See the [Examples-README.md](examples/Examples-README.md) file.
## Support

- Ask questions, report problems and issues on the [Forum](https://groups.google.com/group/cefpython)
- Documentation is in the [docs/](docs) directory
- API reference is in the [api/](api) directory
- Supported examples are listed in the [Examples-README.md](examples/Examples-README.md) file
- Documentation is in the [docs/](docs) directory:
- [Build instructions](docs/Build-instructions.md)
- [Knowledge base](docs/Knowledge-Base.md)
- [Migration guide](docs/Migration-guide.md)
- [Tutorial](docs/Tutorial.md)
- API reference is in the [api/](api) directory:
- [API categories](api/API-categories.md#api-categories)
- [API index](api/API-index.md#api-index)
- Additional documentation is in issues labelled [Knowledge Base](../../issues?q=is%3Aissue+is%3Aopen+label%3A%22Knowledge+Base%22)
- To search documentation use GitHub "This repository" search
at the top. To narrow results to documentation only select
Expand Down
2 changes: 1 addition & 1 deletion api/API-categories.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* [WindowUtils](WindowUtils.md#windowutils-class) class


### Handlers (interfaces)
### Client handlers (interfaces)

* [DisplayHandler](DisplayHandler.md#displayhandler-interface)
* [DownloadHandler](DownloadHandler.md#downloadhandler)
Expand Down
6 changes: 3 additions & 3 deletions api/ApplicationSettings.md
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,9 @@ default User-Agent string will be used. Also configurable using the
(string)
The location where user data such as spell checking dictionary files will
be stored on disk. If empty then the default platform-specific user data
directory will be used ("~/.cef_user_data" directory on Linux,
"~/Library/Application Support/CEF/User Data" directory on Mac OS X,
"Local Settings\Application Data\CEF\User Data" directory under the user
directory will be used (`"~/.cef_user_data"` directory on Linux,
`"~/Library/Application Support/CEF/User Data"` directory on Mac OS X,
`"Local Settings\Application Data\CEF\User Data"` directory under the user
profile directory on Windows).


Expand Down
6 changes: 0 additions & 6 deletions api/JavascriptBindings.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ In CEF 3 communication between javascript and python can only be asynchronous. I
There are plans to support binding data by reference (a list, dict or object's properties). This would be possible with the use of CefRegisterExtension().


## Example usage

See the [wxpython.py](../src/windows/binaries_32bit/wxpython.py) example for an example usage of javascript bindings, javascript callbacks and python callbacks.



## Methods


Expand Down
47 changes: 26 additions & 21 deletions api/cefpython.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,25 @@ All parameters are optional.

This function can only be called on the UI thread.

The "window_title" parameter will be used only
when parent window provided in window_info was set to 0.
The "window_title" parameter will be used only when parent
window provided in window_info was set to 0. This is for use
with hello_world.py and tutorial.py examples which don't use
any third party GUI framework for creation of top-level window.

After the call to CreateBrowserSync() the page is not yet loaded,
if you want your next lines of code to do some stuff on the webpage
you will have to implement LoadHandler.[OnLoadEnd]((LoadHandler.md#onloadend))
if you want your next lines of code to do some stuff on the
webpage you will have to implement LoadHandler.[OnLoadingStateChange]((LoadHandler.md#onloadingstatechange))
callback.


### ExceptHook

| Parameter | Type |
| --- | --- |
| excType | - |
| excValue | - |
| traceObject | - |
| __Return__ | string |
| exc_type | - |
| exc_value | - |
| exc_trace | - |
| __Return__ | void |

Global except hook to exit app cleanly on error. CEF has a multiprocess
architecture and when exiting you need to close all processes (main Browser
Expand Down Expand Up @@ -99,6 +101,7 @@ to Initialize(). Returns None if key is not found.

| | |
| --- | --- |
| file_ (optional) | string |
| __Return__ | string |

Get path to where application resides.
Expand Down Expand Up @@ -181,18 +184,7 @@ Returns true if called on the specified thread.

CEF maintains multiple internal threads that are used for handling different types of tasks. The UI thread creates the browser window and is used for all interaction with the webkit rendering engine and V8 Javascript engine. The UI thread will be the same as the main application thread if CefInitialize() is called with an [ApplicationSettings](ApplicationSettings.md) 'multi_threaded_message_loop' option set to false. The IO thread is used for handling schema and network requests. The FILE thread is used for the application cache and other miscellaneous activities.

List of threads in the Browser process. These are constants defined in the cefpython module:

* TID_UI: The main thread in the browser. This will be the same as the main application thread if cefpython.Initialize() is called with a ApplicationSettings.multi_threaded_message_loop value of false.
* TID_DB: Used to interact with the database.
* TID_FILE: Used to interact with the file system.
* TID_FILE_USER_BLOCKING: Used for file system operations that block user interactions. Responsiveness of this thread affects users.
* TID_PROCESS_LAUNCHER: Used to launch and terminate browser processes.
* TID_CACHE: Used to handle slow HTTP cache operations.
* TID_IO: Used to process IPC and network messages.

List of threads in the Renderer process:
* TID_RENDERER: The main thread in the renderer. Used for all webkit and V8 interaction.
See PostTask() for a list of threads.


### MessageLoop
Expand Down Expand Up @@ -244,10 +236,23 @@ Description from upstream CEF:
| ... | *args |
| __Return__ | void |

Post a task for execution on the thread associated with this task runner. Execution will occur asynchronously. Only Browser process threads are allowed, see IsThread() for a list of available threads and their descriptions.
Post a task for execution on the thread associated with this task runner. Execution will occur asynchronously. Only Browser process threads are allowed.

An example usage is in the wxpython.py example on Windows, in implementation of LifespanHandler.OnBeforePopup().

List of threads in the Browser process:
* cef.TID_UI: The main thread in the browser. This will be the same as the main application thread if cefpython.Initialize() is called with a ApplicationSettings.multi_threaded_message_loop value of false.
* cef.TID_DB: Used to interact with the database.
* cef.TID_FILE: Used to interact with the file system.
* cef.TID_FILE_USER_BLOCKING: Used for file system operations that block user interactions. Responsiveness of this thread affects users.
* cef.TID_PROCESS_LAUNCHER: Used to launch and terminate browser processes.
* cef.TID_CACHE: Used to handle slow HTTP cache operations.
* cef.TID_IO: Used to process IPC and network messages.

List of threads in the Renderer process:
* cef.TID_RENDERER: The main thread in the renderer. Used for all webkit and V8 interaction.



### QuitMessageLoop

Expand Down
Loading

0 comments on commit 850ac55

Please sign in to comment.