3 from collections
import OrderedDict
14 opts, args = getopt.getopt(argv,
"w:h:x:y:",[
"width=",
"height=",
"x=",
"y="])
15 except getopt.GetoptError:
16 print 'drive_control_gui -w <width> -h <height> -x <x> -y <y>' 19 if opt
in (
'-h',
'--height'):
21 elif opt
in (
'-w',
'--weight'):
29 from drive_control_rpc
import pointing, tagging, reset_all, freeze_all, unfreeze_all, narrate, manual_mode, automatic_mode, close_ports, updateDriveList, trigger_behavior, updateBehaviorList
38 for button
in driveButtons.keys():
40 driveButtons[button].destroy()
42 for i,drive
in enumerate(driveList):
43 driveButtons[drive]=Button(window, text=drive, command=
lambda:
trigger_behavior(drive))
44 driveButtons[drive].grid(row=i+3, column=1)
46 for button
in behaviorButtons.keys():
48 behaviorButtons[button].destroy()
50 for i,beh
in enumerate(behaviorList):
51 behaviorButtons[beh]=Button(window, text=beh, command=
lambda:
trigger_behavior(beh))
52 behaviorButtons[beh].grid(row=i+3, column=2)
55 title = Label(window, text=
"Manual drive control").grid(row=0,column=1)
57 labels = OrderedDict()
59 labels[
"General Control:"] = Label(window,text=
"General Control:").grid(row=1,column=0)
60 labels[
"Drive Control:"] = Label(window,text=
"Drive Control:").grid(row=1,column=1)
61 labels[
"Behavior Control:"] = Label(window,text=
"Behavior Control:").grid(row=1,column=2)
65 fixed_buttons = OrderedDict()
66 update_buttons = OrderedDict()
67 driveButtons = OrderedDict()
68 behaviorButtons = OrderedDict()
69 update_buttons[
"Update drive list"] = Button(window, text=
"Update list", command=updateDriveButtons).grid(row=2,column=1)
70 update_buttons[
"Update behavior list"] = Button(window, text=
"Update list", command=updateBehaviorButtons).grid(row=2,column=2)
72 fixed_buttons[
"Manual mode"] = Button(window, text=
"Manual mode", command=manual_mode)
73 fixed_buttons[
"Autonomous mode"] = Button(window, text=
"Autonomous mode", command=automatic_mode)
74 fixed_buttons[
"freeze"] = Button(window, text=
"Freeze", command=freeze_all)
75 fixed_buttons[
"unfreeze"] = Button(window, text=
"Unfreeze", command=unfreeze_all)
76 fixed_buttons[
"reset"] = Button(window, text=
"Reset", command=reset_all)
77 driveButtons[
"dummyButtonD"] = Button(window, text=
"dummyButton", command=please)
78 behaviorButtons[
"dummyButtonB"] = Button(window, text=
"dummyButton", command=please)
82 for i,b
in enumerate(fixed_buttons.values()):
83 b.grid(row=i+2, column=0)
85 for i,b
in enumerate(driveButtons.values()):
86 b.grid(row=i+3, column=1)
87 for i,b
in enumerate(behaviorButtons.values()):
88 b.grid(row=i+3, column=2)
90 window.geometry(
'%dx%d+%d+%d' % (w, h, x, y))
91 window.protocol(
"WM_DELETE_WINDOW", on_closing)
def updateBehaviorButtons()
def trigger_behavior(behavior)