Skip to content

Commit

Permalink
menu add
Browse files Browse the repository at this point in the history
  • Loading branch information
aaliao committed Oct 10, 2023
1 parent 0023656 commit 7e68619
Showing 1 changed file with 45 additions and 13 deletions.
58 changes: 45 additions & 13 deletions mil_common/utils/mil_tools/scripts/preflight/preflightUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,63 @@
term = blessed.Terminal()
pos = 0

while inp != "q":
maxPos = 3
height, width = term.height, term.width
machine = ["SubjuGator", "NaviGator", "Exit"]
options = [
"Hardware Checklist",
"Software Checklist",
"Rosnode Command",
"Back",
"Exit",
]
currmenu = machine

# reprint line selected -> term.on_green"message"

while inp != "q":
maxPos = len(currmenu)
# reprint line selected -> term.on_green"message"
print(term.home + term.clear + term.blink + term.on_green("pressed ") + repr(inp))

print("testing screen\n")
print("checklist")
print("hiiardware checklist")
print("Preflight Checklist\n")

print(term.move_y(term.height // 2))
print(term.black_on_darkkhaki(term.center("press any key")))
for x in range(0, maxPos):
if x == pos:
print(term.blink + term.on_green(currmenu[x]))
else:
print(currmenu[x])

with term.cbreak():
inp = term.inkey()
if inp == "k" or inp == "KEY_UP":
if inp == "k" or inp.name == "KEY_UP":
if pos == 0:
pos = maxPos
pos = maxPos - 1
else:
pos -= 1

if inp == "j" or inp == "KEY_DOWN":
if pos == maxPos:
if inp == "j" or inp.name == "KEY_DOWN":
if pos == maxPos - 1:
pos = 0
else:
pos += 1
if inp.name == "KEY_ENTER":
if pos == maxPos - 1:
inp = "q"
continue
if currmenu == machine:
currmenu = options
elif currmenu == options:
pass
else:
pass


def hardware_test(terminal):
pass


def software_test(terminal):
# this should run ros and do all the init tests
pass


def run_command(terminal):
pass

0 comments on commit 7e68619

Please sign in to comment.