From 3937da0c4631211288e9584c124fece86f312e15 Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Thu, 22 Sep 2022 10:53:59 -0500 Subject: [PATCH] App: Add support for 'discussion' URL attribute --- src/App/Metadata.cpp | 2 + src/App/MetadataPyImp.cpp | 5 + src/Mod/AddonManager/addonmanager_devmode.py | 10 ++ src/Mod/AddonManager/developer_mode.ui | 178 ++++++++++--------- 4 files changed, 113 insertions(+), 82 deletions(-) diff --git a/src/App/Metadata.cpp b/src/App/Metadata.cpp index 05000389a8..e59cc82b5e 100644 --- a/src/App/Metadata.cpp +++ b/src/App/Metadata.cpp @@ -772,6 +772,8 @@ void Metadata::parseVersion1(const DOMNode* startNode) _name = StrXUTF8(element->getTextContent()).str; else if (tagString == "version") _version = Meta::Version(StrXUTF8(element->getTextContent()).str); + else if (tagString == "date") + _date = StrXUTF8(element->getTextContent()).str; else if (tagString == "description") _description = StrXUTF8(element->getTextContent()).str; else if (tagString == "maintainer") diff --git a/src/App/MetadataPyImp.cpp b/src/App/MetadataPyImp.cpp index 2b25309a5b..b0330a9097 100644 --- a/src/App/MetadataPyImp.cpp +++ b/src/App/MetadataPyImp.cpp @@ -340,6 +340,8 @@ Py::Object MetadataPy::getUrls() const case Meta::UrlType::bugtracker: pyUrl["type"] = Py::String("bugtracker"); break; case Meta::UrlType::readme: pyUrl["type"] = Py::String("readme"); break; case Meta::UrlType::documentation: pyUrl["type"] = Py::String("documentation"); break; + case Meta::UrlType::discussion: pyUrl["type"] = Py::String("discussion"); break; + default: pyUrl["type"] = Py::String("unknown"); break; } if (url.type == Meta::UrlType::repository) pyUrl["branch"] = Py::String(url.branch); @@ -378,6 +380,9 @@ void MetadataPy::setUrls(Py::Object args) else if (typeAsString == "documentation") { newUrl.type = Meta::UrlType::documentation; } + else if (typeAsString == "discussion") { + newUrl.type = Meta::UrlType::discussion; + } else { PyErr_SetString(Base::PyExc_FC_GeneralError, "Unrecognized URL type"); return; diff --git a/src/Mod/AddonManager/addonmanager_devmode.py b/src/Mod/AddonManager/addonmanager_devmode.py index ddd0c20996..46e56c7343 100644 --- a/src/Mod/AddonManager/addonmanager_devmode.py +++ b/src/Mod/AddonManager/addonmanager_devmode.py @@ -244,6 +244,8 @@ class DeveloperMode: self.dialog.readmeURLLineEdit.setText(url["location"]) elif url["type"] == "documentation": self.dialog.documentationURLLineEdit.setText(url["location"]) + elif url["type"] == "discussion": + self.dialog.discussionURLLineEdit.setText(url["location"]) def _populate_contents_from_metadata(self, metadata): """Use the passed metadata object to populate the contents list""" @@ -339,6 +341,7 @@ class DeveloperMode: self.dialog.bugtrackerURLLineEdit.clear() self.dialog.readmeURLLineEdit.clear() self.dialog.documentationURLLineEdit.clear() + self.dialog.discussionURLLineEdit.clear() self.dialog.iconDisplayLabel.setPixmap(QPixmap()) self.dialog.iconPathLineEdit.clear() @@ -415,6 +418,13 @@ class DeveloperMode: "type": "documentation", } ) + if self.dialog.discussionURLLineEdit.text(): + urls.append( + { + "location": self.dialog.discussionURLLineEdit.text(), + "type": "discussion", + } + ) self.metadata.Urls = urls # Content, people, and licenses should already be sync'ed diff --git a/src/Mod/AddonManager/developer_mode.ui b/src/Mod/AddonManager/developer_mode.ui index 2e6e0538f8..f6a03e667f 100644 --- a/src/Mod/AddonManager/developer_mode.ui +++ b/src/Mod/AddonManager/developer_mode.ui @@ -54,13 +54,17 @@ Metadata - - - - Displayed in the Addon Manager's list of Addons. Should not include the word "FreeCAD", and must be a valid directory name on all support operating systems. - + + - Addon Name + Icon + + + + + + + README URL @@ -71,19 +75,6 @@ - - - - Explanation of what this Addon provides. Displayed in the Addon Manager. It is not necessary for this to state that this is a FreeCAD Addon. - - - Description - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - @@ -97,6 +88,40 @@ + + + + (Recommended) + + + + + + + (Optional) + + + + + + + (Optional) + + + + + + + + + + Displayed in the Addon Manager's list of Addons. Should not include the word "FreeCAD", and must be a valid directory name on all support operating systems. + + + Addon Name + + + @@ -104,26 +129,12 @@ - - - - - - Semantic (1.2.3-beta) or CalVer (2022.08.30) styles supported - - - - - - - Set to today (CalVer style) - - - - - - - + + + + Documentation URL + + @@ -149,52 +160,23 @@ - - + + - README URL + Discussion URL - - - - (Recommended) + + + + Explanation of what this Addon provides. Displayed in the Addon Manager. It is not necessary for this to state that this is a FreeCAD Addon. - - - - - Website URL + Description - - - - - - (Optional) - - - - - - - Bugtracker URL - - - - - - - (Optional) - - - - - - - Documentation URL + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop @@ -205,14 +187,39 @@ - - + + - Icon + Website URL - + + + + Bugtracker URL + + + + + + + + + Semantic (1.2.3-beta) or CalVer (2022.08.30) styles supported + + + + + + + Set to today (CalVer style) + + + + + + @@ -229,6 +236,13 @@ + + + + (Optional) + + +