mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-13 09:47:50 -06:00
Update all uses of the Resources API with the changed API
This commit is contained in:
parent
559780e268
commit
842689d88e
3 changed files with 15 additions and 7 deletions
|
@ -38,7 +38,7 @@ from . import PrintInformation
|
||||||
from . import CuraActions
|
from . import CuraActions
|
||||||
from . import MultiMaterialDecorator
|
from . import MultiMaterialDecorator
|
||||||
|
|
||||||
from PyQt5.QtCore import pyqtSlot, QUrl, Qt, pyqtSignal, pyqtProperty
|
from PyQt5.QtCore import pyqtSlot, QUrl, Qt, pyqtSignal, pyqtProperty, Q_ENUMS
|
||||||
from PyQt5.QtGui import QColor, QIcon
|
from PyQt5.QtGui import QColor, QIcon
|
||||||
|
|
||||||
import platform
|
import platform
|
||||||
|
@ -50,14 +50,19 @@ import numpy
|
||||||
numpy.seterr(all="ignore")
|
numpy.seterr(all="ignore")
|
||||||
|
|
||||||
class CuraApplication(QtApplication):
|
class CuraApplication(QtApplication):
|
||||||
|
class ResourceTypes:
|
||||||
|
QmlFiles = Resources.UserType + 1
|
||||||
|
Firmware = Resources.UserType + 2
|
||||||
|
Q_ENUMS(ResourceTypes)
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Resources.addResourcePath(os.path.join(QtApplication.getInstallPrefix(), "share", "cura"))
|
Resources.addSearchPath(os.path.join(QtApplication.getInstallPrefix(), "share", "cura"))
|
||||||
if not hasattr(sys, "frozen"):
|
if not hasattr(sys, "frozen"):
|
||||||
Resources.addResourcePath(os.path.join(os.path.abspath(os.path.dirname(__file__)), ".."))
|
Resources.addSearchPath(os.path.join(os.path.abspath(os.path.dirname(__file__)), ".."))
|
||||||
|
|
||||||
super().__init__(name = "cura", version = "master")
|
super().__init__(name = "cura", version = "master")
|
||||||
|
|
||||||
self.setWindowIcon(QIcon(Resources.getPath(Resources.ImagesLocation, "cura-icon.png")))
|
self.setWindowIcon(QIcon(Resources.getPath(Resources.Images, "cura-icon.png")))
|
||||||
|
|
||||||
self.setRequiredPlugins([
|
self.setRequiredPlugins([
|
||||||
"CuraEngineBackend",
|
"CuraEngineBackend",
|
||||||
|
@ -80,6 +85,9 @@ class CuraApplication(QtApplication):
|
||||||
|
|
||||||
self.activeMachineChanged.connect(self._onActiveMachineChanged)
|
self.activeMachineChanged.connect(self._onActiveMachineChanged)
|
||||||
|
|
||||||
|
Resources.addType(self.ResourceTypes.QmlFiles, "qml")
|
||||||
|
Resources.addType(self.ResourceTypes.Firmware, "firmware")
|
||||||
|
|
||||||
Preferences.getInstance().addPreference("cura/active_machine", "")
|
Preferences.getInstance().addPreference("cura/active_machine", "")
|
||||||
Preferences.getInstance().addPreference("cura/active_mode", "simple")
|
Preferences.getInstance().addPreference("cura/active_mode", "simple")
|
||||||
Preferences.getInstance().addPreference("cura/recent_files", "")
|
Preferences.getInstance().addPreference("cura/recent_files", "")
|
||||||
|
@ -151,7 +159,7 @@ class CuraApplication(QtApplication):
|
||||||
|
|
||||||
self.showSplashMessage(self._i18n_catalog.i18nc("Splash screen message", "Loading interface..."))
|
self.showSplashMessage(self._i18n_catalog.i18nc("Splash screen message", "Loading interface..."))
|
||||||
|
|
||||||
self.setMainQml(Resources.getPath(Resources.QmlFilesLocation, "Cura.qml"))
|
self.setMainQml(Resources.getPath(self.ResourceTypes.QmlFiles, "Cura.qml"))
|
||||||
self.initializeEngine()
|
self.initializeEngine()
|
||||||
|
|
||||||
if self.getMachines():
|
if self.getMachines():
|
||||||
|
|
|
@ -71,7 +71,7 @@ class CuraEngineBackend(Backend):
|
||||||
self.backendConnected.connect(self._onBackendConnected)
|
self.backendConnected.connect(self._onBackendConnected)
|
||||||
|
|
||||||
def getEngineCommand(self):
|
def getEngineCommand(self):
|
||||||
return [Preferences.getInstance().getValue("backend/location"),"connect", "127.0.0.1:{0}".format(self._port), "-j", Resources.getPath(Resources.SettingsLocation, "fdmprinter.json"), "-vv"]
|
return [Preferences.getInstance().getValue("backend/location"), "connect", "127.0.0.1:{0}".format(self._port), "-j", Resources.getPath(Resources.Settings, "fdmprinter.json"), "-vv"]
|
||||||
|
|
||||||
## Emitted when we get a message containing print duration and material amount. This also implies the slicing has finished.
|
## Emitted when we get a message containing print duration and material amount. This also implies the slicing has finished.
|
||||||
# \param time The amount of time the print will take.
|
# \param time The amount of time the print will take.
|
||||||
|
|
|
@ -506,6 +506,6 @@ UM.MainWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: UM.Theme.load(UM.Resources.getPath(UM.Resources.ThemesLocation, "cura"))
|
Component.onCompleted: UM.Theme.load(UM.Resources.getPath(UM.Resources.Themes, "cura"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue