From 11f50f1cd3eeed06f8ece7ef1d2fa1d3ee099795 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Tue, 28 Nov 2017 14:55:35 +0100 Subject: [PATCH] Update machine action and image reader dialogs with new component creation method - CURA-4568 --- cura/MachineAction.py | 4 +--- plugins/ImageReader/ImageReaderUI.py | 12 +++--------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/cura/MachineAction.py b/cura/MachineAction.py index 37f09b4efa..66467c53e7 100644 --- a/cura/MachineAction.py +++ b/cura/MachineAction.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 QObject, pyqtSlot, pyqtProperty, pyqtSignal, QUrl -from PyQt5.QtQml import QQmlComponent, QQmlContext +from PyQt5.QtCore import QObject, pyqtSlot, pyqtProperty, pyqtSignal from UM.PluginObject import PluginObject from UM.PluginRegistry import PluginRegistry -from UM.Logger import Logger from UM.Application import Application import os diff --git a/plugins/ImageReader/ImageReaderUI.py b/plugins/ImageReader/ImageReaderUI.py index 40ea15f7a0..1f8a434129 100644 --- a/plugins/ImageReader/ImageReaderUI.py +++ b/plugins/ImageReader/ImageReaderUI.py @@ -4,8 +4,7 @@ import os import threading -from PyQt5.QtCore import Qt, QUrl, pyqtSignal, QObject -from PyQt5.QtQml import QQmlComponent, QQmlContext +from PyQt5.QtCore import Qt, pyqtSignal, QObject from UM.FlameProfiler import pyqtSlot from UM.Application import Application from UM.PluginRegistry import PluginRegistry @@ -81,14 +80,9 @@ class ImageReaderUI(QObject): def _createConfigUI(self): if self._ui_view is None: Logger.log("d", "Creating ImageReader config UI") - path = QUrl.fromLocalFile(os.path.join(PluginRegistry.getInstance().getPluginPath("ImageReader"), "ConfigUI.qml")) - component = QQmlComponent(Application.getInstance()._engine, path) - self._ui_context = QQmlContext(Application.getInstance()._engine.rootContext()) - self._ui_context.setContextProperty("manager", self) - self._ui_view = component.create(self._ui_context) - + path = os.path.join(PluginRegistry.getInstance().getPluginPath("ImageReader"), "ConfigUI.qml") + self._ui_view = Application.getInstance().createQmlComponent(path, {"manager": self}) self._ui_view.setFlags(self._ui_view.flags() & ~Qt.WindowCloseButtonHint & ~Qt.WindowMinimizeButtonHint & ~Qt.WindowMaximizeButtonHint); - self._disable_size_callbacks = False @pyqtSlot()