diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 036369aed7..e90dfd70d3 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -409,6 +409,14 @@ class CuraApplication(QtApplication): else: self.exit(0) + ## Signal to connect preferences action in QML + showPreferencesWindow = pyqtSignal() + + ## Show the preferences window + @pyqtSlot() + def showPreferences(self): + self.showPreferencesWindow.emit() + ## A reusable dialogbox # showMessageBox = pyqtSignal(str, str, str, str, int, int, arguments = ["title", "text", "informativeText", "detailedText", "buttons", "icon"]) @@ -683,7 +691,7 @@ class CuraApplication(QtApplication): self.setMainQml(Resources.getPath(self.ResourceTypes.QmlFiles, "Cura.qml")) self._qml_import_paths.append(Resources.getPath(self.ResourceTypes.QmlFiles)) - run_without_gui = self.getCommandLineOption("headless", False) or self.getCommandLineOption("invisible", False) + run_without_gui = self.getCommandLineOption("headless", False) if not run_without_gui: self.initializeEngine() controller.setActiveStage("PrepareStage") @@ -1426,11 +1434,3 @@ class CuraApplication(QtApplication): node = node.getParent() Selection.add(node) - - - triggerPreferenceWindow = pyqtSignal() - - # This event has a simple logic, display pereference window if user decided to disable "collect information" - @pyqtProperty(bool, notify = triggerPreferenceWindow) - def showMyTest(self): - return True \ No newline at end of file diff --git a/plugins/SliceInfoPlugin/SliceInfo.py b/plugins/SliceInfoPlugin/SliceInfo.py index 28bcc763c7..753e00091b 100755 --- a/plugins/SliceInfoPlugin/SliceInfo.py +++ b/plugins/SliceInfoPlugin/SliceInfo.py @@ -52,11 +52,13 @@ class SliceInfo(Extension): self.send_slice_info_message.actionTriggered.connect(self.messageActionTriggered) self.send_slice_info_message.show() + ## Perform action based on user input. + # Note that clicking "Disable" won't actually disable the data sending, but rather take the user to preferences where they can disable it. def messageActionTriggered(self, message_id, action_id): - if action_id == "Disable": - CuraApplication.getInstance().triggerPreferenceWindow.emit() - self.send_slice_info_message.hide() Preferences.getInstance().setValue("info/asked_send_slice_info", True) + if action_id == "Disable": + CuraApplication.getInstance().showPreferences() + self.send_slice_info_message.hide() def _onWriteStarted(self, output_device): try: diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 40fc88c975..efe956939b 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -531,7 +531,7 @@ UM.MainWindow Connections { target: CuraApplication - onShowMyTestChanged: preferences.visible = true + onShowPreferencesWindow: preferences.visible = true } MessageDialog