mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Creating components is now done with the prefab function
CURA-4568
This commit is contained in:
parent
ffef26097d
commit
0613b1e4b7
5 changed files with 10 additions and 34 deletions
|
@ -73,14 +73,8 @@ class MachineAction(QObject, PluginObject):
|
||||||
|
|
||||||
## Protected helper to create a view object based on provided QML.
|
## Protected helper to create a view object based on provided QML.
|
||||||
def _createViewFromQML(self):
|
def _createViewFromQML(self):
|
||||||
path = QUrl.fromLocalFile(os.path.join(PluginRegistry.getInstance().getPluginPath(self.getPluginId()), self._qml_url))
|
path = os.path.join(PluginRegistry.getInstance().getPluginPath(self.getPluginId()), self._qml_url)
|
||||||
self._component = QQmlComponent(Application.getInstance()._engine, path)
|
self._view = Application.getInstance().createQmlComponent(path, {"manager": self})
|
||||||
self._context = QQmlContext(Application.getInstance()._engine.rootContext())
|
|
||||||
self._context.setContextProperty("manager", self)
|
|
||||||
self._view = self._component.create(self._context)
|
|
||||||
if self._view is None:
|
|
||||||
Logger.log("c", "QQmlComponent status %s", self._component.status())
|
|
||||||
Logger.log("c", "QQmlComponent error string %s", self._component.errorString())
|
|
||||||
|
|
||||||
@pyqtProperty(QObject, constant = True)
|
@pyqtProperty(QObject, constant = True)
|
||||||
def displayItem(self):
|
def displayItem(self):
|
||||||
|
|
|
@ -256,14 +256,8 @@ class WorkspaceDialog(QObject):
|
||||||
return self._result
|
return self._result
|
||||||
|
|
||||||
def _createViewFromQML(self):
|
def _createViewFromQML(self):
|
||||||
path = QUrl.fromLocalFile(os.path.join(PluginRegistry.getInstance().getPluginPath("3MFReader"), self._qml_url))
|
path = os.path.join(PluginRegistry.getInstance().getPluginPath("3MFReader"), self._qml_url)
|
||||||
self._component = QQmlComponent(Application.getInstance()._engine, path)
|
self._view = Application.getInstance().createQmlComponent(path, {"manager": self})
|
||||||
self._context = QQmlContext(Application.getInstance()._engine.rootContext())
|
|
||||||
self._context.setContextProperty("manager", self)
|
|
||||||
self._view = self._component.create(self._context)
|
|
||||||
if self._view is None:
|
|
||||||
Logger.log("c", "QQmlComponent status %s", self._component.status())
|
|
||||||
Logger.log("c", "QQmlComponent error string %s", self._component.errorString())
|
|
||||||
|
|
||||||
def show(self):
|
def show(self):
|
||||||
# Emit signal so the right thread actually shows the view.
|
# Emit signal so the right thread actually shows the view.
|
||||||
|
|
|
@ -106,9 +106,5 @@ class ChangeLog(Extension, QObject,):
|
||||||
self._changelog_window.hide()
|
self._changelog_window.hide()
|
||||||
|
|
||||||
def createChangelogWindow(self):
|
def createChangelogWindow(self):
|
||||||
path = QUrl.fromLocalFile(os.path.join(PluginRegistry.getInstance().getPluginPath(self.getPluginId()), "ChangeLog.qml"))
|
path = os.path.join(PluginRegistry.getInstance().getPluginPath(self.getPluginId()), "ChangeLog.qml")
|
||||||
|
self._changelog_window = Application.getInstance().createQmlComponent(path, {"manager": self})
|
||||||
component = QQmlComponent(Application.getInstance()._engine, path)
|
|
||||||
self._changelog_context = QQmlContext(Application.getInstance()._engine.rootContext())
|
|
||||||
self._changelog_context.setContextProperty("manager", self)
|
|
||||||
self._changelog_window = component.create(self._changelog_context)
|
|
||||||
|
|
|
@ -91,12 +91,8 @@ class USBPrinterOutputDeviceManager(QObject, OutputDevicePlugin, Extension):
|
||||||
# This will create the view if its not already created.
|
# This will create the view if its not already created.
|
||||||
def spawnFirmwareInterface(self, serial_port):
|
def spawnFirmwareInterface(self, serial_port):
|
||||||
if self._firmware_view is None:
|
if self._firmware_view is None:
|
||||||
path = QUrl.fromLocalFile(os.path.join(PluginRegistry.getInstance().getPluginPath("USBPrinting"), "FirmwareUpdateWindow.qml"))
|
path = os.path.join(PluginRegistry.getInstance().getPluginPath("USBPrinting"), "FirmwareUpdateWindow.qml")
|
||||||
component = QQmlComponent(Application.getInstance()._engine, path)
|
self._firmware_view = Application.getInstance().createQmlComponent(path, {"manager": self})
|
||||||
|
|
||||||
self._firmware_context = QQmlContext(Application.getInstance()._engine.rootContext())
|
|
||||||
self._firmware_context.setContextProperty("manager", self)
|
|
||||||
self._firmware_view = component.create(self._firmware_context)
|
|
||||||
|
|
||||||
self._firmware_view.show()
|
self._firmware_view.show()
|
||||||
|
|
||||||
|
|
|
@ -45,9 +45,5 @@ class UserAgreement(QObject, Extension):
|
||||||
CuraApplication.getInstance().setNeedToShowUserAgreement(False)
|
CuraApplication.getInstance().setNeedToShowUserAgreement(False)
|
||||||
|
|
||||||
def createUserAgreementWindow(self):
|
def createUserAgreementWindow(self):
|
||||||
path = QUrl.fromLocalFile(os.path.join(PluginRegistry.getInstance().getPluginPath(self.getPluginId()), "UserAgreement.qml"))
|
path = os.path.join(PluginRegistry.getInstance().getPluginPath(self.getPluginId()), "UserAgreement.qml")
|
||||||
|
self._user_agreement_window = Application.getInstance().createQmlComponent(path, {"manager": self})
|
||||||
component = QQmlComponent(Application.getInstance()._engine, path)
|
|
||||||
self._user_agreement_context = QQmlContext(Application.getInstance()._engine.rootContext())
|
|
||||||
self._user_agreement_context.setContextProperty("manager", self)
|
|
||||||
self._user_agreement_window = component.create(self._user_agreement_context)
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue