Adding python bindings for modifying project properties

main
mgwynn 5 years ago
parent b73de269ee
commit accd473ff5

@ -289,6 +289,7 @@ namespace O3DE::ProjectManager
m_engineTemplate = pybind11::module::import("o3de.engine_template");
m_enableGemProject = pybind11::module::import("o3de.enable_gem");
m_disableGemProject = pybind11::module::import("o3de.disable_gem");
m_editProjectProperties = pybind11::module::import("o3de.project_properties");
// make sure the engine is registered
RegisterThisEngine();
@ -686,6 +687,23 @@ namespace O3DE::ProjectManager
return projectInfo;
}
AZ::Outcome<void, AZStd::string> PythonBindings::ModifyProjectProperties(const QString& path, const QString& origin, const QString& displayName,
const QString& summary, const QString& icon, const QString& addTag, const QString& removeTag)
{
return ExecuteWithLockErrorHandling([&]
{
m_editProjectProperties.attr("edit_project_props")(
pybind11::str(path.toStdString()), //proj_path
pybind11::none(), //proj_name not used
origin.isNull() ? pybind11::none() : pybind11::str(origin.toStdString()), //new_origin
displayName.isNull() ? pybind11::none() : pybind11::str(displayName.toStdString()), //new_display
summary.isNull() ? pybind11::none() : pybind11::str(summary.toStdString()), //new_summary
icon.isNull() ? pybind11::none() : pybind11::str(icon.toStdString()), //new_icon
addTag.isNull() ? pybind11::none() : pybind11::str(addTag.toStdString()), //new_tag
removeTag.isNull() ? pybind11::none() : pybind11::str(removeTag.toStdString())); //remove_tag
});
}
AZ::Outcome<QVector<ProjectInfo>> PythonBindings::GetProjects()
{
QVector<ProjectInfo> projects;

@ -53,6 +53,11 @@ namespace O3DE::ProjectManager
bool UpdateProject(const ProjectInfo& projectInfo) override;
AZ::Outcome<void, AZStd::string> AddGemToProject(const QString& gemPath, const QString& projectPath) override;
AZ::Outcome<void, AZStd::string> RemoveGemFromProject(const QString& gemPath, const QString& projectPath) override;
AZ::Outcome<void, AZStd::string> ModifyProjectProperties(
const QString& path,
const QString& origin = 0,
const QString& displayName = 0,
const QString& summary = 0, const QString& icon = 0, const QString& addTag = 0, const QString& removeTag = 0) override;
// ProjectTemplate
AZ::Outcome<QVector<ProjectTemplateInfo>> GetProjectTemplates() override;
@ -78,5 +83,6 @@ namespace O3DE::ProjectManager
pybind11::handle m_manifest;
pybind11::handle m_enableGemProject;
pybind11::handle m_disableGemProject;
pybind11::handle m_editProjectProperties;
};
}

@ -132,6 +132,25 @@ namespace O3DE::ProjectManager
*/
virtual AZ::Outcome<void, AZStd::string> AddGemToProject(const QString& gemPath, const QString& projectPath) = 0;
/**
* Change property in project json file
* @param path the absolute path to the gem
* @param origin the description or url for project origin (such as project host, repository, owner...etc)
* @param displayName the project display name
* @param summary short description of the project
* @param icon image used to represent the project
* @param addTag user tag to be added
* @param removeTag user tag to be removed
*/
virtual AZ::Outcome<void, AZStd::string> ModifyProjectProperties(
const QString& path,
const QString& origin = 0,
const QString& displayName = 0,
const QString& summary = 0,
const QString& icon = 0,
const QString& addTag = 0,
const QString& removeTag = 0) = 0;
/**
* Remove gem to a project
* @param gemPath the absolute path to the gem

Loading…
Cancel
Save