mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-26 17:33:44 +08:00
e7554170b8
* commaai/openpilot:d05cb31e2e916fba41ba8167030945f427fd811b * bump opendbc * bump opendbc * bump opendbc * bump opendbc * bump opendbc * sunnypilot: remove Qt * cabana: revert to stock Qt * commaai/openpilot:5198b1b079c37742c1050f02ce0aa6dd42b038b9 * commaai/openpilot:954b567b9ba0f3d1ae57d6aa7797fa86dd92ec6e * commaai/openpilot:7534b2a160faa683412c04c1254440e338931c5e * sum more * bump opendbc * not yet * should've been symlink'ed * raylib says wut * quiet mode back * more fixes * no more * too extra red diff on the side * need to bring this back * too extra * let's update docs here * Revert "let's update docs here" This reverts commit 51fe03cd5121e6fdf14657b2c33852c34922b851. * param to control stock vs sp ui * init styles * SP Toggles * Lint * optimizations * multi-button * Lint * param to control stock vs sp ui * init styles * SP Toggles * Lint * optimizations * sp raylib preview * fix callback * fix ui preview * better padding * this * support for next line multi-button * uhh * disabled colors * listitem -> listitemsp * listitem -> listitemsp * add show_description method * remove padding from line separator. like, WHY? 😩😩 * ui: `GuiApplicationExt` * simple button * simple button * add to readme * use gui_app.sunnypilot_ui() * i've got something to confessa * sync * revert * Fix SimpleButtonActionSP not respecting enabled state * some more * ui: `ButtonSP` * slight cleanup * fixes * fix * unused * try this --------- Co-authored-by: Jason Wen <haibin.wen3@gmail.com> Co-authored-by: DevTekVE <devtekve@gmail.com> Co-authored-by: James Vecellio-Grant <159560811+Discountchubbs@users.noreply.github.com> Co-authored-by: discountchubbs <alexgrant990@gmail.com>
96 lines
3.0 KiB
Python
96 lines
3.0 KiB
Python
"""
|
|
Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors.
|
|
|
|
This file is part of sunnypilot and is licensed under the MIT License.
|
|
See the LICENSE.md file in the root directory for more details.
|
|
"""
|
|
from dataclasses import dataclass
|
|
|
|
import pyray as rl
|
|
|
|
|
|
@dataclass
|
|
class Base:
|
|
# Widget/Control Base Dimensions
|
|
ITEM_BASE_HEIGHT = 170
|
|
ITEM_PADDING = 20
|
|
ITEM_TEXT_FONT_SIZE = 50
|
|
ITEM_DESC_FONT_SIZE = 40
|
|
ITEM_DESC_V_OFFSET = 150
|
|
ITEM_TEXT_VALUE_COLOR = rl.Color(170, 170, 170, 255)
|
|
CLOSE_BTN_SIZE = 160
|
|
|
|
TEXT_PADDING = 20
|
|
|
|
# Toggle Control
|
|
TOGGLE_HEIGHT = 120
|
|
TOGGLE_WIDTH = int(TOGGLE_HEIGHT * 1.75)
|
|
TOGGLE_BG_HEIGHT = TOGGLE_HEIGHT - 20
|
|
|
|
# Button Control
|
|
BUTTON_ACTION_WIDTH = 300
|
|
BUTTON_HEIGHT = 120
|
|
|
|
# Simple Button Control
|
|
SIMPLE_BUTTON_WIDTH = 800
|
|
SIMPLE_BUTTON_HEIGHT = 150
|
|
|
|
|
|
@dataclass
|
|
class DefaultStyleSP(Base):
|
|
# Base Colors
|
|
BASE_BG_COLOR = rl.Color(57, 57, 57, 255) # Grey
|
|
ON_BG_COLOR = rl.Color(28, 101, 186, 255) # Blue
|
|
OFF_BG_COLOR = BASE_BG_COLOR
|
|
ON_HOVER_BG_COLOR = rl.Color(17, 78, 150, 255) # Dark Blue
|
|
OFF_HOVER_BG_COLOR = rl.Color(21, 21, 21, 255) # Dark gray
|
|
DISABLED_ON_BG_COLOR = rl.Color(37, 70, 107, 255) # Dull Blue
|
|
DISABLED_OFF_BG_COLOR = rl.Color(39, 39, 39, 255) # Grey
|
|
ITEM_TEXT_COLOR = rl.WHITE
|
|
ITEM_DISABLED_TEXT_COLOR = rl.Color(88, 88, 88, 255)
|
|
ITEM_DESC_TEXT_COLOR = rl.Color(128, 128, 128, 255)
|
|
|
|
# Toggle Control
|
|
TOGGLE_ON_COLOR = ON_BG_COLOR
|
|
TOGGLE_OFF_COLOR = OFF_BG_COLOR
|
|
TOGGLE_KNOB_COLOR = rl.WHITE
|
|
TOGGLE_DISABLED_ON_COLOR = DISABLED_ON_BG_COLOR
|
|
TOGGLE_DISABLED_OFF_COLOR = DISABLED_OFF_BG_COLOR
|
|
TOGGLE_DISABLED_KNOB_COLOR = rl.Color(88, 88, 88, 255) # Lighter Grey
|
|
|
|
# Multi Button Control
|
|
MBC_TRANSPARENT = rl.Color(255, 255, 255, 0)
|
|
MBC_BG_CHECKED_ENABLED = rl.Color(0x69, 0x68, 0x68, 0xFF)
|
|
MBC_DISABLED = rl.Color(0xFF, 0xFF, 0xFF, 0x33)
|
|
|
|
# Option Control
|
|
OPTION_CONTROL_CONTAINER_BG = OFF_BG_COLOR
|
|
OPTION_CONTROL_BTN_ENABLED = rl.Color(88, 88, 88, 255)
|
|
OPTION_CONTROL_BTN_PRESSED = rl.Color(0x69, 0x68, 0x68, 0xFF)
|
|
OPTION_CONTROL_BTN_DISABLED = DISABLED_OFF_BG_COLOR
|
|
OPTION_CONTROL_TEXT_ENABLED = rl.WHITE
|
|
OPTION_CONTROL_TEXT_PRESSED = rl.WHITE
|
|
OPTION_CONTROL_TEXT_DISABLED = ITEM_DISABLED_TEXT_COLOR
|
|
|
|
# Tree Button Colors
|
|
BUTTON_PRIMARY_COLOR = rl.Color(70, 91, 234, 255) # Royal Blue
|
|
BUTTON_NEUTRAL_GRAY = rl.Color(51, 51, 51, 255)
|
|
BUTTON_DISABLED_BG_COLOR = rl.Color(30, 30, 30, 255) # Very Dark Grey
|
|
TREE_DIALOG_TRANSPARENT = rl.Color(0, 0, 0, 0)
|
|
TREE_DIALOG_SEARCH_BUTTON_PRESSED = rl.Color(0x69, 0x68, 0x68, 0xFF)
|
|
TREE_DIALOG_SEARCH_BUTTON_BORDER = rl.Color(150, 150, 150, 200)
|
|
|
|
# Vehicle Description Colors
|
|
GREEN = rl.Color(0, 241, 0, 255)
|
|
BLUE = rl.Color(0, 134, 233, 255)
|
|
YELLOW = rl.Color(255, 213, 0, 255)
|
|
|
|
# Button Colors
|
|
BUTTON_ENABLED_OFF = rl.Color(0x39, 0x39, 0x39, 0xFF)
|
|
BUTTON_OFF_PRESSED = rl.Color(0x4A, 0x4A, 0x4A, 0xFF)
|
|
BUTTON_DISABLED = rl.Color(0x12, 0x12, 0x12, 0xFF)
|
|
BUTTON_TEXT_DISABLED = rl.Color(0x5C, 0x5C, 0x5C, 0xFF)
|
|
|
|
|
|
style = DefaultStyleSP
|