diff options
author | Diego Prado Gesto <d.pradogesto@ultimaker.com> | 2018-05-11 09:42:03 +0300 |
---|---|---|
committer | Diego Prado Gesto <d.pradogesto@ultimaker.com> | 2018-05-11 09:50:42 +0300 |
commit | 43657010bae9de322b1d1b8a28df1714d10a54da (patch) | |
tree | 390367b02eff97cccb49329381f8fa901e42d218 /plugins/GCodeReader | |
parent | 42ecb126145eddebe0ebe7f5ae5ea303ef40ac05 (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/GCodeReader')
-rw-r--r-- | plugins/GCodeReader/FlavorParser.py | 5 | ||||
-rwxr-xr-x | plugins/GCodeReader/GCodeReader.py | 4 |
2 files changed, 4 insertions, 5 deletions
diff --git a/plugins/GCodeReader/FlavorParser.py b/plugins/GCodeReader/FlavorParser.py index 2679cc23a4..ceb5fbdb5d 100644 --- a/plugins/GCodeReader/FlavorParser.py +++ b/plugins/GCodeReader/FlavorParser.py @@ -10,7 +10,6 @@ from UM.Math.Vector import Vector from UM.Message import Message from cura.Scene.CuraSceneNode import CuraSceneNode from UM.i18n import i18nCatalog -from UM.Preferences import Preferences catalog = i18nCatalog("cura") @@ -43,7 +42,7 @@ class FlavorParser: self._current_layer_thickness = 0.2 # default self._filament_diameter = 2.85 # default - Preferences.getInstance().addPreference("gcodereader/show_caution", True) + Application.getInstance().getPreferences().addPreference("gcodereader/show_caution", True) def _clearValues(self): self._extruder_number = 0 @@ -462,7 +461,7 @@ class FlavorParser: Logger.log("d", "GCode loading finished") - if Preferences.getInstance().getValue("gcodereader/show_caution"): + if Application.getInstance().getPreferences().getValue("gcodereader/show_caution"): caution_message = Message(catalog.i18nc( "@info:generic", "Make sure the g-code is suitable for your printer and printer configuration before sending the file to it. The g-code representation may not be accurate."), diff --git a/plugins/GCodeReader/GCodeReader.py b/plugins/GCodeReader/GCodeReader.py index 6f872bc6f7..b821fa2cb3 100755 --- a/plugins/GCodeReader/GCodeReader.py +++ b/plugins/GCodeReader/GCodeReader.py @@ -4,7 +4,7 @@ from UM.FileHandler.FileReader import FileReader from UM.Mesh.MeshReader import MeshReader from UM.i18n import i18nCatalog -from UM.Preferences import Preferences +from UM.Application import Application catalog = i18nCatalog("cura") from . import MarlinFlavorParser, RepRapFlavorParser @@ -22,7 +22,7 @@ class GCodeReader(MeshReader): self._supported_extensions = [".gcode", ".g"] self._flavor_reader = None - Preferences.getInstance().addPreference("gcodereader/show_caution", True) + Application.getInstance().getPreferences().addPreference("gcodereader/show_caution", True) def preReadFromStream(self, stream, *args, **kwargs): for line in stream.split("\n"): |