Tools: param AlphabeticalZeroAtTop handles -1

This commit is contained in:
Randy Mackay 2025-01-14 20:47:10 +09:00
parent a953cc2019
commit 5be8b19ce4

9
Tools/autotest/param_metadata/xmlemit.py Normal file → Executable file
View File

@ -69,9 +69,12 @@ class XmlEmit(Emit):
keys = nv_pairs.keys()
def sort_key(value):
description = nv_pairs[value]
if zero_at_top and value == "0":
# make sure this item goes at the top of the list:
return "AAAAAAA"
if zero_at_top:
# make sure -1 and 0 appear at the top of the list
if value == "-1":
return "0000000"
if value == "0":
return "0000001"
return description
return sorted(keys, key=sort_key)