mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
Merge branch 'master' of https://github.com/Ultimaker/Cura.git into master-CURA-1923
This commit is contained in:
commit
c6e727ada9
41 changed files with 579 additions and 324 deletions
|
|
@ -9,18 +9,20 @@ from UM.Math.Vector import Vector
|
|||
from UM.Scene.SceneNode import SceneNode
|
||||
from UM.Scene.GroupDecorator import GroupDecorator
|
||||
from UM.Math.Quaternion import Quaternion
|
||||
|
||||
from UM.Job import Job
|
||||
|
||||
import math
|
||||
import zipfile
|
||||
|
||||
import xml.etree.ElementTree as ET
|
||||
try:
|
||||
import xml.etree.cElementTree as ET
|
||||
except ImportError:
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
## Base implementation for reading 3MF files. Has no support for textures. Only loads meshes!
|
||||
class ThreeMFReader(MeshReader):
|
||||
def __init__(self):
|
||||
super(ThreeMFReader, self).__init__()
|
||||
super().__init__()
|
||||
self._supported_extensions = [".3mf"]
|
||||
|
||||
self._namespaces = {
|
||||
|
|
@ -116,4 +118,10 @@ class ThreeMFReader(MeshReader):
|
|||
except Exception as e:
|
||||
Logger.log("e", "exception occured in 3mf reader: %s", e)
|
||||
|
||||
return result
|
||||
try: # Selftest - There might be more functions that should fail
|
||||
boundingBox = result.getBoundingBox()
|
||||
boundingBox.isValid()
|
||||
except:
|
||||
return None
|
||||
|
||||
return result
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ message Slice
|
|||
repeated ObjectList object_lists = 1; // The meshgroups to be printed one after another
|
||||
SettingList global_settings = 2; // The global settings used for the whole print job
|
||||
repeated Extruder extruders = 3; // The settings sent to each extruder object
|
||||
repeated SettingExtruder global_inherits_stack = 4; //From which stack the setting would inherit if not defined in a stack.
|
||||
}
|
||||
|
||||
message Extruder
|
||||
|
|
@ -108,8 +109,14 @@ message Setting {
|
|||
bytes value = 2; // The value of the setting
|
||||
}
|
||||
|
||||
message SettingExtruder {
|
||||
string name = 1; //The setting key.
|
||||
|
||||
int32 extruder = 2; //From which extruder stack the setting should inherit.
|
||||
}
|
||||
|
||||
message GCodePrefix {
|
||||
bytes data = 2; // Header string to be prenpended before the rest of the gcode sent from the engine
|
||||
bytes data = 2; //Header string to be prepended before the rest of the g-code sent from the engine.
|
||||
}
|
||||
|
||||
message SlicingFinished {
|
||||
|
|
|
|||
|
|
@ -13,9 +13,11 @@ from UM.Resources import Resources
|
|||
from UM.Settings.Validator import ValidatorState #To find if a setting is in an error state. We can't slice then.
|
||||
from UM.Platform import Platform
|
||||
|
||||
|
||||
import cura.Settings
|
||||
|
||||
from cura.OneAtATimeIterator import OneAtATimeIterator
|
||||
from cura.Settings.ExtruderManager import ExtruderManager
|
||||
from . import ProcessSlicedLayersJob
|
||||
from . import ProcessGCodeJob
|
||||
from . import StartSliceJob
|
||||
|
|
@ -40,7 +42,8 @@ class CuraEngineBackend(Backend):
|
|||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
# Find out where the engine is located, and how it is called. This depends on how Cura is packaged and which OS we are running on.
|
||||
# Find out where the engine is located, and how it is called.
|
||||
# This depends on how Cura is packaged and which OS we are running on.
|
||||
default_engine_location = os.path.join(Application.getInstallPrefix(), "bin", "CuraEngine")
|
||||
if hasattr(sys, "frozen"):
|
||||
default_engine_location = os.path.join(os.path.dirname(os.path.abspath(sys.executable)), "CuraEngine")
|
||||
|
|
@ -59,7 +62,7 @@ class CuraEngineBackend(Backend):
|
|||
self._stored_layer_data = []
|
||||
self._stored_optimized_layer_data = []
|
||||
|
||||
#Triggers for when to (re)start slicing:
|
||||
# Triggers for when to (re)start slicing:
|
||||
self._global_container_stack = None
|
||||
Application.getInstance().globalContainerStackChanged.connect(self._onGlobalStackChanged)
|
||||
self._onGlobalStackChanged()
|
||||
|
|
@ -68,15 +71,15 @@ class CuraEngineBackend(Backend):
|
|||
cura.Settings.ExtruderManager.getInstance().activeExtruderChanged.connect(self._onActiveExtruderChanged)
|
||||
self._onActiveExtruderChanged()
|
||||
|
||||
#When you update a setting and other settings get changed through inheritance, many propertyChanged signals are fired.
|
||||
#This timer will group them up, and only slice for the last setting changed signal.
|
||||
#TODO: Properly group propertyChanged signals by whether they are triggered by the same user interaction.
|
||||
# When you update a setting and other settings get changed through inheritance, many propertyChanged signals are fired.
|
||||
# This timer will group them up, and only slice for the last setting changed signal.
|
||||
# TODO: Properly group propertyChanged signals by whether they are triggered by the same user interaction.
|
||||
self._change_timer = QTimer()
|
||||
self._change_timer.setInterval(500)
|
||||
self._change_timer.setSingleShot(True)
|
||||
self._change_timer.timeout.connect(self.slice)
|
||||
|
||||
#Listeners for receiving messages from the back-end.
|
||||
# Listeners for receiving messages from the back-end.
|
||||
self._message_handlers["cura.proto.Layer"] = self._onLayerMessage
|
||||
self._message_handlers["cura.proto.LayerOptimized"] = self._onOptimizedLayerMessage
|
||||
self._message_handlers["cura.proto.Progress"] = self._onProgressMessage
|
||||
|
|
@ -86,19 +89,19 @@ class CuraEngineBackend(Backend):
|
|||
self._message_handlers["cura.proto.SlicingFinished"] = self._onSlicingFinishedMessage
|
||||
|
||||
self._start_slice_job = None
|
||||
self._slicing = False #Are we currently slicing?
|
||||
self._restart = False #Back-end is currently restarting?
|
||||
self._enabled = True #Should we be slicing? Slicing might be paused when, for instance, the user is dragging the mesh around.
|
||||
self._always_restart = True #Always restart the engine when starting a new slice. Don't keep the process running. TODO: Fix engine statelessness.
|
||||
self._process_layers_job = None #The currently active job to process layers, or None if it is not processing layers.
|
||||
self._slicing = False # Are we currently slicing?
|
||||
self._restart = False # Back-end is currently restarting?
|
||||
self._enabled = True # Should we be slicing? Slicing might be paused when, for instance, the user is dragging the mesh around.
|
||||
self._always_restart = True # Always restart the engine when starting a new slice. Don't keep the process running. TODO: Fix engine statelessness.
|
||||
self._process_layers_job = None # The currently active job to process layers, or None if it is not processing layers.
|
||||
|
||||
self._backend_log_max_lines = 200 # Maximal count of lines to buffer
|
||||
self._error_message = None #Pop-up message that shows errors.
|
||||
self._backend_log_max_lines = 20000 # Maximum number of lines to buffer
|
||||
self._error_message = None # Pop-up message that shows errors.
|
||||
|
||||
self.backendQuit.connect(self._onBackendQuit)
|
||||
self.backendConnected.connect(self._onBackendConnected)
|
||||
|
||||
#When a tool operation is in progress, don't slice. So we need to listen for tool operations.
|
||||
# When a tool operation is in progress, don't slice. So we need to listen for tool operations.
|
||||
Application.getInstance().getController().toolOperationStarted.connect(self._onToolOperationStarted)
|
||||
Application.getInstance().getController().toolOperationStopped.connect(self._onToolOperationStopped)
|
||||
|
||||
|
|
@ -117,9 +120,10 @@ class CuraEngineBackend(Backend):
|
|||
# \return list of commands and args / parameters.
|
||||
def getEngineCommand(self):
|
||||
json_path = Resources.getPath(Resources.DefinitionContainers, "fdmprinter.def.json")
|
||||
return [Preferences.getInstance().getValue("backend/location"), "connect", "127.0.0.1:{0}".format(self._port), "-j", json_path, "-vv"]
|
||||
return [Preferences.getInstance().getValue("backend/location"), "connect", "127.0.0.1:{0}".format(self._port), "-j", json_path, ""]
|
||||
|
||||
## Emitted when we get a message containing print duration and material amount. This also implies the slicing has finished.
|
||||
## Emitted when we get a message containing print duration and material amount.
|
||||
# This also implies the slicing has finished.
|
||||
# \param time The amount of time the print will take.
|
||||
# \param material_amount The amount of material the print will use.
|
||||
printDurationMessage = Signal()
|
||||
|
|
@ -133,7 +137,7 @@ class CuraEngineBackend(Backend):
|
|||
## Perform a slice of the scene.
|
||||
def slice(self):
|
||||
self._slice_start_time = time()
|
||||
if not self._enabled or not self._global_container_stack: #We shouldn't be slicing.
|
||||
if not self._enabled or not self._global_container_stack: # We shouldn't be slicing.
|
||||
# try again in a short time
|
||||
self._change_timer.start()
|
||||
return
|
||||
|
|
@ -143,10 +147,10 @@ class CuraEngineBackend(Backend):
|
|||
self._stored_layer_data = []
|
||||
self._stored_optimized_layer_data = []
|
||||
|
||||
if self._slicing: #We were already slicing. Stop the old job.
|
||||
if self._slicing: # We were already slicing. Stop the old job.
|
||||
self._terminate()
|
||||
|
||||
if self._process_layers_job: #We were processing layers. Stop that, the layers are going to change soon.
|
||||
if self._process_layers_job: # We were processing layers. Stop that, the layers are going to change soon.
|
||||
self._process_layers_job.abort()
|
||||
self._process_layers_job = None
|
||||
|
||||
|
|
@ -183,7 +187,7 @@ class CuraEngineBackend(Backend):
|
|||
self._process.terminate()
|
||||
Logger.log("d", "Engine process is killed. Received return code %s", self._process.wait())
|
||||
self._process = None
|
||||
except Exception as e: # terminating a process that is already terminating causes an exception, silently ignore this.
|
||||
except Exception as e: # terminating a process that is already terminating causes an exception, silently ignore this.
|
||||
Logger.log("d", "Exception occurred while trying to kill the engine %s", str(e))
|
||||
|
||||
## Event handler to call when the job to initiate the slicing process is
|
||||
|
|
@ -204,7 +208,7 @@ class CuraEngineBackend(Backend):
|
|||
|
||||
if job.getResult() == StartSliceJob.StartJobResult.SettingError:
|
||||
if Application.getInstance().getPlatformActivity:
|
||||
self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice. Please check your setting values for errors."), lifetime = 10)
|
||||
self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice. Please check your setting values for errors."))
|
||||
self._error_message.show()
|
||||
self.backendStateChange.emit(BackendState.Error)
|
||||
else:
|
||||
|
|
@ -213,7 +217,7 @@ class CuraEngineBackend(Backend):
|
|||
|
||||
if job.getResult() == StartSliceJob.StartJobResult.NothingToSlice:
|
||||
if Application.getInstance().getPlatformActivity:
|
||||
self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice. No suitable objects found."), lifetime = 10)
|
||||
self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice. No suitable objects found."))
|
||||
self._error_message.show()
|
||||
self.backendStateChange.emit(BackendState.Error)
|
||||
else:
|
||||
|
|
@ -252,6 +256,9 @@ class CuraEngineBackend(Backend):
|
|||
return
|
||||
|
||||
super()._onSocketError(error)
|
||||
if error.getErrorCode() == Arcus.ErrorCode.Debug:
|
||||
return
|
||||
|
||||
self._terminate()
|
||||
|
||||
if error.getErrorCode() not in [Arcus.ErrorCode.BindFailedError, Arcus.ErrorCode.ConnectionResetError, Arcus.ErrorCode.Debug]:
|
||||
|
|
@ -262,7 +269,7 @@ class CuraEngineBackend(Backend):
|
|||
# \param instance The setting instance that has changed.
|
||||
# \param property The property of the setting instance that has changed.
|
||||
def _onSettingChanged(self, instance, property):
|
||||
if property == "value": #Only reslice if the value has changed.
|
||||
if property == "value": # Only reslice if the value has changed.
|
||||
self._onChanged()
|
||||
|
||||
## Called when a sliced layer data message is received from the engine.
|
||||
|
|
@ -313,7 +320,7 @@ class CuraEngineBackend(Backend):
|
|||
|
||||
## Called when a print time message is received from the engine.
|
||||
#
|
||||
# \param message The protobuf message containing the print time and
|
||||
# \param message The protobuff message containing the print time and
|
||||
# material amount per extruder
|
||||
def _onPrintTimeMaterialEstimates(self, message):
|
||||
material_amounts = []
|
||||
|
|
@ -348,8 +355,8 @@ class CuraEngineBackend(Backend):
|
|||
#
|
||||
# \param tool The tool that the user is using.
|
||||
def _onToolOperationStarted(self, tool):
|
||||
self._terminate() # Do not continue slicing once a tool has started
|
||||
self._enabled = False # Do not reslice when a tool is doing it's 'thing'
|
||||
self._terminate() # Do not continue slicing once a tool has started
|
||||
self._enabled = False # Do not reslice when a tool is doing it's 'thing'
|
||||
|
||||
## Called when the user stops using some tool.
|
||||
#
|
||||
|
|
@ -357,13 +364,13 @@ class CuraEngineBackend(Backend):
|
|||
#
|
||||
# \param tool The tool that the user was using.
|
||||
def _onToolOperationStopped(self, tool):
|
||||
self._enabled = True # Tool stop, start listening for changes again.
|
||||
self._enabled = True # Tool stop, start listening for changes again.
|
||||
|
||||
## Called when the user changes the active view mode.
|
||||
def _onActiveViewChanged(self):
|
||||
if Application.getInstance().getController().getActiveView():
|
||||
view = Application.getInstance().getController().getActiveView()
|
||||
if view.getPluginId() == "LayerView": #If switching to layer view, we should process the layers if that hasn't been done yet.
|
||||
if view.getPluginId() == "LayerView": # If switching to layer view, we should process the layers if that hasn't been done yet.
|
||||
self._layer_view_active = True
|
||||
# There is data and we're not slicing at the moment
|
||||
# if we are slicing, there is no need to re-calculate the data as it will be invalid in a moment.
|
||||
|
|
@ -388,22 +395,35 @@ class CuraEngineBackend(Backend):
|
|||
if self._global_container_stack:
|
||||
self._global_container_stack.propertyChanged.disconnect(self._onSettingChanged)
|
||||
self._global_container_stack.containersChanged.disconnect(self._onChanged)
|
||||
extruders = list(ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId()))
|
||||
if extruders:
|
||||
for extruder in extruders:
|
||||
extruder.propertyChanged.disconnect(self._onSettingChanged)
|
||||
|
||||
self._global_container_stack = Application.getInstance().getGlobalContainerStack()
|
||||
|
||||
if self._global_container_stack:
|
||||
self._global_container_stack.propertyChanged.connect(self._onSettingChanged) #Note: Only starts slicing when the value changed.
|
||||
self._global_container_stack.propertyChanged.connect(self._onSettingChanged) # Note: Only starts slicing when the value changed.
|
||||
self._global_container_stack.containersChanged.connect(self._onChanged)
|
||||
extruders = list(ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId()))
|
||||
if extruders:
|
||||
for extruder in extruders:
|
||||
extruder.propertyChanged.connect(self._onSettingChanged)
|
||||
self._onActiveExtruderChanged()
|
||||
self._onChanged()
|
||||
|
||||
def _onActiveExtruderChanged(self):
|
||||
if self._global_container_stack:
|
||||
# Connect all extruders of the active machine. This might cause a few connects that have already happend,
|
||||
# but that shouldn't cause issues as only new / unique connections are added.
|
||||
extruders = list(ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId()))
|
||||
if extruders:
|
||||
for extruder in extruders:
|
||||
extruder.propertyChanged.connect(self._onSettingChanged)
|
||||
if self._active_extruder_stack:
|
||||
self._active_extruder_stack.propertyChanged.disconnect(self._onSettingChanged)
|
||||
self._active_extruder_stack.containersChanged.disconnect(self._onChanged)
|
||||
|
||||
self._active_extruder_stack = cura.Settings.ExtruderManager.getInstance().getActiveExtruderStack()
|
||||
if self._active_extruder_stack:
|
||||
self._active_extruder_stack.propertyChanged.connect(self._onSettingChanged) # Note: Only starts slicing when the value changed.
|
||||
self._active_extruder_stack.containersChanged.connect(self._onChanged)
|
||||
|
||||
|
|
|
|||
|
|
@ -56,10 +56,9 @@ class ProcessSlicedLayersJob(Job):
|
|||
|
||||
## Remove old layer data (if any)
|
||||
for node in DepthFirstIterator(self._scene.getRoot()):
|
||||
if type(node) is SceneNode and node.getMeshData():
|
||||
if node.callDecoration("getLayerData"):
|
||||
self._scene.getRoot().removeChild(node)
|
||||
Job.yieldThread()
|
||||
if node.callDecoration("getLayerData"):
|
||||
node.getParent().removeChild(node)
|
||||
break
|
||||
if self._abort_requested:
|
||||
if self._progress:
|
||||
self._progress.hide()
|
||||
|
|
@ -74,7 +73,7 @@ class ProcessSlicedLayersJob(Job):
|
|||
# instead simply offset all other layers so the lowest layer is always 0.
|
||||
min_layer_number = 0
|
||||
for layer in self._layers:
|
||||
if(layer.id < min_layer_number):
|
||||
if layer.id < min_layer_number:
|
||||
min_layer_number = layer.id
|
||||
|
||||
current_layer = 0
|
||||
|
|
@ -98,7 +97,7 @@ class ProcessSlicedLayersJob(Job):
|
|||
points = numpy.fromstring(polygon.points, dtype="f4") # Convert bytearray to numpy array
|
||||
if polygon.point_type == 0: # Point2D
|
||||
points = points.reshape((-1,2)) # We get a linear list of pairs that make up the points, so make numpy interpret them correctly.
|
||||
else: # Point3D
|
||||
else: # Point3D
|
||||
points = points.reshape((-1,3))
|
||||
|
||||
line_widths = numpy.fromstring(polygon.line_width, dtype="f4") # Convert bytearray to numpy array
|
||||
|
|
@ -108,15 +107,14 @@ class ProcessSlicedLayersJob(Job):
|
|||
# This uses manual array creation + copy rather than numpy.insert since this is
|
||||
# faster.
|
||||
new_points = numpy.empty((len(points), 3), numpy.float32)
|
||||
if polygon.point_type == 0: # Point2D
|
||||
new_points[:,0] = points[:,0]
|
||||
new_points[:,1] = layer.height/1000 # layer height value is in backend representation
|
||||
new_points[:,2] = -points[:,1]
|
||||
if polygon.point_type == 0: # Point2D
|
||||
new_points[:, 0] = points[:, 0]
|
||||
new_points[:, 1] = layer.height / 1000 # layer height value is in backend representation
|
||||
new_points[:, 2] = -points[:, 1]
|
||||
else: # Point3D
|
||||
new_points[:,0] = points[:,0]
|
||||
new_points[:,1] = points[:,2]
|
||||
new_points[:,2] = -points[:,1]
|
||||
|
||||
new_points[:, 0] = points[:, 0]
|
||||
new_points[:, 1] = points[:, 2]
|
||||
new_points[:, 2] = -points[:, 1]
|
||||
|
||||
this_poly = LayerPolygon.LayerPolygon(layer_data, extruder, line_types, new_points, line_widths)
|
||||
this_poly.buildCache()
|
||||
|
|
@ -185,4 +183,3 @@ class ProcessSlicedLayersJob(Job):
|
|||
else:
|
||||
if self._progress:
|
||||
self._progress.hide()
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ from UM.Scene.SceneNode import SceneNode
|
|||
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
|
||||
|
||||
from UM.Settings.Validator import ValidatorState
|
||||
from UM.Settings.SettingRelation import RelationType
|
||||
|
||||
from cura.OneAtATimeIterator import OneAtATimeIterator
|
||||
|
||||
|
|
@ -24,6 +25,7 @@ class StartJobResult(IntEnum):
|
|||
SettingError = 3
|
||||
NothingToSlice = 4
|
||||
|
||||
|
||||
## Formatter class that handles token expansion in start/end gcod
|
||||
class GcodeStartEndFormatter(Formatter):
|
||||
def get_value(self, key, args, kwargs): # [CodeStyle: get_value is an overridden function from the Formatter class]
|
||||
|
|
@ -37,6 +39,7 @@ class GcodeStartEndFormatter(Formatter):
|
|||
Logger.log("w", "Incorrectly formatted placeholder '%s' in start/end gcode", key)
|
||||
return "{" + str(key) + "}"
|
||||
|
||||
|
||||
## Job class that builds up the message of scene data to send to CuraEngine.
|
||||
class StartSliceJob(Job):
|
||||
def __init__(self, slice_message):
|
||||
|
|
@ -71,7 +74,7 @@ class StartSliceJob(Job):
|
|||
return
|
||||
|
||||
# Don't slice if there is a setting with an error value.
|
||||
if self._checkStackForErrors(stack):
|
||||
if not Application.getInstance().getMachineManager().isActiveStackValid:
|
||||
self.setResult(StartJobResult.SettingError)
|
||||
return
|
||||
|
||||
|
|
@ -123,11 +126,15 @@ class StartSliceJob(Job):
|
|||
if temp_list:
|
||||
object_groups.append(temp_list)
|
||||
|
||||
# There are cases when there is nothing to slice. This can happen due to one at a time slicing not being
|
||||
# able to find a possible sequence or because there are no objects on the build plate (or they are outside
|
||||
# the build volume)
|
||||
if not object_groups:
|
||||
self.setResult(StartJobResult.NothingToSlice)
|
||||
return
|
||||
|
||||
self._buildGlobalSettingsMessage(stack)
|
||||
self._buildGlobalInheritsStackMessage(stack)
|
||||
|
||||
for extruder_stack in cura.Settings.ExtruderManager.getInstance().getMachineExtruders(stack.getId()):
|
||||
self._buildExtruderMessage(extruder_stack)
|
||||
|
|
@ -171,6 +178,7 @@ class StartSliceJob(Job):
|
|||
Logger.logException("w", "Unable to do token replacement on start/end gcode")
|
||||
return str(value).encode("utf-8")
|
||||
|
||||
## Create extruder message from stack
|
||||
def _buildExtruderMessage(self, stack):
|
||||
message = self._slice_message.addRepeatedMessage("extruders")
|
||||
message.id = int(stack.getMetaDataEntry("position"))
|
||||
|
|
@ -209,11 +217,54 @@ class StartSliceJob(Job):
|
|||
else:
|
||||
setting_message.value = str(value).encode("utf-8")
|
||||
|
||||
## Sends for some settings which extruder they should fallback to if not
|
||||
# set.
|
||||
#
|
||||
# This is only set for settings that have the global_inherits_stack
|
||||
# property.
|
||||
#
|
||||
# \param stack The global stack with all settings, from which to read the
|
||||
# global_inherits_stack property.
|
||||
def _buildGlobalInheritsStackMessage(self, stack):
|
||||
for key in stack.getAllKeys():
|
||||
extruder = int(stack.getProperty(key, "global_inherits_stack"))
|
||||
if extruder >= 0: #Set to a specific extruder.
|
||||
setting_extruder = self._slice_message.addRepeatedMessage("global_inherits_stack")
|
||||
setting_extruder.name = key
|
||||
setting_extruder.extruder = extruder
|
||||
|
||||
## Check if a node has per object settings and ensure that they are set correctly in the message
|
||||
# \param node \type{SceneNode} Node to check.
|
||||
# \param message object_lists message to put the per object settings in
|
||||
def _handlePerObjectSettings(self, node, message):
|
||||
stack = node.callDecoration("getStack")
|
||||
# Check if the node has a stack attached to it and the stack has any settings in the top container.
|
||||
if stack:
|
||||
for key in stack.getAllKeys():
|
||||
# Check all settings for relations, so we can also calculate the correct values for dependant settings.
|
||||
changed_setting_keys = set(stack.getTop().getAllKeys())
|
||||
for key in stack.getTop().getAllKeys():
|
||||
instance = stack.getTop().getInstance(key)
|
||||
self._addRelations(changed_setting_keys, instance.definition.relations)
|
||||
Job.yieldThread()
|
||||
|
||||
# Ensure that the engine is aware what the build extruder is
|
||||
if stack.getProperty("machine_extruder_count", "value") > 1:
|
||||
changed_setting_keys.add("extruder_nr")
|
||||
|
||||
# Get values for all changed settings
|
||||
for key in changed_setting_keys:
|
||||
setting = message.addRepeatedMessage("settings")
|
||||
setting.name = key
|
||||
setting.value = str(stack.getProperty(key, "value")).encode("utf-8")
|
||||
Job.yieldThread()
|
||||
|
||||
## Recursive function to put all settings that require eachother for value changes in a list
|
||||
# \param relations_set \type{set} Set of keys (strings) of settings that are influenced
|
||||
# \param relations list of relation objects that need to be checked.
|
||||
def _addRelations(self, relations_set, relations):
|
||||
for relation in filter(lambda r: r.role == "value", relations):
|
||||
if relation.type == RelationType.RequiresTarget:
|
||||
continue
|
||||
|
||||
relations_set.add(relation.target.key)
|
||||
self._addRelations(relations_set, relation.target.relations)
|
||||
|
|
@ -9,6 +9,8 @@ import UM.Settings.ContainerRegistry
|
|||
from cura.CuraApplication import CuraApplication
|
||||
from cura.Settings.ExtruderManager import ExtruderManager
|
||||
|
||||
from UM.Settings.InstanceContainer import InstanceContainer
|
||||
|
||||
import re #For escaping characters in the settings.
|
||||
import json
|
||||
|
||||
|
|
@ -61,6 +63,20 @@ class GCodeWriter(MeshWriter):
|
|||
|
||||
return False
|
||||
|
||||
## Create a new container with container 2 as base and container 1 written over it.
|
||||
def _createFlattenedContainerInstance(self, instance_container1, instance_container2):
|
||||
flat_container = InstanceContainer(instance_container2.getName())
|
||||
flat_container.setDefinition(instance_container2.getDefinition())
|
||||
flat_container.setMetaData(instance_container2.getMetaData())
|
||||
|
||||
for key in instance_container2.getAllKeys():
|
||||
flat_container.setProperty(key, "value", instance_container2.getProperty(key, "value"))
|
||||
|
||||
for key in instance_container1.getAllKeys():
|
||||
flat_container.setProperty(key, "value", instance_container1.getProperty(key, "value"))
|
||||
return flat_container
|
||||
|
||||
|
||||
## Serialises a container stack to prepare it for writing at the end of the
|
||||
# g-code.
|
||||
#
|
||||
|
|
@ -74,38 +90,13 @@ class GCodeWriter(MeshWriter):
|
|||
prefix_length = len(prefix)
|
||||
|
||||
container_with_profile = stack.findContainer({"type": "quality"})
|
||||
machine_manager = CuraApplication.getInstance().getMachineManager()
|
||||
|
||||
# Duplicate the current quality profile and update it with any user settings.
|
||||
flat_quality_id = machine_manager.duplicateContainer(container_with_profile.getId())
|
||||
|
||||
flat_quality = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = flat_quality_id)[0]
|
||||
flat_quality._dirty = False
|
||||
user_settings = stack.getTop()
|
||||
|
||||
# We don't want to send out any signals, so disconnect them.
|
||||
flat_quality.propertyChanged.disconnectAll()
|
||||
|
||||
for key in user_settings.getAllKeys():
|
||||
flat_quality.setProperty(key, "value", user_settings.getProperty(key, "value"))
|
||||
|
||||
serialized = flat_quality.serialize()
|
||||
|
||||
flat_global_container = self._createFlattenedContainerInstance(stack.getTop(),container_with_profile)
|
||||
serialized = flat_global_container.serialize()
|
||||
data = {"global_quality": serialized}
|
||||
manager = ExtruderManager.getInstance()
|
||||
for extruder in manager.getMachineExtruders(stack.getId()):
|
||||
|
||||
for extruder in ExtruderManager.getInstance().getMachineExtruders(stack.getId()):
|
||||
extruder_quality = extruder.findContainer({"type": "quality"})
|
||||
|
||||
flat_extruder_quality_id = machine_manager.duplicateContainer(extruder_quality.getId())
|
||||
flat_extruder_quality = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id=flat_extruder_quality_id)[0]
|
||||
flat_extruder_quality._dirty = False
|
||||
extruder_user_settings = extruder.getTop()
|
||||
|
||||
# We don't want to send out any signals, so disconnect them.
|
||||
flat_extruder_quality.propertyChanged.disconnectAll()
|
||||
|
||||
for key in extruder_user_settings.getAllKeys():
|
||||
flat_extruder_quality.setProperty(key, "value", extruder_user_settings.getProperty(key, "value"))
|
||||
flat_extruder_quality = self._createFlattenedContainerInstance(extruder.getTop(), extruder_quality)
|
||||
|
||||
extruder_serialized = flat_extruder_quality.serialize()
|
||||
data.setdefault("extruder_quality", []).append(extruder_serialized)
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ from UM.Math.Color import Color
|
|||
from UM.Mesh.MeshBuilder import MeshBuilder
|
||||
from UM.Job import Job
|
||||
from UM.Preferences import Preferences
|
||||
from UM.Logger import Logger
|
||||
|
||||
from UM.View.RenderBatch import RenderBatch
|
||||
from UM.View.GL.OpenGL import OpenGL
|
||||
|
|
@ -34,7 +35,7 @@ class LayerView(View):
|
|||
self._shader = None
|
||||
self._selection_shader = None
|
||||
self._num_layers = 0
|
||||
self._layer_percentage = 0 # what percentage of layers need to be shown (SLider gives value between 0 - 100)
|
||||
self._layer_percentage = 0 # what percentage of layers need to be shown (Slider gives value between 0 - 100)
|
||||
self._proxy = LayerViewProxy.LayerViewProxy()
|
||||
self._controller.getScene().getRoot().childrenChanged.connect(self._onSceneChanged)
|
||||
self._max_layers = 0
|
||||
|
|
@ -43,12 +44,14 @@ class LayerView(View):
|
|||
self._current_layer_jumps = None
|
||||
self._top_layers_job = None
|
||||
self._activity = False
|
||||
self._old_max_layers = 0
|
||||
|
||||
Preferences.getInstance().addPreference("view/top_layer_count", 5)
|
||||
Preferences.getInstance().addPreference("view/only_show_top_layers", False)
|
||||
Preferences.getInstance().preferenceChanged.connect(self._onPreferencesChanged)
|
||||
|
||||
self._solid_layers = int(Preferences.getInstance().getValue("view/top_layer_count"))
|
||||
|
||||
self._only_show_top_layers = bool(Preferences.getInstance().getValue("view/only_show_top_layers"))
|
||||
self._busy = False
|
||||
|
||||
def getActivity(self):
|
||||
|
|
@ -100,7 +103,7 @@ class LayerView(View):
|
|||
continue
|
||||
|
||||
# Render all layers below a certain number as line mesh instead of vertices.
|
||||
if self._current_layer_num - self._solid_layers > -1:
|
||||
if self._current_layer_num - self._solid_layers > -1 and not self._only_show_top_layers:
|
||||
start = 0
|
||||
end = 0
|
||||
element_counts = layer_data.getElementCounts()
|
||||
|
|
@ -126,14 +129,12 @@ class LayerView(View):
|
|||
if self._current_layer_num > self._max_layers:
|
||||
self._current_layer_num = self._max_layers
|
||||
|
||||
self.resetLayerData()
|
||||
self._startUpdateTopLayers()
|
||||
|
||||
self.currentLayerNumChanged.emit()
|
||||
|
||||
def calculateMaxLayers(self):
|
||||
scene = self.getController().getScene()
|
||||
renderer = self.getRenderer() # TODO: @UnusedVariable
|
||||
self._activity = True
|
||||
|
||||
self._old_max_layers = self._max_layers
|
||||
|
|
@ -199,7 +200,7 @@ class LayerView(View):
|
|||
|
||||
if not job.getResult():
|
||||
return
|
||||
|
||||
self.resetLayerData() # Reset the layer data only when job is done. Doing it now prevents "blinking" data.
|
||||
self._current_layer_mesh = job.getResult().get("layers")
|
||||
self._current_layer_jumps = job.getResult().get("jumps")
|
||||
self._controller.getScene().sceneChanged.emit(self._controller.getScene().getRoot())
|
||||
|
|
@ -207,14 +208,15 @@ class LayerView(View):
|
|||
self._top_layers_job = None
|
||||
|
||||
def _onPreferencesChanged(self, preference):
|
||||
if preference != "view/top_layer_count":
|
||||
if preference != "view/top_layer_count" and preference != "view/only_show_top_layers":
|
||||
return
|
||||
|
||||
self._solid_layers = int(Preferences.getInstance().getValue("view/top_layer_count"))
|
||||
self._only_show_top_layers = bool(Preferences.getInstance().getValue("view/only_show_top_layers"))
|
||||
|
||||
self.resetLayerData()
|
||||
self._startUpdateTopLayers()
|
||||
|
||||
|
||||
class _CreateTopLayersJob(Job):
|
||||
def __init__(self, scene, layer_number, solid_layers):
|
||||
super().__init__()
|
||||
|
|
@ -242,20 +244,20 @@ class _CreateTopLayersJob(Job):
|
|||
|
||||
try:
|
||||
layer = layer_data.getLayer(layer_number).createMesh()
|
||||
except Exception as e:
|
||||
print(e)
|
||||
except Exception:
|
||||
Logger.logException("w", "An exception occurred while creating layer mesh.")
|
||||
return
|
||||
|
||||
if not layer or layer.getVertices() is None:
|
||||
continue
|
||||
|
||||
layer_mesh.addIndices(layer_mesh._vertex_count+layer.getIndices())
|
||||
layer_mesh.addIndices(layer_mesh.getVertexCount() + layer.getIndices())
|
||||
layer_mesh.addVertices(layer.getVertices())
|
||||
|
||||
# Scale layer color by a brightness factor based on the current layer number
|
||||
# This will result in a range of 0.5 - 1.0 to multiply colors by.
|
||||
brightness = numpy.ones((1,4), dtype=numpy.float32) * (2.0 - (i / self._solid_layers)) / 2.0
|
||||
brightness[0, 3] = 1.0;
|
||||
brightness = numpy.ones((1, 4), dtype=numpy.float32) * (2.0 - (i / self._solid_layers)) / 2.0
|
||||
brightness[0, 3] = 1.0
|
||||
layer_mesh.addColors(layer.getColors() * brightness)
|
||||
|
||||
if self._cancel:
|
||||
|
|
@ -271,7 +273,7 @@ class _CreateTopLayersJob(Job):
|
|||
if not jump_mesh or jump_mesh.getVertices() is None:
|
||||
jump_mesh = None
|
||||
|
||||
self.setResult({ "layers": layer_mesh.build(), "jumps": jump_mesh })
|
||||
self.setResult({"layers": layer_mesh.build(), "jumps": jump_mesh})
|
||||
|
||||
def cancel(self):
|
||||
self._cancel = True
|
||||
|
|
|
|||
|
|
@ -47,7 +47,9 @@ Item {
|
|||
id: extruders_model
|
||||
onRowsInserted: extruderSelector.visible = extruders_model.rowCount() > 1
|
||||
onModelReset: extruderSelector.visible = extruders_model.rowCount() > 1
|
||||
onModelChanged: extruderSelector.color = extruders_model.getItem(extruderSelector.currentIndex).colour
|
||||
}
|
||||
property string color: extruders_model.getItem(extruderSelector.currentIndex).colour
|
||||
visible: extruders_model.rowCount() > 1
|
||||
textRole: "name"
|
||||
width: UM.Theme.getSize("setting_control").width
|
||||
|
|
@ -88,7 +90,7 @@ Item {
|
|||
anchors.leftMargin: UM.Theme.getSize("default_lining").width
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
color: extruders_model.getItem(extruderSelector.currentIndex).colour
|
||||
color: extruderSelector.color
|
||||
border.width: UM.Theme.getSize("default_lining").width
|
||||
border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : UM.Theme.getColor("setting_control_border")
|
||||
}
|
||||
|
|
@ -125,7 +127,11 @@ Item {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted:
|
||||
{
|
||||
// Ensure primary extruder is set as active
|
||||
UM.ActiveTool.setProperty("SelectedActiveExtruder", extruders_model.getItem(0).id)
|
||||
}
|
||||
onActivated: UM.ActiveTool.setProperty("SelectedActiveExtruder", extruders_model.getItem(index).id);
|
||||
onModelChanged: updateCurrentIndex();
|
||||
|
||||
|
|
@ -136,6 +142,7 @@ Item {
|
|||
if(extruders_model.getItem(i).id == UM.ActiveTool.properties.getValue("SelectedActiveExtruder"))
|
||||
{
|
||||
extruderSelector.currentIndex = i;
|
||||
extruderSelector.color = extruders_model.getItem(i).colour;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -243,6 +250,7 @@ Item {
|
|||
key: model.key
|
||||
watchedProperties: [ "value", "enabled", "validationState" ]
|
||||
storeIndex: 0
|
||||
removeUnusedValue: false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
from UM.View.View import View
|
||||
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
|
||||
from UM.Scene.Selection import Selection
|
||||
from UM.Resources import Resources
|
||||
from UM.Application import Application
|
||||
from UM.Preferences import Preferences
|
||||
|
|
@ -57,25 +58,28 @@ class SolidView(View):
|
|||
# renderer.queueNode(scene.getRoot(), mesh = node.getBoundingBoxMesh(),mode = Renderer.RenderLines)
|
||||
|
||||
uniforms = {}
|
||||
if self._extruders_model.rowCount() > 0:
|
||||
if self._extruders_model.rowCount() == 0:
|
||||
material = Application.getInstance().getGlobalContainerStack().findContainer({ "type": "material" })
|
||||
material_color = material.getMetaDataEntry("color_code", default = self._extruders_model.defaultColours[0]) if material else self._extruders_model.defaultColours[0]
|
||||
else:
|
||||
# Get color to render this mesh in from ExtrudersModel
|
||||
extruder_index = 0
|
||||
extruder_id = node.callDecoration("getActiveExtruder")
|
||||
if extruder_id:
|
||||
extruder_index = max(0, self._extruders_model.find("id", extruder_id))
|
||||
|
||||
extruder_color = self._extruders_model.getItem(extruder_index)["colour"]
|
||||
try:
|
||||
# Colors are passed as rgb hex strings (eg "#ffffff"), and the shader needs
|
||||
# an rgba list of floats (eg [1.0, 1.0, 1.0, 1.0])
|
||||
uniforms["diffuse_color"] = [
|
||||
int(extruder_color[1:3], 16) / 255,
|
||||
int(extruder_color[3:5], 16) / 255,
|
||||
int(extruder_color[5:7], 16) / 255,
|
||||
1.0
|
||||
]
|
||||
except ValueError:
|
||||
pass
|
||||
material_color = self._extruders_model.getItem(extruder_index)["colour"]
|
||||
try:
|
||||
# Colors are passed as rgb hex strings (eg "#ffffff"), and the shader needs
|
||||
# an rgba list of floats (eg [1.0, 1.0, 1.0, 1.0])
|
||||
uniforms["diffuse_color"] = [
|
||||
int(material_color[1:3], 16) / 255,
|
||||
int(material_color[3:5], 16) / 255,
|
||||
int(material_color[5:7], 16) / 255,
|
||||
1.0
|
||||
]
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
if hasattr(node, "_outside_buildarea"):
|
||||
if node._outside_buildarea:
|
||||
|
|
@ -84,7 +88,7 @@ class SolidView(View):
|
|||
renderer.queueNode(node, shader = self._enabled_shader, uniforms = uniforms)
|
||||
else:
|
||||
renderer.queueNode(node, material = self._enabled_shader, uniforms = uniforms)
|
||||
if node.callDecoration("isGroup"):
|
||||
if node.callDecoration("isGroup") and Selection.isSelected(node):
|
||||
renderer.queueNode(scene.getRoot(), mesh = node.getBoundingBoxMesh(), mode = Renderer.RenderLines)
|
||||
|
||||
def endRendering(self):
|
||||
|
|
|
|||
|
|
@ -18,6 +18,11 @@ class BedLevelMachineAction(MachineAction):
|
|||
pass
|
||||
|
||||
def _reset(self):
|
||||
self._bed_level_position = 0
|
||||
pass
|
||||
|
||||
@pyqtSlot()
|
||||
def startBedLeveling(self):
|
||||
self._bed_level_position = 0
|
||||
printer_output_devices = self._getPrinterOutputDevices()
|
||||
if printer_output_devices:
|
||||
|
|
@ -52,4 +57,5 @@ class BedLevelMachineAction(MachineAction):
|
|||
output_device.moveHead(0, 0, -3)
|
||||
self._bed_level_position += 1
|
||||
elif self._bed_level_position >= 3:
|
||||
output_device.sendCommand("M18") # Turn off all motors so the user can move the axes
|
||||
self.setFinished()
|
||||
|
|
@ -47,37 +47,37 @@ Cura.MachineAction
|
|||
text: catalog.i18nc("@label", "For every position; insert a piece of paper under the nozzle and adjust the print bed height. The print bed height is right when the paper is slightly gripped by the tip of the nozzle.")
|
||||
}
|
||||
|
||||
Item
|
||||
Row
|
||||
{
|
||||
id: bedlevelingWrapper
|
||||
anchors.top: bedlevelingText.bottom
|
||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
height: skipBedlevelingButton.height
|
||||
width: bedlevelingButton.width + skipBedlevelingButton.width + UM.Theme.getSize("default_margin").height < bedLevelMachineAction.width ? bedlevelingButton.width + skipBedlevelingButton.width + UM.Theme.getSize("default_margin").height : bedLevelMachineAction.width
|
||||
width: childrenRect.width
|
||||
spacing: UM.Theme.getSize("default_margin").width
|
||||
|
||||
Button
|
||||
{
|
||||
id: bedlevelingButton
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
text: catalog.i18nc("@action:button","Move to Next Position");
|
||||
id: startBedLevelingButton
|
||||
text: catalog.i18nc("@action:button","Start Bed Leveling")
|
||||
onClicked:
|
||||
{
|
||||
manager.moveToNextLevelPosition()
|
||||
startBedLevelingButton.visible = false;
|
||||
bedlevelingButton.visible = true;
|
||||
checkupMachineAction.heatupHotendStarted = false;
|
||||
checkupMachineAction.heatupBedStarted = false;
|
||||
manager.startCheck();
|
||||
}
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
id: skipBedlevelingButton
|
||||
anchors.top: parent.width < bedLevelMachineAction.width ? parent.top : bedlevelingButton.bottom
|
||||
anchors.topMargin: parent.width < bedLevelMachineAction.width ? 0 : UM.Theme.getSize("default_margin").height/2
|
||||
anchors.left: parent.width < bedLevelMachineAction.width ? bedlevelingButton.right : parent.left
|
||||
anchors.leftMargin: parent.width < bedLevelMachineAction.width ? UM.Theme.getSize("default_margin").width : 0
|
||||
text: catalog.i18nc("@action:button","Skip bed leveling");
|
||||
id: bedlevelingButton
|
||||
text: catalog.i18nc("@action:button","Move to Next Position")
|
||||
visible: false
|
||||
onClicked:
|
||||
{
|
||||
manager.setFinished()
|
||||
manager.moveToNextLevelPosition();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,6 +155,7 @@ class UMOCheckupMachineAction(MachineAction):
|
|||
if output_devices:
|
||||
self._output_device = output_devices[0]
|
||||
try:
|
||||
self._output_device.sendCommand("M18") # Turn off all motors so the user can move the axes
|
||||
self._output_device.startPollEndstop()
|
||||
self._output_device.bedTemperatureChanged.connect(self.bedTemperatureChanged)
|
||||
self._output_device.hotendTemperaturesChanged.connect(self.hotendTemperatureChanged)
|
||||
|
|
|
|||
|
|
@ -39,38 +39,26 @@ Cura.MachineAction
|
|||
text: catalog.i18nc("@label", "It's a good idea to do a few sanity checks on your Ultimaker. You can skip this step if you know your machine is functional");
|
||||
}
|
||||
|
||||
Item
|
||||
Row
|
||||
{
|
||||
id: startStopButtons
|
||||
anchors.top: pageDescription.bottom
|
||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
height: childrenRect.height
|
||||
width: startCheckButton.width + skipCheckButton.width + UM.Theme.getSize("default_margin").height < checkupMachineAction.width ? startCheckButton.width + skipCheckButton.width + UM.Theme.getSize("default_margin").height : checkupMachineAction.width
|
||||
width: childrenRect.width
|
||||
spacing: UM.Theme.getSize("default_margin").width
|
||||
Button
|
||||
{
|
||||
id: startCheckButton
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
text: catalog.i18nc("@action:button","Start Printer Check");
|
||||
onClicked:
|
||||
{
|
||||
checkupMachineAction.heatupHotendStarted = false
|
||||
checkupMachineAction.heatupBedStarted = false
|
||||
manager.startCheck()
|
||||
checkupMachineAction.heatupHotendStarted = false;
|
||||
checkupMachineAction.heatupBedStarted = false;
|
||||
manager.startCheck();
|
||||
startCheckButton.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
id: skipCheckButton
|
||||
anchors.top: parent.width < checkupMachineAction.width ? parent.top : startCheckButton.bottom
|
||||
anchors.topMargin: parent.width < checkupMachineAction.width ? 0 : UM.Theme.getSize("default_margin").height/2
|
||||
anchors.left: parent.width < checkupMachineAction.width ? startCheckButton.right : parent.left
|
||||
anchors.leftMargin: parent.width < checkupMachineAction.width ? UM.Theme.getSize("default_margin").width : 0
|
||||
text: catalog.i18nc("@action:button", "Skip Printer Check");
|
||||
onClicked: manager.setFinished()
|
||||
}
|
||||
}
|
||||
|
||||
Item
|
||||
|
|
|
|||
|
|
@ -12,6 +12,9 @@ class UMOUpgradeSelection(MachineAction):
|
|||
super().__init__("UMOUpgradeSelection", catalog.i18nc("@action", "Select upgrades"))
|
||||
self._qml_url = "UMOUpgradeSelectionMachineAction.qml"
|
||||
|
||||
def _reset(self):
|
||||
self.heatedBedChanged.emit()
|
||||
|
||||
heatedBedChanged = pyqtSignal()
|
||||
|
||||
@pyqtProperty(bool, notify = heatedBedChanged)
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ Cura.MachineAction
|
|||
|
||||
text: catalog.i18nc("@label", "Heated bed (official kit or self-built)")
|
||||
checked: manager.hasHeatedBed
|
||||
onClicked: manager.hasHeatedBed ? manager.removeHeatedBed() : manager.addHeatedBed()
|
||||
onClicked: checked ? manager.addHeatedBed() : manager.removeHeatedBed()
|
||||
}
|
||||
|
||||
UM.I18nCatalog { id: catalog; name: "cura"; }
|
||||
|
|
|
|||
|
|
@ -56,29 +56,21 @@ Cura.MachineAction
|
|||
wrapMode: Text.WordWrap
|
||||
text: catalog.i18nc("@label", "Cura requires these new features and thus your firmware will most likely need to be upgraded. You can do so now.");
|
||||
}
|
||||
Item
|
||||
Row
|
||||
{
|
||||
anchors.top: upgradeText2.bottom
|
||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
width: upgradeButton.width + skipUpgradeButton.width + UM.Theme.getSize("default_margin").height < upgradeFirmwareMachineAction.width ? upgradeButton.width + skipUpgradeButton.width + UM.Theme.getSize("default_margin").height : upgradeFirmwareMachineAction.width
|
||||
width: childrenRect.width
|
||||
spacing: UM.Theme.getSize("default_margin").width
|
||||
Button
|
||||
{
|
||||
id: upgradeButton
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
text: catalog.i18nc("@action:button","Upgrade to Marlin Firmware");
|
||||
onClicked: Cura.USBPrinterManager.updateAllFirmware()
|
||||
}
|
||||
Button
|
||||
{
|
||||
id: skipUpgradeButton
|
||||
anchors.top: parent.width < upgradeFirmwareMachineAction.width ? parent.top : upgradeButton.bottom
|
||||
anchors.topMargin: parent.width < upgradeFirmwareMachineAction.width ? 0 : UM.Theme.getSize("default_margin").height / 2
|
||||
anchors.left: parent.width < upgradeFirmwareMachineAction.width ? upgradeButton.right : parent.left
|
||||
anchors.leftMargin: parent.width < upgradeFirmwareMachineAction.width ? UM.Theme.getSize("default_margin").width : 0
|
||||
text: catalog.i18nc("@action:button", "Skip Upgrade");
|
||||
onClicked: manager.setFinished()
|
||||
onClicked:
|
||||
{
|
||||
Cura.USBPrinterManager.updateAllFirmware()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue