diff --git a/README.md b/README.md index ba57d1b..7d320c0 100644 --- a/README.md +++ b/README.md @@ -199,6 +199,8 @@ In addition to shortcuts mentioned above and those shown in the main menu: ## FAQ +* How can I create themes? + * See [these instructions](THEMES.md). * The program is running too slowly. How can I speed it up? * Adjust the number of visits or maximum time allowed in the settings. * KataGo crashes with out of memory errors, how can I prevent this? diff --git a/THEMES.md b/THEMES.md new file mode 100644 index 0000000..97f1f90 --- /dev/null +++ b/THEMES.md @@ -0,0 +1,11 @@ +# Themes +Version 1.7 brings basic support for themes. + +* Look at the `Theme` class in `katrain/gui/theme.py`. +* Make a `theme.json` file in your `~/.katrain` directory and specify any variables from the above class you want to override, e.g. + ```json + { + "BACKGROUND_COLOR": [1,0,0,1] +} + ``` +* All resources (including icons which can not be renamed for now) will be looked up in `~/.katrain` first, so files with identical names there can be used to override sounds and images. \ No newline at end of file diff --git a/katrain/gui/controlspanel.py b/katrain/gui/controlspanel.py index f9c6458..5fa5e6f 100644 --- a/katrain/gui/controlspanel.py +++ b/katrain/gui/controlspanel.py @@ -9,6 +9,7 @@ from kivymd.uix.floatlayout import MDFloatLayout from katrain.core.constants import MODE_ANALYZE, MODE_PLAY, PLAYER_HUMAN, STATUS_ANALYSIS, STATUS_ERROR from katrain.core.lang import rank_label from katrain.gui.kivyutils import AnalysisToggle, CollapsablePanel +from katrain.gui.theme import Theme class PlayAnalyzeSelect(MDFloatLayout): @@ -70,8 +71,8 @@ class ControlsPanel(BoxLayout): self.status_state = (None, -1e9, None) self.active_comment_node = None self.last_timer_update = (None, 0, False) - self.beep = SoundLoader.load("sounds/countdownbeep.wav") - self.boing = SoundLoader.load("sounds/boing.wav") + self.beep = SoundLoader.load(Theme.COUNTDOWN_SOUND) + self.boing = SoundLoader.load(Theme.MINIMUM_TIME_PASSED_SOUND) if self.boing: self.boing.volume = 0.1 self.beep_start = 5.2 diff --git a/katrain/gui/theme.py b/katrain/gui/theme.py index 58423e0..c2b7ac7 100644 --- a/katrain/gui/theme.py +++ b/katrain/gui/theme.py @@ -64,6 +64,8 @@ class Theme: GRAPH_TEXTURE = "graph_bg.png" # sounds STONE_SOUNDS = [f"stone{i}.wav" for i in [1, 2, 3, 4, 5]] + COUNTDOWN_SOUND = "countdownbeep.wav" + MINIMUM_TIME_PASSED_SOUND = "boing.wav" # eval dots EVAL_COLORS = {