Update machine action and image reader dialogs with new component creation method - CURA-4568

This commit is contained in:
ChrisTerBeke 2017-11-28 14:55:35 +01:00
parent 1d68bcc218
commit 11f50f1cd3
2 changed files with 4 additions and 12 deletions

View file

@ -1,12 +1,10 @@
# Copyright (c) 2016 Ultimaker B.V. # Copyright (c) 2016 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher. # Cura is released under the terms of the LGPLv3 or higher.
from PyQt5.QtCore import QObject, pyqtSlot, pyqtProperty, pyqtSignal, QUrl from PyQt5.QtCore import QObject, pyqtSlot, pyqtProperty, pyqtSignal
from PyQt5.QtQml import QQmlComponent, QQmlContext
from UM.PluginObject import PluginObject from UM.PluginObject import PluginObject
from UM.PluginRegistry import PluginRegistry from UM.PluginRegistry import PluginRegistry
from UM.Logger import Logger
from UM.Application import Application from UM.Application import Application
import os import os

View file

@ -4,8 +4,7 @@
import os import os
import threading import threading
from PyQt5.QtCore import Qt, QUrl, pyqtSignal, QObject from PyQt5.QtCore import Qt, pyqtSignal, QObject
from PyQt5.QtQml import QQmlComponent, QQmlContext
from UM.FlameProfiler import pyqtSlot from UM.FlameProfiler import pyqtSlot
from UM.Application import Application from UM.Application import Application
from UM.PluginRegistry import PluginRegistry from UM.PluginRegistry import PluginRegistry
@ -81,14 +80,9 @@ class ImageReaderUI(QObject):
def _createConfigUI(self): def _createConfigUI(self):
if self._ui_view is None: if self._ui_view is None:
Logger.log("d", "Creating ImageReader config UI") Logger.log("d", "Creating ImageReader config UI")
path = QUrl.fromLocalFile(os.path.join(PluginRegistry.getInstance().getPluginPath("ImageReader"), "ConfigUI.qml")) path = os.path.join(PluginRegistry.getInstance().getPluginPath("ImageReader"), "ConfigUI.qml")
component = QQmlComponent(Application.getInstance()._engine, path) self._ui_view = Application.getInstance().createQmlComponent(path, {"manager": self})
self._ui_context = QQmlContext(Application.getInstance()._engine.rootContext())
self._ui_context.setContextProperty("manager", self)
self._ui_view = component.create(self._ui_context)
self._ui_view.setFlags(self._ui_view.flags() & ~Qt.WindowCloseButtonHint & ~Qt.WindowMinimizeButtonHint & ~Qt.WindowMaximizeButtonHint); self._ui_view.setFlags(self._ui_view.flags() & ~Qt.WindowCloseButtonHint & ~Qt.WindowMinimizeButtonHint & ~Qt.WindowMaximizeButtonHint);
self._disable_size_callbacks = False self._disable_size_callbacks = False
@pyqtSlot() @pyqtSlot()