This commit is contained in:
Sander Land committed 2020-12-07 13:33:08 +01:00
1 parent b3ee899ec4
commit 251344c5a0
16 files changed
+44 -34

No files matched your search

+10 -8
View File
@@ -253,18 +253,17 @@ class NewGamePopup(QuickConfigGui):
def normalized_rules(self):
rules = self.katrain.game.root.get_property("RU", "japanese").strip().lower()
for abbr, name in self.katrain.engine.RULESETS_ABBR:
if abbr==rules or abbr==rules:
if abbr == rules or abbr == rules:
return name
def update_playerinfo(self,*args):
def update_playerinfo(self, *args):
for bw, player_setup in self.player_setup.players.items():
name = self.player_name[bw].text
if name:
self.katrain.game.root.set_property("P" + bw, name)
self.katrain.update_player(bw, **player_setup.player_type_dump)
def update_from_current_game(self):
def update_from_current_game(self, *args):
for bw in "BW":
name = self.katrain.game.root.get_property("P" + bw, None)
if name:
@@ -274,7 +273,6 @@ class NewGamePopup(QuickConfigGui):
if rules is not None:
self.rules_spinner.select_key(rules.strip())
def update_config(self, save_to_file=True):
super().update_config(save_to_file=save_to_file)
self.katrain.log(f"New game settings: {self.katrain.config('game')}", OUTPUT_DEBUG)
@@ -288,11 +286,15 @@ class NewGamePopup(QuickConfigGui):
props = self.collect_properties(self)
root = self.katrain.game.root
changed = False
for k, currentval, newval in [("RU",self.normalized_rules(), props["game/rules"]), ("KM", root.komi, props["game/komi"])]:
if currentval !=newval:
for k, currentval, newval in [
("RU", self.normalized_rules(), props["game/rules"]),
("KM", root.komi, props["game/komi"]),
]:
if currentval != newval:
changed = True
self.katrain.log(
f"Property {k} changed from {currentval} to {newval}, triggering re-analysis of entire game.", OUTPUT_INFO
f"Property {k} changed from {currentval} to {newval}, triggering re-analysis of entire game.",
OUTPUT_INFO,
)
self.katrain.game.root.set_property(k, newval)
self.update_playerinfo()