mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
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:
parent
42ecb12614
commit
43657010ba
22 changed files with 102 additions and 119 deletions
|
@ -5,8 +5,7 @@ from PyQt5.QtCore import QUrl
|
|||
from PyQt5.QtGui import QDesktopServices
|
||||
|
||||
from UM.Extension import Extension
|
||||
from UM.Preferences import Preferences
|
||||
from UM.Logger import Logger
|
||||
from UM.Application import Application
|
||||
from UM.i18n import i18nCatalog
|
||||
from cura.Settings.GlobalStack import GlobalStack
|
||||
|
||||
|
@ -27,12 +26,12 @@ class FirmwareUpdateChecker(Extension):
|
|||
|
||||
# Initialize the Preference called `latest_checked_firmware` that stores the last version
|
||||
# checked for the UM3. In the future if we need to check other printers' firmware
|
||||
Preferences.getInstance().addPreference("info/latest_checked_firmware", "")
|
||||
Application.getInstance().getPreferences().addPreference("info/latest_checked_firmware", "")
|
||||
|
||||
# Listen to a Signal that indicates a change in the list of printers, just if the user has enabled the
|
||||
# 'check for updates' option
|
||||
Preferences.getInstance().addPreference("info/automatic_update_check", True)
|
||||
if Preferences.getInstance().getValue("info/automatic_update_check"):
|
||||
Application.getInstance().getPreferences().addPreference("info/automatic_update_check", True)
|
||||
if Application.getInstance().getPreferences().getValue("info/automatic_update_check"):
|
||||
ContainerRegistry.getInstance().containerAdded.connect(self._onContainerAdded)
|
||||
|
||||
self._download_url = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue