Update all uses of the Resources API with the changed API

This commit is contained in:
Arjen Hiemstra 2015-08-05 17:26:52 +02:00
parent 559780e268
commit 842689d88e
3 changed files with 15 additions and 7 deletions

View file

@ -38,7 +38,7 @@ from . import PrintInformation
from . import CuraActions
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
import platform
@ -50,14 +50,19 @@ import numpy
numpy.seterr(all="ignore")
class CuraApplication(QtApplication):
class ResourceTypes:
QmlFiles = Resources.UserType + 1
Firmware = Resources.UserType + 2
Q_ENUMS(ResourceTypes)
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"):
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")
self.setWindowIcon(QIcon(Resources.getPath(Resources.ImagesLocation, "cura-icon.png")))
self.setWindowIcon(QIcon(Resources.getPath(Resources.Images, "cura-icon.png")))
self.setRequiredPlugins([
"CuraEngineBackend",
@ -80,6 +85,9 @@ class CuraApplication(QtApplication):
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_mode", "simple")
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.setMainQml(Resources.getPath(Resources.QmlFilesLocation, "Cura.qml"))
self.setMainQml(Resources.getPath(self.ResourceTypes.QmlFiles, "Cura.qml"))
self.initializeEngine()
if self.getMachines():

View file

@ -71,7 +71,7 @@ class CuraEngineBackend(Backend):
self.backendConnected.connect(self._onBackendConnected)
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.
# \param time The amount of time the print will take.

View file

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