mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-22 06:03:57 -06:00
Merge branch 'CURA-5095_reset_slice_info_collection' of github.com:Ultimaker/Cura into 3.5
This commit is contained in:
commit
7ffcfa25e9
3 changed files with 29 additions and 10 deletions
|
@ -33,14 +33,22 @@ class SliceInfo(QObject, Extension):
|
||||||
def __init__(self, parent = None):
|
def __init__(self, parent = None):
|
||||||
QObject.__init__(self, parent)
|
QObject.__init__(self, parent)
|
||||||
Extension.__init__(self)
|
Extension.__init__(self)
|
||||||
Application.getInstance().getOutputDeviceManager().writeStarted.connect(self._onWriteStarted)
|
|
||||||
Application.getInstance().getPreferences().addPreference("info/send_slice_info", True)
|
self._application = Application.getInstance()
|
||||||
Application.getInstance().getPreferences().addPreference("info/asked_send_slice_info", False)
|
|
||||||
|
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._more_info_dialog = None
|
||||||
self._example_data_content = 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."),
|
self.send_slice_info_message = Message(catalog.i18nc("@info", "Cura collects anonymized usage statistics."),
|
||||||
lifetime = 0,
|
lifetime = 0,
|
||||||
dismissable = False,
|
dismissable = False,
|
||||||
|
@ -54,9 +62,6 @@ class SliceInfo(QObject, Extension):
|
||||||
self.send_slice_info_message.actionTriggered.connect(self.messageActionTriggered)
|
self.send_slice_info_message.actionTriggered.connect(self.messageActionTriggered)
|
||||||
self.send_slice_info_message.show()
|
self.send_slice_info_message.show()
|
||||||
|
|
||||||
Application.getInstance().initializationFinished.connect(self._onAppInitialized)
|
|
||||||
|
|
||||||
def _onAppInitialized(self):
|
|
||||||
if self._more_info_dialog is None:
|
if self._more_info_dialog is None:
|
||||||
self._more_info_dialog = self._createDialog("MoreInfoWindow.qml")
|
self._more_info_dialog = self._createDialog("MoreInfoWindow.qml")
|
||||||
|
|
||||||
|
|
|
@ -86,6 +86,12 @@ class VersionUpgrade34to35(VersionUpgrade):
|
||||||
parser = configparser.ConfigParser(interpolation = None)
|
parser = configparser.ConfigParser(interpolation = None)
|
||||||
parser.read_string(serialized)
|
parser.read_string(serialized)
|
||||||
|
|
||||||
|
# Need to show the data collection agreement again because the data Cura collects has been changed.
|
||||||
|
if parser.has_option("info", "asked_send_slice_info"):
|
||||||
|
parser.remove_option("info", "asked_send_slice_info")
|
||||||
|
if parser.has_option("info", "send_slice_info"):
|
||||||
|
parser.remove_option("info", "send_slice_info")
|
||||||
|
|
||||||
# Update version number.
|
# Update version number.
|
||||||
parser["general"]["version"] = "6"
|
parser["general"]["version"] = "6"
|
||||||
if "metadata" not in parser:
|
if "metadata" not in parser:
|
||||||
|
|
|
@ -17,6 +17,10 @@ test_upgrade_version_nr_data = [
|
||||||
version = 5
|
version = 5
|
||||||
[metadata]
|
[metadata]
|
||||||
setting_version = 4
|
setting_version = 4
|
||||||
|
|
||||||
|
[info]
|
||||||
|
asked_send_slice_info = True
|
||||||
|
send_slice_info = True
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
@ -33,3 +37,7 @@ def test_upgradeVersionNr(test_name, file_data, upgrader):
|
||||||
#Check the new version.
|
#Check the new version.
|
||||||
assert parser["general"]["version"] == "6"
|
assert parser["general"]["version"] == "6"
|
||||||
assert parser["metadata"]["setting_version"] == "5"
|
assert parser["metadata"]["setting_version"] == "5"
|
||||||
|
|
||||||
|
# Check if the data collection values have been removed
|
||||||
|
assert not parser.has_option("info", "asked_send_slice_info")
|
||||||
|
assert not parser.has_option("info", "send_slice_info")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue