mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 23:53:56 -06:00
parent
c1d8e204b7
commit
a84a5d784a
2 changed files with 12 additions and 24 deletions
|
@ -77,6 +77,7 @@ class CuraApplication(QtApplication):
|
||||||
self._platform_activity = False
|
self._platform_activity = False
|
||||||
|
|
||||||
self.activeMachineChanged.connect(self._onActiveMachineChanged)
|
self.activeMachineChanged.connect(self._onActiveMachineChanged)
|
||||||
|
self.getController().getScene().sceneChanged.connect(self.updatePlatformActivity)
|
||||||
|
|
||||||
Preferences.getInstance().addPreference("cura/active_machine", "")
|
Preferences.getInstance().addPreference("cura/active_machine", "")
|
||||||
Preferences.getInstance().addPreference("cura/active_mode", "simple")
|
Preferences.getInstance().addPreference("cura/active_mode", "simple")
|
||||||
|
@ -223,24 +224,15 @@ class CuraApplication(QtApplication):
|
||||||
def getPlatformActivity(self):
|
def getPlatformActivity(self):
|
||||||
return self._platform_activity
|
return self._platform_activity
|
||||||
|
|
||||||
@pyqtSlot(bool)
|
def updatePlatformActivity(self, node = None):
|
||||||
def setPlatformActivity(self, activity):
|
count = 0
|
||||||
##Sets the _platform_activity variable on true or false depending on whether there is a mesh on the platform
|
for node in DepthFirstIterator(self.getController().getScene().getRoot()):
|
||||||
if activity == True:
|
if type(node) is not SceneNode or not node.getMeshData():
|
||||||
self._platform_activity = activity
|
continue
|
||||||
elif activity == False:
|
|
||||||
nodes = []
|
count += 1
|
||||||
for node in DepthFirstIterator(self.getController().getScene().getRoot()):
|
|
||||||
if type(node) is not SceneNode or not node.getMeshData():
|
self._platform_activity = True if count > 0 else False
|
||||||
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()
|
self.activityChanged.emit()
|
||||||
|
|
||||||
## Remove an object from the scene
|
## Remove an object from the scene
|
||||||
|
@ -254,8 +246,7 @@ class CuraApplication(QtApplication):
|
||||||
if object:
|
if object:
|
||||||
op = RemoveSceneNodeOperation(object)
|
op = RemoveSceneNodeOperation(object)
|
||||||
op.push()
|
op.push()
|
||||||
self.setPlatformActivity(False)
|
|
||||||
|
|
||||||
## Create a number of copies of existing object.
|
## Create a number of copies of existing object.
|
||||||
@pyqtSlot("quint64", int)
|
@pyqtSlot("quint64", int)
|
||||||
def multiplyObject(self, object_id, count):
|
def multiplyObject(self, object_id, count):
|
||||||
|
@ -302,8 +293,7 @@ class CuraApplication(QtApplication):
|
||||||
op.addOperation(RemoveSceneNodeOperation(node))
|
op.addOperation(RemoveSceneNodeOperation(node))
|
||||||
|
|
||||||
op.push()
|
op.push()
|
||||||
self.setPlatformActivity(False)
|
|
||||||
|
|
||||||
## Reset all translation on nodes with mesh data.
|
## Reset all translation on nodes with mesh data.
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def resetAllTranslation(self):
|
def resetAllTranslation(self):
|
||||||
|
|
|
@ -43,7 +43,6 @@ UM.MainWindow {
|
||||||
}
|
}
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
UM.MeshFileHandler.readLocalFile(modelData);
|
UM.MeshFileHandler.readLocalFile(modelData);
|
||||||
Printer.setPlatformActivity(true)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onObjectAdded: fileMenu.insertItem(index, object)
|
onObjectAdded: fileMenu.insertItem(index, object)
|
||||||
|
@ -415,7 +414,6 @@ UM.MainWindow {
|
||||||
onAccepted:
|
onAccepted:
|
||||||
{
|
{
|
||||||
UM.MeshFileHandler.readLocalFile(fileUrl)
|
UM.MeshFileHandler.readLocalFile(fileUrl)
|
||||||
Printer.setPlatformActivity(true)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue