diff --git a/UM/Message.py b/UM/Message.py index c57c44159a..b6b0d49925 100644 --- a/UM/Message.py +++ b/UM/Message.py @@ -13,7 +13,7 @@ def __init__(self, text = "", lifetime = 10, dismissable = True, progress = None self._visible = False self._text = text self._progress = progress - self._max_progress = 0 + self._max_progress = 100 self._lifetime = lifetime self._lifetime_timer = None self._dismissable = dismissable # Can the message be closed by user? @@ -63,7 +63,7 @@ def getMaxProgress(self): def setProgress(self, progress): self._progress = progress - self.progressChanged.emit() + self.progressChanged.emit(self) progressChanged = Signal() diff --git a/UM/Qt/Bindings/VisibleMessagesModel.py b/UM/Qt/Bindings/VisibleMessagesModel.py index 1da4e47dc6..799ec4f94a 100644 --- a/UM/Qt/Bindings/VisibleMessagesModel.py +++ b/UM/Qt/Bindings/VisibleMessagesModel.py @@ -40,6 +40,7 @@ def addMessage(self, message): "actions":self.createActionsModel(message.getActions()), "dismissable": message.isDismissable() }) + message.progressChanged.connect(self._onMessageProgress) def createActionsModel(self, actions): model = ListModel() @@ -69,3 +70,7 @@ def removeMessage(self, message): if self.items[index]["id"] == message_id: self.removeItem(index) break + + def _onMessageProgress(self, message): + index = self.find("id", id(message)) + self.setProperty(index, "progress", message.getProgress())