Skip to content

Commit

Permalink
Fix focus in all examples. Pass kwargs to Handlers' callbacks (BC BRE…
Browse files Browse the repository at this point in the history
…AK!).

Fix focus issue in qt.py and gtk2.py examples during app initial
loading (#284). The solution is to call SetFocus in OnLoadStart once.

Pass keyword arguments to Handlers' callbacks (#291). This will break
many of existing code for Handlers' callbacks. Similar changes were also
applied to: CookieVisitor, StringVisitor, WebRequestClient.

In JavascriptDialogCallback.Continue "userInput" argument was renamed
to "user_input".

Fix PyCharm warnings in kivy_.py example (#285).

Rename JavascriptContextHandler to V8ContextHandler (API docs only
changes).

Update tools/apidocs.py. Sort top-level headings by name.
  • Loading branch information
cztomczak committed Dec 20, 2016
1 parent d81f266 commit 0a7d8d6
Show file tree
Hide file tree
Showing 36 changed files with 956 additions and 848 deletions.
13 changes: 10 additions & 3 deletions api/API-categories.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* [CommandLineSwitches](CommandLineSwitches.md) dictionary


### Objects
### Classes and objects

* [Browser](Browser.md) object
* [Callback](Callback.md) object
Expand All @@ -36,17 +36,24 @@
* [WindowUtils](WindowUtils.md) class


### Handlers
### Handlers (interfaces)

* [DisplayHandler](DisplayHandler.md)
* [DownloadHandler](DownloadHandler.md)
* [FocusHandler](FocusHandler.md)
* [JavascriptContextHandler](JavascriptContextHandler.md)
* [JavascriptDialogHandler](JavascriptDialogHandler.md)
* [KeyboardHandler](KeyboardHandler.md)
* [LifespanHandler](LifespanHandler.md)
* [LoadHandler](LoadHandler.md)
* [RenderHandler](RenderHandler.md)
* [RequestHandler](RequestHandler.md)
* [ResourceHandler](ResourceHandler.md)
* [V8ContextHandler](V8ContextHandler.md)


### Other interfaces

* [CookieVisitor](CookieVisitor.md) interface
* [StringVisitor](StringVisitor.md) interface
* [WebRequestClient](WebRequestClient.md) interface

593 changes: 297 additions & 296 deletions api/API-index.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion api/ApplicationSettings.md
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ The behavior for encode/decode errors is to replace the unknown character with "

(int)
The number of stack trace frames to capture for uncaught exceptions.
Specify a positive value to enable the [JavascriptContextHandler](JavascriptContextHandler.md).OnUncaughtException()
Specify a positive value to enable the [V8ContextHandler](V8ContextHandler.md).OnUncaughtException()
callback. Specify 0 (default value) and
OnUncaughtException() will not be called. Also configurable using the
"uncaught-exception-stack-size" [command-line switch](CommandLineSwitches.md).
Expand Down
4 changes: 2 additions & 2 deletions api/CookieVisitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ Table of contents:
| cookie | [Cookie](Cookie.md) |
| count | int |
| total | int |
| deleteCookie | list |
| delete_cookie_out | list[bool] |
| __Return__ | bool |

Method that will be called once for each cookie. |count| is the 0-based
index for the current cookie. |total| is the total number of cookies.
Set |`deleteCookie[0]`| to True to delete the cookie currently being visited.
Set |delete_cookie_out[0]| to True to delete the cookie currently being visited.
Return False to stop visiting cookies, True to continue. This method may
never be called if no cookies are found.
6 changes: 3 additions & 3 deletions api/DisplayHandler.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ Called when the page title changes.
| Parameter | Type |
| --- | --- |
| browser | [Browser](Browser.md) |
| textOut | list& |
| text_out | list |
| __Return__ | bool |

Called when the browser is about to display a tooltip. `textOut[0]` contains the
Called when the browser is about to display a tooltip. `text_out[0]` contains the
text that will be displayed in the tooltip. To handle the display of the
tooltip yourself return true. Otherwise, you can optionally modify `textOut[0]`
tooltip yourself return true. Otherwise, you can optionally modify `text_out[0]`
and then return false to allow the browser to display the tooltip.
When window rendering is disabled the application is responsible for
drawing tooltips and the return value is ignored.
Expand Down
2 changes: 1 addition & 1 deletion api/FocusHandler.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Table of contents:
| Parameter | Type |
| --- | --- |
| browser | [Browser](Browser.md) |
| next | bool |
| next_component | bool |
| __Return__ | void |

Description from upstream CEF:
Expand Down
10 changes: 5 additions & 5 deletions api/JavascriptDialogHandler.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ requests.
| Parameter | Type |
| --- | --- |
| allow | bool |
| userInput | str |
| user_input | str |
| __Return__ | void |

Continue the javascript dialog request. Set |allow| to true if the OK button was
pressed. The |userInput| value should be specified for prompt dialogs.
pressed. The |user_input| value should be specified for prompt dialogs.


## Callbacks
Expand All @@ -47,17 +47,17 @@ pressed. The |userInput| value should be specified for prompt dialogs.
| message_text | str |
| default_prompt_text | str |
| callback | JavascriptDialogCallback |
| suppress_message[0] | bool& |
| suppress_message_out | list |
| __Return__ | bool |

Called to run a JavaScript dialog. If |origin_url| is non-empty it can be
passed to the CefFormatUrlForSecurityDisplay function to retrieve a secure
and user-friendly display string. The |default_prompt_text| value will be
specified for prompt dialogs only. Set |suppress_message| to true and
specified for prompt dialogs only. Set |suppress_message_out[0]| to true and
return false to suppress the message (suppressing messages is preferable to
immediately executing the callback as this is used to detect presumably
malicious behavior like spamming alert messages in onbeforeunload). Set
|suppress_message| to false and return false to use the default
|suppress_message_out[0]| to false and return false to use the default
implementation (the default implementation will show one modal dialog at a
time and suppress any additional dialog requests until the displayed dialog
is dismissed). Return true if the application will use a custom dialog or
Expand Down
17 changes: 9 additions & 8 deletions api/KeyboardHandler.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ Table of contents:
| --- | --- |
| browser | [Browser](Browser.md) |
| event | KeyEvent |
| eventHandle | MSG\* / GdkEvent\* / NSEvent\*` |
| isKeyboardShortcutOut | out list[0] -> bool |
| __Return__ | void |
| event_handle | MSG\* / GdkEvent\* / NSEvent\*` |
| is_keyboard_shortcut_out | list |
| __Return__ | bool |

Called before a keyboard event is sent to the renderer. |event| contains
information about the keyboard event. |eventHandle| is the operating system
information about the keyboard event. |event_handle| is the operating system
event message, if any. Return true if the event was handled or false
otherwise. If the event will be handled in OnKeyEvent() as a keyboard
shortcut, set isKeyboardShortcutOut[0] to True and return False.
shortcut, set |is_keyboard_shortcut_out[0]| to True and return False.

KeyEvent is a dictionary with the following keys:

Expand Down Expand Up @@ -77,10 +77,11 @@ KeyEventFlags constants defined in the cefpython module:
| --- | --- |
| browser | [Browser](Browser.md) |
| event | KeyEvent |
| eventHandle | MSG\* / GdkEvent\* / NSEvent\* |
| __Return__ | void |
| event_handle | MSG\* / GdkEvent\* / NSEvent\* |
| __Return__ | bool |

Called after the renderer and javascript in the page has had a chance to
handle the event. |event| contains information about the keyboard event.
|os_event| is the operating system event message, if any. Return true if
the keyboard event was handled or false otherwise. Description of the KeyEvent type is in the OnPreKeyEvent() callback.
the keyboard event was handled or false otherwise. Description of the
KeyEvent type is in the OnPreKeyEvent() callback.
22 changes: 11 additions & 11 deletions api/LifespanHandler.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ Table of contents:
| --- | --- |
| browser | [Browser](Browser.md) |
| frame | [Frame](Frame.md) |
| targetUrl | string |
| targetFrameName | string |
| targetDisposition | WindowOpenDisposition |
| userGesture | bool |
| popupFeatures | None |
| out windowInfo[0] | [WindowInfo](WindowInfo.md) |
| target_url | string |
| target_frame_name | string |
| target_disposition | WindowOpenDisposition |
| user_gesture | bool |
| popup_features | None |
| window_info_out | list[[WindowInfo](WindowInfo.md)] |
| client | None |
| out browserSettings[0] | [BrowserSettings](BrowserSettings.md) |
| out noJavascriptAccess[0] | bool |
| browser_settings_out | list[[BrowserSettings](BrowserSettings.md)] |
| no_javascript_access_out | list[bool] |
| __Return__ | bool |

Called on the IO thread before a new popup browser is created. The
Expand All @@ -44,15 +44,15 @@ The |target_disposition| value indicates where the user intended to open
the popup (e.g. current tab, new tab, etc). The |user_gesture| value will
be true if the popup was opened via explicit user gesture (e.g. clicking a
link) or false if the popup opened automatically (e.g. via the
DomContentLoaded event). The |popupFeatures| structure contains additional
DomContentLoaded event). The |popup_features| structure contains additional
information about the requested popup window. To allow creation of the
popup browser optionally modify |windowInfo|, |client|, |browserSettings| and
|noJavascriptAccess| and return false. To cancel creation of the popup
|no_javascript_access| and return false. To cancel creation of the popup
browser return true. The |client| and |settings| values will default to the
source browser's values. If the |no_javascript_access| value is set to
false the new browser will not be scriptable and may not be hosted in the
same renderer process as the source browser. Any modifications to
|windowInfo| will be ignored if the parent browser is wrapped in a
|window_info| will be ignored if the parent browser is wrapped in a
CefBrowserView.

Note that if you return True and create the popup window yourself, then
Expand Down
30 changes: 17 additions & 13 deletions api/LoadHandler.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ Table of contents:
| Parameter | Type |
| --- | --- |
| browser | [Browser](Browser.md) |
| isLoading | bool |
| canGoBack | bool |
| canGoForward | bool |
| is_loading | bool |
| can_go_back | bool |
| can_go_forward | bool |
| __Return__ | void |

Called when the loading state has changed. This callback will be executed
Expand Down Expand Up @@ -78,7 +78,7 @@ Not yet implemented. See [Issue #32](../issues/32).
| --- | --- |
| browser | [Browser](Browser.md) |
| frame | [Frame](Frame.md) |
| httpStatusCode | int |
| http_code | int |
| __Return__ | void |

Called when the browser is done loading a frame. The |frame| value will
Expand All @@ -89,9 +89,12 @@ will always be called for all frames irrespective of whether the request
completes successfully. For notification of overall browser load status use
OnLoadingStateChange instead.

This event behaves like window.onload, it waits for all the content to load (e.g. images), there is currently no callback for a DOMContentLoaded event, see [Issue #32](../issues/32).
This event behaves like window.onload, it waits for all the content
to load (e.g. images), there is currently no callback for
a DOMContentLoaded event, see [Issue #32](../issues/32).

There are some cases when this callback won't get called, see this topic: http://www.magpcss.org/ceforum/viewtopic.php?f=6&t=10906
There are some cases when this callback won't get called, see this
topic: http://www.magpcss.org/ceforum/viewtopic.php?f=6&t=10906


### OnLoadError
Expand All @@ -100,14 +103,15 @@ There are some cases when this callback won't get called, see this topic: http:/
| --- | --- |
| browser | [Browser](Browser.md) |
| frame | [Frame](Frame.md) |
| errorCode | [NetworkError](NetworkError.md) |
| errorText | list& |
| failedUrl | string |
| error_code | [NetworkError](NetworkError.md) |
| error_text_out | list[string] |
| failed_url | string |
| __Return__ | void |

Called when the resource load for a navigation fails or is canceled.
|errorCode| is the error code number, |`errorText[0]`| is the error text and
|failedUrl| is the URL that failed to load. See net\base\net_error_list.h
for complete descriptions of the error codes.
|errorCode| is the error code number, |error_text_out[0]| is the error
text and |failed_url| is the URL that failed to load. See
net\base\net_error_list.h for complete descriptions of the error codes.

This callback may get called when [Browser](Browser.md).`StopLoad` is called, or when file download is aborted (see DownloadHandler).
This callback may get called when [Browser](Browser.md).`StopLoad`
is called, or when file download is aborted (see DownloadHandler).
51 changes: 24 additions & 27 deletions api/RenderHandler.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,51 +54,49 @@ Callbacks available in upstream CEF, but not yet exposed in CEF Python
| Parameter | Type |
| --- | --- |
| browser | [Browser](Browser.md) |
| out rect | list |
| rect_out | list[x,y,width,height] |
| __Return__ | bool |

Called to retrieve the root window rectangle in screen coordinates. Return true if the rectangle was provided.
Called to retrieve the root window rectangle in screen coordinates.
Return true if the rectangle was provided.


### GetViewRect

| Parameter | Type |
| --- | --- |
| browser | [Browser](Browser.md) |
| out rect | list |
| rect_out | list[x,y,width,height] |
| __Return__ | bool |

Called to retrieve the view rectangle which is relative to screen coordinates. Return true if the rectangle was provided.

The `rect` list should contain 4 elements: [x, y, width, height].
Called to retrieve the view rectangle which is relative to screen
coordinates. Return true if the rectangle was provided.


### GetScreenRect

| Parameter | Type |
| --- | --- |
| browser | [Browser](Browser.md) |
| out rect | list |
| rect_out | list[x,y,width,height] |
| __Return__ | bool |

Called to retrieve the simulated screen rectangle. Return true if the rectangle was provided.

The `rect` list should contain 4 elements: [x, y, width, height].
Called to retrieve the simulated screen rectangle. Return true
if the rectangle was provided.


### GetScreenPoint

| Parameter | Type |
| --- | --- |
| browser | [Browser](Browser.md) |
| viewX | int |
| viewY | int |
| out screenCoordinates | list |
| view_x | int |
| view_y | int |
| screen_coordinates_out | list[x,y] |
| __Return__ | bool |

Called to retrieve the translation from view coordinates to actual screen coordinates. Return true if the screen coordinates were provided.

The `screenCoordinates` list should contain 2 elements: [x, y].
Called to retrieve the translation from view coordinates to actual
screen coordinates. Return true if the screen coordinates were provided.


### OnPopupShow
Expand All @@ -109,30 +107,31 @@ The `screenCoordinates` list should contain 2 elements: [x, y].
| show | bool |
| __Return__ | void |

Called when the browser wants to show or hide the popup widget. The popup should be shown if |show| is true and hidden if |show| is false.
Called when the browser wants to show or hide the popup widget.
The popup should be shown if |show| is true and hidden if|show|
is false.


### OnPopupSize

| Parameter | Type |
| --- | --- |
| browser | [Browser](Browser.md) |
| rect | list |
| rect_out | list[x,y,width,height] |
| __Return__ | void |

Called when the browser wants to move or resize the popup widget. |rect| contains the new location and size.

The `rect` list should contain 4 elements: [x, y, width, height].
Called when the browser wants to move or resize the popup widget.
|rect_out| contains the new location and size.


### OnPaint

| Parameter | Type |
| --- | --- |
| browser | [Browser](Browser.md) |
| paintElementType | int |
| out dirtyRects | list |
| buffer | [PaintBuffer](PaintBuffer.md) |
| element_type | int |
| dirty_rects | list[[x,y,width,height],[..]] |
| paint_buffer | [PaintBuffer](PaintBuffer.md) |
| width | int |
| height | int |
| __Return__ | void |
Expand All @@ -141,7 +140,7 @@ Called when an element should be painted. Pixel values passed to this
method are scaled relative to view coordinates based on the value of
CefScreenInfo.device_scale_factor returned from GetScreenInfo. |type|
indicates whether the element is the view or the popup widget. |buffer|
contains the pixel data for the whole image. |dirtyRects| contains the set
contains the pixel data for the whole image. |dirty_rects| contains the set
of rectangles in pixel coordinates that need to be repainted. |buffer| will
be |width|*|height|*4 bytes in size and represents a BGRA image with an
upper-left origin.
Expand All @@ -150,8 +149,6 @@ upper-left origin.
* PET_VIEW
* PET_POPUP

`dirtyRects` is a list of rects: [[x, y, width, height], [..]]


### OnCursorChange

Expand Down
Loading

0 comments on commit 0a7d8d6

Please sign in to comment.