Skip to content
Snippets Groups Projects
Commit 553a5038 authored by rahix's avatar rahix
Browse files

Merge 'Put colors in variables and use Camp Colors'

See merge request !218
parents e89a4a0c cfe4e667
No related branches found
No related tags found
1 merge request!218Menu: Put colors in variables and use Camp CI
Pipeline #3563 passed
...@@ -14,7 +14,10 @@ import ujson ...@@ -14,7 +14,10 @@ import ujson
import sys import sys
BUTTON_TIMER_POPPED = -1 BUTTON_TIMER_POPPED = -1
COLOR1, COLOR2 = (color.CHAOSBLUE_DARK, color.CHAOSBLUE) COLOR_BG = color.CHAOSBLUE_DARK
COLOR_BG_SEL = color.CHAOSBLUE
COLOR_ARROW = color.COMMYELLOW
COLOR_TEXT = color.COMMYELLOW
MAXCHARS = 11 MAXCHARS = 11
HOMEAPP = "main.py" HOMEAPP = "main.py"
...@@ -173,7 +176,7 @@ def draw_menu(disp, applist, pos, appcount, lineoffset): ...@@ -173,7 +176,7 @@ def draw_menu(disp, applist, pos, appcount, lineoffset):
(i - start) * 20, (i - start) * 20,
159, 159,
(i - start) * 20 + 20, (i - start) * 20 + 20,
col=COLOR1 if i == pos else COLOR2, col=COLOR_BG_SEL if i == pos else COLOR_BG,
) )
line = app[1]["name"] line = app[1]["name"]
...@@ -193,10 +196,11 @@ def draw_menu(disp, applist, pos, appcount, lineoffset): ...@@ -193,10 +196,11 @@ def draw_menu(disp, applist, pos, appcount, lineoffset):
disp.print( disp.print(
" " + line[off : (off + (MAXCHARS - 1))], " " + line[off : (off + (MAXCHARS - 1))],
posy=(i - start) * 20, posy=(i - start) * 20,
bg=COLOR1 if i == pos else COLOR2, fg=COLOR_TEXT,
bg=COLOR_BG_SEL if i == pos else COLOR_BG,
) )
if i == pos: if i == pos:
disp.print(">", posy=(i - start) * 20, fg=color.COMMYELLOW, bg=COLOR1) disp.print(">", posy=(i - start) * 20, fg=COLOR_ARROW, bg=COLOR_BG_SEL)
if linelength > (MAXCHARS - 1) and off < linelength - (MAXCHARS - 1): if linelength > (MAXCHARS - 1) and off < linelength - (MAXCHARS - 1):
triangle(disp, 153, (i - start) * 20 + 6, False, 6) triangle(disp, 153, (i - start) * 20 + 6, False, 6)
...@@ -223,21 +227,9 @@ def main(): ...@@ -223,21 +227,9 @@ def main():
timerinactivity = 100 timerinactivity = 100
for ev in button_events(10): for ev in button_events(10):
if numapps == 0: if numapps == 0:
disp.clear(color.COMMYELLOW) disp.clear(COLOR_BG)
disp.print( disp.print(" No apps ", posx=17, posy=20, fg=COLOR_TEXT, bg=COLOR_BG)
" No apps ", disp.print("available", posx=17, posy=40, fg=COLOR_TEXT, bg=COLOR_BG)
posx=17,
posy=20,
fg=color.COMMYELLOW_DARK,
bg=color.COMMYELLOW,
)
disp.print(
"available",
posx=17,
posy=40,
fg=color.COMMYELLOW_DARK,
bg=color.COMMYELLOW,
)
disp.update() disp.update()
continue continue
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment