|
@@ -33,30 +33,35 @@ class SliceInfo(QObject, Extension):
|
|
|
def __init__(self, parent = None):
|
|
|
QObject.__init__(self, parent)
|
|
|
Extension.__init__(self)
|
|
|
- Application.getInstance().getOutputDeviceManager().writeStarted.connect(self._onWriteStarted)
|
|
|
- Application.getInstance().getPreferences().addPreference("info/send_slice_info", True)
|
|
|
- Application.getInstance().getPreferences().addPreference("info/asked_send_slice_info", False)
|
|
|
+
|
|
|
+ self._application = Application.getInstance()
|
|
|
+
|
|
|
+ self._application.getOutputDeviceManager().writeStarted.connect(self._onWriteStarted)
|
|
|
+ self._application.getPreferences().addPreference("info/send_slice_info", True)
|
|
|
+ self._application.getPreferences().addPreference("info/asked_send_slice_info", False)
|
|
|
|
|
|
self._more_info_dialog = None
|
|
|
self._example_data_content = None
|
|
|
|
|
|
- if not Application.getInstance().getPreferences().getValue("info/asked_send_slice_info"):
|
|
|
+ self._application.initializationFinished.connect(self._onAppInitialized)
|
|
|
+
|
|
|
+ def _onAppInitialized(self):
|
|
|
+ # DO NOT read any preferences values in the constructor because at the time plugins are created, no version
|
|
|
+ # upgrade has been performed yet because version upgrades are plugins too!
|
|
|
+ if not self._application.getPreferences().getValue("info/asked_send_slice_info"):
|
|
|
self.send_slice_info_message = Message(catalog.i18nc("@info", "Cura collects anonymized usage statistics."),
|
|
|
lifetime = 0,
|
|
|
dismissable = False,
|
|
|
title = catalog.i18nc("@info:title", "Collecting Data"))
|
|
|
|
|
|
self.send_slice_info_message.addAction("MoreInfo", name = catalog.i18nc("@action:button", "More info"), icon = None,
|
|
|
- description = catalog.i18nc("@action:tooltip", "See more information on what data Cura sends."), button_style = Message.ActionButtonStyle.LINK)
|
|
|
+ description = catalog.i18nc("@action:tooltip", "See more information on what data Cura sends."), button_style = Message.ActionButtonStyle.LINK)
|
|
|
|
|
|
self.send_slice_info_message.addAction("Dismiss", name = catalog.i18nc("@action:button", "Allow"), icon = None,
|
|
|
- description = catalog.i18nc("@action:tooltip", "Allow Cura to send anonymized usage statistics to help prioritize future improvements to Cura. Some of your preferences and settings are sent, the Cura version and a hash of the models you're slicing."))
|
|
|
+ description = catalog.i18nc("@action:tooltip", "Allow Cura to send anonymized usage statistics to help prioritize future improvements to Cura. Some of your preferences and settings are sent, the Cura version and a hash of the models you're slicing."))
|
|
|
self.send_slice_info_message.actionTriggered.connect(self.messageActionTriggered)
|
|
|
self.send_slice_info_message.show()
|
|
|
|
|
|
- Application.getInstance().initializationFinished.connect(self._onAppInitialized)
|
|
|
-
|
|
|
- def _onAppInitialized(self):
|
|
|
if self._more_info_dialog is None:
|
|
|
self._more_info_dialog = self._createDialog("MoreInfoWindow.qml")
|
|
|
|