popup fix
This commit is contained in:
1 parent
2d20196dda
commit
d7915401e7
12 files changed
+56
-17
No files matched your search
+7
-6
@@ -74,8 +74,6 @@ class KaTrainGui(Screen, KaTrainBase):
|
||||
return
|
||||
if "ready" in message.lower():
|
||||
self.controls.set_status(f"KataGo engine ready.")
|
||||
if "ready" in message.lower():
|
||||
self.controls.set_status(f"KataGo engine ready.")
|
||||
if (level == OUTPUT_ERROR or (level == OUTPUT_KATAGO_STDERR and "error" in message.lower())) and getattr(self, "controls", None):
|
||||
self.controls.set_status(f"ERROR: {message}")
|
||||
|
||||
@@ -156,7 +154,8 @@ class KaTrainGui(Screen, KaTrainBase):
|
||||
if game != self.game.game_id:
|
||||
self.log(f"Message skipped as it is outdated (current game is {self.game.game_id}", OUTPUT_EXTRA_DEBUG)
|
||||
continue
|
||||
getattr(self, f"_do_{msg.replace('-','_')}")(*args)
|
||||
fn = getattr(self, f"_do_{msg.replace('-','_')}")
|
||||
fn(*args)
|
||||
self.update_state()
|
||||
except Exception as e:
|
||||
self.log(f"Exception in processing message {msg} {args}: {e}", OUTPUT_ERROR)
|
||||
@@ -164,7 +163,11 @@ class KaTrainGui(Screen, KaTrainBase):
|
||||
|
||||
def __call__(self, message, *args):
|
||||
if self.game:
|
||||
self.message_queue.put([self.game.game_id, message, *args])
|
||||
if message.endswith('popup'): # gui code needs to run in main kivy thread.
|
||||
fn = getattr(self, f"_do_{message.replace('-', '_')}")
|
||||
Clock.schedule_once(lambda _dt: fn(*args), -1)
|
||||
else: # game related actions
|
||||
self.message_queue.put([self.game.game_id, message, *args])
|
||||
|
||||
def _do_new_game(self, move_tree=None, analyze_fast=False):
|
||||
self.board_gui.animating_pv = None
|
||||
@@ -243,8 +246,6 @@ class KaTrainGui(Screen, KaTrainBase):
|
||||
self.ai_settings_popup.content.popup = self.ai_settings_popup
|
||||
self.ai_settings_popup.open()
|
||||
|
||||
# todo pop
|
||||
|
||||
def _do_analyze_sgf_popup(self):
|
||||
if not self.fileselect_popup:
|
||||
popup_contents = LoadSGFPopup()
|
||||
|
||||
+8
-2
@@ -984,8 +984,14 @@
|
||||
LangButton:
|
||||
icon: 'img/flaticon/flag-ko.png'
|
||||
on_press: app.language = 'ko'
|
||||
MenuLabel:
|
||||
text: i18n._('menu:support')
|
||||
BoxLayout:
|
||||
size_hint: 1,1
|
||||
item_height: root.item_height
|
||||
MenuLabel:
|
||||
text: i18n._('menu:manual')
|
||||
MenuLabel:
|
||||
text: i18n._('menu:support')
|
||||
|
||||
|
||||
<OutlineBox@MDBoxLayout+BackgroundMixin>:
|
||||
|
||||
|
||||
@@ -358,6 +358,7 @@ class CollapsablePanel(MDBoxLayout):
|
||||
options=self.build_options, option_colors=self.build_options, options_height=self.build_options, option_active=self.build_options, options_spacing=self.build_options,
|
||||
)
|
||||
self.bind(state=self.build, size_hint_y_open=self.build, height_open=self.build)
|
||||
MDApp.get_running_app().bind(language=lambda *_: Clock.schedule_once(self.build_options,0))
|
||||
self.build_options()
|
||||
|
||||
def build_options(self, *args, **kwargs):
|
||||
@@ -365,7 +366,7 @@ class CollapsablePanel(MDBoxLayout):
|
||||
self.option_buttons = []
|
||||
option_labels = self.option_labels or [i18n._(f"tab:{opt}") for opt in self.options]
|
||||
for ix, (lbl, opt_col, active) in enumerate(zip(option_labels, self.option_colors, self.option_active)):
|
||||
button = CollapsablePanelTab(text=lbl, active_outline_color=opt_col, height=self.options_height, state="down" if active else "normal")
|
||||
button = CollapsablePanelTab(text=lbl, font_name=i18n.font_name, active_outline_color=opt_col, height=self.options_height, state="down" if active else "normal")
|
||||
self.option_buttons.append(button)
|
||||
button.bind(state=lambda *_args, _ix=ix: self.trigger_select(_ix))
|
||||
self.open_close_button = TransparentIconButton( # << / >> collapse button
|
||||
|
||||
@@ -215,13 +215,13 @@ def wrap_anchor(widget):
|
||||
class ConfigTeacherPopup(QuickConfigGui):
|
||||
def __init__(self, katrain):
|
||||
super().__init__(katrain)
|
||||
Clock.schedule_once(self.build, 0)
|
||||
self.build()
|
||||
|
||||
def add_option_widgets(self, widgets):
|
||||
for widget in widgets:
|
||||
self.options_grid.add_widget(wrap_anchor(widget))
|
||||
|
||||
def build(self, _dt):
|
||||
def build(self):
|
||||
undos = self.katrain.config("trainer/num_undo_prompts")
|
||||
thresholds = self.katrain.config("trainer/eval_thresholds")
|
||||
savesgfs = self.katrain.config("trainer/save_feedback")
|
||||
@@ -251,9 +251,9 @@ class AIPopup(QuickConfigGui):
|
||||
super().__init__(katrain)
|
||||
self.ai_select.bind(text=self.build_ai_options)
|
||||
self.ai_select.value_refs = katrain.ai_strategies
|
||||
Clock.schedule_once(self.build_ai_options, 0)
|
||||
self.build_ai_options()
|
||||
|
||||
def build_ai_options(self, *_args):
|
||||
def build_ai_options(self,*_args):
|
||||
strategy = self.ai_select.selected[1]
|
||||
print(strategy, "=strat", _args)
|
||||
mode_settings = self.katrain.config(f"ai/{strategy}")
|
||||
|
||||
Binary file not shown.
@@ -35,7 +35,10 @@ msgid "menu:lang"
|
||||
msgstr "Language"
|
||||
|
||||
msgid "menu:support"
|
||||
msgstr "Support or Contribute"
|
||||
msgstr "Support"
|
||||
|
||||
msgid "menu:manual"
|
||||
msgstr "Manual"
|
||||
|
||||
#. player options in the setup and on the right
|
||||
msgid "player:type"
|
||||
@@ -399,6 +402,10 @@ msgid "update settings"
|
||||
msgstr "Update Settings"
|
||||
|
||||
# ai settings from here
|
||||
|
||||
msgid "ai settings"
|
||||
msgstr "Advanced AI Settings"
|
||||
|
||||
msgid "Select AI"
|
||||
msgstr "Select AI strategy to configure"
|
||||
|
||||
@@ -452,8 +459,8 @@ msgstr "KataGo"
|
||||
|
||||
msgid "aihelp:default"
|
||||
msgstr ""
|
||||
"Full strength KataGo AI. Strength is mainly affected by `max_visits` and "
|
||||
"`model` in the general settings `engine` section."
|
||||
"Full strength KataGo AI. Strength is affected by `max_visits` and "
|
||||
"`model` in the general settings `engine` section and engine configuration file. No options are available here."
|
||||
|
||||
msgid "ai:jigo"
|
||||
msgstr "KataJigo"
|
||||
|
||||
Binary file not shown.
@@ -205,7 +205,7 @@ msgstr "ㅋㅋ ㅋㅋ ㅋㅋㅋㅋㅋ ㅋㅋ ㅋㅋ"
|
||||
|
||||
#. TODO
|
||||
msgid "menu:support"
|
||||
msgstr "ㅋㅋㅋㅋ ㅋ ㅋㅋㅋㅋㅋ"
|
||||
msgstr "ㅋㅋㅋㅋ"
|
||||
|
||||
#. TODO
|
||||
msgid "menu:lang"
|
||||
@@ -632,3 +632,11 @@ msgstr "ㅋㅋㅋ ㅋ ㅋㅋㅋ"
|
||||
#. TODO
|
||||
msgid "btn:Analyze"
|
||||
msgstr "ㅋㅋㅋㅋ"
|
||||
|
||||
#. TODO
|
||||
msgid "menu:homepage"
|
||||
msgstr "ㅋㅋㅋㅋ"
|
||||
|
||||
#. TODO
|
||||
msgid "menu:manual"
|
||||
msgstr "ㅋㅋㅋ"
|
||||
Binary file not shown.
@@ -642,3 +642,11 @@ msgstr "Load SGF File to Analyze"
|
||||
#. TODO
|
||||
msgid "btn:Analyze"
|
||||
msgstr "Analyze"
|
||||
|
||||
#. TODO
|
||||
msgid "menu:homepage"
|
||||
msgstr "Homepage"
|
||||
|
||||
#. TODO
|
||||
msgid "menu:manual"
|
||||
msgstr "Manual"
|
||||
Binary file not shown.
@@ -674,3 +674,11 @@ msgstr "Load SGF File to Analyze"
|
||||
#. TODO
|
||||
msgid "btn:Analyze"
|
||||
msgstr "Analyze"
|
||||
|
||||
#. TODO
|
||||
msgid "menu:homepage"
|
||||
msgstr "Homepage"
|
||||
|
||||
#. TODO
|
||||
msgid "menu:manual"
|
||||
msgstr "Manual"
|
||||
Reference in new issue
Block a user