Skip to content

Commit

Permalink
fix race condition when checking for unmapped settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Kriechi committed Jan 21, 2021
1 parent 3e2ffe3 commit a26c146
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Changelog of Cura-DuetRRFPlugin

## v1.2.1: next
## v1.2.1: 2021-01-21
* fix button width on high-dpi screens
* fix race condition when checking for unmapped settings

## v1.2.0: 2021-01-10
* store settings in local preferences instead of sharable metadata
Expand Down
15 changes: 9 additions & 6 deletions DuetRRFPlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,29 @@ def __init__(self):
super().__init__()
self._application = CuraApplication.getInstance()
self._application.globalContainerStackChanged.connect(self._checkDuetRRFOutputDevices)
self._application.initializationFinished.connect(self._delay_check_unmapped_settings)

init_settings()

self.addMenuItem(catalog.i18n("(moved to Preferences→Printer)"), self._showUnmappedSettingsMessage)

self._found_unmapped = {}

self._change_timer = QTimer()
self._change_timer.setInterval(2000)
self._change_timer.setSingleShot(True)
self._change_timer.timeout.connect(self._check_unmapped_settings)
self._change_timer.start()

def start(self):
pass

def stop(self, store_data: bool = True):
pass

def _delay_check_unmapped_settings(self):
self._change_timer = QTimer()
self._change_timer.setInterval(10000)
self._change_timer.setSingleShot(True)
self._change_timer.timeout.connect(self._check_unmapped_settings)
self._change_timer.start()

def _check_unmapped_settings(self):
Logger.log("d", "called")
try:
instances = json.loads(self._application.getPreferences().getValue(DUETRRF_SETTINGS))

Expand Down

0 comments on commit a26c146

Please sign in to comment.