Help UI tweaks, remove colour from buttons

This commit is contained in:
Phil Howard
2020-09-10 17:17:41 +01:00
parent 09c3476503
commit b8aa33b059
3 changed files with 21 additions and 20 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -113,16 +113,16 @@ class View:
(x + margin, y + margin - 1), text, font=self.font, fill=textcolor (x + margin, y + margin - 1), text, font=self.font, fill=textcolor
) )
def overlay(self, text): def overlay(self, text, top=0):
"""Draw an overlay with some auto-sized text.""" """Draw an overlay with some auto-sized text."""
self._draw.rectangle( self._draw.rectangle(
(0, 20, DISPLAY_WIDTH, DISPLAY_HEIGHT), fill=(192, 225, 254) (0, top, DISPLAY_WIDTH, DISPLAY_HEIGHT), fill=(192, 225, 254)
) # Overlay backdrop ) # Overlay backdrop
self._draw.rectangle((0, 20, DISPLAY_WIDTH, 21), fill=COLOR_BLUE) # Top border self._draw.rectangle((0, top, DISPLAY_WIDTH, top + 1), fill=COLOR_BLUE) # Top border
self.text_in_rect( self.text_in_rect(
text, text,
self.font, self.font,
(3, 20, DISPLAY_WIDTH - 3, DISPLAY_HEIGHT - 2), (3, top, DISPLAY_WIDTH - 3, DISPLAY_HEIGHT - 2),
line_spacing=1, line_spacing=1,
) )
@@ -244,7 +244,7 @@ class MainView(View):
self.icon(icon_backdrop, (0, 0), COLOR_WHITE) self.icon(icon_backdrop, (0, 0), COLOR_WHITE)
self.icon(icon_rightarrow, (3, 3), (55, 55, 55)) self.icon(icon_rightarrow, (3, 3), (55, 55, 55))
self.alarm.render((0, DISPLAY_HEIGHT - 19)) self.alarm.render((3, DISPLAY_HEIGHT - 23))
self.icon(icon_backdrop.rotate(180), (DISPLAY_WIDTH - 26, 0), COLOR_WHITE) self.icon(icon_backdrop.rotate(180), (DISPLAY_WIDTH - 26, 0), COLOR_WHITE)
self.icon(icon_settings, (DISPLAY_WIDTH - 19 - 3, 3), (55, 55, 55)) self.icon(icon_settings, (DISPLAY_WIDTH - 19 - 3, 3), (55, 55, 55))
@@ -279,25 +279,27 @@ class EditView(View):
self.label( self.label(
"Y", "Y",
"Yes" if mode == "bool" else "++", "Yes" if mode == "bool" else "++",
textcolor=COLOR_WHITE, textcolor=COLOR_BLACK,
bgcolor=COLOR_YELLOW, bgcolor=COLOR_WHITE,
) )
self.label( self.label(
"B", "B",
"No" if mode == "bool" else "--", "No" if mode == "bool" else "--",
textcolor=COLOR_WHITE, textcolor=COLOR_BLACK,
bgcolor=COLOR_BLUE, bgcolor=COLOR_WHITE,
) )
else: else:
self.label("B", "Next", textcolor=COLOR_WHITE, bgcolor=COLOR_BLUE) self.label("B", "Next", textcolor=COLOR_BLACK, bgcolor=COLOR_WHITE)
self.label("Y", "Change", textcolor=COLOR_WHITE, bgcolor=COLOR_YELLOW) self.label("Y", "Change", textcolor=COLOR_BLACK, bgcolor=COLOR_WHITE)
self.icon(icon_help, (0, 0), COLOR_BLUE) self._draw.text((3, 36), f"{title} : {text}", font=self.font, fill=COLOR_WHITE)
self._draw.text((3, 43), f"{title} : {text}", font=self.font, fill=COLOR_WHITE)
if self._help_mode: if self._help_mode:
self.overlay(help) self.icon(icon_backdrop.rotate(90), (0, 0), COLOR_BLUE)
self._draw.rectangle((7, 3, 23, 19), COLOR_BLACK)
self.overlay(help, top=26)
self.icon(icon_help, (0, 0), COLOR_BLUE)
def button_a(self): def button_a(self):
self._help_mode = not self._help_mode self._help_mode = not self._help_mode
@@ -373,7 +375,7 @@ class SettingsView(EditView):
def render(self): def render(self):
self.clear() self.clear()
self._draw.text( self._draw.text(
(23, 3), (28, 5),
"Settings", "Settings",
font=self.font, font=self.font,
fill=COLOR_WHITE, fill=COLOR_WHITE,
@@ -482,8 +484,8 @@ class DetailView(ChannelView):
self.icon(icon_rightarrow, (3, 3), (55, 55, 55)) self.icon(icon_rightarrow, (3, 3), (55, 55, 55))
# Prev button # Prev button
self.icon(icon_backdrop, (0, DISPLAY_HEIGHT - 26), COLOR_WHITE) # self.icon(icon_backdrop, (0, DISPLAY_HEIGHT - 26), COLOR_WHITE)
self.icon(icon_return, (3, DISPLAY_HEIGHT - 26 + 3), (55, 55, 55)) # self.icon(icon_return, (3, DISPLAY_HEIGHT - 26 + 3), (55, 55, 55))
# Edit # Edit
self.icon(icon_backdrop.rotate(180), (DISPLAY_WIDTH - 26, 0), COLOR_WHITE) self.icon(icon_backdrop.rotate(180), (DISPLAY_WIDTH - 26, 0), COLOR_WHITE)
@@ -837,8 +839,7 @@ class ViewController:
self.next_view() self.next_view()
def button_b(self): def button_b(self):
if not self.view.button_b(): self.view.button_b()
self.prev_view()
def button_x(self): def button_x(self):
if not self.view.button_x(): if not self.view.button_x():