mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-13 01:37:51 -06:00
Merge branch 'master' of https://github.com/Ultimaker/PluggableCura
Conflicts: plugins/USBPrinting/USBPrinterManager.py
This commit is contained in:
commit
4dc6f87a36
2 changed files with 21 additions and 35 deletions
|
@ -142,35 +142,25 @@ class USBPrinterManager(QObject, SignalEmitter,PluginObject):
|
|||
|
||||
def serialConectionStateCallback(self,serial_port):
|
||||
connection = self.getConnectionByPort(serial_port)
|
||||
if connection is not None:
|
||||
if connection.isConnected():
|
||||
Application.getInstance().addOutputDevice(serial_port, {
|
||||
'id': serial_port,
|
||||
'function': self._writeToSerial,
|
||||
'description': 'Write to USB {0}'.format(serial_port),
|
||||
'icon': 'print_usb',
|
||||
'priority': 1
|
||||
})
|
||||
else:
|
||||
Application.getInstance().removeOutputDevice(serial_port)
|
||||
|
||||
|
||||
if connection.isConnected():
|
||||
Application.getInstance().addOutputDevice(serial_port, {
|
||||
'id': serial_port,
|
||||
'function': self._writeToSerial,
|
||||
'description': 'Write to USB {0}'.format(serial_port),
|
||||
'icon': 'print_usb',
|
||||
'priority': 1
|
||||
})
|
||||
else:
|
||||
Application.getInstance().removeOutputDevice(serial_port)
|
||||
|
||||
def _writeToSerial(self, serial_port):
|
||||
## Create USB control window
|
||||
#self.view = QQuickView()
|
||||
#self.view.setSource(QUrl("plugins/USBPrinting/ControlWindow.qml"))
|
||||
#self.view.show()
|
||||
|
||||
#self.view.engine().rootContext().setContextProperty('manager',self)
|
||||
|
||||
for node in DepthFirstIterator(Application.getInstance().getController().getScene().getRoot()):
|
||||
if type(node) is not SceneNode or not node.getMeshData():
|
||||
continue
|
||||
|
||||
gcode = getattr(node.getMeshData(), 'gcode', False)
|
||||
self.sendGCodeByPort(serial_port,gcode.split('\n'))
|
||||
|
||||
|
||||
gcode_list = getattr(Application.getInstance().getController().getScene(), 'gcode_list', None)
|
||||
if gcode_list:
|
||||
final_list = []
|
||||
for gcode in gcode_list:
|
||||
final_list += gcode.split('\n')
|
||||
self.sendGCodeByPort(serial_port, gcode_list)
|
||||
|
||||
## Get a list of printer connection objects that are connected.
|
||||
def getActiveConnections(self):
|
||||
return [connection for connection in self._printer_connections if connection.isConnected()]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue