Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArjen Hiemstra <ahiemstra@heimr.nl>2015-07-15 11:11:19 +0300
committerArjen Hiemstra <ahiemstra@heimr.nl>2015-07-15 11:15:02 +0300
commita84a5d784ae6eb44e71540368bf11dadc06d837b (patch)
tree20a3d700d3a31e92044c52d74a4170e67d59e1c6
parentc1d8e204b7051561e610bc4d1ad6a6a9391519c4 (diff)
Fix the platform activity check15.06.021.15.06.02
Contributes to #128
-rw-r--r--cura/CuraApplication.py34
-rw-r--r--resources/qml/Cura.qml2
2 files changed, 12 insertions, 24 deletions
diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py
index 3c63d07b4f..8c55e598a1 100644
--- a/cura/CuraApplication.py
+++ b/cura/CuraApplication.py
@@ -77,6 +77,7 @@ class CuraApplication(QtApplication):
self._platform_activity = False
self.activeMachineChanged.connect(self._onActiveMachineChanged)
+ self.getController().getScene().sceneChanged.connect(self.updatePlatformActivity)
Preferences.getInstance().addPreference("cura/active_machine", "")
Preferences.getInstance().addPreference("cura/active_mode", "simple")
@@ -223,24 +224,15 @@ class CuraApplication(QtApplication):
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
+ def updatePlatformActivity(self, node = None):
+ count = 0
+ for node in DepthFirstIterator(self.getController().getScene().getRoot()):
+ if type(node) is not SceneNode or not node.getMeshData():
+ continue
+
+ count += 1
+
+ self._platform_activity = True if count > 0 else False
self.activityChanged.emit()
## Remove an object from the scene
@@ -254,8 +246,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)
def multiplyObject(self, object_id, count):
@@ -302,8 +293,7 @@ class CuraApplication(QtApplication):
op.addOperation(RemoveSceneNodeOperation(node))
op.push()
- self.setPlatformActivity(False)
-
+
## Reset all translation on nodes with mesh data.
@pyqtSlot()
def resetAllTranslation(self):
diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml
index f8e80367eb..6f8a39b53a 100644
--- a/resources/qml/Cura.qml
+++ b/resources/qml/Cura.qml
@@ -43,7 +43,6 @@ UM.MainWindow {
}
onTriggered: {
UM.MeshFileHandler.readLocalFile(modelData);
- Printer.setPlatformActivity(true)
}
}
onObjectAdded: fileMenu.insertItem(index, object)
@@ -415,7 +414,6 @@ UM.MainWindow {
onAccepted:
{
UM.MeshFileHandler.readLocalFile(fileUrl)
- Printer.setPlatformActivity(true)
}
}