diff --git a/UI/UI_math.py b/UI/UI_math.py index 9ed4cdb..3d4ab66 100644 --- a/UI/UI_math.py +++ b/UI/UI_math.py @@ -1,6 +1,7 @@ # THIS FILE IS A PART OF VCStudio # PYTHON 3 +import re # This is collection of simple geometric math operations that I gonna use trough # out the UI of the VCStudio. Stuff like collision detections, overlap detections @@ -161,3 +162,15 @@ def timestring(tleft): +def tryint(s): + try: + return int(s) + except: + return s + +def alphanum_key(s): + return [ tryint(c) for c in re.split('([0-9]+)', s) ] + +def sort_nicely(l): + l.sort(key=alphanum_key) +