From 458c552c6758691bafc5abc2319c1a9647108a8f Mon Sep 17 00:00:00 2001 From: Duncan Macleod Date: Tue, 19 Mar 2019 09:38:23 -0700 Subject: [PATCH] gwsumm.tabs: use str in all tab sorting --- gwsumm/tabs/core.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/gwsumm/tabs/core.py b/gwsumm/tabs/core.py index c5826711..02ec41e2 100644 --- a/gwsumm/tabs/core.py +++ b/gwsumm/tabs/core.py @@ -1134,18 +1134,19 @@ def get_hierarchy(self): @staticmethod def _sortkey(tab): + # NOTE: we need all return values to be strings for + # the sorting to actually work if 'Home' in tab.shortname: - return 1 + return '1' if tab.shortname == 'Summary' and tab.parent is None: - return 2 - elif tab.shortname == 'Summary': - return 3 - elif 'ODC' in tab.shortname: - return 4 - elif tab.shortname.islower(): + return '2' + if tab.shortname == 'Summary': + return '3' + if 'ODC' in tab.shortname: + return '4' + if tab.shortname.islower(): return tab.shortname.upper() - else: - return tab.shortname.lower() + return tab.shortname.lower() def sort(self, key=None, reverse=False): """Sort this `TabList` in place