Skip to content

Commit a6c6256

Browse files
committed
Update control GUI
Signed-off-by: Daniel Schaefer <[email protected]>
1 parent 6d61586 commit a6c6256

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

control.py

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def main():
2929
help='Start/stop vertical scrolling')
3030
parser.add_argument("--pattern", help='Display a pattern',
3131
type=str, choices=PATTERNS)
32-
#parser.add_argument("--draw", help="Draw",
32+
# parser.add_argument("--draw", help="Draw",
3333
# type=str, choices=DRAW_PATTERNS)
3434
parser.add_argument("--image", help="Display a PNG or GIF image (black and white only)",
3535
type=argparse.FileType('rb'))
@@ -65,8 +65,8 @@ def main():
6565
elif args.panic:
6666
command = FWK_MAGIC + [0x05, 0x00]
6767
send_command(command)
68-
elif args.draw is not None:
69-
draw(args.draw)
68+
# elif args.draw is not None:
69+
# draw(args.draw)
7070
elif args.image is not None:
7171
image(args.image)
7272
elif args.gui:
@@ -192,7 +192,8 @@ def gui():
192192
[sg.Button("Bootloader")],
193193

194194
[sg.Text("Brightness")],
195-
[sg.Slider((0,255), orientation='h', k='-BRIGHTNESS-', enable_events=True)],
195+
[sg.Slider((0, 255), orientation='h',
196+
k='-BRIGHTNESS-', enable_events=True)],
196197

197198
[sg.Text("Animation")],
198199
[sg.Button("Start Animation"), sg.Button("Stop Animation")],
@@ -201,19 +202,20 @@ def gui():
201202
[sg.Combo(PATTERNS, k='-COMBO-', enable_events=True)],
202203

203204
[sg.Text("Display Percentage")],
204-
[sg.Slider((0,100), orientation='h', k='-PERCENTAGE-', enable_events=True)],
205+
[sg.Slider((0, 100), orientation='h',
206+
k='-PERCENTAGE-', enable_events=True)],
205207

206-
#[sg.Text("Sleep")],
207-
#[sg.Button("Sleep"), sg.Button("Wake")]
208-
#[sg.Button("Panic")]
208+
[sg.Text("Sleep")],
209+
[sg.Button("Sleep"), sg.Button("Wake")],
210+
# [sg.Button("Panic")]
209211

210212
[sg.Button("Quit")]
211213
]
212214
window = sg.Window("Lotus LED Matrix Control", layout)
213215
while True:
214216
event, values = window.read()
215-
print('Event', event)
216-
print('Values', values)
217+
# print('Event', event)
218+
# print('Values', values)
217219

218220
if event == "Quit" or event == sg.WIN_CLOSED:
219221
break
@@ -236,6 +238,14 @@ def gui():
236238
if event == '-PERCENTAGE-':
237239
percentage(int(values['-PERCENTAGE-']))
238240

241+
if event == 'Sleep':
242+
command = FWK_MAGIC + [0x03, True]
243+
send_command(command)
244+
245+
if event == 'Wake':
246+
command = FWK_MAGIC + [0x03, False]
247+
send_command(command)
248+
239249
window.close()
240250

241251

0 commit comments

Comments
 (0)