diff --git a/cura/PrintInformation.py b/cura/PrintInformation.py index 7c17987807..27c8c853b1 100644 --- a/cura/PrintInformation.py +++ b/cura/PrintInformation.py @@ -335,8 +335,15 @@ class PrintInformation(QObject): # name is "" when I first had some meshes and afterwards I deleted them so the naming should start again is_empty = name == "" if is_gcode or is_project_file or (is_empty or (self._base_name == "" and self._base_name != name)): - # Only take the file name part - self._base_name = filename_parts[0] + # Only take the file name part, Note : file name might have 'dot' in name as well + if is_project_file: + self._base_name = ".".join(filename_parts) + elif len(filename_parts) > 1: + self._base_name = ".".join(filename_parts[0:-1]) + else: + self._base_name = filename_parts[0] + + self._updateJobName() @pyqtProperty(str, fset = setBaseName, notify = baseNameChanged) diff --git a/plugins/Toolbox/resources/qml/ToolboxCompatibilityChart.qml b/plugins/Toolbox/resources/qml/ToolboxCompatibilityChart.qml new file mode 100644 index 0000000000..1c58b46b96 --- /dev/null +++ b/plugins/Toolbox/resources/qml/ToolboxCompatibilityChart.qml @@ -0,0 +1,108 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Toolbox is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.2 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import UM 1.1 as UM + +Item +{ + anchors.topMargin: UM.Theme.getSize("default_margin").height + height: visible ? childrenRect.height : 0 + visible: packageData.type == "material" && packageData.has_configs + Label + { + id: heading + anchors.topMargin: UM.Theme.getSize("default_margin").height + width: parent.width + text: catalog.i18nc("@label", "Compatibility") + wrapMode: Text.WordWrap + color: UM.Theme.getColor("text_medium") + font: UM.Theme.getFont("medium") + } + TableView + { + id: table + anchors.top: heading.bottom + anchors.topMargin: UM.Theme.getSize("default_margin").height + width: parent.width + frameVisible: false + selectionMode: 0 + model: packageData.supported_configs + headerDelegate: Item + { + height: UM.Theme.getSize("toolbox_chart_row").height + Label + { + anchors.verticalCenter: parent.verticalCenter + elide: styleData.elideMode + text: styleData.value + color: UM.Theme.getColor("text") + font: UM.Theme.getFont("default_bold") + } + Rectangle + { + anchors.bottom: parent.bottom + height: UM.Theme.getSize("default_lining").height + width: parent.width + color: "black" + } + } + rowDelegate: Item + { + height: UM.Theme.getSize("toolbox_chart_row").height + Label + { + anchors.verticalCenter: parent.verticalCenter + elide: styleData.elideMode + text: styleData.value + color: UM.Theme.getColor("text_medium") + font: UM.Theme.getFont("default") + } + } + itemDelegate: Item + { + height: UM.Theme.getSize("toolbox_chart_row").height + Label + { + anchors.verticalCenter: parent.verticalCenter + elide: styleData.elideMode + text: styleData.value + color: UM.Theme.getColor("text_medium") + font: UM.Theme.getFont("default") + } + } + + TableViewColumn + { + role: "machine" + title: "Machine" + width: Math.floor(table.width * 0.25) + } + TableViewColumn + { + role: "print_core" + title: "Print Core" + width: Math.floor(table.width * 0.2) + } + TableViewColumn + { + role: "build_plate" + title: "Build Plate" + width: Math.floor(table.width * 0.225) + } + TableViewColumn + { + role: "support_material" + title: "Support" + width: Math.floor(table.width * 0.225) + } + TableViewColumn + { + role: "quality" + title: "Quality" + width: Math.floor(table.width * 0.1) + } + } +} diff --git a/plugins/Toolbox/resources/qml/ToolboxDetailPage.qml b/plugins/Toolbox/resources/qml/ToolboxDetailPage.qml index c1419fb620..c35b9ff618 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDetailPage.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDetailPage.qml @@ -106,7 +106,7 @@ Item spacing: Math.floor(UM.Theme.getSize("narrow_margin").height) Label { - text: details.version || "" + text: details.version || catalog.i18nc("@label", "Unknown") font: UM.Theme.getFont("very_small") color: UM.Theme.getColor("text") } diff --git a/plugins/Toolbox/resources/qml/ToolboxDetailTile.qml b/plugins/Toolbox/resources/qml/ToolboxDetailTile.qml index 3888b314e0..e93fdb646f 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDetailTile.qml +++ b/plugins/Toolbox/resources/qml/ToolboxDetailTile.qml @@ -10,6 +10,7 @@ Item { id: tile property bool installed: toolbox.isInstalled(model.id) + property var packageData: model width: detailList.width - UM.Theme.getSize("wide_margin").width height: normalData.height + supportedConfigsChart.height + 3 * UM.Theme.getSize("default_margin").height Item @@ -158,76 +159,11 @@ Item } } - Item + ToolboxCompatibilityChart { - id: supportedConfigsChart + id: compatibilityChart anchors.top: normalData.bottom - anchors.topMargin: UM.Theme.getSize("default_margin").height - height: visible ? childrenRect.height : 0 width: normalData.width - visible: model.type == "material" && model.supported_configs.length > 0 - Label - { - id: compatibilityHeading - anchors.topMargin: UM.Theme.getSize("default_margin").height - width: parent.width - text: catalog.i18nc("@label", "Compatibility") - wrapMode: Text.WordWrap - color: UM.Theme.getColor("text_medium") - font: UM.Theme.getFont("default") - } - Column - { - id: compatibilityLabels - anchors - { - top: compatibilityHeading.bottom - topMargin: UM.Theme.getSize("default_margin").height - bottomMargin: UM.Theme.getSize("default_margin").height - } - width: childrenRect.width - Label - { - text: catalog.i18nc("@label", "Machines") + ":" - font: UM.Theme.getFont("small") - } - Label - { - text: catalog.i18nc("@label", "Print Cores") + ":" - font: UM.Theme.getFont("small") - } - Label - { - text: catalog.i18nc("@label", "Quality Profiles") + ":" - font: UM.Theme.getFont("small") - } - } - Column - { - id: compatibilityValues - anchors - { - left: compatibilityLabels.right - leftMargin: UM.Theme.getSize("default_margin").height - top: compatibilityLabels.top - bottom: compatibilityLabels.bottom - } - Label - { - text: "Thingy" - font: UM.Theme.getFont("very_small") - } - Label - { - text: "Thingy" - font: UM.Theme.getFont("very_small") - } - Label - { - text: "Thingy" - font: UM.Theme.getFont("very_small") - } - } } Rectangle @@ -235,7 +171,7 @@ Item color: UM.Theme.getColor("lining") width: tile.width height: UM.Theme.getSize("default_lining").height - anchors.top: supportedConfigsChart.bottom + anchors.top: compatibilityChart.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height + UM.Theme.getSize("wide_margin").height //Normal margin for spacing after chart, wide margin between items. } Connections diff --git a/plugins/Toolbox/src/ConfigsModel.py b/plugins/Toolbox/src/ConfigsModel.py new file mode 100644 index 0000000000..dd54d53d93 --- /dev/null +++ b/plugins/Toolbox/src/ConfigsModel.py @@ -0,0 +1,37 @@ +# Copyright (c) 2018 Ultimaker B.V. +# Cura is released under the terms of the LGPLv3 or higher. + +import re +from typing import Dict +from PyQt5.QtCore import Qt, pyqtProperty +from UM.Qt.ListModel import ListModel + +## Model that holds supported configurations (for material/quality packages). +class ConfigsModel(ListModel): + def __init__(self, parent = None): + super().__init__(parent) + + self._configs = None + + self.addRoleName(Qt.UserRole + 1, "machine") + self.addRoleName(Qt.UserRole + 2, "print_core") + self.addRoleName(Qt.UserRole + 3, "build_plate") + self.addRoleName(Qt.UserRole + 4, "support_material") + self.addRoleName(Qt.UserRole + 5, "quality") + + def setConfigs(self, configs): + self._configs = configs + self._update() + + def _update(self): + items = [] + for item in self._configs: + items.append({ + "machine": item["machine"], + "print_core": item["print_core"], + "build_plate": item["build_plate"], + "support_material": item["support_material"], + "quality": item["quality"] + }) + + self.setItems(items) diff --git a/plugins/Toolbox/src/PackagesModel.py b/plugins/Toolbox/src/PackagesModel.py index e485b579b5..611d24af9d 100644 --- a/plugins/Toolbox/src/PackagesModel.py +++ b/plugins/Toolbox/src/PackagesModel.py @@ -5,9 +5,8 @@ import re from typing import Dict from PyQt5.QtCore import Qt, pyqtProperty - from UM.Qt.ListModel import ListModel - +from .ConfigsModel import ConfigsModel ## Model that holds cura packages. By setting the filter property the instances held by this model can be changed. class PackagesModel(ListModel): @@ -29,7 +28,8 @@ class PackagesModel(ListModel): self.addRoleName(Qt.UserRole + 11, "download_url") self.addRoleName(Qt.UserRole + 12, "last_updated") self.addRoleName(Qt.UserRole + 13, "is_bundled") - self.addRoleName(Qt.UserRole + 14, "supported_configs") + self.addRoleName(Qt.UserRole + 14, "has_configs") + self.addRoleName(Qt.UserRole + 15, "supported_configs") # List of filters for queries. The result is the union of the each list of results. self._filter = {} # type: Dict[str, str] @@ -42,6 +42,16 @@ class PackagesModel(ListModel): items = [] for package in self._metadata: + + has_configs = False + configs_model = None + if "data" in package: + if "supported_configs" in package["data"]: + if len(package["data"]["supported_configs"]) > 0: + has_configs = True + configs_model = ConfigsModel() + configs_model.setConfigs(package["data"]["supported_configs"]) + items.append({ "id": package["package_id"], "type": package["package_type"], @@ -56,7 +66,8 @@ class PackagesModel(ListModel): "download_url": package["download_url"] if "download_url" in package else None, "last_updated": package["last_updated"] if "last_updated" in package else None, "is_bundled": package["is_bundled"] if "is_bundled" in package else False, - "supported_configs": package["supported_configs"] if "supported_configs" in package else [] + "has_configs": has_configs, + "supported_configs": configs_model }) # Filter on all the key-word arguments. diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index ea5a535196..4bb3191de9 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -21,6 +21,7 @@ from UM.Version import Version from cura.CuraApplication import CuraApplication from .AuthorsModel import AuthorsModel from .PackagesModel import PackagesModel +from .ConfigsModel import ConfigsModel i18n_catalog = i18nCatalog("cura") diff --git a/resources/definitions/ultimaker3.def.json b/resources/definitions/ultimaker3.def.json index 05f74c6342..64948b4fe9 100644 --- a/resources/definitions/ultimaker3.def.json +++ b/resources/definitions/ultimaker3.def.json @@ -154,6 +154,6 @@ "wall_0_inset": { "value": "0" }, "wall_line_width_x": { "value": "round(wall_line_width * 0.3 / 0.35, 2)" }, "wall_thickness": { "value": "1" }, - "zig_zaggify_infill": { "value": "True" } + "zig_zaggify_infill": { "value": "gradual_infill_steps == 0" } } } diff --git a/resources/definitions/ultimaker_s5.def.json b/resources/definitions/ultimaker_s5.def.json index a69e10e343..c8c8d258d3 100644 --- a/resources/definitions/ultimaker_s5.def.json +++ b/resources/definitions/ultimaker_s5.def.json @@ -154,6 +154,6 @@ "optimize_wall_printing_order": { "value": "True" }, "retraction_combing": { "default_value": "all" }, "initial_layer_line_width_factor": { "value": "120" }, - "zig_zaggify_infill": { "value": "True" } + "zig_zaggify_infill": { "value": "gradual_infill_steps == 0" } } } diff --git a/resources/qml/JobSpecs.qml b/resources/qml/JobSpecs.qml index 3238c66a1e..e7f2d304b5 100644 --- a/resources/qml/JobSpecs.qml +++ b/resources/qml/JobSpecs.qml @@ -19,18 +19,6 @@ Item { height: childrenRect.height - Connections - { - target: backgroundItem - onHasMesh: - { - if (PrintInformation.baseName == "") - { - PrintInformation.baseName = name; - } - } - } - onActivityChanged: { if (activity == false) { //When there is no mesh in the buildplate; the printJobTextField is set to an empty string so it doesn't set an empty string as a jobName (which is later used for saving the file) diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index ee0b163185..c78a51a3a9 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -459,6 +459,7 @@ "toolbox_heading_label": [1.0, 4.0], "toolbox_header": [1.0, 4.0], "toolbox_action_button": [8.0, 2.5], - "toolbox_progress_bar": [8.0, 0.5] + "toolbox_progress_bar": [8.0, 0.5], + "toolbox_chart_row": [1.0, 2.0] } }