WebKit.WebInspector

g GObject.Object GObject.Object WebKit.WebInspector WebKit.WebInspector GObject.Object->WebKit.WebInspector

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

attach ()

close ()

detach ()

get_attached_height ()

get_can_attach ()

get_inspected_uri ()

get_web_view ()

is_attached ()

show ()

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

attached-height

int

r

can-attach

bool

r

inspected-uri

str

r

Signals

Inherited:

GObject.Object (1)

Name

Short Description

attach

Emitted when the inspector is requested to be attached to the window where the inspected web view is.

bring-to-front

Emitted when the inspector should be shown.

closed

Emitted when the inspector page is closed.

detach

Emitted when the inspector is requested to be detached from the window it is currently attached to.

open-window

Emitted when the inspector is requested to open in a separate window.

Fields

Inherited:

GObject.Object (1)

Class Details

class WebKit.WebInspector(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

WebKit.WebInspectorClass

Access to the WebKit inspector.

The WebKit Inspector is a graphical tool to inspect and change the content of a WebKit.WebView. It also includes an interactive JavaScript debugger. Using this class one can get a Gtk.Widget which can be embedded into an application to show the inspector.

The inspector is available when the WebKit.Settings of the WebKit.WebView has set the WebKit.Settings :enable-developer-extras to true, otherwise no inspector is available.

```c // Enable the developer extras WebKit.Settings *settings = WebKit.WebView.get_settings (WEBKIT_WEB_VIEW(my_webview)); g_object_set (G_OBJECT(settings), “enable-developer-extras”, True, None);

// Load some data or reload to be able to inspect the page WebKit.WebView.load_uri (WEBKIT_WEB_VIEW(my_webview), “http://www.gnome.org”);

// Show the inspector WebKit.WebInspector *inspector = WebKit.WebView.get_inspector (WEBKIT_WEB_VIEW(my_webview)); WebKit.WebInspector.show (WEBKIT_WEB_INSPECTOR(inspector)); ```

attach()

Request self to be attached.

The signal WebKit.WebInspector ::attach will be emitted. If the inspector is already attached it does nothing.

close()

Request self to be closed.

detach()

Request self to be detached.

The signal WebKit.WebInspector ::detach will be emitted. If the inspector is already detached it does nothing.

get_attached_height()
Returns:

the height of the inspector view when attached

Return type:

int

Get the height that the inspector view when attached.

Get the height that the inspector view should have when it’s attached. If the inspector view is not attached this returns 0.

get_can_attach()
Returns:

True if there is enough room for the inspector view inside the window that contains the inspected view, or False otherwise.

Return type:

bool

Whether the self can be attached to the same window that contains the inspected view.

New in version 2.8.

get_inspected_uri()
Returns:

the URI that is currently being inspected or None

Return type:

str

Get the URI that is currently being inspected.

This can be None if nothing has been loaded yet in the inspected view, if the inspector has been closed or when inspected view was loaded from a HTML string instead of a URI.

get_web_view()
Returns:

the WebKit.WebViewBase used to display the inspector or None

Return type:

WebKit.WebViewBase

Get the WebKit.WebViewBase used to display the inspector.

This might be None if the inspector hasn’t been loaded yet, or it has been closed.

is_attached()
Returns:

True if self is currently attached or False otherwise

Return type:

bool

Whether the self view is currently attached to the same window that contains the inspected view.

show()

Request self to be shown.

Signal Details

WebKit.WebInspector.signals.attach(web_inspector)
Signal Name:

attach

Flags:

RUN_LAST

Parameters:

web_inspector (WebKit.WebInspector) – The object which received the signal

Returns:

True to stop other handlers from being invoked for the event. False to propagate the event further.

Return type:

bool

Emitted when the inspector is requested to be attached to the window where the inspected web view is. If this signal is not handled the inspector view will be automatically attached to the inspected view, so you only need to handle this signal if you want to attach the inspector view yourself (for example, to add the inspector view to a browser tab).

To prevent the inspector view from being attached you can connect to this signal and simply return True.

WebKit.WebInspector.signals.bring_to_front(web_inspector)
Signal Name:

bring-to-front

Flags:

RUN_LAST

Parameters:

web_inspector (WebKit.WebInspector) – The object which received the signal

Returns:

True to stop other handlers from being invoked for the event. False to propagate the event further.

Return type:

bool

Emitted when the inspector should be shown.

If the inspector is not attached the inspector window should be shown on top of any other windows. If the inspector is attached the inspector view should be made visible. For example, if the inspector view is attached using a tab in a browser window, the browser window should be raised and the tab containing the inspector view should be the active one. In both cases, if this signal is not handled, the default implementation calls Gtk.Window.present() on the current toplevel Gtk.Window of the inspector view.

WebKit.WebInspector.signals.closed(web_inspector)
Signal Name:

closed

Flags:

RUN_LAST

Parameters:

web_inspector (WebKit.WebInspector) – The object which received the signal

Emitted when the inspector page is closed. If you are using your own inspector window, you should connect to this signal and destroy your window.

WebKit.WebInspector.signals.detach(web_inspector)
Signal Name:

detach

Flags:

RUN_LAST

Parameters:

web_inspector (WebKit.WebInspector) – The object which received the signal

Returns:

True to stop other handlers from being invoked for the event. False to propagate the event further.

Return type:

bool

Emitted when the inspector is requested to be detached from the window it is currently attached to. The inspector is detached when the inspector page is about to be closed, and this signal is emitted right before WebKit.WebInspector ::closed, or when the user clicks on the detach button in the inspector view to show the inspector in a separate window. In this case the signal WebKit.WebInspector ::open-window is emitted after this one.

To prevent the inspector view from being detached you can connect to this signal and simply return True.

WebKit.WebInspector.signals.open_window(web_inspector)
Signal Name:

open-window

Flags:

RUN_LAST

Parameters:

web_inspector (WebKit.WebInspector) – The object which received the signal

Returns:

True to stop other handlers from being invoked for the event. False to propagate the event further.

Return type:

bool

Emitted when the inspector is requested to open in a separate window. If this signal is not handled, a Gtk.Window with the inspector will be created and shown, so you only need to handle this signal if you want to use your own window. This signal is emitted after WebKit.WebInspector ::detach to show the inspector in a separate window after being detached.

To prevent the inspector from being shown you can connect to this signal and simply return True

Property Details

WebKit.WebInspector.props.attached_height
Name:

attached-height

Type:

int

Default Value:

0

Flags:

READABLE

The height that the inspector view should have when it is attached.

WebKit.WebInspector.props.can_attach
Name:

can-attach

Type:

bool

Default Value:

False

Flags:

READABLE

Whether the inspector can be attached to the same window that contains the inspected view.

New in version 2.8.

WebKit.WebInspector.props.inspected_uri
Name:

inspected-uri

Type:

str

Default Value:

None

Flags:

READABLE

The URI that is currently being inspected.