mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
instances are removed by ids
This commit is contained in:
parent
ebb6a17d97
commit
8ffdbf0dcf
3 changed files with 15 additions and 6 deletions
|
|
@ -1098,7 +1098,7 @@ class AbstractPublisherController(object):
|
|||
|
||||
pass
|
||||
|
||||
def remove_instances(self, instances):
|
||||
def remove_instances(self, instance_ids):
|
||||
"""Remove list of instances from create context."""
|
||||
# TODO expect instance ids
|
||||
|
||||
|
|
@ -1632,18 +1632,23 @@ class PublisherController(AbstractPublisherController):
|
|||
if self._create_context.host_is_valid:
|
||||
self._create_context.save_changes()
|
||||
|
||||
def remove_instances(self, instances):
|
||||
def remove_instances(self, instance_ids):
|
||||
""""""
|
||||
# TODO expect instance ids instead of instances
|
||||
# QUESTION Expect that instances are really removed? In that case save
|
||||
# reset is not required and save changes too.
|
||||
self.save_changes()
|
||||
|
||||
self._remove_instances_from_context(instances)
|
||||
self._remove_instances_from_context(instance_ids)
|
||||
|
||||
self._on_create_instance_change()
|
||||
|
||||
def _remove_instances_from_context(self, instances):
|
||||
def _remove_instances_from_context(self, instance_ids):
|
||||
instances_by_id = self._create_context.instances_by_id
|
||||
instances = [
|
||||
instances_by_id[instance_id]
|
||||
for instance_id in instance_ids
|
||||
]
|
||||
self._create_context.remove_instances(instances)
|
||||
|
||||
def _on_create_instance_change(self):
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ class QtRemotePublishController(QtPublisherController):
|
|||
# Send 'created_instance_changes' value to client
|
||||
|
||||
@abstractmethod
|
||||
def remove_instances(self, instances):
|
||||
def remove_instances(self, instance_ids):
|
||||
"""Remove list of instances from create context."""
|
||||
# TODO add Args:
|
||||
|
||||
|
|
|
|||
|
|
@ -224,7 +224,11 @@ class OverviewWidget(QtWidgets.QFrame):
|
|||
dialog.exec_()
|
||||
# Skip if OK was not clicked
|
||||
if dialog.result() == QtWidgets.QMessageBox.Ok:
|
||||
self._controller.remove_instances(instances)
|
||||
instance_ids = {
|
||||
instance.id
|
||||
for instance in instances
|
||||
}
|
||||
self._controller.remove_instances(instance_ids)
|
||||
|
||||
def _on_change_view_clicked(self):
|
||||
self._change_view_type()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue