From 50a3965abe2aff59981c756383278fb99edd87af Mon Sep 17 00:00:00 2001 From: Sander Land Date: Fri, 11 Dec 2020 21:00:56 +0100 Subject: [PATCH] no sp in theme --- README.md | 2 +- katrain/gui.kv | 4 ++-- katrain/gui/theme.py | 9 +++------ katrain/popups.kv | 44 ++++++++++++++++++++++---------------------- 4 files changed, 28 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 7d320c0..0e1aa81 100644 --- a/README.md +++ b/README.md @@ -208,7 +208,7 @@ In addition to shortcuts mentioned above and those shown in the main menu: * If still encountering problems, please start KataGo by itself to check for any errors it gives. * Note that if you don't have a GPU, or your GPU does not support OpenCL, you should use the 'eigen' binaries which run on CPU only. * The font size is too small - * On some ultra-high resolution monitors, font scale is not set correctly. Please see [these](https://github.com/sanderland/katrain/issues/250) instructions to adjust them. + * On some ultra-high resolution monitors, font scale is not set correctly. Please see [these](https://github.com/sanderland/katrain/issues/250) instructions to adjust Theme. ## Support / Contribute diff --git a/katrain/gui.kv b/katrain/gui.kv index 46674ff..0049206 100644 --- a/katrain/gui.kv +++ b/katrain/gui.kv @@ -460,7 +460,7 @@ lang_change_tracking: i18n._('') markup: root.markup padding: 5, 5 - font_size: Theme.NOTES_FONT_SIZE + font_size: sp(Theme.NOTES_FONT_SIZE) line_height: root.line_height color: Theme.TEXT_COLOR size_hint_y: None @@ -613,7 +613,7 @@ size_hint: 1,0 LabelledTextInput: id: note - font_size: Theme.NOTES_FONT_SIZE + font_size: sp(Theme.NOTES_FONT_SIZE) multiline: True on_text: root.katrain.set_note(self.text) hint_text: i18n._('SGF Notes Hint') diff --git a/katrain/gui/theme.py b/katrain/gui/theme.py index c2b7ac7..00db9c2 100644 --- a/katrain/gui/theme.py +++ b/katrain/gui/theme.py @@ -1,6 +1,3 @@ -from kivy.metrics import sp - - def to_hexcol(kivycol): return "#" + "".join(f"{round(c * 255):02x}" for c in kivycol[:3]) @@ -22,9 +19,9 @@ BLUE = [0.3, 0.7, 0.9, 1] class Theme: # font DEFAULT_FONT = "fonts/NotoSansCJKsc-Regular.otf" - INPUT_FONT_SIZE = sp(25) - DESC_FONT_SIZE = sp(20) - NOTES_FONT_SIZE = sp(18) + INPUT_FONT_SIZE = 25 # sp + DESC_FONT_SIZE = 20 # sp + NOTES_FONT_SIZE = 18 # sp # gui colors BACKGROUND_COLOR = [36 / 255, 48 / 255, 62 / 255, 1] diff --git a/katrain/popups.kv b/katrain/popups.kv index 9eac4ad..9cba6d5 100644 --- a/katrain/popups.kv +++ b/katrain/popups.kv @@ -18,10 +18,10 @@ # hint_text: "Helper text on focus" # helper_text: "This will disappear when you click off" # helper_text_mode: "on_focus" -# font_size: Theme.INPUT_FONT_SIZE +# font_size: sp(Theme.INPUT_FONT_SIZE) : - font_size: Theme.INPUT_FONT_SIZE + font_size: sp(Theme.INPUT_FONT_SIZE) helper_text_mode: "none" hint_text: "" helper_text: "" @@ -35,27 +35,27 @@ helper_text: i18n._("file not found") : - font_size: Theme.INPUT_FONT_SIZE + font_size: sp(Theme.INPUT_FONT_SIZE) size_hint: 0.5, None : - font_size: Theme.INPUT_FONT_SIZE + font_size: sp(Theme.INPUT_FONT_SIZE) size_hint: 0.5, None : - size: Theme.DESC_FONT_SIZE*2,Theme.DESC_FONT_SIZE*2 + size: sp(Theme.DESC_FONT_SIZE)*2,sp(Theme.DESC_FONT_SIZE)*2 size_hint: None,None on_left_press: if self.target: self.target.text = self.text - size: Theme.DESC_FONT_SIZE * 2, Theme.DESC_FONT_SIZE * 2 - font_size: Theme.DESC_FONT_SIZE + size: sp(Theme.DESC_FONT_SIZE) * 2, sp(Theme.DESC_FONT_SIZE) * 2 + font_size: sp(Theme.DESC_FONT_SIZE) : background_color: Theme.BACKGROUND_COLOR background: self.background if kivy_version < '2.0' else '' title: i18n._(self.title_key) - title_size: Theme.DESC_FONT_SIZE + title_size: sp(Theme.DESC_FONT_SIZE) title_font: self.font_name size_hint: None, None @@ -65,14 +65,14 @@ padding: 4*CP_PADDING,CP_PADDING, 4*CP_PADDING, CP_PADDING : - font_size: Theme.DESC_FONT_SIZE + font_size: sp(Theme.DESC_FONT_SIZE) multiline: True text_size: self.width, None halign: 'center' valign: 'center' - font_size: Theme.DESC_FONT_SIZE * 0.66 + font_size: sp(Theme.DESC_FONT_SIZE) * 0.66 : configfile: configfile @@ -84,7 +84,7 @@ katago_download_progress_box: katago_download_progress_box DescriptionLabel: text: i18n._('katago settings') - font_size: Theme.DESC_FONT_SIZE * 1.5 + font_size: sp(Theme.DESC_FONT_SIZE) * 1.5 GridLayout: cols: 2 rows: 6 @@ -167,9 +167,9 @@ orientation: 'horizontal' DescriptionLabel: text: i18n._('general settings') - font_size: Theme.DESC_FONT_SIZE * 1.5 + font_size: sp(Theme.DESC_FONT_SIZE) * 1.5 DescriptionLabel: - font_size: Theme.DESC_FONT_SIZE * 1.5 + font_size: sp(Theme.DESC_FONT_SIZE) * 1.5 text: i18n._('engine settings') BoxLayout: size_hint: 1,5 @@ -277,7 +277,7 @@ padding: 4 size_hint: 0.95, 1 DescriptionLabel: - font_size: Theme.DESC_FONT_SIZE * 0.8 + font_size: sp(Theme.DESC_FONT_SIZE) * 0.8 text: i18n._("theme") AnchorLayout: LabelledSpinner: @@ -285,7 +285,7 @@ input_property: 'trainer/theme' id: themes_spinner DescriptionLabel: - font_size: Theme.DESC_FONT_SIZE * 0.8 + font_size: sp(Theme.DESC_FONT_SIZE) * 0.8 text: i18n._("stats on top move") AnchorLayout: BoxLayout: @@ -303,19 +303,19 @@ value_refs: TOP_MOVE_OPTIONS input_property: "trainer/top_moves_show_secondary" DescriptionLabel: - font_size: Theme.DESC_FONT_SIZE * 0.8 + font_size: sp(Theme.DESC_FONT_SIZE) * 0.8 text: i18n._("show stats if") AnchorLayout: LabelledIntInput: input_property: "trainer/low_visits" DescriptionLabel: - font_size: Theme.DESC_FONT_SIZE * 0.8 + font_size: sp(Theme.DESC_FONT_SIZE) * 0.8 text: i18n._("show ai dots") AnchorLayout: LabelledCheckBox: input_property: "trainer/eval_show_ai" DescriptionLabel: - font_size: Theme.DESC_FONT_SIZE * 0.8 + font_size: sp(Theme.DESC_FONT_SIZE) * 0.8 text: i18n._("cache analysis to sgf") AnchorLayout: LabelledCheckBox: @@ -468,7 +468,7 @@ LabelledSpinner: size_hint: 0.8,0.8 input_property: 'game/rules' - font_size: Theme.DESC_FONT_SIZE + font_size: sp(Theme.DESC_FONT_SIZE) id: rules_spinner Label: DescriptionLabel: @@ -518,7 +518,7 @@ BoxLayout: size_hint: 1,1 DescriptionLabel: - font_size: Theme.DESC_FONT_SIZE + font_size: sp(Theme.DESC_FONT_SIZE) text: i18n._('Select AI') AnchorLayout: I18NSpinner: @@ -527,12 +527,12 @@ BoxLayout: size_hint: 1,1 DescriptionLabel: - font_size: Theme.DESC_FONT_SIZE + font_size: sp(Theme.DESC_FONT_SIZE) size_hint: 1, 1 text: i18n._('estimated strength') DescriptionLabel: size_hint: 0.8, 1 - font_size: Theme.DESC_FONT_SIZE + font_size: sp(Theme.DESC_FONT_SIZE) id: estimated_rank_label text: '?' + i18n._('strength:kyu') SmallDescriptionLabel: