mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 21:32:15 +01:00
* initial commitof ayon loader * tweaks in ayon utils * implemented product type filtering * products have icons and proper style * fix refresh of products * added enable grouping checkbox * added icons and sorting of grouped items * fix version delegate * add splitter between context and product type filtering * fix products filtering by name * implemented 'filter_repre_contexts_by_loader' * implemented base of action items * implemented folder underline colors * changed version items to dictionary * use 'product_id' instead of 'subset_id' * base implementation of info widget * require less to trigger action * set selection of version ids in controller * added representation widget and related logic changes * implemented actions in representations widget * handle load error * use versions for subset loader * fix representations widget * implemente "in scene" logic properly * use ayon loader in host tools * fix used function to get tasks * show actions per representation name * center window * add window flag to loader window * added 'ThumbnailPainterWidget' to tool utils * implemented thumbnails model * implement thumbnail widget * fix FolderItem args docstring * bypass bug in ayon_api * fix sorting of folders * added refresh button * added expected selection and go to current context * added information if project item is library project * added more filtering options to projects widget * added missing information abou is library to model items * remove select project item on selection change * filter out non library projects * set current context project to project combobox * change window title * fix hero version queries * move current project to the top * fix reset * change icon for library projects * added libraries separator to project widget * show libraries separator in loader * ise single line expression * library loader tool is loader tool in AYON mode * fixes in grouping model * implemented grouping logic * use loader in tray action * better initial sizes * moved 'ActionItem' to abstract * filter loaders by tool name based on current context project * formatting fixes * separate abstract classes into frontend and backend abstractions * added docstrings to abstractions * implemented 'to_data' and 'from_data' for action item options * added more docstrings * first filter representation contexts and then create action items * implemented 'refresh' method * do not reset controller in '_on_first_show' Method '_on_show_timer' will take about the reset. * 'ThumbnailPainterWidget' have more options of bg painting * do not use checkerboard in loader thumbnail * fix condition Co-authored-by: Roy Nieterau <roy_nieterau@hotmail.com> --------- Co-authored-by: Roy Nieterau <roy_nieterau@hotmail.com>
85 lines
2.4 KiB
Python
85 lines
2.4 KiB
Python
class SelectionModel(object):
|
|
"""Model handling selection changes.
|
|
|
|
Triggering events:
|
|
- "selection.project.changed"
|
|
- "selection.folders.changed"
|
|
- "selection.versions.changed"
|
|
"""
|
|
|
|
event_source = "selection.model"
|
|
|
|
def __init__(self, controller):
|
|
self._controller = controller
|
|
|
|
self._project_name = None
|
|
self._folder_ids = set()
|
|
self._version_ids = set()
|
|
self._representation_ids = set()
|
|
|
|
def get_selected_project_name(self):
|
|
return self._project_name
|
|
|
|
def set_selected_project(self, project_name):
|
|
if self._project_name == project_name:
|
|
return
|
|
|
|
self._project_name = project_name
|
|
self._controller.emit_event(
|
|
"selection.project.changed",
|
|
{"project_name": self._project_name},
|
|
self.event_source
|
|
)
|
|
|
|
def get_selected_folder_ids(self):
|
|
return self._folder_ids
|
|
|
|
def set_selected_folders(self, folder_ids):
|
|
if folder_ids == self._folder_ids:
|
|
return
|
|
|
|
self._folder_ids = folder_ids
|
|
self._controller.emit_event(
|
|
"selection.folders.changed",
|
|
{
|
|
"project_name": self._project_name,
|
|
"folder_ids": folder_ids,
|
|
},
|
|
self.event_source
|
|
)
|
|
|
|
def get_selected_version_ids(self):
|
|
return self._version_ids
|
|
|
|
def set_selected_versions(self, version_ids):
|
|
if version_ids == self._version_ids:
|
|
return
|
|
|
|
self._version_ids = version_ids
|
|
self._controller.emit_event(
|
|
"selection.versions.changed",
|
|
{
|
|
"project_name": self._project_name,
|
|
"folder_ids": self._folder_ids,
|
|
"version_ids": self._version_ids,
|
|
},
|
|
self.event_source
|
|
)
|
|
|
|
def get_selected_representation_ids(self):
|
|
return self._representation_ids
|
|
|
|
def set_selected_representations(self, repre_ids):
|
|
if repre_ids == self._representation_ids:
|
|
return
|
|
|
|
self._representation_ids = repre_ids
|
|
self._controller.emit_event(
|
|
"selection.representations.changed",
|
|
{
|
|
"project_name": self._project_name,
|
|
"folder_ids": self._folder_ids,
|
|
"version_ids": self._version_ids,
|
|
"representation_ids": self._representation_ids,
|
|
}
|
|
)
|