-
Notifications
You must be signed in to change notification settings - Fork 1
/
testsuite
executable file
·96 lines (83 loc) · 4.13 KB
/
testsuite
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/usr/bin/python
# -*- encoding: utf-8 -*-
import gui.framework
import device.iss_notify
import datetime
class OpenNotifyTest:
def __init__(self):
self.app = gui.framework.Application()
self.state = {}
self.view = TestWindow(self, self.state)
self.app.main = self.view
self.app.run()
class TestWindow:
def __init__(self, controller, model):
self.window = gui.framework.Window(None, "ISS Notify Test Suite", (400,700))
self.model = model
self.control = controller
self.device = device.iss_notify.ISSNotify()
self.device.verbose = True;
self.init_UI()
self.update_view()
self.window.add_widgets()
def init_UI(self):
self.test_box = self.window.add_box("Testing")
self.syn_btn = self.window.add_button(self.test_box, 0, "SYN", self.syn_press)
self.blink_btn = self.window.add_button(self.test_box, 1, "Blink", self.blink_press)
self.set_color_btn = self.window.add_button(self.test_box, 2, "Set Color", self.color_press)
self.read_clock_btn = self.window.add_button(self.test_box, 3, "Read Clock", self.read_clock_press)
self.set_clock_btn = self.window.add_button(self.test_box, 4, "Set Clock", self.set_clock_press)
self.clear_alarm_btn= self.window.add_button(self.test_box, 5, "Clear Alarms", self.clear_alarm_press)
self.set_alarm_btn = self.window.add_button(self.test_box, 6, "Set Alarm", self.set_alarm_press)
self.get_ms_btn = self.window.add_button(self.test_box, 7, "Get ms", self.get_ms_press)
self.set_block = self.window.add_button(self.test_box, 8, "Set Block", self.set_block_press)
self.get_block = self.window.add_button(self.test_box, 9, "Get Block", self.get_block_press)
self.get_block = self.window.add_button(self.test_box,10, "Rainbow", self.rainbow_press)
self.white_box = self.window.add_box("White Balance")
self.red = self.window.add_slider(self.white_box, 0, "Red", self.red_slide, 127)
self.green = self.window.add_slider(self.white_box, 1, "Green", self.green_slide, 40)
self.blue = self.window.add_slider(self.white_box, 2, "Blue", self.blue_slide, 34)
self.set_wb = self.window.add_button(self.white_box, 3, "Set WB", self.set_wb)
def update_view(self):
pass
# Events
# ======
def syn_press(self, click_arg):
self.device.command("syn")
def blink_press(self, click_arg):
color = self.window.color()
color = device.iss_notify.rgb2device(color)
self.device.command("blink", color)
def color_press(self, click_arg):
color = self.window.color()
color = device.iss_notify.rgb2device(color)
self.device.command("color", arg=str(color))
def read_clock_press(self, click_arg):
self.device.command("time")
def set_clock_press(self, click_arg):
comp_time_utc = datetime.datetime.utcnow()
comp_time_utc = comp_time_utc + datetime.timedelta(seconds=1.2)
tstring = comp_time_utc.strftime('Y%yM%mD%dH%HM%MS%S')
self.device.command("settime", arg=tstring)
def clear_alarm_press(self, click_arg):
self.device.clear_alarm0()
def set_alarm_press(self, click_arg):
self.device.set_alarm()
def get_ms_press(self, click_arg):
self.device.command("ms")
def set_block_press(self, click_arg):
self.device.command("update", arg="2\n987654321,512,1355611869,900,")
def get_block_press(self, clikc_arg):
self.device.command("dump")
def red_slide(self, args):
self.device.command("wb_red", str(self.red.Value))
def green_slide(self, args):
self.device.command("wb_green", str(self.green.Value))
def blue_slide(self, args):
self.device.command("wb_blue", str(self.blue.Value))
def set_wb(self, args):
self.device.command("wb_set", str(self.blue.Value)+','+str(self.green.Value)+','+str(self.red.Value))
def rainbow_press(self, click_arg):
self.device.command("bow")
if __name__ == "__main__":
run = OpenNotifyTest()