mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 23:46:22 -06:00
Cleanup & documentation
This commit is contained in:
parent
d81a2e7a15
commit
c58ed21406
1 changed files with 27 additions and 12 deletions
|
@ -64,6 +64,8 @@ class PrinterApplication(QtApplication):
|
||||||
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')
|
||||||
|
|
||||||
|
## Handle loading of all plugin types (and the backend explicitly)
|
||||||
|
# \sa PluginRegistery
|
||||||
def _loadPlugins(self):
|
def _loadPlugins(self):
|
||||||
self._plugin_registry.loadPlugins({ "type": "logger"})
|
self._plugin_registry.loadPlugins({ "type": "logger"})
|
||||||
self._plugin_registry.loadPlugins({ "type": "storage_device" })
|
self._plugin_registry.loadPlugins({ "type": "storage_device" })
|
||||||
|
@ -154,6 +156,7 @@ class PrinterApplication(QtApplication):
|
||||||
|
|
||||||
requestAddPrinter = pyqtSignal()
|
requestAddPrinter = pyqtSignal()
|
||||||
|
|
||||||
|
## Remove an object from the scene
|
||||||
@pyqtSlot('quint64')
|
@pyqtSlot('quint64')
|
||||||
def deleteObject(self, object_id):
|
def deleteObject(self, object_id):
|
||||||
object = self.getController().getScene().findObject(object_id)
|
object = self.getController().getScene().findObject(object_id)
|
||||||
|
@ -162,6 +165,7 @@ class PrinterApplication(QtApplication):
|
||||||
op = RemoveSceneNodeOperation(object)
|
op = RemoveSceneNodeOperation(object)
|
||||||
op.push()
|
op.push()
|
||||||
|
|
||||||
|
## 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):
|
||||||
node = self.getController().getScene().findObject(object_id)
|
node = self.getController().getScene().findObject(object_id)
|
||||||
|
@ -177,6 +181,7 @@ class PrinterApplication(QtApplication):
|
||||||
op.addOperation(AddSceneNodeOperation(new_node, node.getParent()))
|
op.addOperation(AddSceneNodeOperation(new_node, node.getParent()))
|
||||||
op.push()
|
op.push()
|
||||||
|
|
||||||
|
## Center object on platform.
|
||||||
@pyqtSlot('quint64')
|
@pyqtSlot('quint64')
|
||||||
def centerObject(self, object_id):
|
def centerObject(self, object_id):
|
||||||
node = self.getController().getScene().findObject(object_id)
|
node = self.getController().getScene().findObject(object_id)
|
||||||
|
@ -187,6 +192,7 @@ class PrinterApplication(QtApplication):
|
||||||
op = SetTransformOperation(node, transform)
|
op = SetTransformOperation(node, transform)
|
||||||
op.push()
|
op.push()
|
||||||
|
|
||||||
|
## Delete all mesh data on the scene.
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def deleteAll(self):
|
def deleteAll(self):
|
||||||
nodes = []
|
nodes = []
|
||||||
|
@ -203,6 +209,7 @@ class PrinterApplication(QtApplication):
|
||||||
|
|
||||||
op.push()
|
op.push()
|
||||||
|
|
||||||
|
## Reset all translation on nodes with mesh data.
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def resetAllTranslation(self):
|
def resetAllTranslation(self):
|
||||||
nodes = []
|
nodes = []
|
||||||
|
@ -221,6 +228,7 @@ class PrinterApplication(QtApplication):
|
||||||
|
|
||||||
op.push()
|
op.push()
|
||||||
|
|
||||||
|
## Reset all transformations on nodes with mesh data.
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def resetAll(self):
|
def resetAll(self):
|
||||||
nodes = []
|
nodes = []
|
||||||
|
@ -238,6 +246,7 @@ class PrinterApplication(QtApplication):
|
||||||
|
|
||||||
op.push()
|
op.push()
|
||||||
|
|
||||||
|
## Reload all mesh data on the screen from file.
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def reloadAll(self):
|
def reloadAll(self):
|
||||||
nodes = []
|
nodes = []
|
||||||
|
@ -254,6 +263,8 @@ class PrinterApplication(QtApplication):
|
||||||
job.finished.connect(lambda j: node.setMeshData(j.getResult()))
|
job.finished.connect(lambda j: node.setMeshData(j.getResult()))
|
||||||
job.start()
|
job.start()
|
||||||
|
|
||||||
|
## Get logging data of the backend engine
|
||||||
|
# \returns \type{string} Logging data
|
||||||
@pyqtSlot(result=str)
|
@pyqtSlot(result=str)
|
||||||
def getEngineLog(self):
|
def getEngineLog(self):
|
||||||
log = ""
|
log = ""
|
||||||
|
@ -280,6 +291,7 @@ class PrinterApplication(QtApplication):
|
||||||
|
|
||||||
return self.getActiveMachine().getSettingValueByKey(key)
|
return self.getActiveMachine().getSettingValueByKey(key)
|
||||||
|
|
||||||
|
## Change setting by key value pair
|
||||||
@pyqtSlot(str, 'QVariant')
|
@pyqtSlot(str, 'QVariant')
|
||||||
def setSettingValue(self, key, value):
|
def setSettingValue(self, key, value):
|
||||||
if not self.getActiveMachine():
|
if not self.getActiveMachine():
|
||||||
|
@ -289,8 +301,8 @@ class PrinterApplication(QtApplication):
|
||||||
|
|
||||||
## Add an output device that can be written to.
|
## Add an output device that can be written to.
|
||||||
#
|
#
|
||||||
# \param id The identifier used to identify the device.
|
# \param id \type{string} The identifier used to identify the device.
|
||||||
# \param device A dictionary of device information.
|
# \param device \type{StorageDevice} A dictionary of device information.
|
||||||
# It should contains the following:
|
# It should contains the following:
|
||||||
# - function: A function to be called when trying to write to the device. Will be passed the device id as first parameter.
|
# - function: A function to be called when trying to write to the device. Will be passed the device id as first parameter.
|
||||||
# - description: A translated string containing a description of what happens when writing to the device.
|
# - description: A translated string containing a description of what happens when writing to the device.
|
||||||
|
@ -300,6 +312,9 @@ class PrinterApplication(QtApplication):
|
||||||
self._output_devices[id] = device
|
self._output_devices[id] = device
|
||||||
self.outputDevicesChanged.emit()
|
self.outputDevicesChanged.emit()
|
||||||
|
|
||||||
|
## Remove output device
|
||||||
|
# \param id \type{string} The identifier used to identify the device.
|
||||||
|
# \sa PrinterApplication::addOutputDevice()
|
||||||
def removeOutputDevice(self, id):
|
def removeOutputDevice(self, id):
|
||||||
if id in self._output_devices:
|
if id in self._output_devices:
|
||||||
del self._output_devices[id]
|
del self._output_devices[id]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue