Skip to content

Commit 5b9bad9

Browse files
author
DozenCrows
committed
Created coloured buttons
1 parent d1c8a78 commit 5b9bad9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

PyGameInterface.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ def __getattr__(self, attr):
5555
dotdict({ 'x':1, 'y':2, 'width':1, 'height':1, 'text':"Info", 'code':"RM-ED050-12 KEY_INFO" }),
5656
dotdict({ 'x':0, 'y':3, 'width':1, 'height':1, 'text':"Enter", 'code':"RM-ED050-12 KEY_SELECT" }),
5757
dotdict({ 'x':1, 'y':3, 'width':1, 'height':1, 'text':"Back", 'code':"RM-ED050-15 KEY_BACK" }),
58+
59+
dotdict({ 'x':0, 'y':4, 'width':0.5, 'height':0.5, 'text':"", 'code':"RM-ED050-15 KEY_RED", 'style': { Style.BACKGROUND_COLOUR:(192, 0, 0), Style.HIGHLIGHT_COLOUR:(255, 255, 255)} }),
60+
dotdict({ 'x':0.5, 'y':4, 'width':0.5, 'height':0.5, 'text':"", 'code':"RM-ED050-15 KEY_GREEN", 'style': { Style.BACKGROUND_COLOUR:(0, 192, 0), Style.HIGHLIGHT_COLOUR:(255,255,255)} }),
61+
dotdict({ 'x':1, 'y':4, 'width':0.5, 'height':0.5, 'text':"", 'code':"RM-ED050-15 KEY_YELLOW", 'style': { Style.BACKGROUND_COLOUR:(192, 192, 0), Style.HIGHLIGHT_COLOUR:(255,255,255)} }),
62+
dotdict({ 'x':1.5, 'y':4, 'width':0.5, 'height':0.5, 'text':"", 'code':"RM-ED050-15 KEY_BLUE", 'style': { Style.BACKGROUND_COLOUR:(0, 0, 192), Style.HIGHLIGHT_COLOUR:(255,255,255)} }),
63+
5864
dotdict({ 'x':0, 'y':5, 'width':2, 'height':1, 'text':"Mute", 'code':"Phillips-HTS KEY_MUTE" }),
5965
]
6066

@@ -123,6 +129,9 @@ def layout_buttons(self, layout):
123129
style = self.button_style_large
124130
else:
125131
style = self.button_style
132+
133+
if button_def.has_key('style'):
134+
style = Style.Style(style, button_def.style)
126135

127136
self.buttons.append(TouchScreenButton(x, y, w, h, button_def.text, button_def.code, style))
128137

@@ -297,6 +306,7 @@ def run(self):
297306
time.sleep(0.1)
298307
pygame.event.set_allowed([pygame.MOUSEBUTTONDOWN, pygame.MOUSEBUTTONUP, pygame.MOUSEMOTION])
299308

309+
self.backlight.set(False)
300310
I2C.deinit()
301311
IR.deinit()
302312

@@ -307,7 +317,7 @@ def send_ir(self, code):
307317
for part in parts:
308318
IR.send_once(part)
309319
RPIO.output(8, False)
310-
self.disable_screen_saver()
320+
self.disable_screen_saver()
311321

312322
def enable_screen_saver(self):
313323
self.screen_saver = True

0 commit comments

Comments
 (0)