mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 15:37:27 -06:00
Update UM3 discovery dialog creation to new method - CURA-4568
This commit is contained in:
parent
9a7fa67da7
commit
eeeefcc47a
1 changed files with 11 additions and 16 deletions
|
@ -1,17 +1,15 @@
|
||||||
from cura.MachineAction import MachineAction
|
import os.path
|
||||||
|
import time
|
||||||
|
|
||||||
|
from PyQt5.QtCore import pyqtSignal, pyqtProperty, pyqtSlot, QObject
|
||||||
|
|
||||||
from UM.Application import Application
|
from UM.Application import Application
|
||||||
from UM.PluginRegistry import PluginRegistry
|
from UM.PluginRegistry import PluginRegistry
|
||||||
from UM.Logger import Logger
|
from UM.Logger import Logger
|
||||||
|
|
||||||
from PyQt5.QtCore import pyqtSignal, pyqtProperty, pyqtSlot, QUrl, QObject
|
|
||||||
from PyQt5.QtQml import QQmlComponent, QQmlContext
|
|
||||||
|
|
||||||
import os.path
|
|
||||||
|
|
||||||
import time
|
|
||||||
|
|
||||||
from UM.i18n import i18nCatalog
|
from UM.i18n import i18nCatalog
|
||||||
|
|
||||||
|
from cura.MachineAction import MachineAction
|
||||||
|
|
||||||
catalog = i18nCatalog("cura")
|
catalog = i18nCatalog("cura")
|
||||||
|
|
||||||
class DiscoverUM3Action(MachineAction):
|
class DiscoverUM3Action(MachineAction):
|
||||||
|
@ -136,17 +134,14 @@ class DiscoverUM3Action(MachineAction):
|
||||||
|
|
||||||
def _createAdditionalComponentsView(self):
|
def _createAdditionalComponentsView(self):
|
||||||
Logger.log("d", "Creating additional ui components for UM3.")
|
Logger.log("d", "Creating additional ui components for UM3.")
|
||||||
path = QUrl.fromLocalFile(os.path.join(PluginRegistry.getInstance().getPluginPath("UM3NetworkPrinting"), "UM3InfoComponents.qml"))
|
|
||||||
self.__additional_component = QQmlComponent(Application.getInstance()._engine, path)
|
|
||||||
|
|
||||||
# We need access to engine (although technically we can't)
|
# Create networking dialog
|
||||||
self.__additional_components_context = QQmlContext(Application.getInstance()._engine.rootContext())
|
path = os.path.join(PluginRegistry.getInstance().getPluginPath("UM3NetworkPrinting"), "UM3InfoComponents.qml")
|
||||||
self.__additional_components_context.setContextProperty("manager", self)
|
self.__additional_components_view = Application.getInstance().createQmlComponent(path, {"manager": self})
|
||||||
|
|
||||||
self.__additional_components_view = self.__additional_component.create(self.__additional_components_context)
|
|
||||||
if not self.__additional_components_view:
|
if not self.__additional_components_view:
|
||||||
Logger.log("w", "Could not create ui components for UM3.")
|
Logger.log("w", "Could not create ui components for UM3.")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Create extra components
|
||||||
Application.getInstance().addAdditionalComponent("monitorButtons", self.__additional_components_view.findChild(QObject, "networkPrinterConnectButton"))
|
Application.getInstance().addAdditionalComponent("monitorButtons", self.__additional_components_view.findChild(QObject, "networkPrinterConnectButton"))
|
||||||
Application.getInstance().addAdditionalComponent("machinesDetailPane", self.__additional_components_view.findChild(QObject, "networkPrinterConnectionInfo"))
|
Application.getInstance().addAdditionalComponent("machinesDetailPane", self.__additional_components_view.findChild(QObject, "networkPrinterConnectionInfo"))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue