Incorporating review comments. Some parameter modifications. Some cli edge case handling. Remove remove_tag member from project info

This commit is contained in:
mgwynn
2021-06-07 14:14:32 -04:00
parent ffdce2ef7f
commit 6d6f8413c8
4 changed files with 43 additions and 32 deletions
@@ -26,8 +26,6 @@ namespace O3DE::ProjectManager
, m_backgroundImagePath(backgroundImagePath)
, m_needsBuild(needsBuild)
{
m_userTags = QStringList();
m_userTagsForRemoval = QStringList();
}
bool ProjectInfo::operator==(const ProjectInfo& rhs)
@@ -25,8 +25,15 @@ namespace O3DE::ProjectManager
public:
ProjectInfo() = default;
ProjectInfo(const QString& path, const QString& projectName, const QString& displayName, const QString& origin,
const QString& summary, const QString& imagePath, const QString& backgroundImagePath, bool needsBuild
ProjectInfo(
const QString& path,
const QString& projectName,
const QString& displayName,
const QString& origin,
const QString& summary,
const QString& imagePath,
const QString& backgroundImagePath,
bool needsBuild);
bool operator==(const ProjectInfo& rhs);
bool operator!=(const ProjectInfo& rhs);
@@ -49,9 +56,6 @@ namespace O3DE::ProjectManager
// Used in project creation
// Used to flag tags for removal
QStringList m_userTagsForRemoval;
bool m_needsBuild = false; //! Does this project need to be built
};
} // namespace O3DE::ProjectManager
@@ -53,6 +53,7 @@ namespace Platform
#define Py_To_String(obj) obj.cast<std::string>().c_str()
#define Py_To_String_Optional(dict, key, default_string) dict.contains(key) ? Py_To_String(dict[key]) : default_string
#define Py_To_List(obj) obj.cast<std::list()<std::string>>
namespace RedirectOutput
{
@@ -678,6 +679,12 @@ namespace O3DE::ProjectManager
{
projectInfo.m_projectName = Py_To_String(projectData["project_name"]);
projectInfo.m_displayName = Py_To_String_Optional(projectData, "display_name", projectInfo.m_projectName);
projectInfo.m_origin = Py_To_String_Optional(projectData, "origin", projectInfo.m_origin);
projectInfo.m_summary = Py_To_String_Optional(projectData, "summary", projectInfo.m_summary);
for (const auto& tag : projectData["user_tags"])
{
projectInfo.m_userTags.append(Py_To_String(tag));
}
}
catch ([[maybe_unused]] const std::exception& e)
{
@@ -753,17 +760,11 @@ namespace O3DE::ProjectManager
return ExecuteWithLockErrorHandling([&]
{
std::list<std::string> newTags;
for (auto& i : projectInfo.m_userTags)
for (const auto& i : projectInfo.m_userTags)
{
newTags.push_back(i.toStdString());
}
std::list<std::string> removedTags;
for (auto& i : projectInfo.m_userTagsForRemoval)
{
removedTags.push_back(i.toStdString());
}
m_editProjectProperties.attr("edit_project_props")(
pybind11::str(projectInfo.m_path.toStdString()), // proj_path
pybind11::none(), // proj_name not used
@@ -771,8 +772,9 @@ namespace O3DE::ProjectManager
pybind11::str(projectInfo.m_displayName.toStdString()), // new_display
pybind11::str(projectInfo.m_summary.toStdString()), // new_summary
pybind11::str(projectInfo.m_imagePath.toStdString()), // new_icon
pybind11::list(pybind11::cast(newTags)), // new_tag
pybind11::list(pybind11::cast(removedTags))); // remove_tag
pybind11::none(), // add_tags not used
pybind11::none(), // remove_tags not used
pybind11::list(pybind11::cast(newTags))); // replace_tags
});
}