mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-28 05:11:04 -07:00
Merge branch 'master' of github.com:ultimaker/Cura into per_object_settings
* 'master' of github.com:ultimaker/Cura: (98 commits) 15.10 Restyling of the message stack Fixed machine head polygons Removed unused settings from fdmprinter Added action for togling fullscreen Fixed usage of wrong checkbox in viewpage Added preference to disable automatic push free Added preference to disable auto center when selecting object Cleanup 15.10 Restyling toolbar, viewmode button Update README.md Update README.md Added rudementary 3 point bed leveling 15.10 New font for Cura 15.10 Changes the styling for the open file button 15.10 Changes the label names for the different action buttons Fixed typo Endstop now stops listening upon destruction 15.10 Re-alignment of the messagestack Cleaned up code a bit Added heated bed check ...
This commit is contained in:
commit
f099c30dfd
66 changed files with 2608 additions and 1842 deletions
|
|
@ -38,7 +38,11 @@ from . import PrintInformation
|
|||
from . import CuraActions
|
||||
from . import MultiMaterialDecorator
|
||||
|
||||
<<<<<<< HEAD
|
||||
from PyQt5.QtCore import pyqtSlot, QUrl, Qt, pyqtSignal, pyqtProperty, Q_ENUMS
|
||||
=======
|
||||
from PyQt5.QtCore import pyqtSlot, QUrl, Qt, pyqtSignal, pyqtProperty, QEvent
|
||||
>>>>>>> 3cb3cce31c821a56d2395607a90b51030fdf0916
|
||||
from PyQt5.QtGui import QColor, QIcon
|
||||
|
||||
import platform
|
||||
|
|
@ -84,6 +88,7 @@ class CuraApplication(QtApplication):
|
|||
self._platform_activity = False
|
||||
|
||||
self.getMachineManager().activeMachineInstanceChanged.connect(self._onActiveMachineChanged)
|
||||
self.getController().getScene().sceneChanged.connect(self.updatePlatformActivity)
|
||||
|
||||
Resources.addType(self.ResourceTypes.QmlFiles, "qml")
|
||||
Resources.addType(self.ResourceTypes.Firmware, "firmware")
|
||||
|
|
@ -92,6 +97,7 @@ class CuraApplication(QtApplication):
|
|||
Preferences.getInstance().addPreference("cura/active_mode", "simple")
|
||||
Preferences.getInstance().addPreference("cura/recent_files", "")
|
||||
Preferences.getInstance().addPreference("cura/categories_expanded", "")
|
||||
Preferences.getInstance().addPreference("view/center_on_select", True)
|
||||
|
||||
JobQueue.getInstance().jobFinished.connect(self._onJobFinished)
|
||||
|
||||
|
|
@ -123,6 +129,11 @@ class CuraApplication(QtApplication):
|
|||
def run(self):
|
||||
self._i18n_catalog = i18nCatalog("cura");
|
||||
|
||||
i18nCatalog.setTagReplacements({
|
||||
"filename": "font color=\"black\"",
|
||||
"message": "font color=UM.Theme.colors.message_text;",
|
||||
})
|
||||
|
||||
self.showSplashMessage(self._i18n_catalog.i18nc("Splash screen message", "Setting up scene..."))
|
||||
|
||||
controller = self.getController()
|
||||
|
|
@ -133,7 +144,7 @@ class CuraApplication(QtApplication):
|
|||
|
||||
t = controller.getTool("TranslateTool")
|
||||
if t:
|
||||
t.setEnabledAxis([ToolHandle.XAxis, ToolHandle.ZAxis])
|
||||
t.setEnabledAxis([ToolHandle.XAxis, ToolHandle.YAxis,ToolHandle.ZAxis])
|
||||
|
||||
Selection.selectionChanged.connect(self.onSelectionChanged)
|
||||
|
||||
|
|
@ -181,12 +192,17 @@ class CuraApplication(QtApplication):
|
|||
self.closeSplash()
|
||||
|
||||
for file in self.getCommandLineOption("file", []):
|
||||
job = ReadMeshJob(os.path.abspath(file))
|
||||
job.finished.connect(self._onFileLoaded)
|
||||
job.start()
|
||||
self._openFile(file)
|
||||
|
||||
self.exec_()
|
||||
|
||||
# Handle Qt events
|
||||
def event(self, event):
|
||||
if event.type() == QEvent.FileOpen:
|
||||
self._openFile(event.file())
|
||||
|
||||
return super().event(event)
|
||||
|
||||
def registerObjects(self, engine):
|
||||
engine.rootContext().setContextProperty("Printer", self)
|
||||
self._print_information = PrintInformation.PrintInformation()
|
||||
|
|
@ -202,10 +218,10 @@ class CuraApplication(QtApplication):
|
|||
self._previous_active_tool = None
|
||||
else:
|
||||
self.getController().setActiveTool("TranslateTool")
|
||||
|
||||
self._camera_animation.setStart(self.getController().getTool("CameraTool").getOrigin())
|
||||
self._camera_animation.setTarget(Selection.getSelectedObject(0).getWorldPosition())
|
||||
self._camera_animation.start()
|
||||
if Preferences.getInstance().getValue("view/center_on_select"):
|
||||
self._camera_animation.setStart(self.getController().getTool("CameraTool").getOrigin())
|
||||
self._camera_animation.setTarget(Selection.getSelectedObject(0).getWorldPosition())
|
||||
self._camera_animation.start()
|
||||
else:
|
||||
if self.getController().getActiveTool():
|
||||
self._previous_active_tool = self.getController().getActiveTool().getPluginId()
|
||||
|
|
@ -220,24 +236,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
|
||||
|
|
@ -258,8 +265,7 @@ class CuraApplication(QtApplication):
|
|||
group_node = group_node.getParent()
|
||||
op = RemoveSceneNodeOperation(group_node)
|
||||
op.push()
|
||||
self.setPlatformActivity(False)
|
||||
|
||||
|
||||
## Create a number of copies of existing object.
|
||||
@pyqtSlot("quint64", int)
|
||||
def multiplyObject(self, object_id, count):
|
||||
|
|
@ -306,8 +312,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):
|
||||
|
|
@ -490,12 +495,9 @@ class CuraApplication(QtApplication):
|
|||
self._platform.setPosition(Vector(0.0, 0.0, 0.0))
|
||||
|
||||
def _onFileLoaded(self, job):
|
||||
mesh = job.getResult()
|
||||
if mesh != None:
|
||||
node = SceneNode()
|
||||
|
||||
node = job.getResult()
|
||||
if node != None:
|
||||
node.setSelectable(True)
|
||||
node.setMeshData(mesh)
|
||||
node.setName(os.path.basename(job.getFileName()))
|
||||
|
||||
op = AddSceneNodeOperation(node, self.getController().getScene().getRoot())
|
||||
|
|
@ -521,4 +523,10 @@ class CuraApplication(QtApplication):
|
|||
self.recentFilesChanged.emit()
|
||||
|
||||
def _reloadMeshFinished(self, job):
|
||||
job._node.setMeshData(job.getResult())
|
||||
job._node = job.getResult()
|
||||
|
||||
def _openFile(self, file):
|
||||
job = ReadMeshJob(os.path.abspath(file))
|
||||
job.finished.connect(self._onFileLoaded)
|
||||
job.start()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue