You've already forked MicroPythonOS
mirror of
https://github.com/m5stack/MicroPythonOS.git
synced 2026-05-20 11:51:27 -07:00
Replace 'magic' value 0 with semantic lv.PART.MAIN
This commit is contained in:
@@ -105,8 +105,8 @@ class Connect4(Activity):
|
||||
(self.SCREEN_WIDTH - self.COLS * self.CELL_SIZE) // 2 - 5,
|
||||
self.BOARD_TOP - 5
|
||||
)
|
||||
board_bg.set_style_bg_color(lv.color_hex(self.COLOR_BOARD), 0)
|
||||
board_bg.set_style_radius(8, 0)
|
||||
board_bg.set_style_bg_color(lv.color_hex(self.COLOR_BOARD), lv.PART.MAIN)
|
||||
board_bg.set_style_radius(8, lv.PART.MAIN)
|
||||
board_bg.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
|
||||
|
||||
# Create pieces (visual representation)
|
||||
@@ -119,10 +119,10 @@ class Connect4(Activity):
|
||||
x = board_x + col * self.CELL_SIZE + (self.CELL_SIZE - self.PIECE_RADIUS * 2) // 2
|
||||
y = self.BOARD_TOP + row * self.CELL_SIZE + (self.CELL_SIZE - self.PIECE_RADIUS * 2) // 2
|
||||
piece.set_pos(x, y)
|
||||
piece.set_style_radius(lv.RADIUS_CIRCLE, 0)
|
||||
piece.set_style_bg_color(lv.color_hex(self.COLOR_EMPTY), 0)
|
||||
piece.set_style_border_width(1, 0)
|
||||
piece.set_style_border_color(lv.color_hex(0x1C2833), 0)
|
||||
piece.set_style_radius(lv.RADIUS_CIRCLE, lv.PART.MAIN)
|
||||
piece.set_style_bg_color(lv.color_hex(self.COLOR_EMPTY), lv.PART.MAIN)
|
||||
piece.set_style_border_width(1, lv.PART.MAIN)
|
||||
piece.set_style_border_color(lv.color_hex(0x1C2833), lv.PART.MAIN)
|
||||
piece.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
|
||||
piece_row.append(piece)
|
||||
self.pieces.append(piece_row)
|
||||
@@ -137,8 +137,8 @@ class Connect4(Activity):
|
||||
btn.set_size(self.CELL_SIZE, self.ROWS * self.CELL_SIZE)
|
||||
x = board_x + col * self.CELL_SIZE
|
||||
btn.set_pos(x, self.BOARD_TOP)
|
||||
btn.set_style_bg_opa(0, 0) # Transparent
|
||||
btn.set_style_border_width(0, 0)
|
||||
btn.set_style_bg_opa(0, lv.PART.MAIN) # Transparent
|
||||
btn.set_style_border_width(0, lv.PART.MAIN)
|
||||
btn.add_flag(lv.obj.FLAG.CLICKABLE)
|
||||
btn.add_event_cb(lambda e, c=col: self.on_column_click(c), lv.EVENT.CLICKED, None)
|
||||
btn.add_event_cb(lambda e, b=btn: self.focus_column(b), lv.EVENT.FOCUSED, None)
|
||||
@@ -207,7 +207,7 @@ class Connect4(Activity):
|
||||
|
||||
# Update the visual
|
||||
color = self.COLOR_PLAYER if player == self.PLAYER else self.COLOR_COMPUTER
|
||||
self.pieces[row][col].set_style_bg_color(lv.color_hex(color), 0)
|
||||
self.pieces[row][col].set_style_bg_color(lv.color_hex(color), lv.PART.MAIN)
|
||||
|
||||
# Check for win or tie
|
||||
if self.check_win(row, col):
|
||||
@@ -456,9 +456,9 @@ class Connect4(Activity):
|
||||
def highlight_winning_pieces(self):
|
||||
"""Highlight the winning pieces"""
|
||||
for row, col in self.winning_positions:
|
||||
self.pieces[row][col].set_style_bg_color(lv.color_hex(self.COLOR_WIN), 0)
|
||||
self.pieces[row][col].set_style_border_width(3, 0)
|
||||
self.pieces[row][col].set_style_border_color(lv.color_hex(0xFFFFFF), 0)
|
||||
self.pieces[row][col].set_style_bg_color(lv.color_hex(self.COLOR_WIN), lv.PART.MAIN)
|
||||
self.pieces[row][col].set_style_border_width(3, lv.PART.MAIN)
|
||||
self.pieces[row][col].set_style_border_color(lv.color_hex(0xFFFFFF), lv.PART.MAIN)
|
||||
|
||||
def is_board_full(self):
|
||||
"""Check if the board is full"""
|
||||
@@ -477,6 +477,6 @@ class Connect4(Activity):
|
||||
# Reset visual pieces
|
||||
for row in range(self.ROWS):
|
||||
for col in range(self.COLS):
|
||||
self.pieces[row][col].set_style_bg_color(lv.color_hex(self.COLOR_EMPTY), 0)
|
||||
self.pieces[row][col].set_style_border_width(1, 0)
|
||||
self.pieces[row][col].set_style_border_color(lv.color_hex(0x1C2833), 0)
|
||||
self.pieces[row][col].set_style_bg_color(lv.color_hex(self.COLOR_EMPTY), lv.PART.MAIN)
|
||||
self.pieces[row][col].set_style_border_width(1, lv.PART.MAIN)
|
||||
self.pieces[row][col].set_style_border_color(lv.color_hex(0x1C2833), lv.PART.MAIN)
|
||||
|
||||
@@ -21,7 +21,7 @@ class Main(Activity):
|
||||
|
||||
def onCreate(self):
|
||||
screen = lv.obj()
|
||||
screen.set_style_pad_all(15, 0)
|
||||
screen.set_style_pad_all(15, lv.PART.MAIN)
|
||||
|
||||
# Create title label
|
||||
title_label = lv.label(screen)
|
||||
@@ -39,7 +39,7 @@ class Main(Activity):
|
||||
self.status_label.set_long_mode(lv.label.LONG_MODE.WRAP)
|
||||
self.status_label.align(lv.ALIGN.BOTTOM_LEFT, 0, 0)
|
||||
# Set default green color for status label
|
||||
self.status_label.set_style_text_color(lv.color_hex(0x00FF00), 0)
|
||||
self.status_label.set_style_text_color(lv.color_hex(0x00FF00), lv.PART.MAIN)
|
||||
|
||||
self.setContentView(screen)
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class Draw(Activity):
|
||||
self.hor_res = d.get_horizontal_resolution()
|
||||
self.ver_res = d.get_vertical_resolution()
|
||||
self.canvas.set_size(self.hor_res, self.ver_res)
|
||||
self.canvas.set_style_bg_color(lv.color_white(), 0)
|
||||
self.canvas.set_style_bg_color(lv.color_white(), lv.PART.MAIN)
|
||||
buffer = bytearray(self.hor_res * self.ver_res * 4)
|
||||
self.canvas.set_buffer(buffer, self.hor_res, self.ver_res, lv.COLOR_FORMAT.NATIVE)
|
||||
self.canvas.fill_bg(lv.color_white(), lv.OPA.COVER)
|
||||
|
||||
@@ -39,13 +39,13 @@ class ImageView(Activity):
|
||||
self.prev_button.add_event_cb(lambda e: self.show_prev_image(),lv.EVENT.CLICKED,None)
|
||||
prev_label = lv.label(self.prev_button)
|
||||
prev_label.set_text(lv.SYMBOL.LEFT)
|
||||
prev_label.set_style_text_font(lv.font_montserrat_16, 0)
|
||||
prev_label.set_style_text_font(lv.font_montserrat_16, lv.PART.MAIN)
|
||||
self.play_button = lv.button(screen)
|
||||
self.play_button.align(lv.ALIGN.BOTTOM_MID,0,0)
|
||||
self.play_button.set_style_opa(lv.OPA.TRANSP, 0)
|
||||
self.play_button.set_style_opa(lv.OPA.TRANSP, lv.PART.MAIN)
|
||||
#self.play_button.add_flag(lv.obj.FLAG.HIDDEN)
|
||||
#self.play_button.add_event_cb(lambda e: self.unfocus_if_not_fullscreen(),lv.EVENT.FOCUSED,None)
|
||||
#self.play_button.set_style_shadow_opa(lv.OPA.TRANSP, 0)
|
||||
#self.play_button.set_style_shadow_opa(lv.OPA.TRANSP, lv.PART.MAIN)
|
||||
#self.play_button.add_event_cb(lambda e: self.play(),lv.EVENT.CLICKED,None)
|
||||
#play_label = lv.label(self.play_button)
|
||||
#play_label.set_text(lv.SYMBOL.PLAY)
|
||||
@@ -54,7 +54,7 @@ class ImageView(Activity):
|
||||
self.delete_button.add_event_cb(lambda e: self.delete_image(),lv.EVENT.CLICKED,None)
|
||||
delete_label = lv.label(self.delete_button)
|
||||
delete_label.set_text(lv.SYMBOL.TRASH)
|
||||
delete_label.set_style_text_font(lv.font_montserrat_16, 0)
|
||||
delete_label.set_style_text_font(lv.font_montserrat_16, lv.PART.MAIN)
|
||||
self.next_button = lv.button(screen)
|
||||
self.next_button.align(lv.ALIGN.BOTTOM_RIGHT,0,0)
|
||||
#self.next_button.add_event_cb(self.print_events, lv.EVENT.ALL, None)
|
||||
@@ -62,7 +62,7 @@ class ImageView(Activity):
|
||||
self.next_button.add_event_cb(lambda e: self.show_next_image(),lv.EVENT.CLICKED,None)
|
||||
next_label = lv.label(self.next_button)
|
||||
next_label.set_text(lv.SYMBOL.RIGHT)
|
||||
next_label.set_style_text_font(lv.font_montserrat_16, 0)
|
||||
next_label.set_style_text_font(lv.font_montserrat_16, lv.PART.MAIN)
|
||||
#screen.add_event_cb(self.print_events, lv.EVENT.ALL, None)
|
||||
self.setContentView(screen)
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ class FullscreenQR(Activity):
|
||||
big_receive_qr.set_dark_color(lv.color_black())
|
||||
big_receive_qr.set_light_color(lv.color_white())
|
||||
big_receive_qr.center()
|
||||
big_receive_qr.set_style_border_color(lv.color_white(), 0)
|
||||
big_receive_qr.set_style_border_width(0, 0);
|
||||
big_receive_qr.set_style_border_color(lv.color_white(), lv.PART.MAIN)
|
||||
big_receive_qr.set_style_border_width(0, lv.PART.MAIN);
|
||||
print(f"Updating QR code with data: {receive_qr_data[:20]}...")
|
||||
big_receive_qr.update(receive_qr_data, len(receive_qr_data))
|
||||
print("QR code updated, setting content view")
|
||||
|
||||
@@ -71,7 +71,7 @@ class NostrApp(Activity):
|
||||
def onCreate(self):
|
||||
self.prefs = SharedPreferences("com.micropythonos.nostr")
|
||||
self.main_screen = lv.obj()
|
||||
self.main_screen.set_style_pad_all(10, 0)
|
||||
self.main_screen.set_style_pad_all(10, lv.PART.MAIN)
|
||||
# Header line
|
||||
header_line = lv.line(self.main_screen)
|
||||
header_line.set_points([{'x':0,'y':35},{'x':200,'y':35}],2)
|
||||
@@ -80,7 +80,7 @@ class NostrApp(Activity):
|
||||
self.balance_label = lv.label(self.main_screen)
|
||||
self.balance_label.set_text("")
|
||||
self.balance_label.align(lv.ALIGN.TOP_LEFT, 0, 0)
|
||||
self.balance_label.set_style_text_font(lv.font_montserrat_24, 0)
|
||||
self.balance_label.set_style_text_font(lv.font_montserrat_24, lv.PART.MAIN)
|
||||
self.balance_label.add_flag(lv.obj.FLAG.CLICKABLE)
|
||||
self.balance_label.set_width(DisplayMetrics.pct_of_width(100))
|
||||
# Events label
|
||||
@@ -97,7 +97,7 @@ class NostrApp(Activity):
|
||||
settings_button.add_event_cb(self.settings_button_tap,lv.EVENT.CLICKED,None)
|
||||
settings_label = lv.label(settings_button)
|
||||
settings_label.set_text(lv.SYMBOL.SETTINGS)
|
||||
settings_label.set_style_text_font(lv.font_montserrat_24, 0)
|
||||
settings_label.set_style_text_font(lv.font_montserrat_24, lv.PART.MAIN)
|
||||
settings_label.center()
|
||||
self.setContentView(self.main_screen)
|
||||
|
||||
@@ -156,7 +156,7 @@ class NostrApp(Activity):
|
||||
self.events_label.set_text(f"WiFi is not connected, can't talk to relay...")
|
||||
|
||||
def update_events_label_font(self):
|
||||
self.events_label.set_style_text_font(self.events_label_fonts[self.events_label_current_font], 0)
|
||||
self.events_label.set_style_text_font(self.events_label_fonts[self.events_label_current_font], lv.PART.MAIN)
|
||||
|
||||
def events_label_clicked(self, event):
|
||||
self.events_label_current_font = (self.events_label_current_font + 1) % len(self.events_label_fonts)
|
||||
|
||||
@@ -40,7 +40,7 @@ class ShowFonts(Activity):
|
||||
y = 0
|
||||
for font, name in fonts:
|
||||
title = lv.label(screen)
|
||||
title.set_style_text_font(font, 0)
|
||||
title.set_style_text_font(font, lv.PART.MAIN)
|
||||
title.set_text(f"{name}: 2357 !@#$%^&*( {lv.SYMBOL.OK} {lv.SYMBOL.BACKSPACE} 丰 😀")
|
||||
title.set_pos(0, y)
|
||||
y += font.get_line_height() + 4
|
||||
@@ -66,7 +66,7 @@ class ShowFonts(Activity):
|
||||
x = 0
|
||||
title = lv.label(screen)
|
||||
title.set_text(name + ": 2357 !@#$%^&*(")
|
||||
title.set_style_text_font(lv.font_montserrat_16, 0)
|
||||
title.set_style_text_font(lv.font_montserrat_16, lv.PART.MAIN)
|
||||
title.set_pos(x, y)
|
||||
y += title.get_height() + 20
|
||||
|
||||
@@ -75,7 +75,7 @@ class ShowFonts(Activity):
|
||||
for cp in range(0x20, 0xFF):
|
||||
if font.get_glyph_dsc(font, dsc, cp, cp+1):
|
||||
lbl = lv.label(screen)
|
||||
lbl.set_style_text_font(font, 0)
|
||||
lbl.set_style_text_font(font, lv.PART.MAIN)
|
||||
lbl.set_text(chr(cp))
|
||||
lbl.set_pos(x, y)
|
||||
|
||||
@@ -106,7 +106,7 @@ class ShowFonts(Activity):
|
||||
for font, name in fonts:
|
||||
title = lv.label(screen)
|
||||
title.set_text(name)
|
||||
title.set_style_text_font(lv.font_montserrat_16, 0)
|
||||
title.set_style_text_font(lv.font_montserrat_16, lv.PART.MAIN)
|
||||
title.set_pos(4, y)
|
||||
y += title.get_height() + 20
|
||||
|
||||
@@ -119,7 +119,7 @@ class ShowFonts(Activity):
|
||||
#print(f"{cp} : {chr(cp)}", end="")
|
||||
#print(f"{chr(cp)},", end="")
|
||||
lbl = lv.label(screen)
|
||||
lbl.set_style_text_font(font, 0)
|
||||
lbl.set_style_text_font(font, lv.PART.MAIN)
|
||||
lbl.set_text(chr(cp))
|
||||
lbl.set_pos(x, y)
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ class SoundRecorder(Activity):
|
||||
title = lv.label(screen)
|
||||
title.set_text("Sound Recorder")
|
||||
title.align(lv.ALIGN.TOP_MID, 0, 10)
|
||||
title.set_style_text_font(lv.font_montserrat_20, 0)
|
||||
title.set_style_text_font(lv.font_montserrat_20, lv.PART.MAIN)
|
||||
|
||||
# Status label (shows microphone availability)
|
||||
self._status_label = lv.label(screen)
|
||||
@@ -77,7 +77,7 @@ class SoundRecorder(Activity):
|
||||
self._timer_label = lv.label(screen)
|
||||
self._timer_label.set_text(self._format_timer_text(0))
|
||||
self._timer_label.align(lv.ALIGN.CENTER, 0, -30)
|
||||
self._timer_label.set_style_text_font(lv.font_montserrat_24, 0)
|
||||
self._timer_label.set_style_text_font(lv.font_montserrat_24, lv.PART.MAIN)
|
||||
|
||||
# Record button
|
||||
self._record_button = lv.button(screen)
|
||||
@@ -138,11 +138,11 @@ class SoundRecorder(Activity):
|
||||
"""Update status label based on microphone availability."""
|
||||
if AudioFlinger.has_microphone():
|
||||
self._status_label.set_text("Microphone ready")
|
||||
self._status_label.set_style_text_color(lv.color_hex(0x00AA00), 0)
|
||||
self._status_label.set_style_text_color(lv.color_hex(0x00AA00), lv.PART.MAIN)
|
||||
self._record_button.remove_flag(lv.obj.FLAG.HIDDEN)
|
||||
else:
|
||||
self._status_label.set_text("No microphone available")
|
||||
self._status_label.set_style_text_color(lv.color_hex(0xAA0000), 0)
|
||||
self._status_label.set_style_text_color(lv.color_hex(0xAA0000), lv.PART.MAIN)
|
||||
self._record_button.add_flag(lv.obj.FLAG.HIDDEN)
|
||||
|
||||
def _find_last_recording(self):
|
||||
@@ -259,7 +259,7 @@ class SoundRecorder(Activity):
|
||||
if self._current_max_duration_ms < self.MIN_DURATION_MS:
|
||||
print("SoundRecorder: Not enough storage space")
|
||||
self._status_label.set_text("Not enough storage space")
|
||||
self._status_label.set_style_text_color(lv.color_hex(0xAA0000), 0)
|
||||
self._status_label.set_style_text_color(lv.color_hex(0xAA0000), lv.PART.MAIN)
|
||||
return
|
||||
|
||||
# Start recording
|
||||
@@ -285,9 +285,9 @@ class SoundRecorder(Activity):
|
||||
|
||||
# Update UI
|
||||
self._record_button_label.set_text(lv.SYMBOL.STOP + " Stop")
|
||||
self._record_button.set_style_bg_color(lv.color_hex(0xAA0000), 0)
|
||||
self._record_button.set_style_bg_color(lv.color_hex(0xAA0000), lv.PART.MAIN)
|
||||
self._status_label.set_text("Recording...")
|
||||
self._status_label.set_style_text_color(lv.color_hex(0xAA0000), 0)
|
||||
self._status_label.set_style_text_color(lv.color_hex(0xAA0000), lv.PART.MAIN)
|
||||
|
||||
# Hide play/delete buttons during recording
|
||||
self._play_button.add_flag(lv.obj.FLAG.HIDDEN)
|
||||
@@ -298,7 +298,7 @@ class SoundRecorder(Activity):
|
||||
else:
|
||||
print("SoundRecorder: record_wav failed!")
|
||||
self._status_label.set_text("Failed to start recording")
|
||||
self._status_label.set_style_text_color(lv.color_hex(0xAA0000), 0)
|
||||
self._status_label.set_style_text_color(lv.color_hex(0xAA0000), lv.PART.MAIN)
|
||||
|
||||
def _stop_recording(self):
|
||||
"""Stop recording audio."""
|
||||
@@ -307,7 +307,7 @@ class SoundRecorder(Activity):
|
||||
|
||||
# Show "Saving..." status immediately (file finalization takes time on SD card)
|
||||
self._status_label.set_text("Saving...")
|
||||
self._status_label.set_style_text_color(lv.color_hex(0xFF8800), 0) # Orange
|
||||
self._status_label.set_style_text_color(lv.color_hex(0xFF8800), lv.PART.MAIN) # Orange
|
||||
|
||||
# Disable record button while saving
|
||||
self._record_button.add_flag(lv.obj.FLAG.HIDDEN)
|
||||
@@ -331,7 +331,7 @@ class SoundRecorder(Activity):
|
||||
# Re-enable and reset record button
|
||||
self._record_button.remove_flag(lv.obj.FLAG.HIDDEN)
|
||||
self._record_button_label.set_text(lv.SYMBOL.AUDIO + " Record")
|
||||
self._record_button.set_style_bg_color(lv.theme_get_color_primary(None), 0)
|
||||
self._record_button.set_style_bg_color(lv.theme_get_color_primary(None), lv.PART.MAIN)
|
||||
|
||||
# Update status and find recordings
|
||||
self._update_status()
|
||||
@@ -377,10 +377,10 @@ class SoundRecorder(Activity):
|
||||
|
||||
if success:
|
||||
self._status_label.set_text("Playing...")
|
||||
self._status_label.set_style_text_color(lv.color_hex(0x0000AA), 0)
|
||||
self._status_label.set_style_text_color(lv.color_hex(0x0000AA), lv.PART.MAIN)
|
||||
else:
|
||||
self._status_label.set_text("Playback failed")
|
||||
self._status_label.set_style_text_color(lv.color_hex(0xAA0000), 0)
|
||||
self._status_label.set_style_text_color(lv.color_hex(0xAA0000), lv.PART.MAIN)
|
||||
|
||||
def _on_playback_complete(self, message):
|
||||
"""Callback when playback finishes."""
|
||||
@@ -402,4 +402,4 @@ class SoundRecorder(Activity):
|
||||
except Exception as e:
|
||||
print(f"SoundRecorder: Delete failed: {e}")
|
||||
self._status_label.set_text("Delete failed")
|
||||
self._status_label.set_style_text_color(lv.color_hex(0xAA0000), 0)
|
||||
self._status_label.set_style_text_color(lv.color_hex(0xAA0000), lv.PART.MAIN)
|
||||
@@ -10,13 +10,13 @@ class About(Activity):
|
||||
label.set_text(text)
|
||||
if is_header:
|
||||
primary_color = lv.theme_get_color_primary(None)
|
||||
label.set_style_text_color(primary_color, 0)
|
||||
label.set_style_text_font(lv.font_montserrat_14, 0)
|
||||
label.set_style_margin_top(margin_top, 0)
|
||||
label.set_style_margin_bottom(DisplayMetrics.pct_of_height(2), 0)
|
||||
label.set_style_text_color(primary_color, lv.PART.MAIN)
|
||||
label.set_style_text_font(lv.font_montserrat_14, lv.PART.MAIN)
|
||||
label.set_style_margin_top(margin_top, lv.PART.MAIN)
|
||||
label.set_style_margin_bottom(DisplayMetrics.pct_of_height(2), lv.PART.MAIN)
|
||||
else:
|
||||
label.set_style_text_font(lv.font_montserrat_12, 0)
|
||||
label.set_style_margin_bottom(2, 0)
|
||||
label.set_style_text_font(lv.font_montserrat_12, lv.PART.MAIN)
|
||||
label.set_style_margin_bottom(2, lv.PART.MAIN)
|
||||
return label
|
||||
|
||||
def _add_disk_info(self, screen, path):
|
||||
@@ -35,7 +35,7 @@ class About(Activity):
|
||||
|
||||
def onCreate(self):
|
||||
screen = lv.obj()
|
||||
screen.set_style_border_width(0, 0)
|
||||
screen.set_style_border_width(0, lv.PART.MAIN)
|
||||
screen.set_flex_flow(lv.FLEX_FLOW.COLUMN)
|
||||
screen.set_style_pad_all(DisplayMetrics.pct_of_width(2), lv.PART.MAIN)
|
||||
# Make the screen focusable so it can be scrolled with the arrow keys
|
||||
|
||||
@@ -28,9 +28,9 @@ class AppDetail(Activity):
|
||||
@staticmethod
|
||||
def _apply_default_styles(widget, border=0, radius=0, pad=0):
|
||||
"""Apply common default styles to reduce repetition"""
|
||||
widget.set_style_border_width(border, 0)
|
||||
widget.set_style_radius(radius, 0)
|
||||
widget.set_style_pad_all(pad, 0)
|
||||
widget.set_style_border_width(border, lv.PART.MAIN)
|
||||
widget.set_style_radius(radius, lv.PART.MAIN)
|
||||
widget.set_style_pad_all(pad, lv.PART.MAIN)
|
||||
|
||||
def _cleanup_temp_file(self, path="tmp/temp.mpk"):
|
||||
"""Safely remove temporary file"""
|
||||
@@ -60,7 +60,7 @@ class AppDetail(Activity):
|
||||
self.app = self.getIntent().extras.get("app")
|
||||
self.appstore = self.getIntent().extras.get("appstore")
|
||||
app_detail_screen = lv.obj()
|
||||
app_detail_screen.set_style_pad_all(5, 0)
|
||||
app_detail_screen.set_style_pad_all(5, lv.PART.MAIN)
|
||||
app_detail_screen.set_size(lv.pct(100), lv.pct(100))
|
||||
app_detail_screen.set_pos(0, 40)
|
||||
app_detail_screen.set_flex_flow(lv.FLEX_FLOW.COLUMN)
|
||||
@@ -87,13 +87,13 @@ class AppDetail(Activity):
|
||||
detail_cont.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
|
||||
name_label = lv.label(detail_cont)
|
||||
name_label.set_text(self.app.name)
|
||||
name_label.set_style_text_font(lv.font_montserrat_24, 0)
|
||||
name_label.set_style_text_font(lv.font_montserrat_24, lv.PART.MAIN)
|
||||
self.publisher_label = lv.label(detail_cont)
|
||||
if self.app.publisher:
|
||||
self.publisher_label.set_text(self.app.publisher)
|
||||
else:
|
||||
self.publisher_label.set_text("Unknown publisher")
|
||||
self.publisher_label.set_style_text_font(lv.font_montserrat_16, 0)
|
||||
self.publisher_label.set_style_text_font(lv.font_montserrat_16, lv.PART.MAIN)
|
||||
|
||||
self.progress_bar = lv.bar(app_detail_screen)
|
||||
self.progress_bar.set_width(lv.pct(100))
|
||||
@@ -113,7 +113,7 @@ class AppDetail(Activity):
|
||||
self.version_label.set_text(f"Latest version: {self.app.version}") # would be nice to make this bold if this is newer than the currently installed one
|
||||
else:
|
||||
self.version_label.set_text(f"Unknown version")
|
||||
self.version_label.set_style_text_font(lv.font_montserrat_12, 0)
|
||||
self.version_label.set_style_text_font(lv.font_montserrat_12, lv.PART.MAIN)
|
||||
self.version_label.align_to(self.install_button, lv.ALIGN.OUT_BOTTOM_MID, 0, lv.pct(5))
|
||||
self.long_desc_label = lv.label(app_detail_screen)
|
||||
self.long_desc_label.align_to(self.version_label, lv.ALIGN.OUT_BOTTOM_MID, 0, lv.pct(5))
|
||||
@@ -121,7 +121,7 @@ class AppDetail(Activity):
|
||||
self.long_desc_label.set_text(self.app.long_description)
|
||||
else:
|
||||
self.long_desc_label.set_text(self.app.short_description)
|
||||
self.long_desc_label.set_style_text_font(lv.font_montserrat_12, 0)
|
||||
self.long_desc_label.set_style_text_font(lv.font_montserrat_12, lv.PART.MAIN)
|
||||
self.long_desc_label.set_width(lv.pct(100))
|
||||
print("Loading app detail screen...")
|
||||
self.setContentView(app_detail_screen)
|
||||
|
||||
@@ -59,7 +59,7 @@ class AppStore(Activity):
|
||||
self.settings_button.add_event_cb(self.settings_button_tap,lv.EVENT.CLICKED,None)
|
||||
settings_label = lv.label(self.settings_button)
|
||||
settings_label.set_text(lv.SYMBOL.SETTINGS)
|
||||
settings_label.set_style_text_font(lv.font_montserrat_24, 0)
|
||||
settings_label.set_style_text_font(lv.font_montserrat_24, lv.PART.MAIN)
|
||||
settings_label.center()
|
||||
self.setContentView(self.main_screen)
|
||||
|
||||
@@ -154,11 +154,11 @@ class AppStore(Activity):
|
||||
for app in self.apps:
|
||||
print(app)
|
||||
item = self.apps_list.add_button(None, "")
|
||||
item.set_style_pad_all(0, 0)
|
||||
item.set_style_pad_all(0, lv.PART.MAIN)
|
||||
item.set_size(lv.pct(100), lv.SIZE_CONTENT)
|
||||
self._add_click_handler(item, self.show_app_detail, app)
|
||||
cont = lv.obj(item)
|
||||
cont.set_style_pad_all(0, 0)
|
||||
cont.set_style_pad_all(0, lv.PART.MAIN)
|
||||
cont.set_flex_flow(lv.FLEX_FLOW.ROW)
|
||||
cont.set_size(lv.pct(100), lv.SIZE_CONTENT)
|
||||
cont.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
|
||||
@@ -172,16 +172,16 @@ class AppStore(Activity):
|
||||
label_cont = lv.obj(cont)
|
||||
self._apply_default_styles(label_cont)
|
||||
label_cont.set_flex_flow(lv.FLEX_FLOW.COLUMN)
|
||||
label_cont.set_style_pad_ver(10, 0) # Add vertical padding for spacing
|
||||
label_cont.set_style_pad_ver(10, lv.PART.MAIN) # Add vertical padding for spacing
|
||||
label_cont.set_size(lv.pct(75), lv.SIZE_CONTENT)
|
||||
self._add_click_handler(label_cont, self.show_app_detail, app)
|
||||
name_label = lv.label(label_cont)
|
||||
name_label.set_text(app.name)
|
||||
name_label.set_style_text_font(lv.font_montserrat_16, 0)
|
||||
name_label.set_style_text_font(lv.font_montserrat_16, lv.PART.MAIN)
|
||||
self._add_click_handler(name_label, self.show_app_detail, app)
|
||||
desc_label = lv.label(label_cont)
|
||||
desc_label.set_text(app.short_description)
|
||||
desc_label.set_style_text_font(lv.font_montserrat_12, 0)
|
||||
desc_label.set_style_text_font(lv.font_montserrat_12, lv.PART.MAIN)
|
||||
self._add_click_handler(desc_label, self.show_app_detail, app)
|
||||
print("create_apps_list done")
|
||||
# Settings button needs to float in foreground:
|
||||
@@ -274,9 +274,9 @@ class AppStore(Activity):
|
||||
@staticmethod
|
||||
def _apply_default_styles(widget, border=0, radius=0, pad=0):
|
||||
"""Apply common default styles to reduce repetition"""
|
||||
widget.set_style_border_width(border, 0)
|
||||
widget.set_style_radius(radius, 0)
|
||||
widget.set_style_pad_all(pad, 0)
|
||||
widget.set_style_border_width(border, lv.PART.MAIN)
|
||||
widget.set_style_radius(radius, lv.PART.MAIN)
|
||||
widget.set_style_pad_all(pad, lv.PART.MAIN)
|
||||
|
||||
@staticmethod
|
||||
def _add_click_handler(widget, callback, app):
|
||||
|
||||
@@ -26,10 +26,10 @@ class Launcher(Activity):
|
||||
print("launcher.py onCreate()")
|
||||
main_screen = lv.obj()
|
||||
main_screen.set_style_border_width(0, lv.PART.MAIN)
|
||||
main_screen.set_style_radius(0, 0)
|
||||
main_screen.set_style_radius(0, lv.PART.MAIN)
|
||||
main_screen.set_pos(0, AppearanceManager.NOTIFICATION_BAR_HEIGHT)
|
||||
main_screen.set_style_pad_hor(DisplayMetrics.pct_of_width(2), 0)
|
||||
main_screen.set_style_pad_ver(AppearanceManager.NOTIFICATION_BAR_HEIGHT, 0)
|
||||
main_screen.set_style_pad_hor(DisplayMetrics.pct_of_width(2), lv.PART.MAIN)
|
||||
main_screen.set_style_pad_ver(AppearanceManager.NOTIFICATION_BAR_HEIGHT, lv.PART.MAIN)
|
||||
main_screen.set_flex_flow(lv.FLEX_FLOW.ROW_WRAP)
|
||||
self.setContentView(main_screen)
|
||||
|
||||
@@ -102,8 +102,8 @@ class Launcher(Activity):
|
||||
app_cont = lv.obj(screen)
|
||||
app_cont.set_size(iconcont_width, iconcont_height)
|
||||
app_cont.set_style_border_width(0, lv.PART.MAIN)
|
||||
app_cont.set_style_pad_all(0, 0)
|
||||
app_cont.set_style_bg_opa(lv.OPA.TRANSP, 0)
|
||||
app_cont.set_style_pad_all(0, lv.PART.MAIN)
|
||||
app_cont.set_style_bg_opa(lv.OPA.TRANSP, lv.PART.MAIN)
|
||||
app_cont.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
|
||||
|
||||
# ----- icon ----------------------------------------------------
|
||||
@@ -124,7 +124,7 @@ class Launcher(Activity):
|
||||
label.set_long_mode(lv.label.LONG_MODE.WRAP)
|
||||
label.set_width(iconcont_width)
|
||||
label.align(lv.ALIGN.BOTTOM_MID, 0, 0)
|
||||
label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
|
||||
label.set_style_text_align(lv.TEXT_ALIGN.CENTER, lv.PART.MAIN)
|
||||
|
||||
# ----- events --------------------------------------------------
|
||||
app_cont.add_event_cb(
|
||||
|
||||
@@ -38,7 +38,7 @@ class OSUpdate(Activity):
|
||||
|
||||
def onCreate(self):
|
||||
self.main_screen = lv.obj()
|
||||
self.main_screen.set_style_pad_all(DisplayMetrics.pct_of_width(2), 0)
|
||||
self.main_screen.set_style_pad_all(DisplayMetrics.pct_of_width(2), lv.PART.MAIN)
|
||||
|
||||
# Make the screen focusable so it can be scrolled with the arrow keys
|
||||
if focusgroup := lv.group_get_default():
|
||||
|
||||
@@ -40,7 +40,7 @@ class CalibrateIMUActivity(Activity):
|
||||
|
||||
def onCreate(self):
|
||||
screen = lv.obj()
|
||||
screen.set_style_pad_all(DisplayMetrics.pct_of_width(3), 0)
|
||||
screen.set_style_pad_all(DisplayMetrics.pct_of_width(3), lv.PART.MAIN)
|
||||
screen.set_flex_flow(lv.FLEX_FLOW.COLUMN)
|
||||
screen.set_flex_align(lv.FLEX_ALIGN.CENTER, lv.FLEX_ALIGN.START, lv.FLEX_ALIGN.CENTER)
|
||||
focusgroup = lv.group_get_default()
|
||||
@@ -50,20 +50,20 @@ class CalibrateIMUActivity(Activity):
|
||||
# Title
|
||||
self.title_label = lv.label(screen)
|
||||
self.title_label.set_text("IMU Calibration")
|
||||
self.title_label.set_style_text_font(lv.font_montserrat_16, 0)
|
||||
self.title_label.set_style_text_font(lv.font_montserrat_16, lv.PART.MAIN)
|
||||
|
||||
# Status label
|
||||
self.status_label = lv.label(screen)
|
||||
self.status_label.set_text("Initializing...")
|
||||
self.status_label.set_style_text_font(lv.font_montserrat_12, 0)
|
||||
self.status_label.set_style_text_font(lv.font_montserrat_12, lv.PART.MAIN)
|
||||
self.status_label.set_long_mode(lv.label.LONG_MODE.WRAP)
|
||||
self.status_label.set_width(lv.pct(100))
|
||||
|
||||
# Detail label (for additional info)
|
||||
self.detail_label = lv.label(screen)
|
||||
self.detail_label.set_text("")
|
||||
self.detail_label.set_style_text_font(lv.font_montserrat_10, 0)
|
||||
self.detail_label.set_style_text_color(lv.color_hex(0x888888), 0)
|
||||
self.detail_label.set_style_text_font(lv.font_montserrat_10, lv.PART.MAIN)
|
||||
self.detail_label.set_style_text_color(lv.color_hex(0x888888), lv.PART.MAIN)
|
||||
self.detail_label.set_long_mode(lv.label.LONG_MODE.WRAP)
|
||||
self.detail_label.set_width(lv.pct(90))
|
||||
|
||||
@@ -71,9 +71,9 @@ class CalibrateIMUActivity(Activity):
|
||||
btn_cont = lv.obj(screen)
|
||||
btn_cont.set_width(lv.pct(100))
|
||||
btn_cont.set_height(lv.SIZE_CONTENT)
|
||||
btn_cont.set_style_border_width(0, 0)
|
||||
btn_cont.set_style_border_width(0, lv.PART.MAIN)
|
||||
btn_cont.set_flex_flow(lv.FLEX_FLOW.ROW)
|
||||
btn_cont.set_style_flex_main_place(lv.FLEX_ALIGN.SPACE_BETWEEN, 0)
|
||||
btn_cont.set_style_flex_main_place(lv.FLEX_ALIGN.SPACE_BETWEEN, lv.PART.MAIN)
|
||||
|
||||
# Action button
|
||||
self.action_button = lv.button(btn_cont)
|
||||
|
||||
+22
-28
@@ -34,8 +34,7 @@ class CheckIMUCalibrationActivity(Activity):
|
||||
|
||||
def onCreate(self):
|
||||
screen = lv.obj()
|
||||
screen.set_style_pad_all(DisplayMetrics.pct_of_width(1), 0)
|
||||
#screen.set_style_pad_all(0, 0)
|
||||
screen.set_style_pad_all(DisplayMetrics.pct_of_width(1), lv.PART.MAIN)
|
||||
screen.set_flex_flow(lv.FLEX_FLOW.COLUMN)
|
||||
focusgroup = lv.group_get_default()
|
||||
if focusgroup:
|
||||
@@ -55,84 +54,79 @@ class CheckIMUCalibrationActivity(Activity):
|
||||
# Status label
|
||||
self.status_label = lv.label(screen)
|
||||
self.status_label.set_text("Checking...")
|
||||
self.status_label.set_style_text_font(lv.font_montserrat_14, 0)
|
||||
self.status_label.set_style_text_font(lv.font_montserrat_14, lv.PART.MAIN)
|
||||
|
||||
# Separator
|
||||
sep1 = lv.obj(screen)
|
||||
sep1.set_size(lv.pct(100), 2)
|
||||
sep1.set_style_bg_color(lv.color_hex(0x666666), 0)
|
||||
sep1.set_style_bg_color(lv.color_hex(0x666666), lv.PART.MAIN)
|
||||
|
||||
# Quality score (large, prominent)
|
||||
self.quality_score_label = lv.label(screen)
|
||||
self.quality_score_label.set_text("Quality: --")
|
||||
self.quality_score_label.set_style_text_font(lv.font_montserrat_16, 0)
|
||||
self.quality_score_label.set_style_text_font(lv.font_montserrat_16, lv.PART.MAIN)
|
||||
|
||||
data_cont = lv.obj(screen)
|
||||
data_cont.set_width(lv.pct(100))
|
||||
data_cont.set_height(lv.SIZE_CONTENT)
|
||||
data_cont.set_style_pad_all(0, 0)
|
||||
data_cont.set_style_bg_opa(lv.OPA.TRANSP, 0)
|
||||
data_cont.set_style_border_width(0, 0)
|
||||
data_cont.set_style_pad_all(0, lv.PART.MAIN)
|
||||
data_cont.set_style_bg_opa(lv.OPA.TRANSP, lv.PART.MAIN)
|
||||
data_cont.set_style_border_width(0, lv.PART.MAIN)
|
||||
data_cont.set_flex_flow(lv.FLEX_FLOW.ROW)
|
||||
data_cont.set_style_flex_main_place(lv.FLEX_ALIGN.SPACE_BETWEEN, 0)
|
||||
data_cont.set_style_flex_main_place(lv.FLEX_ALIGN.SPACE_BETWEEN, lv.PART.MAIN)
|
||||
|
||||
# Accelerometer section
|
||||
acc_cont = lv.obj(data_cont)
|
||||
acc_cont.set_height(lv.SIZE_CONTENT)
|
||||
acc_cont.set_width(lv.pct(45))
|
||||
acc_cont.set_style_border_width(0, 0)
|
||||
acc_cont.set_style_pad_all(0, 0)
|
||||
acc_cont.set_style_border_width(0, lv.PART.MAIN)
|
||||
acc_cont.set_style_pad_all(0, lv.PART.MAIN)
|
||||
acc_cont.set_flex_flow(lv.FLEX_FLOW.COLUMN)
|
||||
|
||||
accel_title = lv.label(acc_cont)
|
||||
accel_title.set_text("Accel. (m/s^2)")
|
||||
accel_title.set_style_text_font(lv.font_montserrat_12, 0)
|
||||
accel_title.set_style_text_font(lv.font_montserrat_12, lv.PART.MAIN)
|
||||
|
||||
for axis in ['X', 'Y', 'Z']:
|
||||
label = lv.label(acc_cont)
|
||||
label.set_text(f"{axis}: --")
|
||||
label.set_style_text_font(lv.font_montserrat_10, 0)
|
||||
label.set_style_text_font(lv.font_montserrat_10, lv.PART.MAIN)
|
||||
self.accel_labels.append(label)
|
||||
|
||||
# Gyroscope section
|
||||
gyro_cont = lv.obj(data_cont)
|
||||
gyro_cont.set_width(DisplayMetrics.pct_of_width(45))
|
||||
gyro_cont.set_height(lv.SIZE_CONTENT)
|
||||
gyro_cont.set_style_border_width(0, 0)
|
||||
gyro_cont.set_style_pad_all(0, 0)
|
||||
gyro_cont.set_style_border_width(0, lv.PART.MAIN)
|
||||
gyro_cont.set_style_pad_all(0, lv.PART.MAIN)
|
||||
gyro_cont.set_flex_flow(lv.FLEX_FLOW.COLUMN)
|
||||
|
||||
gyro_title = lv.label(gyro_cont)
|
||||
gyro_title.set_text("Gyro (deg/s)")
|
||||
gyro_title.set_style_text_font(lv.font_montserrat_12, 0)
|
||||
gyro_title.set_style_text_font(lv.font_montserrat_12, lv.PART.MAIN)
|
||||
|
||||
for axis in ['X', 'Y', 'Z']:
|
||||
label = lv.label(gyro_cont)
|
||||
label.set_text(f"{axis}: --")
|
||||
label.set_style_text_font(lv.font_montserrat_10, 0)
|
||||
label.set_style_text_font(lv.font_montserrat_10, lv.PART.MAIN)
|
||||
self.gyro_labels.append(label)
|
||||
|
||||
# Separator
|
||||
#sep2 = lv.obj(screen)
|
||||
#sep2.set_size(lv.pct(100), 2)
|
||||
#sep2.set_style_bg_color(lv.color_hex(0x666666), 0)
|
||||
|
||||
# Issues label
|
||||
self.issues_label = lv.label(screen)
|
||||
self.issues_label.set_text("Issues: None")
|
||||
self.issues_label.set_style_text_font(lv.font_montserrat_12, 0)
|
||||
self.issues_label.set_style_text_color(lv.color_hex(0xFF6666), 0)
|
||||
self.issues_label.set_style_text_font(lv.font_montserrat_12, lv.PART.MAIN)
|
||||
self.issues_label.set_style_text_color(lv.color_hex(0xFF6666), lv.PART.MAIN)
|
||||
self.issues_label.set_long_mode(lv.label.LONG_MODE.WRAP)
|
||||
self.issues_label.set_width(lv.pct(95))
|
||||
|
||||
# Button container
|
||||
btn_cont = lv.obj(screen)
|
||||
btn_cont.set_style_pad_all(5, 0)
|
||||
btn_cont.set_style_pad_all(5, lv.PART.MAIN)
|
||||
btn_cont.set_width(lv.pct(100))
|
||||
btn_cont.set_height(lv.SIZE_CONTENT)
|
||||
btn_cont.set_style_border_width(0, 0)
|
||||
btn_cont.set_style_border_width(0, lv.PART.MAIN)
|
||||
btn_cont.set_flex_flow(lv.FLEX_FLOW.ROW)
|
||||
btn_cont.set_style_flex_main_place(lv.FLEX_ALIGN.SPACE_BETWEEN, 0)
|
||||
btn_cont.set_style_flex_main_place(lv.FLEX_ALIGN.SPACE_BETWEEN, lv.PART.MAIN)
|
||||
|
||||
# Back button
|
||||
back_btn = lv.button(btn_cont)
|
||||
@@ -197,7 +191,7 @@ class CheckIMUCalibrationActivity(Activity):
|
||||
color = 0xFFFF66 # Yellow
|
||||
else:
|
||||
color = 0xFF6666 # Red
|
||||
self.quality_score_label.set_style_text_color(lv.color_hex(color), 0)
|
||||
self.quality_score_label.set_style_text_color(lv.color_hex(color), lv.PART.MAIN)
|
||||
|
||||
# Update accelerometer values
|
||||
accel_mean = quality['accel_mean']
|
||||
|
||||
@@ -31,7 +31,7 @@ class WiFi(Activity):
|
||||
def onCreate(self):
|
||||
print("wifi.py onCreate")
|
||||
main_screen = lv.obj()
|
||||
main_screen.set_style_pad_all(15, 0)
|
||||
main_screen.set_style_pad_all(15, lv.PART.MAIN)
|
||||
self.aplist = lv.list(main_screen)
|
||||
self.aplist.set_size(lv.pct(100), lv.pct(75))
|
||||
self.aplist.align(lv.ALIGN.TOP_MID, 0, 0)
|
||||
@@ -274,7 +274,7 @@ class EditNetwork(Activity):
|
||||
buttons = lv.obj(password_page)
|
||||
buttons.set_width(lv.pct(100))
|
||||
buttons.set_height(lv.SIZE_CONTENT)
|
||||
buttons.set_style_bg_opa(lv.OPA.TRANSP, 0)
|
||||
buttons.set_style_bg_opa(lv.OPA.TRANSP, lv.PART.MAIN)
|
||||
buttons.set_style_border_width(0, lv.PART.MAIN)
|
||||
# Forget / Scan QR button
|
||||
self.forget_button = lv.button(buttons)
|
||||
@@ -311,14 +311,14 @@ class EditNetwork(Activity):
|
||||
if self.selected_ssid is None:
|
||||
new_ssid = self.ssid_ta.get_text()
|
||||
if not new_ssid:
|
||||
self.ssid_ta.set_style_bg_color(lv.color_hex(0xff8080), 0)
|
||||
self.ssid_ta.set_style_bg_color(lv.color_hex(0xff8080), lv.PART.MAIN)
|
||||
return
|
||||
else:
|
||||
self.selected_ssid = new_ssid
|
||||
# If a password is filled, then it should be at least 8 characters:
|
||||
pwd = self.password_ta.get_text()
|
||||
if len(pwd) > 0 and len(pwd) < 8:
|
||||
self.password_ta.set_style_bg_color(lv.color_hex(0xff8080), 0)
|
||||
self.password_ta.set_style_bg_color(lv.color_hex(0xff8080), lv.PART.MAIN)
|
||||
return
|
||||
|
||||
# Return the result
|
||||
|
||||
@@ -190,7 +190,7 @@ class AppearanceManager:
|
||||
|
||||
color = AppearanceManager.get_primary_color()
|
||||
if color:
|
||||
button.set_style_bg_color(color, 0)
|
||||
button.set_style_bg_color(color, lv.PART.MAIN)
|
||||
"""
|
||||
return cls._primary_color
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@ class CameraActivity(Activity):
|
||||
|
||||
def onCreate(self):
|
||||
self.main_screen = lv.obj()
|
||||
self.main_screen.set_style_pad_all(1, 0)
|
||||
self.main_screen.set_style_border_width(0, 0)
|
||||
self.main_screen.set_style_pad_all(1, lv.PART.MAIN)
|
||||
self.main_screen.set_style_border_width(0, lv.PART.MAIN)
|
||||
self.main_screen.set_size(lv.pct(100), lv.pct(100))
|
||||
self.main_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
|
||||
# Initialize LVGL image widget
|
||||
@@ -105,9 +105,9 @@ class CameraActivity(Activity):
|
||||
center_w = round((mpos_ui.DisplayMetrics.pct_of_width(100) - self.button_width - 5 - width)/2)
|
||||
center_h = round((mpos_ui.DisplayMetrics.pct_of_height(100) - height)/2)
|
||||
self.status_label_cont.set_pos(center_w,center_h)
|
||||
self.status_label_cont.set_style_bg_color(lv.color_white(), 0)
|
||||
self.status_label_cont.set_style_bg_opa(66, 0)
|
||||
self.status_label_cont.set_style_border_width(0, 0)
|
||||
self.status_label_cont.set_style_bg_color(lv.color_white(), lv.PART.MAIN)
|
||||
self.status_label_cont.set_style_bg_opa(66, lv.PART.MAIN)
|
||||
self.status_label_cont.set_style_border_width(0, lv.PART.MAIN)
|
||||
self.status_label = lv.label(self.status_label_cont)
|
||||
self.status_label.set_text(self.STATUS_NO_CAMERA)
|
||||
self.status_label.set_long_mode(lv.label.LONG_MODE.WRAP)
|
||||
|
||||
@@ -121,7 +121,7 @@ class CameraSettingsActivity(Activity):
|
||||
# Create main screen
|
||||
screen = lv.obj()
|
||||
screen.set_size(lv.pct(100), lv.pct(100))
|
||||
screen.set_style_pad_all(1, 0)
|
||||
screen.set_style_pad_all(1, lv.PART.MAIN)
|
||||
|
||||
# Create tabview
|
||||
tabview = lv.tabview(screen)
|
||||
@@ -149,7 +149,7 @@ class CameraSettingsActivity(Activity):
|
||||
"""Create slider with label showing current value."""
|
||||
cont = lv.obj(parent)
|
||||
cont.set_size(lv.pct(100), 60)
|
||||
cont.set_style_pad_all(3, 0)
|
||||
cont.set_style_pad_all(3, lv.PART.MAIN)
|
||||
|
||||
label = lv.label(cont)
|
||||
label.set_text(f"{label_text}: {default_val}")
|
||||
@@ -173,7 +173,7 @@ class CameraSettingsActivity(Activity):
|
||||
"""Create checkbox with label."""
|
||||
cont = lv.obj(parent)
|
||||
cont.set_size(lv.pct(100), 35)
|
||||
cont.set_style_pad_all(3, 0)
|
||||
cont.set_style_pad_all(3, lv.PART.MAIN)
|
||||
|
||||
checkbox = lv.checkbox(cont)
|
||||
checkbox.set_text(label_text)
|
||||
@@ -187,7 +187,7 @@ class CameraSettingsActivity(Activity):
|
||||
"""Create dropdown with label."""
|
||||
cont = lv.obj(parent)
|
||||
cont.set_size(lv.pct(100), lv.SIZE_CONTENT)
|
||||
cont.set_style_pad_all(2, 0)
|
||||
cont.set_style_pad_all(2, lv.PART.MAIN)
|
||||
|
||||
label = lv.label(cont)
|
||||
label.set_text(label_text)
|
||||
@@ -215,7 +215,7 @@ class CameraSettingsActivity(Activity):
|
||||
def create_textarea(self, parent, label_text, min_val, max_val, default_val, pref_key):
|
||||
cont = lv.obj(parent)
|
||||
cont.set_size(lv.pct(100), lv.SIZE_CONTENT)
|
||||
cont.set_style_pad_all(3, 0)
|
||||
cont.set_style_pad_all(3, lv.PART.MAIN)
|
||||
|
||||
label = lv.label(cont)
|
||||
label.set_text(f"{label_text}:")
|
||||
@@ -242,7 +242,7 @@ class CameraSettingsActivity(Activity):
|
||||
button_cont.set_size(lv.pct(100), DisplayMetrics.pct_of_height(20))
|
||||
button_cont.remove_flag(lv.obj.FLAG.SCROLLABLE)
|
||||
button_cont.align(lv.ALIGN.BOTTOM_MID, 0, 0)
|
||||
button_cont.set_style_border_width(0, 0)
|
||||
button_cont.set_style_border_width(0, lv.PART.MAIN)
|
||||
|
||||
save_button = lv.button(button_cont)
|
||||
save_button.set_size(lv.SIZE_CONTENT, lv.SIZE_CONTENT)
|
||||
@@ -280,7 +280,7 @@ class CameraSettingsActivity(Activity):
|
||||
"""Create Basic settings tab."""
|
||||
tab.set_flex_flow(lv.FLEX_FLOW.COLUMN)
|
||||
#tab.set_scrollbar_mode(lv.SCROLLBAR_MODE.AUTO)
|
||||
tab.set_style_pad_all(1, 0)
|
||||
tab.set_style_pad_all(1, lv.PART.MAIN)
|
||||
|
||||
# Color Mode
|
||||
colormode = prefs.get_bool("colormode")
|
||||
@@ -334,7 +334,7 @@ class CameraSettingsActivity(Activity):
|
||||
def create_advanced_tab(self, tab, prefs):
|
||||
"""Create Advanced settings tab."""
|
||||
tab.set_flex_flow(lv.FLEX_FLOW.COLUMN)
|
||||
tab.set_style_pad_all(1, 0)
|
||||
tab.set_style_pad_all(1, lv.PART.MAIN)
|
||||
|
||||
# Auto Exposure Control (master switch)
|
||||
exposure_ctrl = prefs.get_bool("exposure_ctrl")
|
||||
@@ -442,7 +442,7 @@ class CameraSettingsActivity(Activity):
|
||||
"""Create Expert settings tab."""
|
||||
#tab.set_scrollbar_mode(lv.SCROLLBAR_MODE.AUTO)
|
||||
tab.set_flex_flow(lv.FLEX_FLOW.COLUMN)
|
||||
tab.set_style_pad_all(1, 0)
|
||||
tab.set_style_pad_all(1, lv.PART.MAIN)
|
||||
|
||||
# Sharpness
|
||||
sharpness = prefs.get_int("sharpness")
|
||||
@@ -494,7 +494,7 @@ class CameraSettingsActivity(Activity):
|
||||
|
||||
def create_raw_tab(self, tab, prefs):
|
||||
tab.set_flex_flow(lv.FLEX_FLOW.COLUMN)
|
||||
tab.set_style_pad_all(0, 0)
|
||||
tab.set_style_pad_all(0, lv.PART.MAIN)
|
||||
|
||||
# This would be nice but does not provide adequate resolution:
|
||||
#startX, label, cont = self.create_slider(tab, "startX", 0, 2844, startX, "startX")
|
||||
|
||||
@@ -132,7 +132,7 @@ def handle_back_swipe():
|
||||
backbutton.add_state(lv.STATE.DISABLED)
|
||||
backlabel = lv.label(backbutton)
|
||||
backlabel.set_text(lv.SYMBOL.LEFT)
|
||||
backlabel.set_style_text_font(lv.font_montserrat_18, 0)
|
||||
backlabel.set_style_text_font(lv.font_montserrat_18, lv.PART.MAIN)
|
||||
backlabel.center()
|
||||
|
||||
def handle_top_swipe():
|
||||
@@ -162,5 +162,5 @@ def handle_top_swipe():
|
||||
downbutton.add_state(lv.STATE.DISABLED)
|
||||
downlabel = lv.label(downbutton)
|
||||
downlabel.set_text(lv.SYMBOL.DOWN)
|
||||
downlabel.set_style_text_font(lv.font_montserrat_18, 0)
|
||||
downlabel.set_style_text_font(lv.font_montserrat_18, lv.PART.MAIN)
|
||||
downlabel.center()
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user