mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-18 20:28:01 -06:00
Merge branch '15.06'
* 15.06: Do not cause "dictionary changed size during iteration" errors when changing view Adds an idle-state for the layerview slider Adds an idle-state for the safebutton Sets the platform activity on true when a model is loaded Sets the platform activity on true when a model is loaded Create functions that get & set platform activity Send M104 to set the temperature to 0 Do not store files that fail to load in recent files
This commit is contained in:
commit
89b175bc5c
7 changed files with 52 additions and 16 deletions
|
@ -33,6 +33,7 @@ class BuildVolume(SceneNode):
|
|||
|
||||
self.setCalculateBoundingBox(False)
|
||||
|
||||
|
||||
def setWidth(self, width):
|
||||
self._width = width
|
||||
|
||||
|
|
|
@ -74,6 +74,7 @@ class CuraApplication(QtApplication):
|
|||
self._print_information = None
|
||||
self._i18n_catalog = None
|
||||
self._previous_active_tool = None
|
||||
self._platform_activity = False
|
||||
|
||||
self.activeMachineChanged.connect(self._onActiveMachineChanged)
|
||||
|
||||
|
@ -216,6 +217,31 @@ class CuraApplication(QtApplication):
|
|||
self._previous_active_tool = None
|
||||
|
||||
requestAddPrinter = pyqtSignal()
|
||||
activityChanged = pyqtSignal()
|
||||
|
||||
@pyqtProperty(bool, notify = activityChanged)
|
||||
def getPlatformActivity(self):
|
||||
return self._platform_activity
|
||||
|
||||
@pyqtSlot(bool)
|
||||
def setPlatformActivity(self, activity):
|
||||
##Sets the _platform_activity variable on true or false depending on whether there is a mesh on the platform
|
||||
if activity == True:
|
||||
self._platform_activity = activity
|
||||
elif activity == False:
|
||||
nodes = []
|
||||
for node in DepthFirstIterator(self.getController().getScene().getRoot()):
|
||||
if type(node) is not SceneNode or not node.getMeshData():
|
||||
continue
|
||||
nodes.append(node)
|
||||
i = 0
|
||||
for node in nodes:
|
||||
if not node.getMeshData():
|
||||
continue
|
||||
i += 1
|
||||
if i <= 1: ## i == 0 when the meshes are removed using the deleteAll function; i == 1 when the last remaining mesh is removed using the deleteObject function
|
||||
self._platform_activity = activity
|
||||
self.activityChanged.emit()
|
||||
|
||||
## Remove an object from the scene
|
||||
@pyqtSlot("quint64")
|
||||
|
@ -228,6 +254,7 @@ class CuraApplication(QtApplication):
|
|||
if object:
|
||||
op = RemoveSceneNodeOperation(object)
|
||||
op.push()
|
||||
self.setPlatformActivity(False)
|
||||
|
||||
## Create a number of copies of existing object.
|
||||
@pyqtSlot("quint64", int)
|
||||
|
@ -268,7 +295,6 @@ class CuraApplication(QtApplication):
|
|||
if type(node) is not SceneNode or not node.getMeshData():
|
||||
continue
|
||||
nodes.append(node)
|
||||
|
||||
if nodes:
|
||||
op = GroupedOperation()
|
||||
|
||||
|
@ -276,6 +302,7 @@ class CuraApplication(QtApplication):
|
|||
op.addOperation(RemoveSceneNodeOperation(node))
|
||||
|
||||
op.push()
|
||||
self.setPlatformActivity(False)
|
||||
|
||||
## Reset all translation on nodes with mesh data.
|
||||
@pyqtSlot()
|
||||
|
@ -523,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())
|
||||
|
|
|
@ -22,15 +22,15 @@ class ProcessSlicedObjectListJob(Job):
|
|||
super().__init__()
|
||||
self._message = message
|
||||
self._scene = Application.getInstance().getController().getScene()
|
||||
|
||||
self._progress = None
|
||||
Application.getInstance().getController().activeViewChanged.connect(self._onActiveViewChanged)
|
||||
|
||||
def run(self):
|
||||
if Application.getInstance().getController().getActiveView().getPluginId() == "LayerView":
|
||||
self._progress = Message(catalog.i18nc("Layers View mode", "Layers"), 0, False, 0)
|
||||
self._progress.show()
|
||||
|
||||
Application.getInstance().getController().activeViewChanged.connect(self._onActiveViewChanged)
|
||||
|
||||
objectIdMap = {}
|
||||
new_node = SceneNode()
|
||||
## Put all nodes in a dict identified by ID
|
||||
|
|
|
@ -469,7 +469,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.
|
||||
|
|
|
@ -41,7 +41,10 @@ UM.MainWindow {
|
|||
var path = modelData.toString()
|
||||
return (index + 1) + ". " + path.slice(path.lastIndexOf("/") + 1);
|
||||
}
|
||||
onTriggered: UM.MeshFileHandler.readLocalFile(modelData);
|
||||
onTriggered: {
|
||||
UM.MeshFileHandler.readLocalFile(modelData);
|
||||
Printer.setPlatformActivity(true)
|
||||
}
|
||||
}
|
||||
onObjectAdded: fileMenu.insertItem(index, object)
|
||||
onObjectRemoved: fileMenu.removeItem(object)
|
||||
|
@ -318,7 +321,11 @@ UM.MainWindow {
|
|||
redo.onTriggered: UM.OperationStack.redo();
|
||||
redo.enabled: UM.OperationStack.canRedo;
|
||||
|
||||
deleteSelection.onTriggered: UM.Controller.removeSelection();
|
||||
deleteSelection.onTriggered: {
|
||||
if(objectContextMenu.objectId != 0) {
|
||||
Printer.deleteObject(objectContextMenu.objectId);
|
||||
}
|
||||
}
|
||||
|
||||
deleteObject.onTriggered: {
|
||||
if(objectContextMenu.objectId != 0) {
|
||||
|
@ -408,6 +415,7 @@ UM.MainWindow {
|
|||
onAccepted:
|
||||
{
|
||||
UM.MeshFileHandler.readLocalFile(fileUrl)
|
||||
Printer.setPlatformActivity(true)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ Rectangle {
|
|||
property Action saveAction;
|
||||
|
||||
property real progress: UM.Backend.progress;
|
||||
property bool activity: Printer.getPlatformActivity;
|
||||
Behavior on progress { NumberAnimation { duration: 250; } }
|
||||
|
||||
property string currentDevice: "local_file"
|
||||
|
@ -76,7 +77,7 @@ Rectangle {
|
|||
color: UM.Theme.colors.save_button_estimated_text;
|
||||
font: UM.Theme.fonts.small;
|
||||
text:
|
||||
if(base.progress < 0) {
|
||||
if(base.activity == false) {
|
||||
//: Save button label
|
||||
return qsTr("Please load a 3D model");
|
||||
} else if (base.progress < 0.99) {
|
||||
|
@ -97,7 +98,7 @@ Rectangle {
|
|||
anchors.leftMargin: UM.Theme.sizes.save_button_text_margin.width;
|
||||
color: UM.Theme.colors.save_button_printtime_text;
|
||||
font: UM.Theme.fonts.small;
|
||||
visible: base.progress < 0.99 ? false : true
|
||||
visible: base.activity == false || base.progress < 0.99 ? false : true
|
||||
text: (!base.printDuration || !base.printDuration.valid) ? "" : base.printDuration.getDisplayString(UM.DurationFormat.Long);
|
||||
}
|
||||
Label {
|
||||
|
@ -107,11 +108,10 @@ Rectangle {
|
|||
anchors.leftMargin: UM.Theme.sizes.save_button_text_margin.width;
|
||||
color: base.printDuration.days > 0 ? UM.Theme.colors.save_button_estimated_text : UM.Theme.colors.save_button_printtime_text;
|
||||
font: UM.Theme.fonts.small;
|
||||
|
||||
property bool mediumLengthDuration: base.printDuration.hours > 9 && base.printMaterialAmount > 9.99 && base.printDuration.days == 0
|
||||
width: mediumLengthDuration ? 50 : undefined
|
||||
elide: mediumLengthDuration ? Text.ElideRight : Text.ElideNone
|
||||
visible: base.progress < 0.99 ? false : true
|
||||
visible: base.activity == false || base.progress < 0.99 ? false : true
|
||||
//: Print material amount save button label
|
||||
text: base.printMaterialAmount < 0 ? "" : qsTr("%1m material").arg(base.printMaterialAmount);
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ Rectangle {
|
|||
}
|
||||
width: Math.max(infoBox.width * base.progress);
|
||||
color: UM.Theme.colors.save_button_active
|
||||
visible: base.progress > 0.99 ? false : true
|
||||
visible: progress > 0.99 ? false : true
|
||||
}
|
||||
|
||||
Button {
|
||||
|
@ -135,7 +135,7 @@ Rectangle {
|
|||
anchors.left: parent.left
|
||||
anchors.leftMargin: UM.Theme.sizes.default_margin.width;
|
||||
tooltip: ''
|
||||
enabled: progress >= 0.99;
|
||||
enabled: progress > 0.99 && base.activity == true
|
||||
|
||||
width: infoBox.width/6*4.5
|
||||
height: UM.Theme.sizes.save_button_save_to_button.height
|
||||
|
|
|
@ -389,7 +389,7 @@ QtObject {
|
|||
}
|
||||
Label {
|
||||
id: maxValueLabel
|
||||
visible: UM.LayerView.getLayerActivity ? true : false
|
||||
visible: UM.LayerView.getLayerActivity && Printer.getPlatformActivity ? true : false
|
||||
text: control.maximumValue + 1
|
||||
font: control.maximumValue > 998 ? UM.Theme.fonts.small : UM.Theme.fonts.default
|
||||
transformOrigin: Item.BottomLeft
|
||||
|
@ -399,7 +399,7 @@ QtObject {
|
|||
}
|
||||
Label {
|
||||
id: minValueLabel
|
||||
visible: UM.LayerView.getLayerActivity ? true : false
|
||||
visible: UM.LayerView.getLayerActivity && Printer.getPlatformActivity ? true : false
|
||||
text: '1'
|
||||
font: control.maximumValue > 998 ? UM.Theme.fonts.small : UM.Theme.fonts.default
|
||||
transformOrigin: Item.BottomLeft
|
||||
|
@ -416,7 +416,7 @@ QtObject {
|
|||
Behavior on color { ColorAnimation { duration: 50; } }
|
||||
Label {
|
||||
id: valueLabel
|
||||
visible: UM.LayerView.getLayerActivity ? true : false
|
||||
visible: UM.LayerView.getLayerActivity && Printer.getPlatformActivity ? true : false
|
||||
text: control.value + 1
|
||||
anchors.bottom: layerSliderControl.bottom
|
||||
anchors.right: layerSliderControl.left
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue