Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Prado Gesto <d.pradogesto@ultimaker.com>2018-05-11 09:42:03 +0300
committerDiego Prado Gesto <d.pradogesto@ultimaker.com>2018-05-11 09:50:42 +0300
commit43657010bae9de322b1d1b8a28df1714d10a54da (patch)
tree390367b02eff97cccb49329381f8fa901e42d218 /plugins/SliceInfoPlugin
parent42ecb126145eddebe0ebe7f5ae5ea303ef40ac05 (diff)
CURA-5164 The Preferences is not a singleton class anymore since in some point
several instances need to be created. - In the ThreeMFWorkspaceReader we need to create some temporal instances of Preferences that makes it not singleton anymore. - The current preferences are kept in the Application class and so all the calls to the preferences are changed to get the preferences from Application. - The method getInstance in Preferences is kept as deprecated since some external plugins.
Diffstat (limited to 'plugins/SliceInfoPlugin')
-rwxr-xr-xplugins/SliceInfoPlugin/SliceInfo.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/plugins/SliceInfoPlugin/SliceInfo.py b/plugins/SliceInfoPlugin/SliceInfo.py
index 82e07da464..d32e512e4f 100755
--- a/plugins/SliceInfoPlugin/SliceInfo.py
+++ b/plugins/SliceInfoPlugin/SliceInfo.py
@@ -10,7 +10,6 @@ from PyQt5.QtCore import pyqtSlot, QObject
from UM.Extension import Extension
from UM.Application import Application
-from UM.Preferences import Preferences
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
from UM.Message import Message
from UM.i18n import i18nCatalog
@@ -34,13 +33,13 @@ class SliceInfo(QObject, Extension):
QObject.__init__(self, parent)
Extension.__init__(self)
Application.getInstance().getOutputDeviceManager().writeStarted.connect(self._onWriteStarted)
- Preferences.getInstance().addPreference("info/send_slice_info", True)
- Preferences.getInstance().addPreference("info/asked_send_slice_info", False)
+ Application.getInstance().getPreferences().addPreference("info/send_slice_info", True)
+ Application.getInstance().getPreferences().addPreference("info/asked_send_slice_info", False)
self._more_info_dialog = None
self._example_data_content = None
- if not Preferences.getInstance().getValue("info/asked_send_slice_info"):
+ if not Application.getInstance().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,
@@ -62,7 +61,7 @@ class SliceInfo(QObject, Extension):
## 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):
- Preferences.getInstance().setValue("info/asked_send_slice_info", True)
+ Application.getInstance().getPreferences().setValue("info/asked_send_slice_info", True)
if action_id == "MoreInfo":
self.showMoreInfoDialog()
self.send_slice_info_message.hide()
@@ -88,11 +87,11 @@ class SliceInfo(QObject, Extension):
@pyqtSlot(bool)
def setSendSliceInfo(self, enabled: bool):
- Preferences.getInstance().setValue("info/send_slice_info", enabled)
+ Application.getInstance().getPreferences().setValue("info/send_slice_info", enabled)
def _onWriteStarted(self, output_device):
try:
- if not Preferences.getInstance().getValue("info/send_slice_info"):
+ if not Application.getInstance().getPreferences().getValue("info/send_slice_info"):
Logger.log("d", "'info/send_slice_info' is turned off.")
return # Do nothing, user does not want to send data
@@ -107,7 +106,7 @@ class SliceInfo(QObject, Extension):
data["schema_version"] = 0
data["cura_version"] = application.getVersion()
- active_mode = Preferences.getInstance().getValue("cura/active_mode")
+ active_mode = Application.getInstance().getPreferences().getValue("cura/active_mode")
if active_mode == 0:
data["active_mode"] = "recommended"
else:
@@ -122,7 +121,7 @@ class SliceInfo(QObject, Extension):
machine_settings_changed_by_user = True
data["machine_settings_changed_by_user"] = machine_settings_changed_by_user
- data["language"] = Preferences.getInstance().getValue("general/language")
+ data["language"] = Application.getInstance().getPreferences().getValue("general/language")
data["os"] = {"type": platform.system(), "version": platform.version()}
data["active_machine"] = {"definition_id": global_stack.definition.getId(),