Versions Compared

    Key

    • This line was added.
    • This line was removed.
    • Formatting was changed.
    Comment: Published by Scroll Versions from this space and version 6.6-3

    ...

    Table of Contents

    Plugin Paths

    New in ArtistView 6.6:

    • You can easily navigate to the stock plugins dir by going to File > Open Plugins Directory
    • You can add additional plugins path(s) under the Plugins tab in the preferences
    • You can add additional plugins path(s) by setting a comma-separated list of paths in an environment variable called ARTISTVIEW_ADDITIONAL_PLUGINS_PATHS
       

    ...

    • html
      • Example: The stock "Job Properties" tab
      • Will display basic html but not much in the way of css or javascript.  
      • The functional goal of this plugin is to return basic html as a string.
    • webkit: (To be introduced with v6.6)  
      • Example: The stock "Thumbnails" tab.
      • Will display advanced html, including css and javascript - much like a typical web browser. 
      • The functional goal of this plugin is to return a complete [x]html page.
    • tree
      • Example: QubeTabTreeExample.py in the plugins directory
      • Will display a list of [nested] lists in a tree widget.
      • The functional goal of this plugin is to return a [nested list of] list[s].
    • preview
      • Example: The stock "Preview" tab.
      • Will create an image viewer with scrubber for flipping between output frames. 
      • The functional goal of this plugin is to return a list of paths to images.
    • openGL:
      • Deprecated in 6.5-0

    ...

    If a user does not have required permission to run the plugin, then the plugin will not show at all.  If the user has required permission, but is not an admin, then the plugin will be visible but disabled when the user attempts to perform the action on any entity they do not own (for example, one cannot modify someone else's job unless they are an admin).

    Accessing Qube Information from the Plugin

    In order for the plugin to do anything meaningful, it must know what entities are selected and have access to the Qube data that drives those entities. Any user function defines must take the kwarg "**selected".  Selected will be a dictionary containing lists of items that are selected in the interface.  The dictionary is keyed on the type of item.  Regardless of the function, selected will always contain the following keys:

    • jobs - a list of currently selected jobs, if any
    • subjobs - a list of currently selected subjobs/instances, if any
    • frames - a list of currently selected frames/work items/agenda items, if any
    • hosts - a list of currently selected hosts, if any

    In the body of your run method, then, you will retrieve the selected items that matter, and do with them what you choose.

    When the plugin completes, it signals the interface to update the related jobs or hosts.

    Challenging the User - "Are you sure?"

    If you would like to display a dialog that the user must agree to before the plugin is to be run, you do so by adding an an askUser method method to the plugin class. This function should return a dictionary that drives the interface.  That dictionary must contain the following key/value pairs:

    • "title": The window title of the challenge dialog, i.e. "Performing an action"
    • "text": The main text to be displayed, i.e. "Are you sure?"
    • "info_text": The small-print text displayed below the main text, i.e. "You're about to do something important.  Be sure you know what you're doing."
    • "detailed_text": If this exists, a "More info" button will be displayed that, when pressed, will expand the dialog, display a scroll bar & allow much more text to be displayed, i.e. "This is what you're about to do to these jobs: ...."
    • "icon": The type of icon to display.  Options are (the strings):
      • 'information' - a white speech box
      • 'question' -  a yellow question mark
      • 'warning' - a yellow exclamation point
      • 'critical' - a red stop sign
      • 'noicon' - nothing
    • "button": A list of button(s) text to be displayed.  All positive answers eventually return True, all negatives return False.  Options are (the strings):
      • 'ok'
      • 'cancel'
      • 'save'
      • 'discard'
      • 'yes'
      • 'no'
      • 'apply'
      • 'abort'
      • 'close'

    Performing a search from a Plugin

    If you would like to set a search field and perform a search, programmatically, from a plugin, you do so by adding an updateUI method to the plugin class. This function should return a dictionary of UI fields that need updating.  For 6.7, the only UI fields that can be updated are the search fields which are denoted by the keys search_jobs, search_frames, search_instances, or search_workers for the search field in the job list, frame, list, instance list, or worker list, respectively.

    For example, to perform a search for all jobs with a matching pgrp to the selected job(s), the updateUI function would look like:

    Code Block
    languagepy
        def updateUI(self,**selected):
            jobs = selected.get('jobs',[])
            pgrp_id_searches = set(("pgrp:%d"%j['pgrp'] for j in jobs))
            return {"search_jobs":" OR ".join(map(str,list(pgrp_id_searches)))}

    ..which would return a dictionary that looks like {"search_jobs":"pgrp:1234 OR pgrp:1235"}.  This would then fill the job list search field with pgrp:1234 OR pgrp:1235 and perform the search.

    ...

    Accessing Qube Information from the Plugin

    In order for the plugin to do anything meaningful, it must know what entities are selected and have access to the Qube data that drives those entities. Any user function defines must take the kwarg "**selected".  Selected will be a dictionary containing lists of items that are selected in the interface.  The dictionary is keyed on the type of item.  Regardless of the function, selected will always contain the following keys:

    • jobs - a list of currently selected jobs, if any
    • subjobs - a list of currently selected subjobs/instances, if any
    • frames - a list of currently selected frames/work items/agenda items, if any
    • hosts - a list of currently selected hosts, if any

    In the body of your run method, then, you will retrieve the selected items that matter, and do with them what you choose.

    When the plugin completes, it signals the interface to update the related jobs or hosts.

    Example

    This is the QubeMenuJobHelloWorld.py plugin from the plugins directory that is shipped with ArtistView.  If unhidden, this plugin will challenge the user if they really wish to run the plugin.  Their choice will logged to stderr in the run method.

    ...