From 83274b74c2f9e16a9de62c1a1c487310b3660eec Mon Sep 17 00:00:00 2001 From: mkrupczak3 Date: Thu, 18 Aug 2022 18:04:29 -0400 Subject: [PATCH] find_me_mode minor formatting fix Windows --- src/find_me_mode.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/find_me_mode.py b/src/find_me_mode.py index ebe4a92..30e8c7d 100755 --- a/src/find_me_mode.py +++ b/src/find_me_mode.py @@ -148,10 +148,13 @@ def find_me_mode(): mag = -1 * mag # instead of magnetic -> true heading, we go true -> magnetic (so we must invert) if mag != 0.0: - warnStr = '\033[1;31;m' #ANSI escape sequence, bold and red + warnStr = "" + if os.name != 'nt': + warnStr += '\033[1;31;m' #ANSI escape sequence, bold and red warnStr += f"WARNING: adjusting target headings by {'+' if mag > 0 else ''}{mag}° for use with analog compass\n" warnStr += " please ensure this direction is correct and your compass decl. is set to 0°" - warnStr +="\033[0;0m" #ANSI escape sequence, reset terminal to normal colors + if os.name != 'nt': + warnStr +="\033[0;0m" #ANSI escape sequence, reset terminal to normal colors warnStr +="\n" print(warnStr) time.sleep(2) @@ -179,11 +182,14 @@ def find_me_mode(): errstr = "FATAL ERROR: could not determine your altitude!" sys.exit(errstr) - warnStr = '\033[1;31;m' #ANSI escape sequence, bold and red + warnStr = "" + if os.name != 'nt': + warnStr += '\033[1;31;m' #ANSI escape sequence, bold and red warnStr += "WARNING: you did not input your current altitude\n" warnStr += f" using value {alt}m according to nearest GeoTIFF DEM datapoint\n" warnStr += " your GPS reading may be more accurate than this value" - warnStr +="\033[0;0m" #ANSI escape sequence, reset terminal to normal colors + if os.name != 'nt': + warnStr +="\033[0;0m" #ANSI escape sequence, reset terminal to normal colors warnStr +="\n" print(warnStr) time.sleep(4)