Ensure 0%-100% spoolup is sorted properly
This commit is contained in:
13
gui/utils/sorter.py
Normal file
13
gui/utils/sorter.py
Normal file
@@ -0,0 +1,13 @@
|
||||
"""
|
||||
Taken from https://stackoverflow.com/questions/2669059/how-to-sort-alpha-numeric-set-in-python
|
||||
"""
|
||||
|
||||
import re
|
||||
|
||||
|
||||
def _convert(text):
|
||||
return int(text) if text.isdigit() else text
|
||||
|
||||
|
||||
def smartSort(key):
|
||||
return [_convert(c) for c in re.split('([0-9]+)', key)]
|
||||
Reference in New Issue
Block a user