From 7c80d929722041b7e1674ea3eaf3c289a8fd7376 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Mon, 24 Jul 2023 21:16:03 +0200 Subject: [PATCH 1/4] Change CURA-10676 --- UM/Settings/SettingDefinition.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/UM/Settings/SettingDefinition.py b/UM/Settings/SettingDefinition.py index 371617ffd7..8d3c6367f0 100644 --- a/UM/Settings/SettingDefinition.py +++ b/UM/Settings/SettingDefinition.py @@ -105,8 +105,8 @@ def __init__(self, key: str, container: Optional[DefinitionContainerInterface] = self._i18n_catalog = i18n_catalog # type: Optional[i18nCatalog] - self._children = [] # type: List[SettingDefinition] - self._relations = [] # type: List[SettingRelation] + self._children = [] # type: List[SettingDefinition] + self._relations = [] # type: List[SettingRelation] # Cached set of keys of ancestors. Used for fast lookups of ancestors. self.__ancestors = set() # type: Set[str] @@ -116,6 +116,17 @@ def __init__(self, key: str, container: Optional[DefinitionContainerInterface] = self.__property_values = {} # type: Dict[str, Any] + def extend_category(self, value_id: str, value_display: str, plugin_id: Optional[str] = None) -> None: + """Append a category to the setting. + + :param value_id: :type{str} The id of the category. + :param value_display: :type{str} The display name of the category. If the display string needs to be translated, provide the translated string. + :param plugin_id: :type{Optional[str]} The id of the plugin that owns the category. Defaults to None. + """ + + value_id = f"{plugin_id}::{value_id}" if plugin_id else value_id + self.options[value_id] = value_display + def __getattr__(self, name: str) -> Any: """Override __getattr__ to provide access to definition properties.""" From 08327e384f64a1158de84aedc8091492f04c03bb Mon Sep 17 00:00:00 2001 From: casperlamboo Date: Mon, 24 Jul 2023 19:29:44 +0000 Subject: [PATCH 2/4] update translations --- resources/i18n/cs_CZ/uranium.po | 2 +- resources/i18n/de_DE/uranium.po | 2 +- resources/i18n/es_ES/uranium.po | 2 +- resources/i18n/fi_FI/uranium.po | 2 +- resources/i18n/fr_FR/uranium.po | 2 +- resources/i18n/hu_HU/uranium.po | 2 +- resources/i18n/it_IT/uranium.po | 2 +- resources/i18n/ja_JP/uranium.po | 2 +- resources/i18n/ko_KR/uranium.po | 2 +- resources/i18n/nl_NL/uranium.po | 2 +- resources/i18n/pl_PL/uranium.po | 2 +- resources/i18n/pt_BR/uranium.po | 2 +- resources/i18n/pt_PT/uranium.po | 2 +- resources/i18n/ru_RU/uranium.po | 2 +- resources/i18n/tr_TR/uranium.po | 2 +- resources/i18n/uranium.pot | 62 ++++++++++++++++----------------- resources/i18n/zh_CN/uranium.po | 2 +- resources/i18n/zh_TW/uranium.po | 2 +- 18 files changed, 48 insertions(+), 48 deletions(-) diff --git a/resources/i18n/cs_CZ/uranium.po b/resources/i18n/cs_CZ/uranium.po index c42b1f2519..02df201e4f 100644 --- a/resources/i18n/cs_CZ/uranium.po +++ b/resources/i18n/cs_CZ/uranium.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Uranium 5.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-03 10:52+0000\n" +"POT-Creation-Date: 2023-07-24 19:29+0000\n" "PO-Revision-Date: 2022-04-26 00:14+0200\n" "Last-Translator: Miroslav Šustek \n" "Language-Team: DenyCZ \n" diff --git a/resources/i18n/de_DE/uranium.po b/resources/i18n/de_DE/uranium.po index d40e9fda6d..f21d069830 100644 --- a/resources/i18n/de_DE/uranium.po +++ b/resources/i18n/de_DE/uranium.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-03 10:52+0000\n" +"POT-Creation-Date: 2023-07-24 19:29+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/resources/i18n/es_ES/uranium.po b/resources/i18n/es_ES/uranium.po index ce699b1c17..6cde5a2e88 100644 --- a/resources/i18n/es_ES/uranium.po +++ b/resources/i18n/es_ES/uranium.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-03 10:52+0000\n" +"POT-Creation-Date: 2023-07-24 19:29+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/resources/i18n/fi_FI/uranium.po b/resources/i18n/fi_FI/uranium.po index 2536199cbb..3e456e084d 100644 --- a/resources/i18n/fi_FI/uranium.po +++ b/resources/i18n/fi_FI/uranium.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Uranium 5.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-03 10:52+0000\n" +"POT-Creation-Date: 2023-07-24 19:29+0000\n" "PO-Revision-Date: 2017-09-27 12:27+0200\n" "Last-Translator: Bothof \n" "Language-Team: Finnish \n" diff --git a/resources/i18n/fr_FR/uranium.po b/resources/i18n/fr_FR/uranium.po index 862b24f052..3d0355b3a1 100644 --- a/resources/i18n/fr_FR/uranium.po +++ b/resources/i18n/fr_FR/uranium.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-03 10:52+0000\n" +"POT-Creation-Date: 2023-07-24 19:29+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/resources/i18n/hu_HU/uranium.po b/resources/i18n/hu_HU/uranium.po index 10f6f721e5..2f654cd4b1 100644 --- a/resources/i18n/hu_HU/uranium.po +++ b/resources/i18n/hu_HU/uranium.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Uranium 5.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-03 10:52+0000\n" +"POT-Creation-Date: 2023-07-24 19:29+0000\n" "PO-Revision-Date: 2019-10-10 22:30+0200\n" "Last-Translator: Nagy Attila\n" "Language-Team: AT-VLOG \n" diff --git a/resources/i18n/it_IT/uranium.po b/resources/i18n/it_IT/uranium.po index 5a2858b9e6..49b18bb8ae 100644 --- a/resources/i18n/it_IT/uranium.po +++ b/resources/i18n/it_IT/uranium.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-03 10:52+0000\n" +"POT-Creation-Date: 2023-07-24 19:29+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/resources/i18n/ja_JP/uranium.po b/resources/i18n/ja_JP/uranium.po index f627239f3e..63fc986411 100644 --- a/resources/i18n/ja_JP/uranium.po +++ b/resources/i18n/ja_JP/uranium.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-03 10:52+0000\n" +"POT-Creation-Date: 2023-07-24 19:29+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/resources/i18n/ko_KR/uranium.po b/resources/i18n/ko_KR/uranium.po index f50fe99714..0752d7f29c 100644 --- a/resources/i18n/ko_KR/uranium.po +++ b/resources/i18n/ko_KR/uranium.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-03 10:52+0000\n" +"POT-Creation-Date: 2023-07-24 19:29+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/resources/i18n/nl_NL/uranium.po b/resources/i18n/nl_NL/uranium.po index cb7b8ce870..4a6669dd99 100644 --- a/resources/i18n/nl_NL/uranium.po +++ b/resources/i18n/nl_NL/uranium.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-03 10:52+0000\n" +"POT-Creation-Date: 2023-07-24 19:29+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/resources/i18n/pl_PL/uranium.po b/resources/i18n/pl_PL/uranium.po index bb88e3ed21..2b971906ae 100644 --- a/resources/i18n/pl_PL/uranium.po +++ b/resources/i18n/pl_PL/uranium.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Uranium 5.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-03 10:52+0000\n" +"POT-Creation-Date: 2023-07-24 19:29+0000\n" "PO-Revision-Date: 2019-11-15 15:35+0100\n" "Last-Translator: Mariusz 'Virgin71' Matłosz \n" "Language-Team: reprapy.pl\n" diff --git a/resources/i18n/pt_BR/uranium.po b/resources/i18n/pt_BR/uranium.po index 5c07d56c42..cbbcdf8941 100644 --- a/resources/i18n/pt_BR/uranium.po +++ b/resources/i18n/pt_BR/uranium.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Uranium 5.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-03 10:52+0000\n" +"POT-Creation-Date: 2023-07-24 19:29+0000\n" "PO-Revision-Date: 2022-04-25 07:03+0200\n" "Last-Translator: Cláudio Sampaio \n" "Language-Team: Cláudio Sampaio\n" diff --git a/resources/i18n/pt_PT/uranium.po b/resources/i18n/pt_PT/uranium.po index 57630d4313..70b01512d8 100644 --- a/resources/i18n/pt_PT/uranium.po +++ b/resources/i18n/pt_PT/uranium.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-03 10:52+0000\n" +"POT-Creation-Date: 2023-07-24 19:29+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/resources/i18n/ru_RU/uranium.po b/resources/i18n/ru_RU/uranium.po index 1df9c05df3..7fd47727dd 100644 --- a/resources/i18n/ru_RU/uranium.po +++ b/resources/i18n/ru_RU/uranium.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-03 10:52+0000\n" +"POT-Creation-Date: 2023-07-24 19:29+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/resources/i18n/tr_TR/uranium.po b/resources/i18n/tr_TR/uranium.po index 8ecca11761..bc8435b215 100644 --- a/resources/i18n/tr_TR/uranium.po +++ b/resources/i18n/tr_TR/uranium.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-03 10:52+0000\n" +"POT-Creation-Date: 2023-07-24 19:29+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/resources/i18n/uranium.pot b/resources/i18n/uranium.pot index fcee1f415f..c4871cdbd0 100644 --- a/resources/i18n/uranium.pot +++ b/resources/i18n/uranium.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-03 10:52+0000\n" +"POT-Creation-Date: 2023-07-24 19:29+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -598,122 +598,122 @@ msgid "Local Container Provider" msgstr "" msgctxt "description" -msgid "Provides the Rotate tool." +msgid "Enables saving to local files." msgstr "" msgctxt "name" -msgid "Rotate Tool" +msgid "Local File Output Device" msgstr "" msgctxt "description" -msgid "Provides the Move tool." +msgid "Makes it possible to read Wavefront OBJ files." msgstr "" msgctxt "name" -msgid "Move Tool" +msgid "Wavefront OBJ Reader" msgstr "" msgctxt "description" -msgid "Provides the tool to manipulate the camera." +msgid "Provides support for writing STL files." msgstr "" msgctxt "name" -msgid "Camera Tool" +msgid "STL Writer" msgstr "" msgctxt "description" -msgid "Provides the Mirror tool." +msgid "Provides support for reading STL files." msgstr "" msgctxt "name" -msgid "Mirror Tool" +msgid "STL Reader" msgstr "" msgctxt "description" -msgid "Provides the Scale tool." +msgid "Makes it possible to write Wavefront OBJ files." msgstr "" msgctxt "name" -msgid "Scale Tool" +msgid "Wavefront OBJ Writer" msgstr "" msgctxt "description" -msgid "Provides the Selection tool." +msgid "Outputs log information to the console." msgstr "" msgctxt "name" -msgid "Selection Tool" +msgid "Console Logger" msgstr "" msgctxt "description" -msgid "Enables saving to local files." +msgid "Outputs log information to a file in your settings folder." msgstr "" msgctxt "name" -msgid "Local File Output Device" +msgid "File Logger" msgstr "" msgctxt "description" -msgid "Outputs log information to a file in your settings folder." +msgid "Provides a simple solid mesh view." msgstr "" msgctxt "name" -msgid "File Logger" +msgid "Simple View" msgstr "" msgctxt "description" -msgid "Outputs log information to the console." +msgid "Checks for updates of the software." msgstr "" msgctxt "name" -msgid "Console Logger" +msgid "Update Checker" msgstr "" msgctxt "description" -msgid "Checks for updates of the software." +msgid "Provides the Mirror tool." msgstr "" msgctxt "name" -msgid "Update Checker" +msgid "Mirror Tool" msgstr "" msgctxt "description" -msgid "Makes it possible to read Wavefront OBJ files." +msgid "Provides the Move tool." msgstr "" msgctxt "name" -msgid "Wavefront OBJ Reader" +msgid "Move Tool" msgstr "" msgctxt "description" -msgid "Makes it possible to write Wavefront OBJ files." +msgid "Provides the Rotate tool." msgstr "" msgctxt "name" -msgid "Wavefront OBJ Writer" +msgid "Rotate Tool" msgstr "" msgctxt "description" -msgid "Provides support for reading STL files." +msgid "Provides the tool to manipulate the camera." msgstr "" msgctxt "name" -msgid "STL Reader" +msgid "Camera Tool" msgstr "" msgctxt "description" -msgid "Provides support for writing STL files." +msgid "Provides the Scale tool." msgstr "" msgctxt "name" -msgid "STL Writer" +msgid "Scale Tool" msgstr "" msgctxt "description" -msgid "Provides a simple solid mesh view." +msgid "Provides the Selection tool." msgstr "" msgctxt "name" -msgid "Simple View" +msgid "Selection Tool" msgstr "" diff --git a/resources/i18n/zh_CN/uranium.po b/resources/i18n/zh_CN/uranium.po index 7034120b14..9e1ec5c995 100644 --- a/resources/i18n/zh_CN/uranium.po +++ b/resources/i18n/zh_CN/uranium.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-03 10:52+0000\n" +"POT-Creation-Date: 2023-07-24 19:29+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/resources/i18n/zh_TW/uranium.po b/resources/i18n/zh_TW/uranium.po index 54e1781295..8b97673860 100644 --- a/resources/i18n/zh_TW/uranium.po +++ b/resources/i18n/zh_TW/uranium.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Uranium 5.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-03 10:52+0000\n" +"POT-Creation-Date: 2023-07-24 19:29+0000\n" "PO-Revision-Date: 2022-01-02 20:28+0800\n" "Last-Translator: Valen Chang \n" "Language-Team: Valen Chang \n" From 9acb2fa12b2a1d682c54a20092827f15f36e6c47 Mon Sep 17 00:00:00 2001 From: Casper Lamboo Date: Tue, 25 Jul 2023 09:25:24 +0200 Subject: [PATCH 3/4] Use idoimatic python variable definitions CURA-10720 Co-authored-by: Jaime van Kessel --- UM/Settings/SettingDefinition.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UM/Settings/SettingDefinition.py b/UM/Settings/SettingDefinition.py index 8d3c6367f0..bc904aca46 100644 --- a/UM/Settings/SettingDefinition.py +++ b/UM/Settings/SettingDefinition.py @@ -105,8 +105,8 @@ def __init__(self, key: str, container: Optional[DefinitionContainerInterface] = self._i18n_catalog = i18n_catalog # type: Optional[i18nCatalog] - self._children = [] # type: List[SettingDefinition] - self._relations = [] # type: List[SettingRelation] + self._children: List[SettingDefinition] = [] + self._relations: List[SettingRelation] = [] # Cached set of keys of ancestors. Used for fast lookups of ancestors. self.__ancestors = set() # type: Set[str] From e48fc281e5682db107e52a0a3ac2d9df23da4352 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Tue, 25 Jul 2023 14:46:33 +0200 Subject: [PATCH 4/4] Add plugin version to custom enum values CURA-10720 --- UM/Settings/SettingDefinition.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/UM/Settings/SettingDefinition.py b/UM/Settings/SettingDefinition.py index bc904aca46..2249496107 100644 --- a/UM/Settings/SettingDefinition.py +++ b/UM/Settings/SettingDefinition.py @@ -116,15 +116,19 @@ def __init__(self, key: str, container: Optional[DefinitionContainerInterface] = self.__property_values = {} # type: Dict[str, Any] - def extend_category(self, value_id: str, value_display: str, plugin_id: Optional[str] = None) -> None: + def extend_category(self, value_id: str, value_display: str, plugin_id: Optional[str] = None, + plugin_version: Optional[str] = None) -> None: """Append a category to the setting. :param value_id: :type{str} The id of the category. :param value_display: :type{str} The display name of the category. If the display string needs to be translated, provide the translated string. :param plugin_id: :type{Optional[str]} The id of the plugin that owns the category. Defaults to None. + :param plugin_version: :type{Optional[str]} The version of the plugin that owns the category. Defaults to None. """ - - value_id = f"{plugin_id}::{value_id}" if plugin_id else value_id + if plugin_id is not None and plugin_version is not None: + value_id = f"PLUGIN::{plugin_id}@{plugin_version}::{value_id}" + elif plugin_id is not None or plugin_version is not None: + raise ValueError("Both plugin_id and plugin_version must be provided if one of them is provided.") self.options[value_id] = value_display def __getattr__(self, name: str) -> Any: