Skip to content

Commit

Permalink
auto-dismiss success message notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
Kriechi committed Sep 19, 2021
1 parent 4fccb8b commit 6ea1331
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 11 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
43 changes: 34 additions & 9 deletions DuetRRFOutputDevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -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...")
Expand Down Expand Up @@ -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 + '"'
Expand All @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}

0 comments on commit 6ea1331

Please sign in to comment.