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