Skip to content

Commit d9e8098

Browse files
committed
properly reload OutputDevices on config changes
1 parent ab8aebc commit d9e8098

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog of Cura-DuetRRFPlugin
22

3+
## v1.2.2: 2021-01-27
4+
* add OutputDevices on currently active printer after saving config
5+
* remove OutputDevices on currently active printer after deleting config
6+
37
## v1.2.1: 2021-01-21
48
* fix button width on high-dpi screens
59
* fix race condition when checking for unmapped settings

DuetRRFAction.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ def __init__(self, parent: QObject = None) -> None:
2222
super().__init__("DuetRRFAction", catalog.i18nc("@action", "Connect Duet RepRapFirmware"))
2323

2424
self._qml_url = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'resources', 'qml', 'DuetRRFAction.qml')
25-
self._application = CuraApplication.getInstance()
2625

26+
self._application = CuraApplication.getInstance()
27+
self._application.globalContainerStackChanged.connect(self._onGlobalContainerStackChanged)
2728
ContainerRegistry.getInstance().containerAdded.connect(self._onContainerAdded)
28-
CuraApplication.getInstance().globalContainerStackChanged.connect(self._onGlobalContainerStackChanged)
2929

3030
def _onGlobalContainerStackChanged(self) -> None:
3131
self.printerSettingsUrlChanged.emit()
@@ -89,10 +89,16 @@ def saveConfig(self, url, duet_password, http_user, http_password):
8989
save_config(url, duet_password, http_user, http_password)
9090
Logger.log("d", "config saved")
9191

92+
# trigger a stack change to reload the output devices
93+
self._application.globalContainerStackChanged.emit()
94+
9295
@pyqtSlot()
9396
def deleteConfig(self):
9497
if delete_config():
9598
Logger.log("d", "config deleted")
99+
100+
# trigger a stack change to reload the output devices
101+
self._application.globalContainerStackChanged.emit()
96102
else:
97103
Logger.log("d", "no config to delete")
98104

DuetRRFPlugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def _checkDuetRRFOutputDevices(self):
126126

127127
manager = self.getOutputDeviceManager()
128128

129-
# remove all DuetRRF output devices - the new stack might not need them
129+
# remove all DuetRRF output devices - the new stack might not need them or have a different config
130130
manager.removeOutputDevice("duetrrf-configure")
131131
manager.removeOutputDevice("duetrrf-print")
132132
manager.removeOutputDevice("duetrrf-simulate")

build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env bash
22

3+
set -o errexit
4+
35
TAG=$(git describe --abbrev=0 --tags --exact-match)
46
git archive ${TAG} --prefix=DuetRRFPlugin/ --format=zip -o ~/Downloads/DuetRRFPlugin_${TAG}.zip
57

0 commit comments

Comments
 (0)