Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions gui/wxpython/core/treemodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,17 @@ def RemoveNode(self, node):
del node.children[:]

def SortChildren(self, node):
"""Sorts children with 'natural sort' based on label."""
"""Sorts children with 'natural sort' based on label.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably have a data catalog-specific TreeModel class

Pins temporal datasets to the top."""
if node.children:
naturally_sort(node.children, key=lambda node: node.label)

def custom_sort_key(n):
# Pin STDS to the top
if n.data.get("type") in {"strds", "stvds", "str3ds"}:
return "0_" + n.label
return "1_" + n.label

naturally_sort(node.children, key=custom_sort_key)

def Filtered(self, **kwargs):
"""Filters model based on parameters in kwargs
Expand Down
Loading
Loading