templates#
The module used to create job and asset items based on zip template files.
The template files usually contain a folder structure used to define the skeleton of a project file structure.
The list of template files are read from/and saved to the folder returned by
get_template_folder()
.
The template mode can be any arbitrary string - we’re defining them as
JobTemplateMode
and AssetTemplateMode
.
Classes:
|
Context menu associated with the |
|
Delegate associated with |
|
Widget used to display a list of zip template files associated with the given mode. |
|
List widget used to peak into the contents of a zip template file. |
|
Main template list with a template content preview widget. |
Functions:
|
Returns the path where the ZIP template files are stored, associated with the given mode. |
- class bookmarks.templates.TemplateContextMenu(index, parent=None)[source]#
Bases:
BaseContextMenu
Context menu associated with the
TemplatesWidget
.Methods:
add_menu
()Add action menu.
Refresh action menu.
Remove action menu.
Reveal action menu.
setup
()Creates the context menu.
Add action menu.
Refresh action menu.
Remove action menu.
Reveal action menu.
- class bookmarks.templates.TemplateListDelegate(parent=None)[source]#
Bases:
ListWidgetDelegate
Delegate associated with
TemplateListWidget
.Methods:
createEditor
(parent, option, index)Custom editor for editing the template's name.
- class bookmarks.templates.TemplateListWidget(mode=JobTemplateMode, parent=None)[source]#
Bases:
ListWidget
Widget used to display a list of zip template files associated with the given mode.
Methods:
contextMenuEvent
(event)Event handler.
create
(name, destination)The main method used to expand the selected zip template into a destination folder.
dropMimeData
(index, data, action)Returns the drop mime data.
eventFilter
(widget, event)Event filter handler.
Loads the available zip template files from the template directory.
mode
()The TemplateWidget's current mode.
showEvent
(event)Event handler.
sizeHint
()Returns a size hint.
Returns the supported drop actions.
update_name
(index)Updates the model data when a template's name has been edited.
- create(name, destination)[source]#
The main method used to expand the selected zip template into a destination folder.
- Parameters:
name (str) – The name of the folder the contents of the zip archive will be saved to.
destination (str) – The destination folder where the new asset will be expanded to.
- class bookmarks.templates.TemplatesPreviewWidget(parent=None)[source]#
Bases:
QListWidget
List widget used to peak into the contents of a zip template file.
Methods:
eventFilter
(widget, event)Event filter handler.
init_data
(files)Slot responsible for displaying a list of file names.
sizeHint
()Returns a size hint.
- class bookmarks.templates.TemplatesWidget(mode, parent=None)[source]#
Bases:
QSplitter
Main template list with a template content preview widget.
Methods:
itemActivated
(selectionList)Slot called when a template was selected by the user.
mode
()The current template mode.
sizeHint
()Returns a size hint.