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.
This commit is contained in:
Diego Prado Gesto 2018-05-11 08:42:03 +02:00
parent 42ecb12614
commit 43657010ba
22 changed files with 102 additions and 119 deletions

View file

@ -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"):