Move backend location preference into the backend class and use the new api

This commit is contained in:
Arjen Hiemstra 2015-03-11 18:10:44 +01:00
parent 27f475dc79
commit 4e6322d94e
2 changed files with 3 additions and 4 deletions

View File

@ -17,6 +17,8 @@ class CuraEngineBackend(Backend):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
Preferences.getInstance().addPreference('backend/location', '../PinkUnicornEngine/CuraEngine')
self._scene = Application.getInstance().getController().getScene() self._scene = Application.getInstance().getController().getScene()
self._scene.sceneChanged.connect(self._onSceneChanged) self._scene.sceneChanged.connect(self._onSceneChanged)
@ -34,7 +36,7 @@ class CuraEngineBackend(Backend):
self._center = None self._center = None
def getEngineCommand(self): def getEngineCommand(self):
return [Preferences.getPreference("BackendLocation"), '--connect', "127.0.0.1:{0}".format(self._port)] return [Preferences.getInstance().getValue("backend/location"), '--connect', "127.0.0.1:{0}".format(self._port)]
def _onSceneChanged(self, source): def _onSceneChanged(self, source):
if (type(source) is not SceneNode) or (source is self._scene.getRoot()): if (type(source) is not SceneNode) or (source is self._scene.getRoot()):

View File

@ -1,8 +1,6 @@
#Shoopdawoop #Shoopdawoop
from . import CuraEngineBackend from . import CuraEngineBackend
from UM.Preferences import Preferences
def getMetaData(): def getMetaData():
return { return {
'type': 'backend', 'type': 'backend',
@ -12,6 +10,5 @@ def getMetaData():
} }
def register(app): def register(app):
Preferences.addPreference("BackendLocation","../PinkUnicornEngine/CuraEngine")
return CuraEngineBackend.CuraEngineBackend() return CuraEngineBackend.CuraEngineBackend()