graph click and background
This commit is contained in:
1 parent
41ba582a85
commit
f6b8c73fb2
14 files changed
+78
-68
No files matched your search
@@ -19,14 +19,14 @@ errors = False
|
||||
|
||||
po = {}
|
||||
pofile = {}
|
||||
num_todo = defaultdict(int)
|
||||
todos = defaultdict(list)
|
||||
|
||||
for lang in locales:
|
||||
pofile[lang] = os.path.join(localedir, lang, "LC_MESSAGES", "katrain.po")
|
||||
po[lang] = polib.pofile(pofile[lang])
|
||||
for entry in po[lang].translated_entries():
|
||||
if "TODO" in entry.comment:
|
||||
num_todo[lang] += 1
|
||||
todos[lang].append(entry)
|
||||
else:
|
||||
strings_to_langs[entry.msgid][lang] = entry.msgstr
|
||||
strings_to_keys[entry.msgid][lang] = set(re.findall("{.*?}", entry.msgstr))
|
||||
@@ -34,8 +34,10 @@ for lang in locales:
|
||||
print("duplicate", entry.msgid, "in", lang)
|
||||
errors = True
|
||||
lang_to_strings[lang].add(entry.msgid)
|
||||
if num_todo[lang]:
|
||||
print(f"{lang} has {num_todo[lang]} TODO entries")
|
||||
if todos[lang]:
|
||||
print(f"========== {lang} has {len(todos[lang])} TODO entries ========== ")
|
||||
for item in todos[lang]:
|
||||
print(item)
|
||||
|
||||
|
||||
for lang in locales:
|
||||
|
||||
+4
-3
@@ -140,12 +140,13 @@
|
||||
points: self.x,self.y,self.x+self.width,self.y
|
||||
width: 1
|
||||
|
||||
<I18NSpinner>:
|
||||
font_size: self.height * 0.5
|
||||
sync_height_frac: 1.0
|
||||
<Spinner>:
|
||||
-font_size: self.height * 0.5
|
||||
background_color: [*[c*255/88 for c in BACKGROUND_COLOR[:3]], 1] # compensate for texture
|
||||
option_cls: 'I18NSpinnerOption'
|
||||
|
||||
<I18NSpinner>
|
||||
sync_height_frac: 1.0
|
||||
|
||||
<CircleWithText>:
|
||||
min_size: min(self.height,self.width)
|
||||
|
||||
+42
-22
@@ -46,6 +46,10 @@ class LabelledTextInput(MDTextField):
|
||||
def input_value(self):
|
||||
return self.text
|
||||
|
||||
@property
|
||||
def raw_input_value(self):
|
||||
return self.text
|
||||
|
||||
|
||||
class LabelledPathInput(LabelledTextInput):
|
||||
def __init__(self, **kwargs):
|
||||
@@ -77,6 +81,9 @@ class LabelledCheckBox(MDCheckbox):
|
||||
def input_value(self):
|
||||
return bool(self.active)
|
||||
|
||||
def raw_input_value(self):
|
||||
return self.active
|
||||
|
||||
|
||||
class LabelledSpinner(I18NSpinner):
|
||||
input_property = StringProperty("")
|
||||
@@ -85,6 +92,9 @@ class LabelledSpinner(I18NSpinner):
|
||||
def input_value(self):
|
||||
return self.selected[1] # ref value
|
||||
|
||||
def raw_input_value(self):
|
||||
return self.text
|
||||
|
||||
|
||||
class LabelledFloatInput(LabelledTextInput):
|
||||
signed = BooleanProperty(True)
|
||||
@@ -105,7 +115,7 @@ class LabelledFloatInput(LabelledTextInput):
|
||||
|
||||
@property
|
||||
def input_value(self):
|
||||
return float(self.text)
|
||||
return float('0'+self.text)
|
||||
|
||||
|
||||
class LabelledIntInput(LabelledTextInput):
|
||||
@@ -116,7 +126,7 @@ class LabelledIntInput(LabelledTextInput):
|
||||
|
||||
@property
|
||||
def input_value(self):
|
||||
return int(self.text)
|
||||
return int('0'+self.text)
|
||||
|
||||
|
||||
class InputParseError(Exception):
|
||||
@@ -128,7 +138,7 @@ class QuickConfigGui(MDBoxLayout):
|
||||
super().__init__()
|
||||
self.katrain = katrain
|
||||
self.popup = None
|
||||
Clock.schedule_once(lambda _dt: self.set_properties(self))
|
||||
Clock.schedule_once(self.build_and_set_properties,0)
|
||||
|
||||
def collect_properties(self, widget) -> Dict:
|
||||
if isinstance(widget, (LabelledTextInput, LabelledSpinner, LabelledCheckBox)) and getattr(
|
||||
@@ -137,7 +147,7 @@ class QuickConfigGui(MDBoxLayout):
|
||||
try:
|
||||
ret = {widget.input_property: widget.input_value}
|
||||
except Exception as e: # TODO : on widget?
|
||||
raise InputParseError(f"Could not parse value for {widget.input_property} ({widget.__class__}): {e}")
|
||||
raise InputParseError(f"Could not parse value '{widget.raw_input_value}' for {widget.input_property} ({widget.__class__.__name__}): {e}")
|
||||
else:
|
||||
ret = {}
|
||||
for c in widget.children:
|
||||
@@ -167,7 +177,10 @@ class QuickConfigGui(MDBoxLayout):
|
||||
)
|
||||
return config[keys[-1]], config, keys[-1]
|
||||
|
||||
def set_properties(self, widget):
|
||||
def build_and_set_properties(self,*_args):
|
||||
return self._set_properties_subtree(self)
|
||||
|
||||
def _set_properties_subtree(self, widget):
|
||||
if isinstance(widget, (LabelledTextInput, LabelledSpinner, LabelledCheckBox)) and getattr(
|
||||
widget, "input_property", None
|
||||
):
|
||||
@@ -184,7 +197,7 @@ class QuickConfigGui(MDBoxLayout):
|
||||
else:
|
||||
widget.text = str(value)
|
||||
for c in widget.children:
|
||||
self.set_properties(c)
|
||||
self._set_properties_subtree(c)
|
||||
|
||||
def update_config(self, save_to_file=True):
|
||||
updated = set()
|
||||
@@ -237,15 +250,11 @@ def wrap_anchor(widget):
|
||||
|
||||
|
||||
class ConfigTeacherPopup(QuickConfigGui):
|
||||
def __init__(self, katrain):
|
||||
super().__init__(katrain)
|
||||
self.build()
|
||||
|
||||
def add_option_widgets(self, widgets):
|
||||
for widget in widgets:
|
||||
self.options_grid.add_widget(wrap_anchor(widget))
|
||||
|
||||
def build(self):
|
||||
def build_and_set_properties(self,*_args):
|
||||
undos = self.katrain.config("trainer/num_undo_prompts")
|
||||
thresholds = self.katrain.config("trainer/eval_thresholds")
|
||||
savesgfs = self.katrain.config("trainer/save_feedback")
|
||||
@@ -263,7 +272,7 @@ class ConfigTeacherPopup(QuickConfigGui):
|
||||
LabelledCheckBox(text=str(savesgf), input_property=f"trainer/save_feedback::{i}"),
|
||||
]
|
||||
)
|
||||
self.set_properties(self)
|
||||
super().build_and_set_properties()
|
||||
|
||||
|
||||
class DescriptionLabel(Label):
|
||||
@@ -297,24 +306,35 @@ class AIPopup(QuickConfigGui):
|
||||
|
||||
|
||||
class ConfigPopup(QuickConfigGui):
|
||||
def __init__(self, katrain):
|
||||
super().__init__(katrain)
|
||||
|
||||
def check_models(self):
|
||||
model = self.collect_properties()['katago/model']
|
||||
def build_and_set_properties(self,*_args):
|
||||
super().build_and_set_properties()
|
||||
self.check_models()
|
||||
|
||||
def check_models(self,*args): # WIP
|
||||
try:
|
||||
model = self.collect_properties(self)['engine/model']
|
||||
except InputParseError:
|
||||
self.model_files.values = []
|
||||
return
|
||||
|
||||
if os.path.exists(model):
|
||||
if os.path.isdir(model):
|
||||
path = model
|
||||
file = None
|
||||
path = model.rstrip('\\/')
|
||||
file = None
|
||||
else:
|
||||
if model.startswith('katrain'):
|
||||
model = find_package_resource(model)
|
||||
path, file = os.path.split(model)
|
||||
glob.glob(path+'*.bin.gz')
|
||||
for file in f:
|
||||
|
||||
self.model_files.values = []
|
||||
files = sorted([os.path.split(f)[1] for ftype in ['*.bin.gz','*.txt.gz'] for f in glob.glob(path+os.path.sep+ftype)])
|
||||
self.model_files.values =files
|
||||
print(file,files,file in files)
|
||||
if file in files:
|
||||
self.model_files.text = file
|
||||
else:
|
||||
self.model_files.values = []
|
||||
|
||||
|
||||
def update_config(self, save_to_file=True):
|
||||
updated = super().update_config(save_to_file=save_to_file)
|
||||
self.katrain.debug_level = self.katrain.config("general/debug_level", OUTPUT_INFO)
|
||||
|
||||
@@ -178,44 +178,44 @@ Builder.load_string(
|
||||
rgba: GRAPH_DOT_COLOR
|
||||
Ellipse:
|
||||
id: score_dot
|
||||
pos: [c - self.highlight_size / 2 for c in (self.score_dot_pos if not self.navigate_move else [self.navigate_move[1],self.navigate_move[2]] ) ]
|
||||
pos: [c - self.highlight_size / 2 for c in (self.score_dot_pos if not self.navigate_move[0] else [self.navigate_move[1],self.navigate_move[2]] ) ]
|
||||
size: (self.highlight_size,self.highlight_size) if root.show_score else (0.0001,0.0001)
|
||||
Color:
|
||||
rgba: GRAPH_DOT_COLOR
|
||||
Ellipse:
|
||||
id: winrate_dot
|
||||
pos: [c - self.highlight_size / 2 for c in (self.winrate_dot_pos if not self.navigate_move else [self.navigate_move[1],self.navigate_move[3]] ) ]
|
||||
pos: [c - self.highlight_size / 2 for c in (self.winrate_dot_pos if not self.navigate_move[0] else [self.navigate_move[1],self.navigate_move[3]] ) ]
|
||||
size: (self.highlight_size,self.highlight_size) if root.show_winrate else (0.0001,0.0001)
|
||||
# score ticks
|
||||
GraphMarkerLabel:
|
||||
font_size: root.marker_font_size
|
||||
color: SCORE_COLOR
|
||||
pos: root.right_edge - root.width-1, root.y+root.height - self.font_size - 1
|
||||
pos: root.right_edge - self.width-1, root.pos[1]+root.height - self.font_size - 1
|
||||
text: 'B+{}'.format(root.score_scale)
|
||||
opacity: int(root.show_score)
|
||||
GraphMarkerLabel:
|
||||
font_size: root.marker_font_size
|
||||
color: SCORE_COLOR
|
||||
pos: root.right_edge - root.width-1, root.mid - root.height/2 + 2
|
||||
pos: root.right_edge - self.width-1, root.mid - self.height/2 + 2
|
||||
text: i18n._('Jigo')
|
||||
opacity: int(root.show_score)
|
||||
GraphMarkerLabel:
|
||||
font_size: root.marker_font_size
|
||||
color: SCORE_COLOR
|
||||
pos: root.right_edge - root.width-1, root.y
|
||||
pos: root.right_edge - self.width-1, root.pos[1]
|
||||
text: 'W+' + str(int(root.score_scale))
|
||||
opacity: int(root.show_score)
|
||||
# wr ticks
|
||||
GraphMarkerLabel:
|
||||
font_size: root.marker_font_size
|
||||
color: WINRATE_COLOR
|
||||
pos: root.x+1, root.y+root.height - self.font_size - 1
|
||||
pos: root.pos[0]+1, root.pos[1]+root.height - self.font_size - 1
|
||||
text: "{}%".format(50 + root.winrate_scale)
|
||||
opacity: int(root.show_winrate)
|
||||
GraphMarkerLabel:
|
||||
font_size: root.marker_font_size
|
||||
color: WINRATE_COLOR
|
||||
pos:root.x+1, root.y
|
||||
pos:root.pos[0]+1, root.pos[1]
|
||||
text: "{}%".format(50 - root.winrate_scale)
|
||||
opacity: int(root.show_winrate)
|
||||
"""
|
||||
|
||||
Binary file not shown.
@@ -359,7 +359,10 @@ msgid "general settings"
|
||||
msgstr "Allgemeine Einstellungen"
|
||||
|
||||
msgid "engine settings"
|
||||
msgstr "KataGo Engine Einstellungen"
|
||||
msgstr "Engine Einstellungen"
|
||||
|
||||
msgid "katago settings"
|
||||
msgstr "KataGo Einstellungen"
|
||||
|
||||
msgid "config file path"
|
||||
msgstr "Alle Optionen sind gespeichert in:"
|
||||
@@ -599,7 +602,3 @@ msgstr "KataGo model {model} does not exist, please check general settings."
|
||||
#. TODO
|
||||
msgid "equalizing analysis"
|
||||
msgstr "Equalizing analysis of candidate moves to {visits} visits"
|
||||
|
||||
#. TODO
|
||||
msgid "katago settings"
|
||||
msgstr "KataGo settings"
|
||||
Binary file not shown.
@@ -356,7 +356,10 @@ msgid "general settings"
|
||||
msgstr "Configuraciones Generales"
|
||||
|
||||
msgid "engine settings"
|
||||
msgstr "Configuración Motor KataGo"
|
||||
msgstr "Configuración Motor"
|
||||
|
||||
msgid "katago settings"
|
||||
msgstr "Configuración KataGo"
|
||||
|
||||
msgid "config file path"
|
||||
msgstr "La Configuración se guardan en:"
|
||||
@@ -602,7 +605,3 @@ msgstr ""
|
||||
#. TODO
|
||||
msgid "extra analysis"
|
||||
msgstr "Performing additional analysis to {visits} visits"
|
||||
|
||||
#. TODO
|
||||
msgid "katago settings"
|
||||
msgstr "KataGo settings"
|
||||
Binary file not shown.
@@ -355,8 +355,11 @@ msgstr "Chemin d’accès est introuvable"
|
||||
msgid "general settings"
|
||||
msgstr "Divers"
|
||||
|
||||
msgid "katago settings"
|
||||
msgstr "Moteur de KataGo"
|
||||
|
||||
msgid "engine settings"
|
||||
msgstr "Moteur de Jeu (KataGo)"
|
||||
msgstr "Moteur de Jeu"
|
||||
|
||||
msgid "engine:katago"
|
||||
msgstr ""
|
||||
@@ -635,7 +638,3 @@ msgstr "Details"
|
||||
#. TODO
|
||||
msgid "equalizing analysis"
|
||||
msgstr "Equalizing analysis of candidate moves to {visits} visits"
|
||||
|
||||
#. TODO
|
||||
msgid "katago settings"
|
||||
msgstr "KataGo settings"
|
||||
Binary file not shown.
@@ -349,8 +349,11 @@ msgstr "존재하지 않는 경로입니다."
|
||||
msgid "general settings"
|
||||
msgstr "일반 설정"
|
||||
|
||||
msgid "katago settings"
|
||||
msgstr "KataGo 설정"
|
||||
|
||||
msgid "engine settings"
|
||||
msgstr "KataGo 엔진 설정"
|
||||
msgstr "엔진 설정"
|
||||
|
||||
msgid "config file path"
|
||||
msgstr "설정 파일 경로:"
|
||||
@@ -579,7 +582,3 @@ msgstr "Equalizing analysis of candidate moves to {visits} visits"
|
||||
#. TODO
|
||||
msgid "extra analysis"
|
||||
msgstr "Performing additional analysis to {visits} visits"
|
||||
|
||||
#. TODO
|
||||
msgid "katago settings"
|
||||
msgstr "KataGo settings"
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 835 B After Width: | Height: | Size: 694 B |
+3
-12
@@ -80,7 +80,6 @@
|
||||
|
||||
<ConfigPopup>:
|
||||
configfile: configfile
|
||||
model_files: model_files
|
||||
DescriptionLabel:
|
||||
text: i18n._('katago settings')
|
||||
font_size: DESC_FONT_SIZE * 1.5
|
||||
@@ -99,17 +98,9 @@
|
||||
DescriptionLabel:
|
||||
text: i18n._("engine:model")
|
||||
size_hint: 0.33, 1
|
||||
BoxLayout:
|
||||
AnchorLayout:
|
||||
size_hint: 0.66, 1
|
||||
LabelledPathInput:
|
||||
input_property: "engine/model"
|
||||
on_text: root.check_models(*args)
|
||||
AnchorLayout:
|
||||
size_hint: 0.33, 1
|
||||
Spinner:
|
||||
id: model_files
|
||||
on_text: root.set_model(*args)
|
||||
AnchorLayout:
|
||||
LabelledPathInput:
|
||||
input_property: "engine/model"
|
||||
DescriptionLabel:
|
||||
text: i18n._("engine:config")
|
||||
size_hint: 0.33, 1
|
||||
|
||||
Reference in new issue
Block a user