mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-12 17:27:51 -06:00
Updating firmware now spawns progress window
This commit is contained in:
parent
de03470dbc
commit
34aac653b4
2 changed files with 49 additions and 19 deletions
29
FirmwareUpdateWindow.qml
Normal file
29
FirmwareUpdateWindow.qml
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
import QtQuick 2.1
|
||||||
|
import QtQuick.Controls 1.1
|
||||||
|
import QtQuick.Layouts 1.1
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
width: 300; height: 100
|
||||||
|
ColumnLayout
|
||||||
|
{
|
||||||
|
|
||||||
|
Text
|
||||||
|
{
|
||||||
|
text: "Updating firmware
|
||||||
|
}
|
||||||
|
ProgressBar
|
||||||
|
{
|
||||||
|
id: prog;
|
||||||
|
value: manager.progress
|
||||||
|
minimumValue: 0;
|
||||||
|
maximumValue: 100;
|
||||||
|
Layout.maximumWidth:parent.width
|
||||||
|
Layout.preferredWidth:230
|
||||||
|
Layout.preferredHeight:25
|
||||||
|
Layout.minimumWidth:230
|
||||||
|
Layout.minimumHeight:25
|
||||||
|
width: 230
|
||||||
|
height: 25
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -31,30 +31,29 @@ class USBPrinterManager(QObject, SignalEmitter, Extension):
|
||||||
self._progress = 0
|
self._progress = 0
|
||||||
|
|
||||||
|
|
||||||
self.view = None
|
self._control_view = None
|
||||||
|
self._firmware_view = None
|
||||||
self._extruder_temp = 0
|
self._extruder_temp = 0
|
||||||
self._bed_temp = 0
|
self._bed_temp = 0
|
||||||
self._error_message = ""
|
self._error_message = ""
|
||||||
|
|
||||||
|
## Add menu item to top menu.
|
||||||
self.addMenuItem(i18n_catalog.i18n("Update firmware"), self.updateAllFirmware)
|
self.addMenuItem(i18n_catalog.i18n("Update firmware"), self.updateAllFirmware)
|
||||||
|
|
||||||
#time.sleep(1)
|
def spawnFirmwareInterface(self, serial_port):
|
||||||
#self.connectAllConnections()
|
if self._firmware_view is None:
|
||||||
#time.sleep(5)
|
self._firmware_view = QQuickView()
|
||||||
#f = open("Orb.gcode")
|
self._firmware_view.engine().rootContext().setContextProperty('manager',self)
|
||||||
#lines = f.readlines()
|
self._firmware_view.setSource(QUrl("plugins/USBPrinting/FirmwareUpdateWindow.qml"))
|
||||||
#print(len(lines))
|
self._firmware_view.show()
|
||||||
#print(len(self._printer_connections))
|
|
||||||
#self.sendGCodeToAllActive(lines)
|
|
||||||
#print("sending heat " , self.sendCommandToAllActive("M104 S190"))
|
|
||||||
|
|
||||||
|
|
||||||
def spawnInterface(self,serial_port):
|
def spawnControlInterface(self,serial_port):
|
||||||
if self.view is None:
|
if self._control_view is None:
|
||||||
self.view = QQuickView()
|
self._control_view = QQuickView()
|
||||||
self.view.engine().rootContext().setContextProperty('manager',self)
|
self._control_view.engine().rootContext().setContextProperty('manager',self)
|
||||||
self.view.setSource(QUrl("plugins/USBPrinting/ControlWindow.qml"))
|
self._control_view.setSource(QUrl("plugins/USBPrinting/ControlWindow.qml"))
|
||||||
self.view.show()
|
self._control_view.show()
|
||||||
|
|
||||||
|
|
||||||
processingProgress = pyqtSignal(float, arguments = ['amount'])
|
processingProgress = pyqtSignal(float, arguments = ['amount'])
|
||||||
|
@ -113,12 +112,14 @@ class USBPrinterManager(QObject, SignalEmitter, Extension):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def updateAllFirmware(self):
|
def updateAllFirmware(self):
|
||||||
|
self.spawnFirmwareInterface("")
|
||||||
for printer_connection in self._printer_connections:
|
for printer_connection in self._printer_connections:
|
||||||
printer_connection.updateFirmware(Resources.getPath(Resources.FirmwareLocation, self._getDefaultFirmwareName()))
|
printer_connection.updateFirmware(Resources.getPath(Resources.FirmwareLocation, self._getDefaultFirmwareName()))
|
||||||
|
|
||||||
def updateFirmwareBySerial(self, serial_port):
|
def updateFirmwareBySerial(self, serial_port):
|
||||||
printer_connection = self.getConnectionByPort(serial_port)
|
printer_connection = self.getConnectionByPort(serial_port)
|
||||||
if printer_connection is not None:
|
if printer_connection is not None:
|
||||||
|
self.spawnFirmwareInterface(printer_connection.getSerialPort())
|
||||||
printer_connection.updateFirmware(Resources.getPath(Resources.FirmwareLocation, self._getDefaultFirmwareName()))
|
printer_connection.updateFirmware(Resources.getPath(Resources.FirmwareLocation, self._getDefaultFirmwareName()))
|
||||||
|
|
||||||
def _getDefaultFirmwareName(self):
|
def _getDefaultFirmwareName(self):
|
||||||
|
@ -220,7 +221,7 @@ class USBPrinterManager(QObject, SignalEmitter, Extension):
|
||||||
if connection.isConnected():
|
if connection.isConnected():
|
||||||
Application.getInstance().addOutputDevice(serial_port, {
|
Application.getInstance().addOutputDevice(serial_port, {
|
||||||
'id': serial_port,
|
'id': serial_port,
|
||||||
'function': self.spawnInterface,
|
'function': self.spawnControlInterface,
|
||||||
'description': 'Write to USB {0}'.format(serial_port),
|
'description': 'Write to USB {0}'.format(serial_port),
|
||||||
'icon': 'print_usb',
|
'icon': 'print_usb',
|
||||||
'priority': 1
|
'priority': 1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue