diff --git a/plugins/USBPrinting/USBPrinterOutputDeviceManager.py b/plugins/USBPrinting/USBPrinterOutputDeviceManager.py index 47e2776286..4de71e8b23 100644 --- a/plugins/USBPrinting/USBPrinterOutputDeviceManager.py +++ b/plugins/USBPrinting/USBPrinterOutputDeviceManager.py @@ -2,32 +2,29 @@ # Cura is released under the terms of the LGPLv3 or higher. from UM.Signal import Signal, signalemitter -from . import USBPrinterOutputDevice from UM.Application import Application from UM.Resources import Resources from UM.Logger import Logger from UM.OutputDevice.OutputDevicePlugin import OutputDevicePlugin -from cura.PrinterOutputDevice import ConnectionState -from UM.Qt.ListModel import ListModel -from UM.Message import Message +from UM.i18n import i18nCatalog +from cura.PrinterOutputDevice import ConnectionState from cura.CuraApplication import CuraApplication +from . import USBPrinterOutputDevice +from PyQt5.QtCore import QObject, pyqtSlot, pyqtProperty, pyqtSignal + import threading import platform import time -import os.path import serial.tools.list_ports -from UM.Extension import Extension -from PyQt5.QtCore import QUrl, QObject, pyqtSlot, pyqtProperty, pyqtSignal, Qt -from UM.i18n import i18nCatalog i18n_catalog = i18nCatalog("cura") ## Manager class that ensures that a usbPrinteroutput device is created for every connected USB printer. @signalemitter -class USBPrinterOutputDeviceManager(QObject, OutputDevicePlugin, Extension): +class USBPrinterOutputDeviceManager(QObject, OutputDevicePlugin): addUSBOutputDeviceSignal = Signal() progressChanged = pyqtSignal() @@ -42,7 +39,8 @@ class USBPrinterOutputDeviceManager(QObject, OutputDevicePlugin, Extension): self._check_updates = True Application.getInstance().applicationShuttingDown.connect(self.stop) - self.addUSBOutputDeviceSignal.connect(self.addOutputDevice) #Because the model needs to be created in the same thread as the QMLEngine, we use a signal. + # Because the model needs to be created in the same thread as the QMLEngine, we use a signal. + self.addUSBOutputDeviceSignal.connect(self.addOutputDevice) def start(self): self._check_updates = True diff --git a/plugins/USBPrinting/__init__.py b/plugins/USBPrinting/__init__.py index 1cc45c3c3b..7bf5853c10 100644 --- a/plugins/USBPrinting/__init__.py +++ b/plugins/USBPrinting/__init__.py @@ -1,17 +1,18 @@ -# Copyright (c) 2015 Ultimaker B.V. +# Copyright (c) 2017 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. from . import USBPrinterOutputDeviceManager -from PyQt5.QtQml import qmlRegisterType, qmlRegisterSingletonType +from PyQt5.QtQml import qmlRegisterSingletonType from UM.i18n import i18nCatalog i18n_catalog = i18nCatalog("cura") + def getMetaData(): - return { - } + return {} + def register(app): # We are violating the QT API here (as we use a factory, which is technically not allowed). # but we don't really have another means for doing this (and it seems to you know -work-) qmlRegisterSingletonType(USBPrinterOutputDeviceManager.USBPrinterOutputDeviceManager, "Cura", 1, 0, "USBPrinterManager", USBPrinterOutputDeviceManager.USBPrinterOutputDeviceManager.getInstance) - return {"extension":USBPrinterOutputDeviceManager.USBPrinterOutputDeviceManager.getInstance(), "output_device": USBPrinterOutputDeviceManager.USBPrinterOutputDeviceManager.getInstance()} + return {"output_device": USBPrinterOutputDeviceManager.USBPrinterOutputDeviceManager.getInstance()}