From 3e0b395c72e0ecc628329ec1837e306dbafe286a Mon Sep 17 00:00:00 2001 From: Konstantinos Karmas Date: Mon, 30 Aug 2021 10:45:45 +0200 Subject: [PATCH 1/6] Add the Buildplate.svg to the Cura icons The icon existed only in the UM3NetworkPrinting plugin but it was also used in the ConfigurationItem.qml in Cura, so it had to be moved to the Cura icons. CURA-8520 --- .../resources/qml/MonitorBuildplateConfiguration.qml | 2 +- resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml | 2 +- .../themes/cura-light/icons/default}/Buildplate.svg | 0 resources/themes/cura-light/icons/deprecated_icons.json | 4 ++++ 4 files changed, 6 insertions(+), 2 deletions(-) rename {plugins/UM3NetworkPrinting/resources/svg/icons => resources/themes/cura-light/icons/default}/Buildplate.svg (100%) mode change 100755 => 100644 diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorBuildplateConfiguration.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorBuildplateConfiguration.qml index 0f4aec5424..598d0ec70a 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorBuildplateConfiguration.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorBuildplateConfiguration.qml @@ -51,7 +51,7 @@ Item anchors.centerIn: parent color: UM.Theme.getColor("monitor_icon_primary") height: UM.Theme.getSize("medium_button_icon").width - source: "../svg/icons/Buildplate.svg" + source: UM.Theme.getIcon("Buildplate") width: height visible: buildplate } diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index 92b88d3c09..85b653721f 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -202,7 +202,7 @@ Button Cura.IconWithText { id: buildplateLabel - source: UM.Theme.getIcon("buildplate") + source: UM.Theme.getIcon("Buildplate") text: { if (configuration === null) diff --git a/plugins/UM3NetworkPrinting/resources/svg/icons/Buildplate.svg b/resources/themes/cura-light/icons/default/Buildplate.svg old mode 100755 new mode 100644 similarity index 100% rename from plugins/UM3NetworkPrinting/resources/svg/icons/Buildplate.svg rename to resources/themes/cura-light/icons/default/Buildplate.svg diff --git a/resources/themes/cura-light/icons/deprecated_icons.json b/resources/themes/cura-light/icons/deprecated_icons.json index 8fb1982617..eb2ce2c075 100644 --- a/resources/themes/cura-light/icons/deprecated_icons.json +++ b/resources/themes/cura-light/icons/deprecated_icons.json @@ -306,5 +306,9 @@ "translate": { "new_icon": "ArrowFourWay", "size": "default" + }, + "buildplate": { + "new_icon": "Buildplate", + "size": "default" } } \ No newline at end of file From b41b0e55b553d6c1fe375e2f239430f96242d757 Mon Sep 17 00:00:00 2001 From: Konstantinos Karmas Date: Mon, 30 Aug 2021 11:29:18 +0200 Subject: [PATCH 2/6] Add missing icon mappings CURA-8520 --- .../cura-light/icons/deprecated_icons.json | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/resources/themes/cura-light/icons/deprecated_icons.json b/resources/themes/cura-light/icons/deprecated_icons.json index eb2ce2c075..fe004cc332 100644 --- a/resources/themes/cura-light/icons/deprecated_icons.json +++ b/resources/themes/cura-light/icons/deprecated_icons.json @@ -310,5 +310,81 @@ "buildplate": { "new_icon": "Buildplate", "size": "default" + }, + "basic": { + "new_icon": "PrintQuality", + "size": "default" + }, + "category_shield": { + "new_icon": "Shield", + "size": "default" + }, + "category_unknown": { + "new_icon": "Sputnik", + "size": "default" + }, + "cross2": { + "new_icon": "CancelBlock", + "size": "default" + }, + "drop_down_button": { + "new_icon": "ChevronSingleDown", + "size": "default" + }, + "link": { + "new_icon": "Link", + "size": "default" + }, + "print_time": { + "new_icon": "Clock", + "size": "default" + }, + "printer_cloud_connected": { + "new_icon": "CloudBadge", + "size": "low" + }, + "printer_cloud_not_available": { + "new_icon": "CloudBadge", + "size": "low" + }, + "printer_connected": { + "new_icon": "CheckBlueBG", + "size": "low" + }, + "printsetup": { + "new_icon": "Sliders", + "size": "default" + }, + "quick": { + "new_icon": "Quick", + "size": "default" + }, + "scale_max": { + "new_icon": "ScaleMax", + "size": "default" + }, + "setting_per_object": { + "new_icon": "MeshType", + "size": "default" + }, + "star_empty": { + "new_icon": "Star", + "size": "default" + }, + "star_filled": { + "new_icon": "StarFilled", + "size": "default" + }, + "ulti": { + "new_icon": "PrintQuality", + "size": "default" + }, + "view_xray": { + "new_icon": "CancelBlock", + "size": "default" + }, + "viewMode": { + "new_icon": "Eye", + "size": "default" } } \ No newline at end of file From cf93f661358fe5cdca27a67b2a0eba3999632370 Mon Sep 17 00:00:00 2001 From: Konstantinos Karmas Date: Mon, 30 Aug 2021 11:42:57 +0200 Subject: [PATCH 3/6] Add missing Group.svg icon CURA-8520 --- resources/qml/WelcomePages/CloudContent.qml | 2 +- resources/themes/cura-light/icons/default/Group.svg | 3 +++ resources/themes/cura-light/icons/deprecated_icons.json | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 resources/themes/cura-light/icons/default/Group.svg diff --git a/resources/qml/WelcomePages/CloudContent.qml b/resources/qml/WelcomePages/CloudContent.qml index 9d3e980991..444c1df95c 100644 --- a/resources/qml/WelcomePages/CloudContent.qml +++ b/resources/qml/WelcomePages/CloudContent.qml @@ -172,7 +172,7 @@ Item anchors.horizontalCenter: communityColumn.horizontalCenter fillMode: Image.PreserveAspectFit width: UM.Theme.getSize("welcome_wizard_cloud_content_image").width - source: UM.Theme.getIcon("PrinterTriple", "medium") + source: UM.Theme.getIcon("Group") sourceSize.width: width sourceSize.height: height } diff --git a/resources/themes/cura-light/icons/default/Group.svg b/resources/themes/cura-light/icons/default/Group.svg new file mode 100644 index 0000000000..8632b37f7c --- /dev/null +++ b/resources/themes/cura-light/icons/default/Group.svg @@ -0,0 +1,3 @@ + + + diff --git a/resources/themes/cura-light/icons/deprecated_icons.json b/resources/themes/cura-light/icons/deprecated_icons.json index fe004cc332..09242655e2 100644 --- a/resources/themes/cura-light/icons/deprecated_icons.json +++ b/resources/themes/cura-light/icons/deprecated_icons.json @@ -331,6 +331,10 @@ "new_icon": "ChevronSingleDown", "size": "default" }, + "group": { + "new_icon": "Group", + "size": "default" + }, "link": { "new_icon": "Link", "size": "default" From 57b0287c8423827d76730cd82f74bbfe98d4ec93 Mon Sep 17 00:00:00 2001 From: Konstantinos Karmas Date: Mon, 30 Aug 2021 14:27:52 +0200 Subject: [PATCH 4/6] Add missing Play icon The `play` icon is readded to the theme and remapped to the `Play.svg`. Found by @fieldOfView. CURA-8520 --- resources/themes/cura-light/icons/default/Play.svg | 5 +++++ resources/themes/cura-light/icons/deprecated_icons.json | 4 ++++ 2 files changed, 9 insertions(+) create mode 100644 resources/themes/cura-light/icons/default/Play.svg diff --git a/resources/themes/cura-light/icons/default/Play.svg b/resources/themes/cura-light/icons/default/Play.svg new file mode 100644 index 0000000000..1b2510513d --- /dev/null +++ b/resources/themes/cura-light/icons/default/Play.svg @@ -0,0 +1,5 @@ + + + + diff --git a/resources/themes/cura-light/icons/deprecated_icons.json b/resources/themes/cura-light/icons/deprecated_icons.json index 09242655e2..e60b5a5366 100644 --- a/resources/themes/cura-light/icons/deprecated_icons.json +++ b/resources/themes/cura-light/icons/deprecated_icons.json @@ -339,6 +339,10 @@ "new_icon": "Link", "size": "default" }, + "play": { + "new_icon": "Play", + "size": "default" + }, "print_time": { "new_icon": "Clock", "size": "default" From de1a299e7aee4d5268776c018a503f950d36f0f2 Mon Sep 17 00:00:00 2001 From: Konstantinos Karmas Date: Mon, 30 Aug 2021 14:28:52 +0200 Subject: [PATCH 5/6] Add missing view_normal icon in the deprecated icons Also remove the capitalization from the `viewMode`. CURA-8520 --- resources/themes/cura-light/icons/deprecated_icons.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/resources/themes/cura-light/icons/deprecated_icons.json b/resources/themes/cura-light/icons/deprecated_icons.json index e60b5a5366..e0d8583605 100644 --- a/resources/themes/cura-light/icons/deprecated_icons.json +++ b/resources/themes/cura-light/icons/deprecated_icons.json @@ -391,7 +391,11 @@ "new_icon": "CancelBlock", "size": "default" }, - "viewMode": { + "view_normal": { + "new_icon": "Infill0", + "size": "default" + }, + "viewmode": { "new_icon": "Eye", "size": "default" } From 751732076d31c5b3cb6b15280b14deb08d80c32a Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 31 Aug 2021 12:00:59 +0200 Subject: [PATCH 6/6] Add test to see if all deprecated theme icons still exist This will make it easier in the future if we deprecate icons again. And it's nice for now. Contributes to issue CURA-8520. --- tests/TestThemes.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/TestThemes.py diff --git a/tests/TestThemes.py b/tests/TestThemes.py new file mode 100644 index 0000000000..a84d94298c --- /dev/null +++ b/tests/TestThemes.py @@ -0,0 +1,33 @@ +# Copyright (c) 2021 Ultimaker B.V. +# Cura is released under the terms of the LGPLv3 or higher. + +import json # To parse the deprecated icons files. +import os # To find the theme folders. +import pytest + +theme_base = os.path.join(os.path.split(__file__)[0], "..", "resources", "themes") +theme_paths = [os.path.join(theme_base, theme_folder) for theme_folder in os.listdir(theme_base) if os.path.isdir(os.path.join(theme_base, theme_folder))] + +@pytest.mark.parametrize("theme_path", theme_paths) +def test_deprecatedIconsExist(theme_path: str) -> None: + icons_folder = os.path.join(theme_path, "icons") + deprecated_icons_file = os.path.join(icons_folder, "deprecated_icons.json") + if not os.path.exists(deprecated_icons_file): + return # No deprecated icons file, there is nothing to go wrong. + + # Find out which icons exist in this theme file. + existing_icons = {} + for size in [subfolder for subfolder in os.listdir(icons_folder) if os.path.isdir(os.path.join(icons_folder, subfolder))]: + existing_icons[size] = set(os.path.splitext(fname)[0] for fname in os.listdir(os.path.join(icons_folder, size))) + + with open(deprecated_icons_file) as f: + deprecated_icons = json.load(f) + + for entry in deprecated_icons.values(): + assert "new_icon" in entry # For each deprecated icon we must know which icon replaced it. + new_icon = entry["new_icon"] + assert "size" in entry + size = entry["size"] + + assert size in existing_icons # The replacement icon must have a size that exists. + assert new_icon in existing_icons[size] # The new icon must exist for that size.