Merge branch '4.1' of github.com:Ultimaker/Cura

This commit is contained in:
Jaime van Kessel 2019-04-30 10:51:33 +02:00
commit 6fbbed9c06
4 changed files with 20 additions and 11 deletions

View file

@ -70,7 +70,7 @@ class DiscoveredPrinter(QObject):
# In ClusterUM3OutputDevice, when it updates a printer information, it updates the machine type using the field # In ClusterUM3OutputDevice, when it updates a printer information, it updates the machine type using the field
# "machine_variant", and for some reason, it's not the machine type ID/codename/... but a human-readable string # "machine_variant", and for some reason, it's not the machine type ID/codename/... but a human-readable string
# like "Ultimaker 3". The code below handles this case. # like "Ultimaker 3". The code below handles this case.
if machine_manager.hasMachineTypeName(self._machine_type): if machine_manager.hasHumanReadableMachineTypeName(self._machine_type):
readable_type = self._machine_type readable_type = self._machine_type
else: else:
readable_type = machine_manager.getMachineTypeNameFromId(self._machine_type) readable_type = machine_manager.getMachineTypeNameFromId(self._machine_type)
@ -82,7 +82,7 @@ class DiscoveredPrinter(QObject):
def isUnknownMachineType(self) -> bool: def isUnknownMachineType(self) -> bool:
from cura.CuraApplication import CuraApplication from cura.CuraApplication import CuraApplication
machine_manager = CuraApplication.getInstance().getMachineManager() machine_manager = CuraApplication.getInstance().getMachineManager()
if machine_manager.hasMachineTypeName(self._machine_type): if machine_manager.hasHumanReadableMachineTypeName(self._machine_type):
readable_type = self._machine_type readable_type = self._machine_type
else: else:
readable_type = machine_manager.getMachineTypeNameFromId(self._machine_type) readable_type = machine_manager.getMachineTypeNameFromId(self._machine_type)

View file

@ -1640,7 +1640,10 @@ class MachineManager(QObject):
return abbr_machine return abbr_machine
def hasMachineTypeName(self, machine_type_name: str) -> bool: # Checks if the given machine type name in the available machine list.
# The machine type is a code name such as "ultimaker_3", while the machine type name is the human-readable name of
# the machine type, which is "Ultimaker 3" for "ultimaker_3".
def hasHumanReadableMachineTypeName(self, machine_type_name: str) -> bool:
results = self._container_registry.findDefinitionContainersMetadata(name = machine_type_name) results = self._container_registry.findDefinitionContainersMetadata(name = machine_type_name)
return len(results) > 0 return len(results) > 0

View file

@ -256,10 +256,7 @@ class StartSliceJob(Job):
self._buildGlobalInheritsStackMessage(stack) self._buildGlobalInheritsStackMessage(stack)
# Build messages for extruder stacks # Build messages for extruder stacks
# Send the extruder settings in the order of extruder positions. Somehow, if you send e.g. extruder 3 first, for extruder_stack in global_stack.extruderList:
# then CuraEngine can slice with the wrong settings. This I think should be fixed in CuraEngine as well.
extruder_stack_list = sorted(list(global_stack.extruders.items()), key = lambda item: int(item[0]))
for _, extruder_stack in extruder_stack_list:
self._buildExtruderMessage(extruder_stack) self._buildExtruderMessage(extruder_stack)
for group in filtered_object_groups: for group in filtered_object_groups:

View file

@ -268,13 +268,16 @@ Item
right: contentHeader.xPosCloseButton right: contentHeader.xPosCloseButton
} }
property var clickPos: Qt.point(0, 0) property var clickPos: Qt.point(0, 0)
property bool dragging: false
onPressed: onPressed:
{ {
clickPos = Qt.point(mouse.x, mouse.y); clickPos = Qt.point(mouse.x, mouse.y);
dragging = true
} }
onPositionChanged: onPositionChanged:
{
if(dragging)
{ {
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y); var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y);
if (delta.x !== 0 || delta.y !== 0) if (delta.x !== 0 || delta.y !== 0)
@ -282,9 +285,15 @@ Item
contentContainer.trySetPosition(contentContainer.x + delta.x, contentContainer.y + delta.y); contentContainer.trySetPosition(contentContainer.x + delta.x, contentContainer.y + delta.y);
} }
} }
}
onReleased:
{
dragging = false
}
onDoubleClicked: onDoubleClicked:
{ {
dragging = false
contentContainer.trySetPosition(0, 0); contentContainer.trySetPosition(0, 0);
} }