hooks.tk-multi-publish2.basic.publish_renders module¶
-
class
KatanaRenderPublishPlugin
(*args, **kwargs)¶ Bases:
sphinx.ext.autodoc.importer._MockObject
Plugin for publishing an open katana session.
This hook relies on functionality found in the base file publisher hook in the publish2 app and should inherit from it in the configuration. The hook setting for this plugin should look something like this:
hook: "{self}/publish_file.py:{engine}/tk-multi-publish2/basic/publish_session.py"
-
accept
(settings, item)¶ Method called by the publisher to determine if an item is of any interest to this plugin. Only items matching the filters defined via the item_filters property will be presented to this method.
A publish task will be generated for each item accepted here. Returns a dictionary with the following booleans:
- accepted: Indicates if the plugin is interested in this value at
- all. Required.
- enabled: If True, the plugin will be enabled in the UI, otherwise
- it will be disabled. Optional, True by default.
- visible: If True, the plugin will be visible in the UI, otherwise
- it will be hidden. Optional, True by default.
- checked: If True, the plugin will be checked in the UI, otherwise
- it will be unchecked. Optional, True by default.
Parameters: - settings – Dictionary of Settings. The keys are strings, matching the keys returned in the settings property. The values are Setting instances.
- item – Item to process
Returns: dictionary with boolean keys accepted, required and enabled
-
create_settings_widget
(parent)¶ Creates a Qt widget, for the supplied parent widget (a container widget on the right side of the publish UI).
Parameters: parent – The parent to use for the widget being created Returns: A QtGui.QWidget or subclass that displays information about the plugin and/or editable widgets for modifying the plugin’s settings.
-
description
¶ Verbose, multi-line description of what the plugin does. This can contain simple html for formatting.
-
get_ui_settings
(widget)¶ Invoked by the Publisher when the selection changes. This method gathers the settings on the previously selected task, so that they can be later used to repopulate the custom UI if the task gets selected again. They will also be passed to the accept, validate, publish and finalize methods, so that the settings can be used to drive the publish process.
The widget argument is the widget that was previously created by create_settings_widget.
The method returns a dictionary, where the key is the name of a setting that should be updated and the value is the new value of that setting. Note that it is up to you how you want to store the UI’s state as settings and you don’t have to necessarily to return all the values from the UI. This is to allow the publisher to update a subset of settings when multiple tasks have been selected.
Example:
{ "setting_a": "/path/to/a/file" }
Parameters: widget – The widget that was created by create_settings_widget
-
icon
¶ The path to an icon on disk that is representative of this plugin (
str
).
-
item_filters
¶ List of item types that this plugin is interested in.
Only items matching entries in this list will be presented to the accept() method. Strings can contain glob patters such as , for example [“katana.”, “file.katana”]
-
name
¶ The general name for this plugin (
str
).
-
set_ui_settings
(widget, settings)¶ Allows the custom UI to populate its fields with the settings from the currently selected tasks.
The widget is the widget created and returned by create_settings_widget.
A list of settings dictionaries are supplied representing the current values of the settings for selected tasks. The settings dictionaries correspond to the dictionaries returned by the settings property of the hook.
Example:
settings = [ { "seeting_a": "/path/to/a/file" "setting_b": False }, { "setting_a": "/path/to/a/file" "setting_b": False }]
The default values for the settings will be the ones specified in the environment file. Each task has its own copy of the settings.
When invoked with multiple settings dictionaries, it is the responsibility of the custom UI to decide how to display the information. If you do not wish to implement the editing of multiple tasks at the same time, you can raise a
NotImplementedError
when there is more than one item in the list and the publisher will inform the user than only one task of that type can be edited at a time.Parameters: - widget – The widget that was created by create_settings_widget
- settings – a list of dictionaries of settings for each selected task.
-
settings
¶ Dictionary defining the settings that this plugin expects to receive through the settings parameter in the accept, validate, publish and finalize methods.
A dictionary on the following form:
{ "Settings Name": { "type": "settings_type", "default": "default_value", "description": "One line description of the setting" }
The type string should be one of the data types that toolkit accepts as part of its environment configuration.
-
validate
(settings, item)¶ Validates the given item to check that it is ok to publish. Returns a boolean to indicate validity.
Parameters: - settings – Dictionary of Settings. The keys are strings, matching the keys returned in the settings property. The values are Setting instances.
- item – Item to process
Returns: True if item is valid, False otherwise.
-
-
class
RenderPublishWidget
(parent=None, description_widget=None)¶ Bases:
sphinx.ext.autodoc.importer._MockObject
Widget that contains all the
RenderPublishWidgetItem
generated by the current publisher selection.-
addItem
(name, data)¶ Add an item to this widget
-
clear
()¶ Clear the current layout.
-
getData
()¶ Get the data for the selected nodes
-