create context has callbacks for reset preparation and finalization

This commit is contained in:
Jakub Trllo 2022-10-17 15:19:48 +02:00
parent ec206bec00
commit bacbff0262
2 changed files with 19 additions and 0 deletions

View file

@ -860,6 +860,9 @@ class CreateContext:
All changes will be lost if were not saved explicitely.
"""
self.reset_preparation()
self.reset_avalon_context()
self.reset_plugins(discover_publish_plugins)
self.reset_context_data()
@ -868,6 +871,18 @@ class CreateContext:
self.reset_instances()
self.execute_autocreators()
self.reset_finalization()
def reset_preparation(self):
"""Prepare attributes that must be prepared/cleaned before reset."""
pass
def reset_finalization(self):
"""Cleanup of attributes after reset."""
pass
def reset_avalon_context(self):
"""Give ability to reset avalon context.

View file

@ -552,6 +552,8 @@ class PublisherController:
self.save_changes()
self.create_context.reset_preparation()
# Reset avalon context
self.create_context.reset_avalon_context()
@ -560,6 +562,8 @@ class PublisherController:
self._reset_publish()
self._reset_instances()
self.create_context.reset_finalization()
self.emit_card_message("Refreshed..")
def _reset_plugins(self):