mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
trigger before save event as first thing
This commit is contained in:
parent
34830ee881
commit
3d2a39b592
2 changed files with 6 additions and 11 deletions
|
|
@ -45,12 +45,7 @@ class BaseEvent(object):
|
|||
|
||||
class BeforeWorkfileSave(BaseEvent):
|
||||
"""Before workfile changes event data."""
|
||||
def __init__(self, new_workfile, workdir):
|
||||
data = {
|
||||
"workfile_path": new_workfile,
|
||||
"workdir_path": workdir
|
||||
}
|
||||
super(BeforeWorkfileSave, self).__init__("before.workfile.save", data)
|
||||
|
||||
self.workfile_path = new_workfile
|
||||
def __init__(self, filename, workdir):
|
||||
super(BeforeWorkfileSave, self).__init__("before.workfile.save")
|
||||
self.filename = filename
|
||||
self.workdir_path = workdir
|
||||
|
|
|
|||
|
|
@ -654,6 +654,9 @@ class FilesWidget(QtWidgets.QWidget):
|
|||
if not work_file:
|
||||
return
|
||||
|
||||
# Trigger before save event
|
||||
BeforeWorkfileSave.emit(work_file, self._workdir_path)
|
||||
|
||||
# Initialize work directory if it has not been initialized before
|
||||
if not os.path.exists(self._workfiles_root):
|
||||
log.debug("Initializing Work Directory: %s", self._workfiles_root)
|
||||
|
|
@ -670,9 +673,6 @@ class FilesWidget(QtWidgets.QWidget):
|
|||
file_path = os.path.join(
|
||||
os.path.normpath(self._workfiles_root), work_file
|
||||
)
|
||||
|
||||
BeforeWorkfileSave.emit(file_path, self._workdir_path)
|
||||
|
||||
self._enter_session() # Make sure we are in the right session
|
||||
self.host.save_file(file_path)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue