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

@ -456,7 +456,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
num_visible_settings = len(visible_settings_string.split(";"))
active_mode = temp_preferences.getValue("cura/active_mode")
if not active_mode:
active_mode = Preferences.getInstance().getValue("cura/active_mode")
active_mode = Application.getInstance().getPreferences().getValue("cura/active_mode")
except KeyError:
# If there is no preferences file, it's not a workspace, so notify user of failure.
Logger.log("w", "File %s is not a valid workspace.", file_name)
@ -575,7 +575,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
temp_preferences.deserialize(serialized)
# Copy a number of settings from the temp preferences to the global
global_preferences = Preferences.getInstance()
global_preferences = application.getInstance().getPreferences()
visible_settings = temp_preferences.getValue("general/visible_settings")
if visible_settings is None: