Fix: Display Repo Gems on Repo Screen Correctly (#5638)

Signed-off-by: nggieber <nggieber@amazon.com>
This commit is contained in:
AMZN-nggieber
2021-11-16 15:53:51 -08:00
committed by GitHub
parent 2ae8477683
commit 0d17e575a7
8 changed files with 62 additions and 27 deletions
@@ -41,7 +41,7 @@ namespace O3DE::ProjectManager
item->setData(gemRepoInfo.m_lastUpdated, RoleLastUpdated);
item->setData(gemRepoInfo.m_path, RolePath);
item->setData(gemRepoInfo.m_additionalInfo, RoleAdditionalInfo);
item->setData(gemRepoInfo.m_includedGemPaths, RoleIncludedGems);
item->setData(gemRepoInfo.m_includedGemUris, RoleIncludedGems);
appendRow(item);
@@ -98,7 +98,7 @@ namespace O3DE::ProjectManager
return modelIndex.data(RolePath).toString();
}
QStringList GemRepoModel::GetIncludedGemPaths(const QModelIndex& modelIndex)
QStringList GemRepoModel::GetIncludedGemUris(const QModelIndex& modelIndex)
{
return modelIndex.data(RoleIncludedGems).toStringList();
}
@@ -118,23 +118,19 @@ namespace O3DE::ProjectManager
QVector<GemInfo> GemRepoModel::GetIncludedGemInfos(const QModelIndex& modelIndex)
{
QVector<GemInfo> allGemInfos;
QStringList repoGemPaths = GetIncludedGemPaths(modelIndex);
QString repoUri = GetRepoUri(modelIndex);
for (const QString& gemPath : repoGemPaths)
const AZ::Outcome<QVector<GemInfo>, AZStd::string>& gemInfosResult = PythonBindingsInterface::Get()->GetGemRepoGemInfos(repoUri);
if (gemInfosResult.IsSuccess())
{
AZ::Outcome<GemInfo> gemInfoResult = PythonBindingsInterface::Get()->GetGemInfo(gemPath);
if (gemInfoResult.IsSuccess())
{
allGemInfos.append(gemInfoResult.GetValue());
}
else
{
QMessageBox::critical(nullptr, tr("Gem Not Found"), tr("Cannot find info for gem %1.").arg(gemPath));
}
return gemInfosResult.GetValue();
}
else
{
QMessageBox::critical(nullptr, tr("Gems not found"), tr("Cannot find info for gems from repo %1").arg(GetName(modelIndex)));
}
return allGemInfos;
return QVector<GemInfo>();
}
bool GemRepoModel::IsEnabled(const QModelIndex& modelIndex)