actions#

User actions module.

These actions are usually triggered by the user via keyboard shortcuts or by interactions with the UI.

Functions:

add_bookmark(server, job, root)

Add the given bookmark item and save it in the user settings file.

add_favourite(source_paths, source)

Add and save a favourite item.

add_item()

Triggers the current tab's add item action.

add_server(v)

Adds a server item to the list of user specified servers.

add_zip_template(source, mode[, prompt])

Adds the selected source zip archive as a mode template file.

adjust_tab_button_size(*args, **kwargs)

Slot used to adjust the size of the top bar buttons size.

asset_identifier_changed(table, source, key, ...)

Refresh the assets model if the identifier changes.

capture_thumbnail(index)

Captures a thumbnail for the given index.

change_sorting(role, order)

Change the sorting role of the current item view model.

change_tab(idx)

Changes the current item tab.

clear_favourites([prompt])

Clear the list of saved favourite items.

convert_image_sequence(index)

Convert the selected image sequence to a movie file.

copy_asset_properties(index)

Copy asset properties to clipboard.

copy_path(path[, mode, first, copy])

Copies the given path to the clipboard.

copy_selected_alt_path(index)

Copies the path of the given item to the clipboard.

copy_selected_path(index)

Copies the path of the given item to the clipboard.

decrease_row_size()

Decreases the row size of the current tab view.

delete_selected_files(index)

Deletes the selected file items.

edit_asset([asset])

Shows AssetPropertyEditor to edit the properties of a bookmark item.

edit_bookmark([server, job, root])

Shows BookmarkPropertyEditor to edit the properties of a bookmark item.

edit_file(f)

Edit the given file.

edit_item(index)

Action used to open an item editor.

exec_instance()

Opens a new app instance.

execute(index[, first])

Given the model index, executes the index's path using QDesktopServices.

execute_detached(path)

Utility function used to execute a file as a detached process.

export_favourites(*args[, destination])

Saves all favourite items to a zip file.

export_properties(index)

Exports the selected item's properties.

extract_zip_template(source, destination, name)

Expands the selected source zip archive to destination as name.

filter_flag_changed(flag, parent_paths, source)

Slot used to keep item filter flag values updated across all datasets.

generate_thumbnails_changed(state)

Slot called when the thumbnail generating preference has changed.

hide_sg_connecting_message()

Hides a ShotGrid connection progress message.

import_favourites(*args[, source])

Import a previously exported favourites file.

import_properties(index)

Imports properties and applies them to the selected item.

increase_row_size()

Increases the row size of the current tab view.

must_be_initialized(func)

Decorator function sure functions only run when common.main_widget exists and initialized.

next_tab()

Shows the next available item tab.

paste_asset_properties(index)

Paste asset properties from clipboard to the selected item.

pick_launcher_item()

Slot called when a launcher item was clicked.

pick_template(mode)

Prompts the user to pick a new *.zip file containing a template directory structure.

pick_thumbnail_from_file(index)

Picks a thumbnail for the given index.

pick_thumbnail_from_library(index)

Picks a thumbnail for the given index.

preview_image(index)

Shows a preview of the given image.

preview_thumbnail(index)

Displays a preview of the currently selected item.

previous_tab()

Shows the previous item tab.

prune_bookmarks()

Removes invalid bookmark items from the current set.

refresh([idx])

Refresh the model of an item view.

remove_bookmark(server, job, root)

Remove the given bookmark from the user settings file.

remove_favourite(source_paths, source)

Remove a saved favourite item.

remove_server(v)

Remove a server item from the list of user specified servers.

remove_thumbnail(index)

Deletes a thumbnail file and the cached entries associated with it.

remove_zip_template(source[, prompt])

Deletes a zip template file from the disk.

reset_row_size()

Reset the current tab view row size to its default value.

reveal(item)

Reveals an item in the file explorer.

reveal_default_bookmarks_json()

Reveals common.default_bookmarks_template in the file explorer.

reveal_selected(index)

Reveal the currently selected item in the file explorer.

reveal_url(index)

Opens the given item's primary ULR.

selection(func)

Decorator function to ensure QModelIndexes passed to worker threads are in a valid state.

set_active(k, v)

Sets the given path as the active path segment for the given key.

set_task_folder(v)

Sets the active task folder.

show_add_asset([server, job, root])

Shows AssetPropertyEditor to create a new asset item.

show_add_file([asset, extension, file, ...])

Shows FileSaverWidget to add a new empty template path file.

show_asset(path)

Slot used to reveal an asset item in the asset tab.

show_bookmarker()

Shows BookmarkerWidget.

show_notes(index)

Shows the NoteEditor editor.

show_preferences()

Shows the PreferenceEditor editor widget.

show_publish_widget(index)

Shows the PublishWidget editor.

show_sg_connecting_message()

Shows a ShotGrid connection progress message.

show_sg_error_message(v)

Shows a ShotGrid error message.

show_slack()

Opens the Slack widget used to send messages using SlackAPI.

suggest_prefix(job)

Suggests a prefix for the given job.

test_slack_token(token)

Tests the given slack api token.

toggle_active_item()

Toggles the MarkedAsActive item filter of the current tab model.

toggle_active_mode()

Toggle the active path mode.

toggle_archived(index)

Toggles the MarkedAsArchived flag of the given item.

toggle_archived_items()

Toggles the MarkedAsArchived item filter of the current tab model.

toggle_debug(state)

Toggles debugging staten on or off.

toggle_favourite(index)

Toggles the MarkedAsFavourite flag of the given item.

toggle_favourite_items()

Toggles the MarkedAsFavourite item filter of the current tab model.

toggle_filter_editor()

Toggles the search filter editor view of the current item view.

toggle_flag(flag, v)

Toggle an item filter flag in the current item tab.

toggle_full_screen()

Toggle BookmarksAppWindow full-screen view.

toggle_inline_icons()

Toggles the inline icon visibility of the current tab view.

toggle_maximized()

Toggle BookmarksAppWindow maximized view.

toggle_minimized()

Toggle BookmarksAppWindow minimized view.

toggle_progress_columns()

Toggles the visibility of the progress tracker columns.

toggle_sequence()

Toggles the data type of the file item model.

toggle_sort_order()

Change the sorting order of the current item view model.

toggle_stays_always_on_top()

Toggle BookmarksAppWindow stacking value.

toggle_task_view()

Shows or hides the visibility of the :class:~bookmarks.items.task_items.TaskItemView`` widget.

bookmarks.actions.add_bookmark(server, job, root)[source]#

Add the given bookmark item and save it in the user settings file.

Parameters:
  • server (str) – server path segment.

  • job (str) – job path segment.

  • root (str) – root path segment.

bookmarks.actions.add_favourite(source_paths, source)[source]#

Add and save a favourite item.

Parameters:
  • source_paths (list) – A list of parent paths.

  • source (str) – The item to save as a favourite item.

bookmarks.actions.add_item()[source]#

Triggers the current tab’s add item action.

bookmarks.actions.add_server(v)[source]#

Adds a server item to the list of user specified servers.

Parameters:

v (str) – A path to a server, e.g. Q:/jobs.

bookmarks.actions.add_zip_template(source, mode, prompt=False)[source]#

Adds the selected source zip archive as a mode template file.

Parameters:
  • source (str) – Path to a zip template file.

  • mode (str) – A template mode (one of ‘job’ or ‘asset’).

  • prompt (bool) – Prompt user to confirm overriding existing files.

Returns:

Path to the saved template file, or None.

Return type:

str

bookmarks.actions.adjust_tab_button_size(*args, **kwargs)[source]#

Slot used to adjust the size of the top bar buttons size.

bookmarks.actions.asset_identifier_changed(table, source, key, value)[source]#

Refresh the assets model if the identifier changes.

bookmarks.actions.capture_thumbnail(index)[source]#

Captures a thumbnail for the given index.

Parameters:

index (QtCore.QModelIndex) – The item index.

bookmarks.actions.change_sorting(role, order)[source]#

Change the sorting role of the current item view model.

bookmarks.actions.change_tab(idx)[source]#

Changes the current item tab.

bookmarks.actions.clear_favourites(prompt=True)[source]#

Clear the list of saved favourite items.

Parameters:

prompt (bool) – If True, will prompt the user for confirmation.

bookmarks.actions.convert_image_sequence(index)[source]#

Convert the selected image sequence to a movie file.

bookmarks.actions.copy_asset_properties(index)[source]#

Copy asset properties to clipboard.

Parameters:

index (QModelIndex) – Index of the currently selected item.

bookmarks.actions.copy_path(path, mode=common.WindowsPath, first=True, copy=True)[source]#

Copies the given path to the clipboard.

The path will be conformed to the given mode. E.g. forward slashes converted to back-slashes for WindowsPath.

Parameters:
  • path (str) – A file path.

  • mode (int) – Any of WindowsPath, UnixPath, SlackPath or MacOSPath. Defaults to WindowsPath.

  • first (bool) – When True, copies the first item of a sequence.

  • copy (bool) – When False, the converted path won’t be copied to the clipboard. Defaults to True.

Returns:

The path copied to the clipboard.

Return type:

str

bookmarks.actions.copy_selected_alt_path(index)[source]#

Copies the path of the given item to the clipboard.

Parameters:

index (QtCore.QModelIndex) – The item index.

bookmarks.actions.copy_selected_path(index)[source]#

Copies the path of the given item to the clipboard.

Parameters:

index (QtCore.QModelIndex) – The item index.

bookmarks.actions.decrease_row_size()[source]#

Decreases the row size of the current tab view.

bookmarks.actions.delete_selected_files(index)[source]#

Deletes the selected file items.

bookmarks.actions.edit_asset(asset=None)[source]#

Shows AssetPropertyEditor to edit the properties of a bookmark item.

Parameters:

asset (str) – asset path segment.

bookmarks.actions.edit_bookmark(server=None, job=None, root=None)[source]#

Shows BookmarkPropertyEditor to edit the properties of a bookmark item.

Parameters:
  • server (str) – server path segment. Optional.

  • job (str) – job path segment. Optional.

  • root (str) – root path segment. Optional.

bookmarks.actions.edit_file(f)[source]#

Edit the given file.

bookmarks.actions.edit_item(index)[source]#

Action used to open an item editor.

bookmarks.actions.exec_instance()[source]#

Opens a new app instance.

bookmarks.actions.execute(index, first=False)[source]#

Given the model index, executes the index’s path using QDesktopServices.

Parameters:
  • index (QModelIndex or str) – A list item index or a path to a file.

  • first (bool) – Execute the first item of a collapsed sequence.

bookmarks.actions.execute_detached(path)[source]#

Utility function used to execute a file as a detached process.

On Windows, we’ll call the give file through the explorer. This is so, that the new process does not inherit the current environment.

bookmarks.actions.export_favourites(*args, destination=None)[source]#

Saves all favourite items to a zip file.

Parameters:
  • args (tuple) – A server, job, root argument tuple.

  • destination (str) – The path to save the zip file to. Optional.

bookmarks.actions.export_properties(index)[source]#

Exports the selected item’s properties.

bookmarks.actions.extract_zip_template(source, destination, name)[source]#

Expands the selected source zip archive to destination as name.

The contents will be expanded to a {destination}/{name} where name is an arbitrary name of a job or an asset item to be created.

Parameters:
  • source (str) – Path to a zip archive.

  • destination (str) – Path to a folder

  • name (str) – Name of the root folder where the archive contents will be expanded to.

Returns:

Path to the expanded archive contents.

Return type:

str

bookmarks.actions.filter_flag_changed(flag, parent_paths, source, state=None, limit=9999)[source]#

Slot used to keep item filter flag values updated across all datasets.

For instance, the favourite item model might set flag values that we want to keep updated in other models too.

Parameters:
  • flag (int) – A filter flag.

  • parent_paths (list) – The parent paths that make up the source file.

  • source (str) – The source file path.

  • state (bool) – The favourite state flat value.

  • limit (int) – The maximum number of items to check.

bookmarks.actions.generate_thumbnails_changed(state)[source]#

Slot called when the thumbnail generating preference has changed.

Parameters:

state (QtCore.Qt.CheckState) – The preference state.

bookmarks.actions.hide_sg_connecting_message()[source]#

Hides a ShotGrid connection progress message.

bookmarks.actions.import_favourites(*args, source=None)[source]#

Import a previously exported favourites file.

Parameters:

source (str) – Path to a file. Defaults to None.

bookmarks.actions.import_properties(index)[source]#

Imports properties and applies them to the selected item.

bookmarks.actions.increase_row_size()[source]#

Increases the row size of the current tab view.

bookmarks.actions.must_be_initialized(func)[source]#

Decorator function sure functions only run when common.main_widget exists and initialized.

bookmarks.actions.next_tab()[source]#

Shows the next available item tab.

bookmarks.actions.paste_asset_properties(index)[source]#

Paste asset properties from clipboard to the selected item.

Parameters:

index (QModelIndex) – Index of the currently selected item.

bookmarks.actions.pick_launcher_item()[source]#

Slot called when a launcher item was clicked.

bookmarks.actions.pick_template(mode)[source]#

Prompts the user to pick a new *.zip file containing a template directory structure.

The template is copied to %localappdata%/[product]/[mode]_templates/*.zip folder.

Parameters:

mode (str) – A template mode, e.g. JobTemplateMode.

bookmarks.actions.pick_thumbnail_from_file(index)[source]#

Picks a thumbnail for the given index.

Parameters:

index (QtCore.QModelIndex) – The item index.

bookmarks.actions.pick_thumbnail_from_library(index)[source]#

Picks a thumbnail for the given index.

Parameters:

index (QtCore.QModelIndex) – The item index.

bookmarks.actions.preview_image(index)[source]#

Shows a preview of the given image.

Parameters:

index (QtCore.QModelIndex) – The item index.

bookmarks.actions.preview_thumbnail(index)[source]#

Displays a preview of the currently selected item.

For image files we’ll try to load and display the image itself, and for any other case we will fall back to cached or default thumbnail images.

bookmarks.actions.previous_tab()[source]#

Shows the previous item tab.

bookmarks.actions.prune_bookmarks()[source]#

Removes invalid bookmark items from the current set.

bookmarks.actions.refresh(idx=None)[source]#

Refresh the model of an item view.

Parameters:

idx (int) – The item tab number. Optional.

bookmarks.actions.remove_bookmark(server, job, root)[source]#

Remove the given bookmark from the user settings file.

Removing a bookmark item will close and delete the item’s database controller instances.

Parameters:
  • server (str) – server path segment.

  • job (str) – job path segment.

  • root (str) – A path segment.

bookmarks.actions.remove_favourite(source_paths, source)[source]#

Remove a saved favourite item.

Parameters:
  • source_paths (list) – A list of parent paths.

  • source (str) – The item to save as a favourite item.

bookmarks.actions.remove_server(v)[source]#

Remove a server item from the list of user specified servers.

Parameters:

v (str) – A path to a server, e.g. Q:/jobs.

bookmarks.actions.remove_thumbnail(index)[source]#

Deletes a thumbnail file and the cached entries associated with it.

bookmarks.actions.remove_zip_template(source, prompt=True)[source]#

Deletes a zip template file from the disk.

Parameters:
  • source (str) – Path to a zip template file.

  • prompt (bool) – Prompt the user for confirmation.

bookmarks.actions.reset_row_size()[source]#

Reset the current tab view row size to its default value.

bookmarks.actions.reveal(item)[source]#

Reveals an item in the file explorer.

Parameters:

item (str or QModelIndex) – The item to show in the file manager.

bookmarks.actions.reveal_default_bookmarks_json()[source]#

Reveals common.default_bookmarks_template in the file explorer.

bookmarks.actions.reveal_selected(index)[source]#

Reveal the currently selected item in the file explorer.

Parameters:

index (QtCore.QModelIndex) – The item index.

bookmarks.actions.reveal_url(index)[source]#

Opens the given item’s primary ULR.

Parameters:

index (QtCore.QModelIndex) – The item index.

bookmarks.actions.selection(func)[source]#

Decorator function to ensure QModelIndexes passed to worker threads are in a valid state.

bookmarks.actions.set_active(k, v)[source]#

Sets the given path as the active path segment for the given key.

Parameters:
  • k (str) – An active key, e.g. ‘server’.

  • v (str or None) – A path segment, e.g. ‘//myserver/jobs’.

bookmarks.actions.set_task_folder(v)[source]#

Sets the active task folder.

Parameters:

v (str) – A task path segment, e.g. ‘scenes’.

bookmarks.actions.show_add_asset(server=None, job=None, root=None)[source]#

Shows AssetPropertyEditor to create a new asset item.

Parameters:
  • server (str) – server path segment. Optional.

  • job (str) – job path segment. Optional.

  • root (str) – root path segment. Optional.

bookmarks.actions.show_add_file(asset=None, extension=None, file=None, create_file=True, increment=False)[source]#

Shows FileSaverWidget to add a new empty template path file.

Parameters:
  • asset (str) – Name of the asset.

  • extension (str) – An format, e.g. ‘psd’.

  • file (str) – Path to an existing file. Optional.

  • create_file (bool) – Creates an empty file if True.

  • increment (bool) – Increment the version number element of file.

Returns:

The editor widget instance.

bookmarks.actions.show_asset(path)[source]#

Slot used to reveal an asset item in the asset tab.

Parameters:

path (str) – Path of the asset item.

bookmarks.actions.show_bookmarker()[source]#

Shows BookmarkerWidget.

bookmarks.actions.show_notes(index)[source]#

Shows the NoteEditor editor.

Parameters:

index (QtCore.QModelIndex) – The item index.

bookmarks.actions.show_preferences()[source]#

Shows the PreferenceEditor editor widget.

bookmarks.actions.show_publish_widget(index)[source]#

Shows the PublishWidget editor.

bookmarks.actions.show_sg_connecting_message()[source]#

Shows a ShotGrid connection progress message.

bookmarks.actions.show_sg_error_message(v)[source]#

Shows a ShotGrid error message.

bookmarks.actions.show_slack()[source]#

Opens the Slack widget used to send messages using SlackAPI.

bookmarks.actions.suggest_prefix(job)[source]#

Suggests a prefix for the given job.

Parameters:

job (Job) – The job to suggest prefix for.

bookmarks.actions.test_slack_token(token)[source]#

Tests the given slack api token.

Parameters:

token (str) – The slack api token.

bookmarks.actions.toggle_active_item()[source]#

Toggles the MarkedAsActive item filter of the current tab model.

bookmarks.actions.toggle_active_mode()[source]#

Toggle the active path mode.

bookmarks.actions.toggle_archived(index)[source]#

Toggles the MarkedAsArchived flag of the given item.

Parameters:

index (QtCore.QModelIndex) – The item index.

bookmarks.actions.toggle_archived_items()[source]#

Toggles the MarkedAsArchived item filter of the current tab model.

bookmarks.actions.toggle_debug(state)[source]#

Toggles debugging staten on or off.

When on, the app will print debugging information to the console.

Parameters:

state (QtCore.Qt.CheckState) – Debugging state.

bookmarks.actions.toggle_favourite(index)[source]#

Toggles the MarkedAsFavourite flag of the given item.

Parameters:

index (QtCore.QModelIndex) – The item index.

bookmarks.actions.toggle_favourite_items()[source]#

Toggles the MarkedAsFavourite item filter of the current tab model.

bookmarks.actions.toggle_filter_editor()[source]#

Toggles the search filter editor view of the current item view.

bookmarks.actions.toggle_flag(flag, v)[source]#

Toggle an item filter flag in the current item tab.

Parameters:
  • flag (int) – An item filter flag.

  • v (bool) – The filter flag value.

bookmarks.actions.toggle_full_screen()[source]#

Toggle BookmarksAppWindow full-screen view.

bookmarks.actions.toggle_inline_icons()[source]#

Toggles the inline icon visibility of the current tab view.

bookmarks.actions.toggle_maximized()[source]#

Toggle BookmarksAppWindow maximized view.

bookmarks.actions.toggle_minimized()[source]#

Toggle BookmarksAppWindow minimized view.

bookmarks.actions.toggle_progress_columns()[source]#

Toggles the visibility of the progress tracker columns.

bookmarks.actions.toggle_sequence()[source]#

Toggles the data type of the file item model.

bookmarks.actions.toggle_sort_order()[source]#

Change the sorting order of the current item view model.

bookmarks.actions.toggle_stays_always_on_top()[source]#

Toggle BookmarksAppWindow stacking value.

bookmarks.actions.toggle_task_view()[source]#

Shows or hides the visibility of the :class:~bookmarks.items.task_items.TaskItemView`` widget.