diff --git a/plugins/3MFReader/WorkspaceDialog.py b/plugins/3MFReader/WorkspaceDialog.py index 95fef78081..5b474843d5 100644 --- a/plugins/3MFReader/WorkspaceDialog.py +++ b/plugins/3MFReader/WorkspaceDialog.py @@ -1,12 +1,10 @@ # Copyright (c) 2016 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from PyQt5.QtCore import QUrl, pyqtSignal, QObject, pyqtProperty, QCoreApplication +from PyQt5.QtCore import pyqtSignal, QObject, pyqtProperty, QCoreApplication from UM.FlameProfiler import pyqtSlot -from PyQt5.QtQml import QQmlComponent, QQmlContext from UM.PluginRegistry import PluginRegistry from UM.Application import Application -from UM.Logger import Logger from UM.i18n import i18nCatalog from UM.Settings.ContainerRegistry import ContainerRegistry diff --git a/plugins/PluginBrowser/PluginBrowser.py b/plugins/PluginBrowser/PluginBrowser.py index 37ad128b49..338513d499 100644 --- a/plugins/PluginBrowser/PluginBrowser.py +++ b/plugins/PluginBrowser/PluginBrowser.py @@ -11,7 +11,6 @@ from UM.Message import Message from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply from PyQt5.QtCore import QUrl, QObject, Qt, pyqtProperty, pyqtSignal, pyqtSlot -from PyQt5.QtQml import QQmlComponent, QQmlContext import json import os @@ -112,16 +111,15 @@ class PluginBrowser(QObject, Extension): def _createDialog(self, qml_name): Logger.log("d", "Creating dialog [%s]", qml_name) - path = QUrl.fromLocalFile(os.path.join(PluginRegistry.getInstance().getPluginPath(self.getPluginId()), qml_name)) - self._qml_component = QQmlComponent(Application.getInstance()._engine, path) + path = os.path.join(PluginRegistry.getInstance().getPluginPath(self.getPluginId()), qml_name) + dialog = Application.getInstance().createQmlComponent(path, { + "manager": self + }) - # We need access to engine (although technically we can't) - self._qml_context = QQmlContext(Application.getInstance()._engine.rootContext()) - self._qml_context.setContextProperty("manager", self) - dialog = self._qml_component.create(self._qml_context) if dialog is None: Logger.log("e", "QQmlComponent status %s", self._qml_component.status()) Logger.log("e", "QQmlComponent errorString %s", self._qml_component.errorString()) + return dialog def setIsDownloading(self, is_downloading):