Skip to content

Commit a060734

Browse files
committed
Version R2.17e
1 parent 16c86c0 commit a060734

File tree

6 files changed

+36
-26
lines changed

6 files changed

+36
-26
lines changed

bin/Code/MainWindow/WInformation.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,13 @@ def keyPressEvent(self, event):
254254
def comment_changed(self):
255255
if self.move:
256256
self.move.set_comment(self.comment.texto())
257+
self.get_manager().refresh_pgn()
257258
elif self.game:
258259
self.game.first_comment = self.comment.texto().replace("}", "]")
259260

261+
def get_manager(self):
262+
return self.w_parent.manager
263+
260264
def valoration_changed(self):
261265
if self.move:
262266
li = []
@@ -400,6 +404,7 @@ def remove_line(self):
400404

401405
var_move.variations.remove(num_line)
402406
self.link_variation_pressed(selected_link)
407+
self.get_manager().refresh_pgn()
403408

404409
def num_total_variations(self):
405410
total = len(self.li_variations())
@@ -490,8 +495,11 @@ def mostrar(self):
490495

491496
def select(self):
492497
li_variations = self.li_variations()
493-
if len(li_variations) == 0:
498+
n_variations = len(li_variations)
499+
if n_variations == 0:
494500
return None
501+
if n_variations == 1:
502+
return 0
495503
menu = QTVarios.LCMenuRondo(self)
496504
for num, variante in enumerate(li_variations):
497505
move = variante.move(0)
@@ -545,3 +553,4 @@ def tb_remove_variation(self):
545553
if num is not None:
546554
self.move.variations.remove(num)
547555
self.mostrar()
556+
self.get_manager().refresh_pgn()

bin/Code/Manager.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2239,8 +2239,9 @@ def start_message(self, nomodal=False):
22392239
self.mensaje(mensaje, delayed=nomodal)
22402240

22412241
def player_has_moved_base(self, from_sq, to_sq, promotion=""):
2242-
if self.board.variation_history is not None: #and self.board.variation_history.count("|") == 2:
2243-
return self.mueve_variation(from_sq, to_sq, promotion="")
2242+
if self.board.variation_history is not None:
2243+
if not (self.in_end_of_line() and self.board.variation_history.count("|") == 0):
2244+
return self.mueve_variation(from_sq, to_sq, promotion="")
22442245
return self.messenger(from_sq, to_sq, promotion)
22452246

22462247
def mueve_variation(self, from_sq, to_sq, promotion=""):

bin/Code/PlayAgainstEngine/Chess2880.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def get_last_manual(self):
5959

6060
class Chess324:
6161
def __init__(self):
62-
self.num_basic, self.lista = self.generate()
62+
self.lista = self.generate()
6363
self.key = "CHESS324"
6464

6565
@staticmethod
@@ -86,27 +86,23 @@ def generate():
8686
permutation_white: str
8787
for permutation_black in li:
8888
for permutation_white in li:
89+
if permutation_black == permutation_white and permutation_white == "RNBQKBNR":
90+
continue
8991
li_total.append((permutation_black.lower(), permutation_white))
9092

9193
random.seed(324)
9294
random.shuffle(li_total)
9395
random.seed(time.time_ns())
94-
pos_basic = -1
95-
for pos, (permutation_white, permutation_black) in enumerate(li_total):
96-
if permutation_black != permutation_white or permutation_white != "RNBQKBNR":
97-
pos_basic = pos
98-
return pos_basic, li_total
96+
return li_total
9997

10098
def get_fen(self, num):
10199
grp_black, grp_white = self.lista[num]
102100
fen = f"{grp_black}/pppppppp/8/8/8/8/PPPPPPPP/{grp_white} w KQkq - 0 1"
103101
return fen
104102

105103
def get_fen_random(self):
106-
while True:
107-
pos = random.randint(0, 324)
108-
if pos != self.num_basic:
109-
return self.get_fen(pos)
104+
pos = random.randint(0, 323)
105+
return self.get_fen(pos)
110106

111107
def save_last_manual(self, number):
112108
dic = {"LAST_MANUAL": str(number + 1)}

bin/Code/PlayAgainstEngine/WPlayAgainstEngine.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ def new_groupbox(xlabel, xlayout, xrutinacheck=None, checkable=False):
410410
# ##################################################################################################################################
411411
self.cbAjustarRival = (
412412
Controles.CB(self, self.personalidades.list_personalities(True), ADJUST_BETTER)
413-
.capture_changes(self.ajustesCambiado)
413+
.capture_changes(self.changed_strength)
414414
.set_font(font)
415415
)
416416
lb_ajustar_rival = Controles.LB2P(self, _("Set strength")).set_font(font)
@@ -473,7 +473,7 @@ def new_groupbox(xlabel, xlayout, xrutinacheck=None, checkable=False):
473473
dic = {}
474474
self.restore_dic(dic)
475475

476-
self.ajustesCambiado()
476+
self.changed_strength()
477477

478478
self.restore_video(anchoDefecto=710)
479479

@@ -488,7 +488,7 @@ def gb_pww_pressed(self):
488488
def conf_engines(self):
489489
w = WConfEngines.WConfEngines(self)
490490
w.exec_()
491-
self.ajustesCambiado()
491+
self.changed_strength()
492492
self.motores.redo_external_engines()
493493

494494
def grid_num_datos(self, grid):
@@ -734,7 +734,7 @@ def change_personalities(self):
734734
actual = self.cbAjustarRival.valor()
735735
self.cbAjustarRival.rehacer(self.personalidades.list_personalities(True), actual)
736736

737-
def ajustesCambiado(self):
737+
def changed_strength(self):
738738
resp = self.cbAjustarRival.valor()
739739
if resp is None:
740740
self.cbAjustarRival.set_value(ADJUST_HIGH_LEVEL)
@@ -826,7 +826,11 @@ def chess_variants(self):
826826
rondo = QTVarios.rondo_puntos()
827827
rondo_main = QTVarios.rondo_colores()
828828
menu = QTVarios.LCMenuRondo(self)
829-
chess18 = menu.submenu(_("Chess 18"), rondo_main.otro())
829+
830+
def tr_chess(x):
831+
return _("Chess 18").replace("18", x)
832+
833+
chess18 = menu.submenu(tr_chess("18"), rondo_main.otro())
830834
for pos, uno in enumerate(
831835
("rbbqknnr", "rqbbknnr", "rbbnkqnr", "rnbbkqnr", "rbbnknqr", "rnbbknqr", "rqbnkbnr",
832836
"rnbnkbqr", "rnnbkqbr", "rbnnkqbr", "rqnbknbr", "rnqbknbr", "rbqnknbr", "rbnqknbr",
@@ -835,13 +839,13 @@ def chess_variants(self):
835839
chess18.opcion(fen, f"{pos}. {uno}", rondo.otro())
836840

837841
menu.separador()
838-
chess324 = menu.submenu(_("Chess 2880").replace("2880", "324"), rondo_main.otro())
842+
chess324 = menu.submenu(tr_chess("324"), rondo_main.otro())
839843
chess324.opcion("324|manual", _("Select position"), rondo.otro())
840844
chess324.separador()
841845
chess324.opcion("324|random", _("Random"), rondo.otro())
842846

843847
menu.separador()
844-
chess2880 = menu.submenu(_("Chess 2880"), rondo_main.otro())
848+
chess2880 = menu.submenu(tr_chess("2880"), rondo_main.otro())
845849
chess2880.opcion("2880|manual", _("Select position"), rondo.otro())
846850
chess2880.separador()
847851
chess2880.opcion("2880|random", _("Random"), rondo.otro())
@@ -857,14 +861,14 @@ def chess_variants(self):
857861
o2880 = Chess2880.Chess2880()
858862
opcion = resp.split("|")[1]
859863
if opcion == "manual":
860-
number = QTUtil2.read_simple(self, _("Chess 2880"), _("Select position") + " 1...2880",
864+
number = QTUtil2.read_simple(self, tr_chess("2880"), _("Select position") + " 1...2879",
861865
o2880.get_last_manual())
862866
if not number:
863867
return
864868
if not number.isdigit():
865869
return
866870
x = int(number)
867-
if x < 1 or x > 2880:
871+
if x < 1 or x >= 2880:
868872
return
869873
x -= 1
870874
self.fen = o2880.get_fen(x)
@@ -876,14 +880,14 @@ def chess_variants(self):
876880
o324 = Chess2880.Chess324()
877881
opcion = resp.split("|")[1]
878882
if opcion == "manual":
879-
number = QTUtil2.read_simple(self, _("Chess 2880").replace("2880", "324"), _("Select position") + " 1...324",
883+
number = QTUtil2.read_simple(self, tr_chess("324"), _("Select position") + " 1...323",
880884
o324.get_last_manual())
881885
if not number:
882886
return
883887
if not number.isdigit():
884888
return
885889
x = int(number)
886-
if x < 1 or x > 324:
890+
if x < 1 or x >= 324:
887891
return
888892
x -= 1
889893
self.fen = o324.get_fen(x)

bin/Code/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def relative_root(path):
9999

100100

101101
BASE_VERSION = "B" # Para el control de updates que necesitan reinstalar entero
102-
VERSION = "R 2.17d"
102+
VERSION = "R 2.17e"
103103
DEBUG = False
104104
DEBUG_ENGINES = False
105105

bin/bug.log

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Version R 2.17d
1+
Version R 2.17e

0 commit comments

Comments
 (0)