@@ -29,7 +29,7 @@ def main():
29
29
help = 'Start/stop vertical scrolling' )
30
30
parser .add_argument ("--pattern" , help = 'Display a pattern' ,
31
31
type = str , choices = PATTERNS )
32
- #parser.add_argument("--draw", help="Draw",
32
+ # parser.add_argument("--draw", help="Draw",
33
33
# type=str, choices=DRAW_PATTERNS)
34
34
parser .add_argument ("--image" , help = "Display a PNG or GIF image (black and white only)" ,
35
35
type = argparse .FileType ('rb' ))
@@ -65,8 +65,8 @@ def main():
65
65
elif args .panic :
66
66
command = FWK_MAGIC + [0x05 , 0x00 ]
67
67
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)
70
70
elif args .image is not None :
71
71
image (args .image )
72
72
elif args .gui :
@@ -192,7 +192,8 @@ def gui():
192
192
[sg .Button ("Bootloader" )],
193
193
194
194
[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 )],
196
197
197
198
[sg .Text ("Animation" )],
198
199
[sg .Button ("Start Animation" ), sg .Button ("Stop Animation" )],
@@ -201,19 +202,20 @@ def gui():
201
202
[sg .Combo (PATTERNS , k = '-COMBO-' , enable_events = True )],
202
203
203
204
[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 )],
205
207
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")]
209
211
210
212
[sg .Button ("Quit" )]
211
213
]
212
214
window = sg .Window ("Lotus LED Matrix Control" , layout )
213
215
while True :
214
216
event , values = window .read ()
215
- print ('Event' , event )
216
- print ('Values' , values )
217
+ # print('Event', event)
218
+ # print('Values', values)
217
219
218
220
if event == "Quit" or event == sg .WIN_CLOSED :
219
221
break
@@ -236,6 +238,14 @@ def gui():
236
238
if event == '-PERCENTAGE-' :
237
239
percentage (int (values ['-PERCENTAGE-' ]))
238
240
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
+
239
249
window .close ()
240
250
241
251
0 commit comments