Custom themes

Added toggles for the "Custom Themes" configuration. Colors, icons, sounds, and turn signal animations are all individually toggleable.
This commit is contained in:
FrogAi
2024-02-27 16:34:47 -07:00
parent 50cc95341d
commit 786e52880d
62 changed files with 276 additions and 25 deletions

View File

@@ -77,7 +77,7 @@ class Soundd:
for sound in sound_list:
filename, play_count, volume = sound_list[sound]
wavefile = wave.open(BASEDIR + "/selfdrive/assets/sounds/" + filename, 'r')
wavefile = wave.open(self.sound_directory + filename, 'r')
assert wavefile.getnchannels() == 1
assert wavefile.getsampwidth() == 2
@@ -186,6 +186,19 @@ class Soundd:
AudibleAlert.warningImmediate: self.params.get_int("WarningImmediateVolume")
}
custom_theme = self.params.get_bool("CustomTheme")
custom_sounds = self.params.get_int("CustomSounds") if custom_theme else 0
theme_configuration = {
0: "stock",
1: "frog_theme",
2: "tesla_theme",
3: "stalin_theme"
}
theme_name = theme_configuration.get(custom_sounds, "stock")
self.sound_directory = BASEDIR + ("/selfdrive/frogpilot/assets/custom_themes/" + theme_name + "/sounds/" if custom_sounds else "/selfdrive/assets/sounds/")
self.load_sounds()
def main():