mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
Merge pull request #2793 from BigRoy/pyblish_pype_preserve_comment_on_reset
Pyblish Pype: Preserve comment on reset
This commit is contained in:
commit
c0dde86027
3 changed files with 17 additions and 3 deletions
|
|
@ -90,9 +90,8 @@ def show(parent=None):
|
|||
install_fonts()
|
||||
install_translator(app)
|
||||
|
||||
ctrl = control.Controller()
|
||||
|
||||
if self._window is None:
|
||||
ctrl = control.Controller()
|
||||
self._window = window.Window(ctrl, parent)
|
||||
self._window.destroyed.connect(on_destroyed)
|
||||
|
||||
|
|
|
|||
|
|
@ -228,6 +228,16 @@ class Controller(QtCore.QObject):
|
|||
def reset_context(self):
|
||||
self.log.debug("Resetting pyblish context object")
|
||||
|
||||
comment = None
|
||||
if (
|
||||
self.context is not None and
|
||||
self.context.data.get("comment") and
|
||||
# We only preserve the user typed comment if we are *not*
|
||||
# resetting from a successful publish without errors
|
||||
self._current_state != "Published"
|
||||
):
|
||||
comment = self.context.data["comment"]
|
||||
|
||||
self.context = pyblish.api.Context()
|
||||
|
||||
self.context._publish_states = InstanceStates.ContextType
|
||||
|
|
@ -249,6 +259,10 @@ class Controller(QtCore.QObject):
|
|||
|
||||
self.context.families = ("__context__",)
|
||||
|
||||
if comment:
|
||||
# Preserve comment on reset if user previously had a comment
|
||||
self.context.data["comment"] = comment
|
||||
|
||||
self.log.debug("Reset of pyblish context object done")
|
||||
|
||||
def reset(self):
|
||||
|
|
|
|||
|
|
@ -1139,9 +1139,10 @@ class Window(QtWidgets.QDialog):
|
|||
self.intent_box.setCurrentIndex(self.intent_model.default_index)
|
||||
|
||||
self.comment_box.placeholder.setVisible(False)
|
||||
self.comment_box.placeholder.setVisible(True)
|
||||
# Launch controller reset
|
||||
self.controller.reset()
|
||||
if not self.comment_box.text():
|
||||
self.comment_box.placeholder.setVisible(True)
|
||||
|
||||
def validate(self):
|
||||
self.info(self.tr("Preparing validate.."))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue