Preserve comment on reset

This commit is contained in:
Roy Nieterau 2022-02-22 15:15:12 +01:00
parent b43b304295
commit 4d44a374ae
2 changed files with 11 additions and 2 deletions

View file

@ -228,6 +228,10 @@ 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"):
comment = self.context.data["comment"]
self.context = pyblish.api.Context()
self.context._publish_states = InstanceStates.ContextType
@ -249,6 +253,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):

View file

@ -1138,8 +1138,9 @@ class Window(QtWidgets.QDialog):
if self.intent_model.has_items:
self.intent_box.setCurrentIndex(self.intent_model.default_index)
self.comment_box.placeholder.setVisible(False)
self.comment_box.placeholder.setVisible(True)
if self.comment_box.text():
self.comment_box.placeholder.setVisible(False)
self.comment_box.placeholder.setVisible(True)
# Launch controller reset
self.controller.reset()