# UI Extensions

Contents

- UI Extensions
  - Extension Manager
  - Helpers

## Extension Manager

class `qrenderdoc.``ExtensionManager`

  A manager for listing available and active extensions, as well as the interface for extensions to register hooks and additional functionality.

  `ExtensionCallback`(context, data)

    Not a member function - the signature for any `ExtensionCallback` callbacks.

    Callback for extensions to register entry points with, used in many situations depending on how it was registered.

    Parameters: | context (CaptureContext) – The current capture context. data (dict) – Additional data for the call, as a dictionary with string keys. Context-dependent based on what generated the callback

  `ErrorDialog`(text, title)

    ErrorDialog(text)

    Display an error message dialog.

    Parameters: | text (str) – The text of the dialog itself, required. title (str) – The dialog title, optional.

  `GetInstalledExtensions`()

    Retrieve a list of installed extensions.

    Returns: | The list of installed extensions.
    Return type: | `list` of `ExtensionMetadata`.

  `IsExtensionLoaded`(name)

    Check if an installed extension is enabled.

    Parameters: | name (str) – The qualified name of the extension, e.g. `foo.bar`
    Returns: | If the extension is enabled or not.
    Return type: | bool

  `LoadExtension`(name)

    Enable an extension by name. If the extension is already enabled, this will reload it.

    Parameters: | name (str) – The qualified name of the extension, e.g. `foo.bar`
    Returns: | If the extension loaded successfully or not.
    Return type: | bool

  `MessageDialog`(text, title)

    MessageDialog(text)

    Display a simple informational message dialog.

    Parameters: | text (str) – The text of the dialog itself, required. title (str) – The dialog title, optional.

  `OpenDirectoryName`(caption, dir)

    OpenDirectoryName(caption) OpenDirectoryName()

    Browse for a directory to open.

    Parameters: | caption (str) – The dialog title, optional. dir (str) – The starting directory for browsing, optional.
    Returns: | The directory selected, or an empty string if nothing was selected.
    Return type: | str

  `OpenFileName`(caption, dir, filter)

    OpenFileName(caption, dir) OpenFileName(caption) OpenFileName()

    Browse for a filename to open.

    Parameters: | caption (str) – The dialog title, optional. dir (str) – The starting directory for browsing, optional. filter (str) – The filter to apply for filenames, optional.
    Returns: | The filename selected, or an empty string if nothing was selected.
    Return type: | str

  `QuestionDialog`(text, options, title)

    QuestionDialog(text, options)

    Display an error message dialog.

    Parameters: | text (str) – The text of the dialog itself, required. options (list) – The buttons to display on the dialog. title (str) – The dialog title, optional.
    Returns: | The button that was clicked on.
    Return type: | DialogButton

  `RegisterContextMenu`(base, submenus, callback)

    Register a context menu item in a panel for an extension.

    Parameters: | base (ContextMenu) – The panel to add the item to. submenus (list) – A list of strings containing the submenus to add before the item. The last string will be the name of the menu item itself. Must contain at least one entry. callback – The function to callback when the menu item is selected.

  `RegisterPanelMenu`(base, submenus, callback)

    Register a menu item in a panel for an extension.

    Parameters: | base (PanelMenu) – The panel to add the item to. submenus (list) – A list of strings containing the submenus to add before the item. The last string will be the name of the menu item itself. Must contain at least one entry. callback – The function to callback when the menu item is selected.

  `RegisterWindowMenu`(base, submenus, callback)

    Register a new menu item in the main window’s menus for an extension.

    Parameters: | base (WindowMenu) – The base menu to add the item to. submenus (list) – A list of strings containing the submenus to add before the item. The last string will be the name of the menu item itself. Must contain at least one entry, or two entries if `base` is `WindowMenu.NewMenu`. callback – The function to callback when the menu item is selected.

  `SaveFileName`(caption, dir, filter)

    SaveFileName(caption, dir) SaveFileName(caption) SaveFileName()

    Browse for a filename to save to.

    Parameters: | caption (str) – The dialog title, optional. dir (str) – The starting directory for browsing, optional. filter (str) – The filter to apply for filenames, optional.
    Returns: | The filename selected, or an empty string if nothing was selected.
    Return type: | str

## Helpers

class `qrenderdoc.``ExtensionMetadata`

  The metadata for an extension.

  `author`

    The author of the extension, optionally with an email contact

  `description`

    A longer description of what the extension does

  `extensionAPI`

    The version of the extension API that this extension is written against

  `extensionURL`

    The URL for where the extension is fetched from

  `filePath`

    The location of this package on disk

  `name`

    The short friendly name for the extension

  `package`

    The python package for this extension, e.g. foo.bar

  `version`

    The version of the extension

class `qrenderdoc.``WindowMenu`

  Specifies the base menu to add a menu item into.

  `File`

    The menu item will be in a section between Open/Save/Close captures and Import/Export.

  `Window`

    The menu item will be in a new section at the end of the menu.

  `Tools`

    The menu item will be added to a new section above Settings.

  `NewMenu`

    The menu item will be a root menu, placed between Tools and Help.

  `Help`

    The menu item will be added after the error reporting item.

class `qrenderdoc.``PanelMenu`

  Specifies the panel to add a menu item into.

  `EventBrowser`

    The `EventBrowser`.

  `PipelineStateViewer`

    The `PipelineStateViewer`.

  `MeshPreview`

    The mesh previewing `BufferViewer`.

  `TextureViewer`

    The `TextureViewer`.

class `qrenderdoc.``ContextMenu`

  Specifies the panel to add a menu item into.

  `EventBrowser_Event`

    Adds the item to the context menu for events in the `EventBrowser`.

  `MeshPreview_Vertex`

    Adds the item to the context menu for all vertices in the mesh previewing `BufferViewer`.

  `MeshPreview_VSInVertex`

    Adds the item to the context menu for vertex inputs in the mesh previewing `BufferViewer`.

  `MeshPreview_VSOutVertex`

    Adds the item to the context menu for VS output in the mesh previewing `BufferViewer`.

  `MeshPreview_GSOutVertex`

    Adds the item to the context menu for GS/Tess output in the mesh previewing `BufferViewer`.

  `TextureViewer_Thumbnail`

    Adds the item to the context menu for all thumbnails in the `TextureViewer`.

  `TextureViewer_InputThumbnail`

    Adds the item to the context menu for input thumbnails in the `TextureViewer`.

  `TextureViewer_OutputThumbnail`

    Adds the item to the context menu for output thumbnails in the `TextureViewer`.