:right-sidebar: True WebInspector =================================================================== .. currentmodule:: gi.repository.WebKit .. class:: WebInspector(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` Access to the WebKit inspector. The WebKit Inspector is a graphical tool to inspect and change the content of a :obj:`~gi.repository.WebKit.WebView`\. It also includes an interactive JavaScript debugger. Using this class one can get a :obj:`~gi.repository.Gtk.Widget` which can be embedded into an application to show the inspector. The inspector is available when the :obj:`~gi.repository.WebKit.Settings` of the :obj:`~gi.repository.WebKit.WebView` has set the :obj:`~gi.repository.WebKit.Settings`\:enable-developer-extras to true, otherwise no inspector is available. .. code-block:: c :dedent: // Enable the developer extras WebKitSettings *settings = webkit_web_view_get_settings (WEBKIT_WEB_VIEW(my_webview)); g_object_set (G_OBJECT(settings), "enable-developer-extras", TRUE, NULL); // Load some data or reload to be able to inspect the page webkit_web_view_load_uri (WEBKIT_WEB_VIEW(my_webview), "http://www.gnome.org"); // Show the inspector WebKitWebInspector *inspector = webkit_web_view_get_inspector (WEBKIT_WEB_VIEW(my_webview)); webkit_web_inspector_show (WEBKIT_WEB_INSPECTOR(inspector)); Methods ------- .. rst-class:: interim-class .. class:: WebInspector :no-index: .. method:: attach() -> None Request ``inspector`` to be attached. The signal :obj:`~gi.repository.WebKit.WebInspector`\::attach will be emitted. If the inspector is already attached it does nothing. .. method:: close() -> None Request ``inspector`` to be closed. .. method:: detach() -> None Request ``inspector`` to be detached. The signal :obj:`~gi.repository.WebKit.WebInspector`\::detach will be emitted. If the inspector is already detached it does nothing. .. method:: get_attached_height() -> 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. .. method:: get_can_attach() -> bool Whether the ``inspector`` can be attached to the same window that contains the inspected view. .. versionadded:: 2.8 .. method:: get_inspected_uri() -> str Get the URI that is currently being inspected. This can be :const:`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. .. method:: get_web_view() -> ~gi.repository.WebKit.WebViewBase Get the :obj:`~gi.repository.WebKit.WebViewBase` used to display the inspector. This might be :const:`None` if the inspector hasn't been loaded yet, or it has been closed. .. method:: is_attached() -> bool Whether the ``inspector`` view is currently attached to the same window that contains the inspected view. .. method:: show() -> None Request ``inspector`` to be shown. Properties ---------- .. rst-class:: interim-class .. class:: WebInspector :no-index: .. attribute:: props.attached_height :type: int The type of the None singleton. .. attribute:: props.can_attach :type: bool The type of the None singleton. .. versionadded:: 2.8 .. attribute:: props.inspected_uri :type: str The type of the None singleton. Signals ------- .. rst-class:: interim-class .. class:: WebInspector.signals :no-index: .. method:: attach() -> 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 :const:`True`. .. method:: bring_to_front() -> bool The type of the None singleton. .. method:: closed() -> None The type of the None singleton. .. method:: detach() -> 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 :obj:`~gi.repository.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 :obj:`~gi.repository.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 :const:`True`. .. method:: open_window() -> bool The type of the None singleton.