From 6ea133110c3b7e7f142f83247ca03a019676d27e Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Sun, 19 Sep 2021 17:42:08 +0200 Subject: [PATCH] auto-dismiss success message notifications --- CHANGELOG.md | 3 +++ DuetRRFOutputDevice.py | 43 +++++++++++++++++++++++++++++++++--------- plugin.json | 4 ++-- 3 files changed, 39 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 019ac13..27f74a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog of Cura-DuetRRFPlugin +## v1.2.4: 2021-09-19 + * auto-dismiss success message notifications after 15sec + ## v1.2.3: 2021-01-30 * move deleting of unmapped settings to action button on message * correctly bump plugin version metadata diff --git a/DuetRRFOutputDevice.py b/DuetRRFOutputDevice.py index 77e5d91..20cea49 100644 --- a/DuetRRFOutputDevice.py +++ b/DuetRRFOutputDevice.py @@ -212,7 +212,13 @@ def onFilenameAccepted(self): self.writeStarted.emit(self) # show a progress message - self._message = Message(catalog.i18nc("@info:progress", "Uploading to {}...").format(self._name), 0, False, -1) + self._message = Message( + "Uploading {} ...".format(self._fileName), + lifetime=0, + dismissable=False, + progress=-1, + title="DuetRRF: " + self._name, + ) self._message.show() Logger.log("d", "Loading gcode...") @@ -288,7 +294,13 @@ def onUploadDone(self, reply): self._message.hide() self._message = None - self._message = Message(catalog.i18nc("@info:progress", "Simulating print on {}...\nPLEASE CLOSE DWC AND DO NOT INTERACT WITH THE PRINTER!").format(self._name), 0, False, -1) + self._message = Message( + "Simulating print {}...\nPlease close DWC and DO NOT interact with the printer!".format(self._fileName), + lifetime=0, + dismissable=False, + progress=-1, + title="DuetRRF: " + self._name, + ) self._message.show() gcode='M37 P"0:/gcodes/' + self._fileName + '"' @@ -312,8 +324,11 @@ def onUploadDone(self, reply): self._message.hide() self._message = None - text = "Uploaded file {} to {}.".format(os.path.basename(self._fileName), self._name) - self._message = Message(catalog.i18nc("@info:status", text), 0, False) + self._message = Message( + "Uploaded file: {}".format(self._fileName), + lifetime=15, + title="DuetRRF: " + self._name, + ) self._message.addAction("open_browser", catalog.i18nc("@action:button", "Open Browser"), "globe", catalog.i18nc("@info:tooltip", "Open browser to DuetWebControl.")) self._message.actionTriggered.connect(self._onMessageActionTriggered) self._message.show() @@ -355,8 +370,11 @@ def onPrintStarted(self, reply): self._message.hide() self._message = None - text = "Print started on {} with file {}.".format(self._name, self._fileName) - self._message = Message(catalog.i18nc("@info:status", text), 0, False) + self._message = Message( + "Print started: {}".format(self._fileName), + lifetime=15, + title="DuetRRF: " + self._name, + ) self._message.addAction("open_browser", catalog.i18nc("@action:button", "Open Browser"), "globe", catalog.i18nc("@info:tooltip", "Open browser to DuetWebControl.")) self._message.actionTriggered.connect(self._onMessageActionTriggered) self._message.show() @@ -461,8 +479,11 @@ def onReported(self, reply): self._message.hide() self._message = None - text = "Simulation finished on {}:\n\n{}".format(self._name, reply_body) - self._message = Message(catalog.i18nc("@info:status", text), 0, False) + self._message = Message( + "Simulation finished!\n\n{}".format(reply_body), + lifetime=0, + title="DuetRRF: " + self._name, + ) self._message.addAction("open_browser", catalog.i18nc("@action:button", "Open Browser"), "globe", catalog.i18nc("@info:tooltip", "Open browser to DuetWebControl.")) self._message.actionTriggered.connect(self._onMessageActionTriggered) self._message.show() @@ -507,7 +528,11 @@ def _onNetworkError(self, reply, error): if reply: errorString = reply.errorString() - message = Message(catalog.i18nc("@info:status", "There was a network error: {} {}").format(error, errorString), 0, False) + message = Message( + "There was a network error: {} {}".format(error, errorString), + lifetime=0, + title="DuetRRF: " + self._name, + ) message.show() self.writeError.emit(self) diff --git a/plugin.json b/plugin.json index 92ae93e..7bf0583 100644 --- a/plugin.json +++ b/plugin.json @@ -2,6 +2,6 @@ "name": "DuetRRF", "author": "Thomas Kriechbaumer", "description": "Upload and Print to Duet 2 Wifi / Duet 2 Ethernet / Duet 2 Maestro / Duet 3 with RepRapFirmware.", - "version": "1.2.3", - "supported_sdk_versions": ["7.3.0", "7.4.0"] + "version": "1.2.4", + "supported_sdk_versions": ["7.3.0", "7.4.0", "7.5.0", "7.6.0", "7.7.0"] }