Merge remote-tracking branch 'origin/master' into CURA-5296_bundled_packages

This commit is contained in:
Ian Paschal 2018-05-07 15:47:28 +02:00
commit 6dbbfe91db
11 changed files with 45 additions and 25 deletions

1
.gitignore vendored
View file

@ -14,6 +14,7 @@ CuraEngine.exe
LC_MESSAGES LC_MESSAGES
.cache .cache
*.qmlc *.qmlc
.mypy_cache
#MacOS #MacOS
.DS_Store .DS_Store

View file

@ -1,4 +1,4 @@
# Copyright (c) 2017 Ultimaker B.V. # Copyright (c) 2018 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher. # Cura is released under the terms of the LGPLv3 or higher.
enable_testing() enable_testing()
@ -53,3 +53,9 @@ foreach(_plugin ${_plugins})
cura_add_test(NAME pytest-${_plugin_name} DIRECTORY ${_plugin_directory} PYTHONPATH "${_plugin_directory}|${CMAKE_SOURCE_DIR}|${URANIUM_DIR}") cura_add_test(NAME pytest-${_plugin_name} DIRECTORY ${_plugin_directory} PYTHONPATH "${_plugin_directory}|${CMAKE_SOURCE_DIR}|${URANIUM_DIR}")
endif() endif()
endforeach() endforeach()
#Add code style test.
add_test(
NAME "code-style"
COMMAND ${PYTHON_EXECUTABLE} run_mypy.py WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)

View file

@ -402,7 +402,8 @@ class ExtruderManager(QObject):
# Register the extruder trains by position # Register the extruder trains by position
for extruder_train in extruder_trains: for extruder_train in extruder_trains:
self._extruder_trains[global_stack_id][extruder_train.getMetaDataEntry("position")] = extruder_train extruder_position = extruder_train.getMetaDataEntry("position")
self._extruder_trains[global_stack_id][extruder_position] = extruder_train
# regardless of what the next stack is, we have to set it again, because of signal routing. ??? # regardless of what the next stack is, we have to set it again, because of signal routing. ???
extruder_train.setParent(global_stack) extruder_train.setParent(global_stack)

View file

@ -38,7 +38,7 @@ class ExtruderStack(CuraContainerStack):
# #
# This will set the next stack and ensure that we register this stack as an extruder. # This will set the next stack and ensure that we register this stack as an extruder.
@override(ContainerStack) @override(ContainerStack)
def setNextStack(self, stack: CuraContainerStack) -> None: def setNextStack(self, stack: CuraContainerStack, connect_signals: bool = True) -> None:
super().setNextStack(stack) super().setNextStack(stack)
stack.addExtruder(self) stack.addExtruder(self)
self.addMetaDataEntry("machine", stack.id) self.addMetaDataEntry("machine", stack.id)

View file

@ -125,7 +125,7 @@ class GlobalStack(CuraContainerStack):
# #
# This will simply raise an exception since the Global stack cannot have a next stack. # This will simply raise an exception since the Global stack cannot have a next stack.
@override(ContainerStack) @override(ContainerStack)
def setNextStack(self, next_stack: ContainerStack) -> None: def setNextStack(self, stack: CuraContainerStack, connect_signals: bool = True) -> None:
raise Exceptions.InvalidOperationError("Global stack cannot have a next stack!") raise Exceptions.InvalidOperationError("Global stack cannot have a next stack!")
# protected: # protected:
@ -153,6 +153,23 @@ class GlobalStack(CuraContainerStack):
return True return True
## Perform some sanity checks on the global stack
# Sanity check for extruders; they must have positions 0 and up to machine_extruder_count - 1
def isValid(self):
container_registry = ContainerRegistry.getInstance()
extruder_trains = container_registry.findContainerStacks(type = "extruder_train", machine = self.getId())
machine_extruder_count = self.getProperty("machine_extruder_count", "value")
extruder_check_position = set()
for extruder_train in extruder_trains:
extruder_position = extruder_train.getMetaDataEntry("position")
extruder_check_position.add(extruder_position)
for check_position in range(machine_extruder_count):
if str(check_position) not in extruder_check_position:
return False
return True
## private: ## private:
global_stack_mime = MimeType( global_stack_mime = MimeType(

View file

@ -6,6 +6,7 @@ import time
#Type hinting. #Type hinting.
from typing import List, Dict, TYPE_CHECKING, Optional from typing import List, Dict, TYPE_CHECKING, Optional
from UM.ConfigurationErrorMessage import ConfigurationErrorMessage
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
from UM.Settings.InstanceContainer import InstanceContainer from UM.Settings.InstanceContainer import InstanceContainer
from UM.Settings.Interfaces import ContainerInterface from UM.Settings.Interfaces import ContainerInterface
@ -167,8 +168,6 @@ class MachineManager(QObject):
if active_machine_id != "" and ContainerRegistry.getInstance().findContainerStacksMetadata(id = active_machine_id): if active_machine_id != "" and ContainerRegistry.getInstance().findContainerStacksMetadata(id = active_machine_id):
# An active machine was saved, so restore it. # An active machine was saved, so restore it.
self.setActiveMachine(active_machine_id) self.setActiveMachine(active_machine_id)
# Make sure _active_container_stack is properly initiated
ExtruderManager.getInstance().setActiveExtruderIndex(0)
def _onOutputDevicesChanged(self) -> None: def _onOutputDevicesChanged(self) -> None:
self._printer_output_devices = [] self._printer_output_devices = []
@ -359,6 +358,10 @@ class MachineManager(QObject):
return return
global_stack = containers[0] global_stack = containers[0]
if not global_stack.isValid():
# Mark global stack as invalid
ConfigurationErrorMessage.getInstance().addFaultyContainers(global_stack.getId())
return # We're done here
ExtruderManager.getInstance().setActiveExtruderIndex(0) # Switch to first extruder ExtruderManager.getInstance().setActiveExtruderIndex(0) # Switch to first extruder
self._global_container_stack = global_stack self._global_container_stack = global_stack
Application.getInstance().setGlobalContainerStack(global_stack) Application.getInstance().setGlobalContainerStack(global_stack)

View file

@ -56,8 +56,6 @@ class MachineSettingsAction(MachineAction):
if self._isEmptyDefinitionChanges(definition_changes_id): if self._isEmptyDefinitionChanges(definition_changes_id):
return return
self._container_registry.removeContainer(definition_changes_id)
def _reset(self): def _reset(self):
if not self._global_container_stack: if not self._global_container_stack:
return return

View file

@ -9,9 +9,7 @@ import UM 1.1 as UM
Column Column
{ {
// HACK: GridLayouts don't render to the correct height with odd numbers of height: childrenRect.height
// items, so if odd, add some extra space.
height: grid.model.items.length % 2 == 0 ? childrenRect.height : childrenRect.height + UM.Theme.getSize("toolbox_thumbnail_small").height
width: parent.width width: parent.width
spacing: UM.Theme.getSize("default_margin").height spacing: UM.Theme.getSize("default_margin").height
Label Label
@ -36,6 +34,7 @@ Column
delegate: ToolboxDownloadsGridTile delegate: ToolboxDownloadsGridTile
{ {
Layout.preferredWidth: (grid.width - (grid.columns - 1) * grid.columnSpacing) / grid.columns Layout.preferredWidth: (grid.width - (grid.columns - 1) * grid.columnSpacing) / grid.columns
Layout.preferredHeight: UM.Theme.getSize("toolbox_thumbnail_small").height
} }
} }
} }

View file

@ -189,14 +189,10 @@ class UM3OutputDevicePlugin(OutputDevicePlugin):
b"name": system_info["name"].encode("utf-8"), b"name": system_info["name"].encode("utf-8"),
b"address": address.encode("utf-8"), b"address": address.encode("utf-8"),
b"firmware_version": system_info["firmware"].encode("utf-8"), b"firmware_version": system_info["firmware"].encode("utf-8"),
b"manual": b"true" b"manual": b"true",
b"machine": str(system_info['hardware']["typeid"]).encode("utf-8")
} }
if "hardware" in system_info and 'typeid' in system_info["hardware"]:
properties[b"machine"] = str(system_info['hardware']["typeid"]).encode("utf-8")
else:
properties[b"machine"] = system_info["variant"].encode("utf-8")
if has_cluster_capable_firmware: if has_cluster_capable_firmware:
# Cluster needs an additional request, before it's completed. # Cluster needs an additional request, before it's completed.
properties[b"incomplete"] = b"true" properties[b"incomplete"] = b"true"

View file

@ -227,6 +227,7 @@
{ {
"label": "Outer nozzle diameter", "label": "Outer nozzle diameter",
"description": "The outer diameter of the tip of the nozzle.", "description": "The outer diameter of the tip of the nozzle.",
"unit": "mm",
"default_value": 1, "default_value": 1,
"type": "float", "type": "float",
"settable_per_mesh": false, "settable_per_mesh": false,
@ -238,6 +239,7 @@
{ {
"label": "Nozzle length", "label": "Nozzle length",
"description": "The height difference between the tip of the nozzle and the lowest part of the print head.", "description": "The height difference between the tip of the nozzle and the lowest part of the print head.",
"unit": "mm",
"default_value": 3, "default_value": 3,
"type": "float", "type": "float",
"settable_per_mesh": false, "settable_per_mesh": false,
@ -261,6 +263,7 @@
{ {
"label": "Heat zone length", "label": "Heat zone length",
"description": "The distance from the tip of the nozzle in which heat from the nozzle is transferred to the filament.", "description": "The distance from the tip of the nozzle in which heat from the nozzle is transferred to the filament.",
"unit": "mm",
"default_value": 16, "default_value": 16,
"type": "float", "type": "float",
"settable_per_mesh": false, "settable_per_mesh": false,
@ -271,6 +274,7 @@
{ {
"label": "Filament Park Distance", "label": "Filament Park Distance",
"description": "The distance from the tip of the nozzle where to park the filament when an extruder is no longer used.", "description": "The distance from the tip of the nozzle where to park the filament when an extruder is no longer used.",
"unit": "mm",
"default_value": 16, "default_value": 16,
"value": "machine_heat_zone_length", "value": "machine_heat_zone_length",
"type": "float", "type": "float",

View file

@ -46,14 +46,9 @@ def main():
print("------------- Checking module {mod}".format(**locals())) print("------------- Checking module {mod}".format(**locals()))
result = subprocess.run([sys.executable, mypyModule, "-p", mod]) result = subprocess.run([sys.executable, mypyModule, "-p", mod])
if result.returncode != 0: if result.returncode != 0:
print(""" print("\nModule {mod} failed checking. :(".format(**locals()))
Module {mod} failed checking. :( return 1
""".format(**locals()))
break
else: else:
print(""" print("\n\nDone checking. All is good.")
Done checking. All is good.
""")
return 0 return 0
sys.exit(main()) sys.exit(main())