Skip to content

Commit

Permalink
Counter.total available in py3.10+
Browse files Browse the repository at this point in the history
Signed-off-by: Christian López Barrón <[email protected]>
  • Loading branch information
chrizzFTD committed Jan 2, 2025
1 parent b60a4ca commit 092eae4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion grill/views/description.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,9 @@ def _find_parent_for_display(_node):

arc_statistics_colors = ChainMap({Pcp.ArcTypeRoot.displayName: _HIGHLIGHT_COLORS['boolean']}, _HIGHLIGHT_COLORS)
arcs_stats = ' | '.join(f'<span style="color:rgb{arc_statistics_colors[arc_type.displayName][_PALETTE.get()].getRgb()[:3]};">{arc_type.displayName}: {arcs_counter.get(arc_type, 0)}' for arc_type in chain([Pcp.ArcTypeRoot], _ARCS_LEGEND))
self._composition_stats.setText(f'Total nodes: {arcs_counter.total()}{arcs_stats}')
# py-3.10+
total_arcs = arcs_counter.total() if hasattr(arcs_counter, 'total') else sum(arcs_counter.values())
self._composition_stats.setText(f'Total nodes: {total_arcs}{arcs_stats}')
tree.expandAll()
tree._fixPositions() # TODO: Houdini needs this. Why?
for index, size in sizes.items():
Expand Down

0 comments on commit 092eae4

Please sign in to comment.