sceneinventory is using product name and type

This commit is contained in:
Jakub Trllo 2024-02-23 12:43:06 +01:00
parent 1089f6e587
commit 08840e1235
3 changed files with 15 additions and 15 deletions

View file

@ -43,7 +43,7 @@ class InventoryModel(TreeModel):
"Name",
"version",
"count",
"family",
"productType",
"group",
"loader",
"objectName",
@ -140,8 +140,8 @@ class InventoryModel(TreeModel):
return qtawesome.icon("fa.file-o", color=color)
if index.column() == 3:
# Family icon
return item.get("familyIcon", None)
# Product type icon
return item.get("productTypeIcon", None)
column_name = self.Columns[index.column()]
@ -174,7 +174,7 @@ class InventoryModel(TreeModel):
return super(InventoryModel, self).data(index, role)
def set_hierarchy_view(self, state):
"""Set whether to display subsets in hierarchy view."""
"""Set whether to display products in hierarchy view."""
state = bool(state)
if state != self._hierarchy_view:
@ -297,7 +297,7 @@ class InventoryModel(TreeModel):
self.add_child(item_node, parent=group_node)
# TODO Use product icons
family_icon = qtawesome.icon(
product_type_icon = qtawesome.icon(
"fa.folder", color="#0091B2"
)
# Prepare site sync specific data
@ -313,18 +313,18 @@ class InventoryModel(TreeModel):
subset = group_dict["subset"]
asset = group_dict["asset"]
# Get the primary family
# Get product type
maj_version, _ = schema.get_schema_version(subset["schema"])
if maj_version < 3:
src_doc = version
else:
src_doc = subset
prim_family = src_doc["data"].get("family")
if not prim_family:
product_type = src_doc["data"].get("family")
if not product_type:
families = src_doc["data"].get("families")
if families:
prim_family = families[0]
product_type = families[0]
# Store the highest available version so the model can know
# whether current version is currently up-to-date.
@ -340,8 +340,8 @@ class InventoryModel(TreeModel):
group_node["representation"] = repre_id
group_node["version"] = version["name"]
group_node["highest_version"] = highest_version["name"]
group_node["family"] = prim_family or ""
group_node["familyIcon"] = family_icon
group_node["productType"] = product_type or ""
group_node["productTypeIcon"] = product_type_icon
group_node["count"] = len(group_containers)
group_node["isGroupNode"] = True
group_node["group"] = subset["data"].get("subsetGroup")

View file

@ -112,17 +112,17 @@ class SceneInventoryView(QtWidgets.QTreeView):
loaded_hero_versions = []
versions_by_parent_id = collections.defaultdict(list)
subset_ids = set()
product_ids = set()
for version in loaded_versions:
if version["type"] == "hero_version":
loaded_hero_versions.append(version)
else:
parent_id = version["parent"]
versions_by_parent_id[parent_id].append(version)
subset_ids.add(parent_id)
product_ids.add(parent_id)
all_versions = get_versions(
project_name, subset_ids=subset_ids, hero=True
project_name, subset_ids=product_ids, hero=True
)
hero_versions = []
versions = []

View file

@ -78,7 +78,7 @@ class SceneInventoryWindow(QtWidgets.QDialog):
view.setColumnWidth(0, 250) # name
view.setColumnWidth(1, 55) # version
view.setColumnWidth(2, 55) # count
view.setColumnWidth(3, 150) # family
view.setColumnWidth(3, 150) # product type
view.setColumnWidth(4, 120) # group
view.setColumnWidth(5, 150) # loader