mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 05:49:03 +08:00
Merge branch '15.06' of https://github.com/Ultimaker/Cura into 15.06
This commit is contained in:
commit
d41f1a410c
@ -111,6 +111,7 @@ class CuraApplication(QtApplication):
|
||||
self._plugin_registry.loadPlugin("CuraEngineBackend")
|
||||
|
||||
def addCommandLineOptions(self, parser):
|
||||
super().addCommandLineOptions(parser)
|
||||
parser.add_argument("file", nargs="*", help="Files to load after starting the application.")
|
||||
|
||||
def run(self):
|
||||
@ -549,7 +550,7 @@ class CuraApplication(QtApplication):
|
||||
op.push()
|
||||
|
||||
def _onJobFinished(self, job):
|
||||
if type(job) is not ReadMeshJob:
|
||||
if type(job) is not ReadMeshJob or not job.getResult():
|
||||
return
|
||||
|
||||
f = QUrl.fromLocalFile(job.getFileName())
|
||||
|
@ -37,6 +37,12 @@ class CuraEngineBackend(Backend):
|
||||
self._scene = Application.getInstance().getController().getScene()
|
||||
self._scene.sceneChanged.connect(self._onSceneChanged)
|
||||
|
||||
# Workaround to disable layer view processing if layer view is not active.
|
||||
self._layer_view_active = False
|
||||
Application.getInstance().getController().activeViewChanged.connect(self._onActiveViewChanged)
|
||||
self._onActiveViewChanged()
|
||||
self._stored_layer_data = None
|
||||
|
||||
self._settings = None
|
||||
Application.getInstance().activeMachineChanged.connect(self._onActiveMachineChanged)
|
||||
self._onActiveMachineChanged()
|
||||
@ -150,7 +156,7 @@ class CuraEngineBackend(Backend):
|
||||
obj = msg.objects.add()
|
||||
obj.id = id(object)
|
||||
|
||||
verts = numpy.array(mesh_data.getVertices(), copy=True)
|
||||
verts = numpy.array(mesh_data.getVertices())
|
||||
verts[:,[1,2]] = verts[:,[2,1]]
|
||||
verts[:,1] *= -1
|
||||
obj.vertices = verts.tostring()
|
||||
@ -188,8 +194,11 @@ class CuraEngineBackend(Backend):
|
||||
|
||||
def _onSlicedObjectListMessage(self, message):
|
||||
if self._save_polygons:
|
||||
job = ProcessSlicedObjectListJob.ProcessSlicedObjectListJob(message)
|
||||
job.start()
|
||||
if self._layer_view_active:
|
||||
job = ProcessSlicedObjectListJob.ProcessSlicedObjectListJob(message)
|
||||
job.start()
|
||||
else :
|
||||
self._stored_layer_data = message
|
||||
|
||||
def _onProgressMessage(self, message):
|
||||
if message.amount >= 0.99:
|
||||
@ -248,3 +257,14 @@ class CuraEngineBackend(Backend):
|
||||
def _onToolOperationStopped(self, tool):
|
||||
self._enabled = True
|
||||
self._onChanged()
|
||||
|
||||
def _onActiveViewChanged(self):
|
||||
if Application.getInstance().getController().getActiveView():
|
||||
view = Application.getInstance().getController().getActiveView()
|
||||
if view.getPluginId() == "LayerView":
|
||||
self._layer_view_active = True
|
||||
if self._stored_layer_data:
|
||||
job = ProcessSlicedObjectListJob.ProcessSlicedObjectListJob(self._stored_layer_data)
|
||||
job.start()
|
||||
else:
|
||||
self._layer_view_active = False
|
||||
|
@ -255,7 +255,10 @@ class PrinterConnection(SignalEmitter):
|
||||
## Close the printer connection
|
||||
def close(self):
|
||||
if self._connect_thread.isAlive():
|
||||
self._connect_thread.join()
|
||||
try:
|
||||
self._connect_thread.join()
|
||||
except:
|
||||
pass
|
||||
if self._serial is not None:
|
||||
self.setIsConnected(False)
|
||||
try:
|
||||
@ -465,7 +468,7 @@ class PrinterConnection(SignalEmitter):
|
||||
|
||||
# Turn of temperatures
|
||||
self._sendCommand("M140 S0")
|
||||
self._sendCommand("M109 S0")
|
||||
self._sendCommand("M104 S0")
|
||||
self._is_printing = False
|
||||
|
||||
## Check if the process did not encounter an error yet.
|
||||
|
@ -46,6 +46,8 @@ class USBPrinterManager(QObject, SignalEmitter, Extension):
|
||||
## Add menu item to top menu of the application.
|
||||
self.setMenuName("Firmware")
|
||||
self.addMenuItem(i18n_catalog.i18n("Update Firmware"), self.updateAllFirmware)
|
||||
|
||||
Application.getInstance().applicationShuttingDown.connect(self._onApplicationShuttingDown)
|
||||
|
||||
pyqtError = pyqtSignal(str, arguments = ["error"])
|
||||
processingProgress = pyqtSignal(float, arguments = ["amount"])
|
||||
@ -170,7 +172,7 @@ class USBPrinterManager(QObject, SignalEmitter, Extension):
|
||||
|
||||
## Callback for bed temperature change
|
||||
def onBedTemperature(self, serial_port,temperature):
|
||||
self._bed_temperature = temperature
|
||||
self._bed_temp = temperature
|
||||
self.pyqtBedTemperature.emit(temperature)
|
||||
|
||||
## Callback for error
|
||||
@ -280,15 +282,19 @@ class USBPrinterManager(QObject, SignalEmitter, Extension):
|
||||
i = 0
|
||||
while True:
|
||||
values = winreg.EnumValue(key, i)
|
||||
if not base_list or "USBSER" in values[0]:
|
||||
if not only_list_usb or "USBSER" in values[0]:
|
||||
base_list += [values[1]]
|
||||
i += 1
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
if base_list:
|
||||
base_list = base_list + glob.glob("/dev/ttyUSB*") + glob.glob("/dev/ttyACM*") + glob.glob("/dev/cu.usb*")
|
||||
base_list = filter(lambda s: "Bluetooth" not in s, base_list) # Filter because mac sometimes puts them in the list
|
||||
else:
|
||||
base_list = base_list + glob.glob("/dev/ttyUSB*") + glob.glob("/dev/ttyACM*") + glob.glob("/dev/cu.*") + glob.glob("/dev/tty.usb*") + glob.glob("/dev/rfcomm*") + glob.glob("/dev/serial/by-id/*")
|
||||
if only_list_usb:
|
||||
base_list = base_list + glob.glob("/dev/ttyUSB*") + glob.glob("/dev/ttyACM*") + glob.glob("/dev/cu.usb*")
|
||||
base_list = filter(lambda s: "Bluetooth" not in s, base_list) # Filter because mac sometimes puts them in the list
|
||||
else:
|
||||
base_list = base_list + glob.glob("/dev/ttyUSB*") + glob.glob("/dev/ttyACM*") + glob.glob("/dev/cu.*") + glob.glob("/dev/tty.usb*") + glob.glob("/dev/rfcomm*") + glob.glob("/dev/serial/by-id/*")
|
||||
return base_list
|
||||
|
||||
def _onApplicationShuttingDown(self):
|
||||
for connection in self._printer_connections:
|
||||
connection.close()
|
||||
|
Loading…
x
Reference in New Issue
Block a user