Merge branch 'refactoring_machine_manager' of github.com:Ultimaker/Cura into refactoring_machine_manager

This commit is contained in:
Jack Ha 2018-02-22 15:52:22 +01:00
commit 5a6e84a57f
26 changed files with 162 additions and 73 deletions

View File

@ -7,6 +7,7 @@ from UM.Logger import Logger
from UM.Settings.Interfaces import DefinitionContainerInterface from UM.Settings.Interfaces import DefinitionContainerInterface
from UM.Settings.InstanceContainer import InstanceContainer from UM.Settings.InstanceContainer import InstanceContainer
from UM.Settings.ContainerRegistry import ContainerRegistry from UM.Settings.ContainerRegistry import ContainerRegistry
from UM.Settings.SettingFunction import SettingFunction
from UM.Util import parseBool from UM.Util import parseBool
from cura.Machines.VariantManager import VariantType from cura.Machines.VariantManager import VariantType
@ -50,7 +51,6 @@ class CuraStackBuilder:
(definition_id, global_variant_name)) (definition_id, global_variant_name))
global_variant_container = variant_node.getContainer() global_variant_container = variant_node.getContainer()
# get variant container for extruders # get variant container for extruders
extruder_variant_container = application.empty_variant_container extruder_variant_container = application.empty_variant_container
# Only look for the preferred variant if this machine has variants # Only look for the preferred variant if this machine has variants
@ -65,21 +65,6 @@ class CuraStackBuilder:
(definition_id, extruder_variant_name)) (definition_id, extruder_variant_name))
extruder_variant_container = variant_node.getContainer() extruder_variant_container = variant_node.getContainer()
# get material container for extruders
material_container = application.empty_material_container
# Only look for the preferred material if this machine has materials
if parseBool(machine_definition.getMetaDataEntry("has_materials", False)):
material_diameter = machine_definition.getProperty("material_diameter", "value")
approximate_material_diameter = str(round(material_diameter))
root_material_id = machine_definition.getMetaDataEntry("preferred_material")
root_material_id = material_manager.getRootMaterialIDForDiameter(root_material_id, approximate_material_diameter)
material_node = material_manager.getMaterialNode(definition_id, extruder_variant_name, material_diameter, root_material_id)
# Sanity check. If you see this error, the related definition files should be fixed.
if not material_node:
raise RuntimeError("Cannot find material with definition [%s], extruder_variant_name [%s], and root_material_id [%s]" %
(definition_id, extruder_variant_name, root_material_id))
material_container = material_node.getContainer()
generated_name = registry.createUniqueName("machine", "", name, machine_definition.getName()) generated_name = registry.createUniqueName("machine", "", name, machine_definition.getName())
# Make sure the new name does not collide with any definition or (quality) profile # Make sure the new name does not collide with any definition or (quality) profile
# createUniqueName() only looks at other stacks, but not at definitions or quality profiles # createUniqueName() only looks at other stacks, but not at definitions or quality profiles
@ -96,6 +81,23 @@ class CuraStackBuilder:
) )
new_global_stack.setName(generated_name) new_global_stack.setName(generated_name)
# get material container for extruders
material_container = application.empty_material_container
# Only look for the preferred material if this machine has materials
if parseBool(machine_definition.getMetaDataEntry("has_materials", False)):
material_diameter = machine_definition.getProperty("material_diameter", "value")
if isinstance(material_diameter, SettingFunction):
material_diameter = material_diameter(new_global_stack)
approximate_material_diameter = str(round(material_diameter))
root_material_id = machine_definition.getMetaDataEntry("preferred_material")
root_material_id = material_manager.getRootMaterialIDForDiameter(root_material_id, approximate_material_diameter)
material_node = material_manager.getMaterialNode(definition_id, extruder_variant_name, material_diameter, root_material_id)
# Sanity check. If you see this error, the related definition files should be fixed.
if not material_node:
raise RuntimeError("Cannot find material with definition [%s], extruder_variant_name [%s], and root_material_id [%s]" %
(definition_id, extruder_variant_name, root_material_id))
material_container = material_node.getContainer()
# Create ExtruderStacks # Create ExtruderStacks
extruder_dict = machine_definition.getMetaDataEntry("machine_extruder_trains") extruder_dict = machine_definition.getMetaDataEntry("machine_extruder_trains")

View File

@ -72,6 +72,8 @@ class MonitorStage(CuraStage):
# Force an update of the icon source # Force an update of the icon source
self._updateIconSource() self._updateIconSource()
except IndexError: except IndexError:
#If index error occurs, then the icon on monitor button also should be updated
self._updateIconSource()
pass pass
def _onEngineCreated(self): def _onEngineCreated(self):

View File

@ -6,9 +6,7 @@
"visible": true, "visible": true,
"author": "ABAX 3d Technologies", "author": "ABAX 3d Technologies",
"manufacturer": "ABAX 3d Technologies", "manufacturer": "ABAX 3d Technologies",
"file_formats": "text/x-gcode", "file_formats": "text/x-gcode"
"quality_definition": "abax_pri3",
"has_machine_quality": true
}, },
"overrides": { "overrides": {
"machine_start_gcode": { "machine_start_gcode": {

View File

@ -519,6 +519,9 @@ UM.MainWindow
insertPage(4, catalog.i18nc("@title:tab", "Profiles"), Qt.resolvedUrl("Preferences/ProfilesPage.qml")); insertPage(4, catalog.i18nc("@title:tab", "Profiles"), Qt.resolvedUrl("Preferences/ProfilesPage.qml"));
// Remove plug-ins page because we will use the shiny new plugin browser:
removePage(5);
//Force refresh //Force refresh
setPage(0); setPage(0);
} }
@ -630,17 +633,6 @@ UM.MainWindow
} }
} }
// show the installed plugins page in the preferences dialog
Connections
{
target: Cura.Actions.configurePlugins
onTriggered:
{
preferences.visible = true
preferences.setPage(5)
}
}
UM.ExtensionModel { UM.ExtensionModel {
id: curaExtensions id: curaExtensions
} }

View File

@ -0,0 +1,22 @@
[general]
version = 2
name = Fine
definition = abax_pri5
[metadata]
setting_version = 4
type = quality
quality_type = normal
weight = -1
material = generic_pla
[values]
layer_height = 0.2
wall_thickness = 1.05
top_bottom_thickness = 0.8
infill_sparse_density = 20
speed_print = 80
speed_layer_0 = =round(speed_print * 30 / 50)
speed_topbottom = 20
cool_min_layer_time = 5
cool_min_speed = 10

View File

@ -0,0 +1,22 @@
[general]
version = 2
name = Extra Fine
definition = abax_pri5
[metadata]
setting_version = 4
type = quality
quality_type = high
weight = 1
material = generic_pla
[values]
layer_height = 0.1
wall_thickness = 1.05
top_bottom_thickness = 0.8
infill_sparse_density = 20
speed_print = 50
speed_layer_0 = =round(speed_print * 30 / 50)
speed_topbottom = 20
cool_min_layer_time = 5
cool_min_speed = 10

View File

@ -0,0 +1,22 @@
[general]
version = 2
name = Fine
definition = abax_pri5
[metadata]
setting_version = 4
type = quality
quality_type = normal
weight = 0
material = generic_pla
[values]
layer_height = 0.2
wall_thickness = 1.05
top_bottom_thickness = 0.8
infill_sparse_density = 20
speed_print = 50
speed_layer_0 = =round(speed_print * 30 / 50)
speed_topbottom = 20
cool_min_layer_time = 5
cool_min_speed = 10

View File

@ -12,7 +12,6 @@ material = generic_petg
variant = 0.4 mm variant = 0.4 mm
[values] [values]
adhesion_type = skirt
bottom_thickness = 0.6 bottom_thickness = 0.6
coasting_enable = True coasting_enable = True
coasting_speed = 95 coasting_speed = 95
@ -27,8 +26,6 @@ infill_line_width = 0.6
infill_overlap = 15 infill_overlap = 15
infill_pattern = zigzag infill_pattern = zigzag
infill_sparse_density = 20 infill_sparse_density = 20
layer_height = 0.3
layer_height_0 = 0.3
line_width = 0.4 line_width = 0.4
material_bed_temperature = 50 material_bed_temperature = 50
material_bed_temperature_layer_0 = 55 material_bed_temperature_layer_0 = 55

View File

@ -12,7 +12,6 @@ material = generic_petg
variant = 0.4 mm 2-fans variant = 0.4 mm 2-fans
[values] [values]
adhesion_type = skirt
bottom_thickness = 0.6 bottom_thickness = 0.6
coasting_enable = True coasting_enable = True
coasting_speed = 95 coasting_speed = 95
@ -27,8 +26,6 @@ infill_line_width = 0.6
infill_overlap = 15 infill_overlap = 15
infill_pattern = zigzag infill_pattern = zigzag
infill_sparse_density = 20 infill_sparse_density = 20
layer_height = 0.3
layer_height_0 = 0.3
line_width = 0.4 line_width = 0.4
material_bed_temperature = 50 material_bed_temperature = 50
material_bed_temperature_layer_0 = 55 material_bed_temperature_layer_0 = 55

View File

@ -12,7 +12,6 @@ material = generic_petg
variant = 0.4 mm variant = 0.4 mm
[values] [values]
adhesion_type = skirt
bottom_thickness = 0.6 bottom_thickness = 0.6
coasting_enable = True coasting_enable = True
coasting_speed = 95 coasting_speed = 95
@ -27,8 +26,6 @@ infill_line_width = 0.6
infill_overlap = 15 infill_overlap = 15
infill_pattern = zigzag infill_pattern = zigzag
infill_sparse_density = 20 infill_sparse_density = 20
layer_height = 0.2
layer_height_0 = 0.3
line_width = 0.4 line_width = 0.4
material_bed_temperature = 50 material_bed_temperature = 50
material_bed_temperature_layer_0 = 55 material_bed_temperature_layer_0 = 55

View File

@ -12,7 +12,6 @@ material = generic_petg
variant = 0.4 mm 2-fans variant = 0.4 mm 2-fans
[values] [values]
adhesion_type = skirt
bottom_thickness = 0.6 bottom_thickness = 0.6
coasting_enable = True coasting_enable = True
coasting_speed = 95 coasting_speed = 95
@ -27,8 +26,6 @@ infill_line_width = 0.6
infill_overlap = 15 infill_overlap = 15
infill_pattern = zigzag infill_pattern = zigzag
infill_sparse_density = 20 infill_sparse_density = 20
layer_height = 0.2
layer_height_0 = 0.3
line_width = 0.4 line_width = 0.4
material_bed_temperature = 50 material_bed_temperature = 50
material_bed_temperature_layer_0 = 55 material_bed_temperature_layer_0 = 55

View File

@ -12,7 +12,6 @@ material = generic_pla
variant = 0.4 mm variant = 0.4 mm
[values] [values]
adhesion_type = skirt
bottom_thickness = 0.6 bottom_thickness = 0.6
coasting_enable = True coasting_enable = True
coasting_speed = 95 coasting_speed = 95
@ -27,8 +26,6 @@ infill_line_width = 0.6
infill_overlap = 15 infill_overlap = 15
infill_pattern = zigzag infill_pattern = zigzag
infill_sparse_density = 20 infill_sparse_density = 20
layer_height = 0.3
layer_height_0 = 0.3
line_width = 0.4 line_width = 0.4
material_flow = 90 material_flow = 90
meshfix_union_all = False meshfix_union_all = False

View File

@ -12,7 +12,6 @@ material = generic_pla
variant = 0.4 mm 2-fans variant = 0.4 mm 2-fans
[values] [values]
adhesion_type = skirt
bottom_thickness = 0.6 bottom_thickness = 0.6
coasting_enable = True coasting_enable = True
coasting_speed = 95 coasting_speed = 95
@ -27,8 +26,6 @@ infill_line_width = 0.6
infill_overlap = 15 infill_overlap = 15
infill_pattern = zigzag infill_pattern = zigzag
infill_sparse_density = 20 infill_sparse_density = 20
layer_height = 0.3
layer_height_0 = 0.3
line_width = 0.4 line_width = 0.4
material_flow = 90 material_flow = 90
meshfix_union_all = False meshfix_union_all = False

View File

@ -12,7 +12,6 @@ material = generic_pla
variant = 0.4 mm variant = 0.4 mm
[values] [values]
adhesion_type = skirt
bottom_thickness = 0.6 bottom_thickness = 0.6
coasting_enable = True coasting_enable = True
coasting_speed = 95 coasting_speed = 95
@ -27,8 +26,6 @@ infill_line_width = 0.6
infill_overlap = 15 infill_overlap = 15
infill_pattern = zigzag infill_pattern = zigzag
infill_sparse_density = 20 infill_sparse_density = 20
layer_height = 0.1
layer_height_0 = 0.3
line_width = 0.4 line_width = 0.4
material_flow = 90 material_flow = 90
material_print_temperature = 205 material_print_temperature = 205

View File

@ -12,7 +12,6 @@ material = generic_pla
variant = 0.4 mm 2-fans variant = 0.4 mm 2-fans
[values] [values]
adhesion_type = skirt
bottom_thickness = 0.6 bottom_thickness = 0.6
coasting_enable = True coasting_enable = True
coasting_speed = 95 coasting_speed = 95
@ -27,8 +26,6 @@ infill_line_width = 0.6
infill_overlap = 15 infill_overlap = 15
infill_pattern = zigzag infill_pattern = zigzag
infill_sparse_density = 20 infill_sparse_density = 20
layer_height = 0.1
layer_height_0 = 0.3
line_width = 0.4 line_width = 0.4
material_flow = 90 material_flow = 90
material_print_temperature = 205 material_print_temperature = 205

View File

@ -12,7 +12,6 @@ material = generic_pla
variant = 0.4 mm variant = 0.4 mm
[values] [values]
adhesion_type = skirt
bottom_thickness = 0.6 bottom_thickness = 0.6
coasting_enable = True coasting_enable = True
coasting_speed = 95 coasting_speed = 95
@ -27,8 +26,6 @@ infill_line_width = 0.6
infill_overlap = 15 infill_overlap = 15
infill_pattern = zigzag infill_pattern = zigzag
infill_sparse_density = 20 infill_sparse_density = 20
layer_height = 0.2
layer_height_0 = 0.3
line_width = 0.4 line_width = 0.4
material_flow = 90 material_flow = 90
meshfix_union_all = False meshfix_union_all = False

View File

@ -12,7 +12,6 @@ material = generic_pla
variant = 0.4 mm 2-fans variant = 0.4 mm 2-fans
[values] [values]
adhesion_type = skirt
bottom_thickness = 0.6 bottom_thickness = 0.6
coasting_enable = True coasting_enable = True
coasting_speed = 95 coasting_speed = 95
@ -27,8 +26,6 @@ infill_line_width = 0.6
infill_overlap = 15 infill_overlap = 15
infill_pattern = zigzag infill_pattern = zigzag
infill_sparse_density = 20 infill_sparse_density = 20
layer_height = 0.2
layer_height_0 = 0.3
line_width = 0.4 line_width = 0.4
material_flow = 90 material_flow = 90
meshfix_union_all = False meshfix_union_all = False

View File

@ -12,7 +12,6 @@ material = generic_pla
variant = 0.4 mm variant = 0.4 mm
[values] [values]
adhesion_type = skirt
bottom_thickness = 0.6 bottom_thickness = 0.6
coasting_enable = True coasting_enable = True
coasting_speed = 95 coasting_speed = 95
@ -27,8 +26,6 @@ infill_line_width = 0.6
infill_overlap = 15 infill_overlap = 15
infill_pattern = zigzag infill_pattern = zigzag
infill_sparse_density = 20 infill_sparse_density = 20
layer_height = 0.05
layer_height_0 = 0.3
line_width = 0.4 line_width = 0.4
material_flow = 90 material_flow = 90
material_print_temperature = 202 material_print_temperature = 202

View File

@ -27,8 +27,6 @@ infill_line_width = 0.6
infill_overlap = 15 infill_overlap = 15
infill_pattern = zigzag infill_pattern = zigzag
infill_sparse_density = 20 infill_sparse_density = 20
layer_height = 0.05
layer_height_0 = 0.3
line_width = 0.4 line_width = 0.4
material_flow = 90 material_flow = 90
material_print_temperature = 202 material_print_temperature = 202

View File

@ -0,0 +1,16 @@
[general]
version = 2
name = Coarse
definition = imade3d_jellybox
[metadata]
setting_version = 4
type = quality
quality_type = fast
weight = -1
global_quality = True
[values]
adhesion_type = skirt
layer_height = 0.3
layer_height_0 = 0.3

View File

@ -0,0 +1,16 @@
[general]
version = 2
name = Fine
definition = imade3d_jellybox
[metadata]
setting_version = 4
type = quality
quality_type = high
weight = 1
global_quality = True
[values]
adhesion_type = skirt
layer_height = 0.1
layer_height_0 = 0.3

View File

@ -0,0 +1,16 @@
[general]
version = 2
name = Medium
definition = imade3d_jellybox
[metadata]
setting_version = 4
type = quality
quality_type = normal
weight = 0
global_quality = True
[values]
adhesion_type = skirt
layer_height = 0.2
layer_height_0 = 0.3

View File

@ -0,0 +1,16 @@
[general]
version = 2
name = UltraFine
definition = imade3d_jellybox
[metadata]
setting_version = 4
type = quality
quality_type = ultrahigh
weight = 2
global_quality = True
[values]
adhesion_type = skirt
layer_height = 0.05
layer_height_0 = 0.3

View File

@ -51,24 +51,24 @@ setup(name="Cura",
#console=[{"script": "cura_app.py"}], #console=[{"script": "cura_app.py"}],
options={"py2exe": {"skip_archive": False, "includes": includes}}) options={"py2exe": {"skip_archive": False, "includes": includes}})
print("Coping Cura plugins.") print("Copying Cura plugins.")
shutil.copytree(os.path.dirname(UM.__file__) + "/../plugins", "dist/plugins", ignore = shutil.ignore_patterns("ConsoleLogger", "OBJWriter", "MLPWriter", "MLPReader")) shutil.copytree(os.path.dirname(UM.__file__) + "/../plugins", "dist/plugins", ignore = shutil.ignore_patterns("ConsoleLogger", "OBJWriter", "MLPWriter", "MLPReader"))
for path in os.listdir("plugins"): for path in os.listdir("plugins"):
copytree("plugins/" + path, "dist/plugins/" + path) copytree("plugins/" + path, "dist/plugins/" + path)
print("Coping resources.") print("Copying resources.")
copytree(os.path.dirname(UM.__file__) + "/../resources", "dist/resources") copytree(os.path.dirname(UM.__file__) + "/../resources", "dist/resources")
copytree("resources", "dist/resources") copytree("resources", "dist/resources")
print("Coping Uranium QML.") print("Copying Uranium QML.")
shutil.copytree(os.path.dirname(UM.__file__) + "/Qt/qml/UM", "dist/qml/UM") shutil.copytree(os.path.dirname(UM.__file__) + "/Qt/qml/UM", "dist/qml/UM")
for site_package in site.getsitepackages(): for site_package in site.getsitepackages():
qt_origin_path = os.path.join(site_package, "PyQt5") qt_origin_path = os.path.join(site_package, "PyQt5")
if os.path.isdir(qt_origin_path): if os.path.isdir(qt_origin_path):
print("Coping PyQt5 plugins from: %s" % qt_origin_path) print("Copying PyQt5 plugins from: %s" % qt_origin_path)
shutil.copytree(os.path.join(qt_origin_path, "plugins"), "dist/PyQt5/plugins") shutil.copytree(os.path.join(qt_origin_path, "plugins"), "dist/PyQt5/plugins")
print("Coping PyQt5 QtQuick from: %s" % qt_origin_path) print("Copying PyQt5 QtQuick from: %s" % qt_origin_path)
shutil.copytree(os.path.join(qt_origin_path, "qml/QtQuick"), "dist/qml/QtQuick") shutil.copytree(os.path.join(qt_origin_path, "qml/QtQuick"), "dist/qml/QtQuick")
shutil.copytree(os.path.join(qt_origin_path, "qml/QtQuick.2"), "dist/qml/QtQuick.2") shutil.copytree(os.path.join(qt_origin_path, "qml/QtQuick.2"), "dist/qml/QtQuick.2")
print("Coping PyQt5 svg library from: %s" % qt_origin_path) print("Copying PyQt5 svg library from: %s" % qt_origin_path)
shutil.copy(os.path.join(qt_origin_path, "Qt5Svg.dll"), "dist/Qt5Svg.dll") shutil.copy(os.path.join(qt_origin_path, "Qt5Svg.dll"), "dist/Qt5Svg.dll")
print("Copying Angle libraries from %s" % qt_origin_path) print("Copying Angle libraries from %s" % qt_origin_path)
shutil.copy(os.path.join(qt_origin_path, "libEGL.dll"), "dist/libEGL.dll") shutil.copy(os.path.join(qt_origin_path, "libEGL.dll"), "dist/libEGL.dll")