Merge pull request #1610 from aws-lumberyard-dev/LYN-4507

Remove deleted projects from project manager
This commit is contained in:
AMZN-Phil
2021-07-02 10:16:06 -07:00
committed by GitHub
6 changed files with 66 additions and 23 deletions
@@ -115,6 +115,8 @@ namespace O3DE::ProjectManager
QFrame* ProjectsScreen::CreateProjectsContent(QString buildProjectPath, ProjectButton** projectButton)
{
RemoveInvalidProjects();
QFrame* frame = new QFrame(this);
frame->setObjectName("projectsContent");
{
@@ -495,6 +497,11 @@ namespace O3DE::ProjectManager
return displayFirstTimeContent;
}
bool ProjectsScreen::RemoveInvalidProjects()
{
return PythonBindingsInterface::Get()->RemoveInvalidProjects();
}
bool ProjectsScreen::StartProjectBuild(const ProjectInfo& projectInfo)
{
if (ProjectUtils::IsVS2019Installed())
@@ -62,6 +62,7 @@ namespace O3DE::ProjectManager
ProjectButton* CreateProjectButton(ProjectInfo& project, QLayout* flowLayout, bool processing = false);
void ResetProjectsContent();
bool ShouldDisplayFirstTimeContent();
bool RemoveInvalidProjects();
bool StartProjectBuild(const ProjectInfo& projectInfo);
QList<ProjectInfo>::iterator RequiresBuildProjectIterator(const QString& projectPath);
@@ -755,6 +755,21 @@ namespace O3DE::ProjectManager
});
}
bool PythonBindings::RemoveInvalidProjects()
{
bool removalResult = false;
bool result = ExecuteWithLock(
[&]
{
auto pythonRemovalResult = m_register.attr("remove_invalid_o3de_projects")();
// Returns an exit code so boolify it then invert result
removalResult = !pythonRemovalResult.cast<bool>();
});
return result && removalResult;
}
AZ::Outcome<void, AZStd::string> PythonBindings::UpdateProject(const ProjectInfo& projectInfo)
{
bool updateProjectSucceeded = false;
@@ -50,6 +50,7 @@ namespace O3DE::ProjectManager
AZ::Outcome<void, AZStd::string> 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;
bool RemoveInvalidProjects() override;
// ProjectTemplate
AZ::Outcome<QVector<ProjectTemplateInfo>> GetProjectTemplates(const QString& projectPath = {}) override;
@@ -141,6 +141,11 @@ namespace O3DE::ProjectManager
*/
virtual AZ::Outcome<void, AZStd::string> RemoveGemFromProject(const QString& gemPath, const QString& projectPath) = 0;
/**
* Removes invalid projects from the manifest
*/
virtual bool RemoveInvalidProjects() = 0;
// Project Templates