common.settings#
Defines a customized QSettings object used to store user settings.
The user settings are stored in an ini file stored at get_user_settings_path()
.
The current ui state, current active paths and application settings are all stored in here.
Classes:
|
An INI config file used to store local user settings. |
Functions:
|
Get an active path segment stored in the user settings. |
|
Returns a generic string representation of a bookmark item. |
Loads any preconfigured bookmark items from the json config file. |
|
Returns the path to the user settings file. |
|
Initializes the |
|
|
Replace and strip backslashes. |
Copy the |
Data:
section/key definitions |
- class bookmarks.common.settings.UserSettings(parent=None)[source]#
Bases:
QSettings
An INI config file used to store local user settings.
Methods:
Load previously saved active path elements from the settings file.
setValue
(key, v)Set a value to the user settings file.
Set and save the given bookmark item values.
Set and save the given favourite item values.
set_servers
(v)Set and save the given server values.
value
(key[, default])Get a value from the user settings file.
Verify the active path values and unset any item, that refers to an invalid path.
- load_active_values()[source]#
Load previously saved active path elements from the settings file.
If the resulting path is invalid, we’ll progressively unset the invalid path segments until we find a valid path.
- setValue(key, v)[source]#
Set a value to the user settings file.
Overrides the default value() method to provide type checking. Types are saved in {key}_type.
- Parameters:
key (str) – A settings key.
v (object) – The value to save.
- set_bookmarks(v)[source]#
Set and save the given bookmark item values.
- Parameters:
v (dict) – The bookmark item values.
- set_favourites(v)[source]#
Set and save the given favourite item values.
- Parameters:
v (dict) – The favourite item values.
- value(key, default=None)[source]#
Get a value from the user settings file.
Overrides the default value() method to provide type checking. Types are saved in {key}_type.
- Parameters:
key (str) – A settings key.
default (object, optional) – The default value if value not set.
- Returns:
The value stored in settings or None if not found.
- bookmarks.common.settings.active(k, path=False, args=False)[source]#
Get an active path segment stored in the user settings.
- Parameters:
k (str) – One of the following segment names: ‘server’, ‘job’, ‘root’, ‘asset’, ‘task’, ‘file’
path (bool, optional) – If True, will return a path to the active item.
args (bool, optional) – If True, will return all components that make up the active path.
- Returns:
The name of the active item. * str (when path=True): Path to the active item. * tuple (when args=True): Active path elements.
- Return type:
str
- bookmarks.common.settings.bookmark_key(server, job, root)[source]#
Returns a generic string representation of a bookmark item.
- Parameters:
server (str) – server path segment.
job (str) – job path segment.
root (str) – root path segment.
- Returns:
The bookmark item key.
- Return type:
str
- bookmarks.common.settings.get_default_bookmarks()[source]#
Loads any preconfigured bookmark items from the json config file.
- Returns:
The parsed data.
- Return type:
dict
- bookmarks.common.settings.get_user_settings_path()[source]#
Returns the path to the user settings file.
- bookmarks.common.settings.init_settings()[source]#
Initializes the
UserSettings
instance.
- bookmarks.common.settings.strip(s)[source]#
Replace and strip backslashes.
- Parameters:
s (str) – The string to modify.
- Returns:
The modified string.
- Return type:
str
- bookmarks.common.settings.update_private_values()[source]#
Copy the
SynchronisedActivePaths
values toPrivateActivePaths
.
- bookmarks.common.settings.SECTIONS = {'active': ('server', 'job', 'root', 'asset', 'task', 'file'), 'bookmarker': ('bookmarker/server', 'bookmarker/job', 'bookmarker/root'), 'ffmpeg': ('ffmpeg/preset', 'ffmpeg/size', 'ffmpeg/timecode'), 'file_saver': ('file_saver/task', 'file_saver/element', 'file_saver/extension', 'file_saver/template', 'file_saver/user'), 'filters': ('filters/active', 'filters/archived', 'filters/favourites', 'filters/buttons', 'filters/collapsed', 'filters/text', 'filters/text_history', 'filters/sort_by', 'filters/sort_order', 'filters/row_heights', 'filters/selection_file', 'filters/selection_sequence', 'filters/progress'), 'maya': ('maya/sync_workspace', 'maya/workspace_save_warnings', 'maya/push_capture_to_rv', 'maya/reveal_capture', 'maya/publish_capture'), 'maya_export': ('maya_export/type', 'maya_export/set', 'maya_export/timeline', 'maya_export/version', 'maya_export/keep_open'), 'publish': ('publish/template', 'publish/task', 'publish/copy_path', 'publish/reveal', 'publish/teams_notification'), 'selection': ('selection/current_tab',), 'settings': ('settings/job_scan_depth', 'settings/ui_scale', 'settings/show_menu_icons', 'settings/paint_thumbnail_bg', 'settings/disable_oiio', 'settings/always_always_on_top', 'settings/bin_ffmpeg', 'settings/bin_rv', 'settings/bin_rvpush', 'settings/bin_oiiotool'), 'shotgrid': ('shotgrid/link_multiple_filter', 'shotgrid/publish_task', 'shotgrid/publish_type', 'shotgrid/publish_version', 'shotgrid/current_user', 'shotgrid/current_asset', 'shotgrid/current_selection', 'shotgrid/sg_user', 'shotgrid/sg_storage', 'shotgrid/sg_type'), 'slack': ('slack/user',), 'state': ('state/geometry', 'state/state'), 'user': ('user/servers', 'user/bookmarks', 'user/favourites')}#
section/key definitions