Skip to content

Commit

Permalink
Version R2.10a
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasmonk committed Sep 14, 2023
1 parent 4132ad9 commit 487a3ef
Show file tree
Hide file tree
Showing 31 changed files with 517 additions and 426 deletions.
Binary file modified Resources/Locale/es/LC_MESSAGES/lucaschess.mo
Binary file not shown.
Binary file modified Resources/Locale/fr/LC_MESSAGES/lucaschess.mo
Binary file not shown.
594 changes: 299 additions & 295 deletions Resources/Locale/messages.pot

Large diffs are not rendered by default.

Binary file modified Resources/Locale/nl/LC_MESSAGES/lucaschess.mo
Binary file not shown.
2 changes: 1 addition & 1 deletion Resources/Locale/nl/lang.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
NAME=Nederlands
AUTHOR=Willy Lefebvre
%=78
%=83
15 changes: 9 additions & 6 deletions bin/Code/Analysis/AnalysisGame.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,10 @@ def save_pgn(self, file, name, dic_cab, fen, move, rm, mj):
return False

if mj: # blunder
pblunder = Game.Game()
pblunder.set_position(move.position_before)
pblunder.read_pv(rm.pv)
jg0 = pblunder.move(0)
game_blunder = Game.Game()
game_blunder.set_position(move.position_before)
game_blunder.read_pv(rm.pv)
jg0 = game_blunder.move(0)
jg0.set_comment(rm.texto())

p = Game.Game()
Expand All @@ -255,7 +255,7 @@ def save_pgn(self, file, name, dic_cab, fen, move, rm, mj):

jg0.set_comment("%s %s: %s\n" % (name, eti_t, rm.texto()))
if mj:
jg0.add_variation(pblunder)
jg0.add_variation(game_blunder)

cab = ""
for k, v in dic_cab.items():
Expand All @@ -267,7 +267,7 @@ def save_pgn(self, file, name, dic_cab, fen, move, rm, mj):
cab += '[Result "%s"]\n' % result

with open(file, "at", encoding="utf-8", errors="ignore") as q:
texto = cab + "\n" + p.pgnBase() + mas + "\n\n"
texto = cab + "\n" + p.pgn_base() + mas + "\n\n"
q.write(texto)

return True
Expand Down Expand Up @@ -540,6 +540,9 @@ def gui_dispatch(xrm):

self.xmanager.remove_gui_dispatch()

# from Code.Analysis import AnalysisMaia
# AnalysisMaia.analysis_maia(self.procesador.main_window, self.xmanager, game, True)


def analysis_game(manager):
game = manager.game
Expand Down
2 changes: 1 addition & 1 deletion bin/Code/Analysis/Histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ def genHistograms(game):
if lostp:
tooltip += " ↓%0.02f" % lostp

avg = move.elo_avg
avg = move.elo_avg if hasattr(move, "elo_avg") else 0
# tooltip += " (%d)" % avg
hp = HPoint(nj, pts, lostp, lostp_abs, tooltip, avg)
hgame.addPoint(hp)
Expand Down
8 changes: 4 additions & 4 deletions bin/Code/Base/Game.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def readPGN(self, pgn):
def pgn(self):
li = ['[%s "%s"]\n' % (k, v) for k, v in self.li_tags]
txt = "".join(li)
txt += "\n%s" % self.pgnBase()
txt += "\n%s" % self.pgn_base()
return txt

def pgn_tags(self):
Expand Down Expand Up @@ -479,8 +479,8 @@ def pgnBaseRAW(self, numJugada=None, translated=False):

return resp

def pgnBase(self, numJugada=None):
resp = self.pgnBaseRAW(numJugada)
def pgn_base(self, numJugada=None, translated=False):
resp = self.pgnBaseRAW(numJugada, translated=translated)
li = []
ln = len(resp)
pos = 0
Expand Down Expand Up @@ -543,7 +543,7 @@ def pgn_translated(self, numJugada=None, hastaJugada=9999):

pgn = move.pgn_translated()
if n == len(self) - 1:
if self.termination == TERMINATION_MATE:
if self.termination == TERMINATION_MATE and not pgn.endswith("#"):
pgn += "#"

resp += pgn + " "
Expand Down
6 changes: 4 additions & 2 deletions bin/Code/Base/Move.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def __init__(self, game, position_before=None, position=None, from_sq=None, to_s
self.bad_move = None
self.verybad_move = None

self.elo_avg = 0

def set_time_ms(self, ms):
self.time_ms = ms

Expand Down Expand Up @@ -117,8 +119,8 @@ def is_draw(self):

@property
def pgnBase(self):
pgnBase = self.position_before.pgn(self.from_sq, self.to_sq, self.promotion)
return pgnBase
xpgn_base = self.position_before.pgn(self.from_sq, self.to_sq, self.promotion)
return xpgn_base

def add_nag(self, nag):
if nag and not (nag in self.li_nags):
Expand Down
8 changes: 8 additions & 0 deletions bin/Code/Config/Configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ def __init__(self, user):
self.x_analyzer_depth_ab = 24
self.x_analyzer_mstime_ab = 0
self.x_analyzer_mstime_refresh_ab = 200
self.x_analyzer_activate_ab = False

self.x_maia_nodes_exponential = False

Expand Down Expand Up @@ -361,6 +362,13 @@ def set_player(self, value):
def translator(self):
return self.x_translator if self.x_translator else "en"

def language(self):
tr_actual = self.translator()
dlang = Code.path_resource("Locale")
fini = os.path.join(dlang, tr_actual, "lang.ini")
dic = Util.ini_dic(fini)
return dic["NAME"]

def set_translator(self, xtranslator):
self.x_translator = xtranslator

Expand Down
3 changes: 3 additions & 0 deletions bin/Code/Config/WindowConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def options(parent, configuration):

li_traducciones = configuration.list_translations()
tr_actual = configuration.translator()

li = []
for k, trad, porc, author in li_traducciones:
label = "%s" % trad
Expand Down Expand Up @@ -198,6 +199,7 @@ def options(parent, configuration):

form.checkbox(_("Enable captured material window by default"), configuration.x_captures_activate)
form.checkbox(_("Enable information panel by default"), configuration.x_info_activate)
form.checkbox(_("Enable analysis bar by default"), configuration.x_analyzer_activate_ab)
form.checkbox(_("Arrow with the best move when there is an analysis"), configuration.x_show_bestmove)
form.separador()
form.spinbox(_("Font size of information labels"), 3, 30, 70, configuration.x_sizefont_infolabels)
Expand Down Expand Up @@ -273,6 +275,7 @@ def options(parent, configuration):
configuration.x_pgn_withfigurines,
configuration.x_captures_activate,
configuration.x_info_activate,
configuration.x_analyzer_activate_ab,
configuration.x_show_bestmove,
configuration.x_sizefont_infolabels,
configuration.x_enable_highdpiscaling,
Expand Down
2 changes: 1 addition & 1 deletion bin/Code/ControlPGN.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def actual(self):
for k, v in dmore().items():
resp += '[%s "%s"]\n' % (k, v)

resp += "\n" + self.manager.game.pgnBase()
resp += "\n" + self.manager.game.pgn_base()
if not resp.endswith(r):
resp += " %s" % r

Expand Down
2 changes: 2 additions & 0 deletions bin/Code/Director/TabVisual.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,8 @@ def recupera(self):
if lista is not None:
for reg in lista:
self.recuperaReg(reg)
else:
lista = []

li_previos = self.board.lista_movibles()
self.board.borraMovibles()
Expand Down
1 change: 1 addition & 0 deletions bin/Code/Director/WindowDirector.py
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,7 @@ def boardRelease(self, a1, siRight, is_shift, is_alt, is_ctrl):
nid = int(nid)
self.datos_new = self.creaTarea(tp, nid, a1 + a1, -1)
self.tp_new = tp
self.refresh_guion()
# li = self.guion.borraRepeticionUltima()
# if li:
# self.borrar_lista(li)
Expand Down
9 changes: 5 additions & 4 deletions bin/Code/Engines/EngineRun.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,28 +651,29 @@ def play_bestmove_time(self, play_return, game, time_white, time_black, inc_time
if self.test_book(game):
play_return(self.mrm)
return
env = "go nodes %d" % self.nodes
env = f"go nodes {self.nodes}"
max_time = time_white if self.is_white else time_black
self.play_with_return(play_return, game, env, max_time, None)

def play_bestmove_game(self, play_return, game, max_time, max_depth):
if self.test_book(game):
play_return(self.mrm)
return
env = "go nodes %d" % self.nodes
env = f"go nodes {self.nodes}"
self.play_with_return(play_return, game, env, max_time, max_depth)

def test_book(self, game):
if len(game) < 30:
pv = self.book.eligeJugadaTipo(game.last_position.fen(), random.choice(self.book_select))
if pv:
self.mrm.dispatch("bestmove %s" % pv)
self.mrm.dispatch(f"bestmove {pv}")
self.mrm.ordena()
return True
return False

def work_bestmove(self, orden, msmax_time):
self.reset()
orden = "go nodes %d" % self.nodes
orden = f"go nodes {self.nodes}"
self.put_line(orden)
self.wait_mrm("bestmove", msmax_time)

2 changes: 1 addition & 1 deletion bin/Code/GM/ManagerGM.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,6 @@ def current_pgn(self):
resp += '[ECO "%s"]\n' % ap.eco
resp += '[Opening "%s"]\n' % ap.tr_name

resp += "\n" + self.game.pgnBase() + " " + result.strip()
resp += "\n" + self.game.pgn_base() + " " + result.strip()

return resp
4 changes: 1 addition & 3 deletions bin/Code/GM/WindowGM.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ def __init__(self, procesador):
self.cbBooks, lbBooks = QTUtil2.combobox_lb(self, li, None, _("Bypass moves in the book"))

# Openings

self.btOpening = Controles.PB(self, " " * 5 + _("Undetermined") + " " * 5, self.aperturasEditar).ponPlano(False)
self.btOpeningsFavoritas = (
Controles.PB(self, "", self.preferred_openings).ponIcono(Iconos.Favoritos()).anchoFijo(24)
Expand Down Expand Up @@ -438,12 +437,11 @@ def grabaDic(self):
def restore_dic(self):
dic = Util.restore_pickle(self.configuration.file_gms())
if dic:

gm = dic["GM"]
modo = dic.get("MODO", "estandar")
is_white = dic.get("IS_WHITE", True)
with_adjudicator = dic.get("WITH_ADJUDICATOR", True)
show_evals = dic.get("SHOWEVALS", False)
show_evals = dic.get("SHOW_EVALS", False)
engine = dic["ENGINE"]
vtime = dic["VTIME"]
depth = dic.get("DEPTH", 0)
Expand Down
18 changes: 14 additions & 4 deletions bin/Code/MainWindow/WAnalysisBar.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from PySide2 import QtWidgets, QtCore

import Code
from Code.Base import Game
from Code.Analysis import AnalysisEval
from Code.Base import Game
from Code.QT import FormLayout, Iconos


Expand All @@ -20,6 +20,9 @@ def __init__(self, w_parent, board):
self.setValue(5000)
self.setTextVisible(False)
b, w = Code.dic_colors["BLACK_ANALYSIS_BAR"], Code.dic_colors["WHITE_ANALYSIS_BAR"]
# style = """QProgressBar{background-color :%s;border : 1px solid %s; border-radius: 5px;}
# QProgressBar::chunk {background-color: %s; border-bottom-right-radius: 5px;
# border-bottom-left-radius: 5px;}""" % (b, b, w)
style = """QProgressBar{background-color :%s;border : 1px solid %s;}
QProgressBar::chunk {background-color: %s;}""" % (b, b, w)
self.setStyleSheet(style)
Expand All @@ -30,6 +33,13 @@ def __init__(self, w_parent, board):
self.xpv = None
self.game = None

def set_value(self, valor):
v = self.value()
dif = +1 if v < valor else -1
while v != valor:
v += dif
self.setValue(v)

def activate(self, ok):
self.setVisible(ok)
if ok:
Expand Down Expand Up @@ -62,7 +72,7 @@ def set_game(self, game):
close = True
if close:
# Si ya está calculado y está fuera de límites se actualiza pero no se lanza el motor
self.setValue(ev_cache)
self.set_value(ev_cache)
self.setToolTip(tooltip_cache)
return

Expand All @@ -83,15 +93,15 @@ def control_state(self):
cp = -cp
cp = max(cp, -self.max_range)
cp = min(cp, self.max_range)
ev = int(self.aeval.lv(cp)*100)
ev = int(self.aeval.lv(cp) * 100)
if self.xpv in self.cache:
ev_cache, rm_cache, tooltip_cache = self.cache[self.xpv]
if rm_cache.depth > depth:
ev = ev_cache
rm = rm_cache
tooltip = tooltip_cache

self.setValue(ev)
self.set_value(ev)

if tooltip is None:
pgn = Game.pv_pgn(self.game.last_position.fen(), rm.pv)
Expand Down
21 changes: 15 additions & 6 deletions bin/Code/Manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ def __init__(self, procesador):
self.board.exePulsadoNum = self.exePulsadoNum
self.board.exePulsadaLetra = self.exePulsadaLetra

# Capturas
self.capturasActivable = False

# Informacion
self.informacionActivable = False
self.analysisbarActivable = False



self.nonDistract = None

Expand Down Expand Up @@ -794,6 +794,12 @@ def ponCapPorDefecto(self):
self.main_window.activaCapturas(True)
self.put_view()

def ponABarPorDefecto(self):
self.analysisbarActivable = True
if self.configuration.x_analyzer_activate_ab:
self.main_window.activate_analysis_bar(True)
self.put_view()

def ponInfoPorDefecto(self):
self.informacionActivable = True
if self.configuration.x_info_activate:
Expand All @@ -803,6 +809,7 @@ def ponInfoPorDefecto(self):
def ponCapInfoPorDefecto(self):
self.ponCapPorDefecto()
self.ponInfoPorDefecto()
self.ponABarPorDefecto()

def capturas(self):
if self.capturasActivable:
Expand Down Expand Up @@ -1234,7 +1241,7 @@ def configurar(self, liMasOpciones=None, siCambioTutor=False, siSonidos=False, s
menuVista.opcion(
"vista_analysis_bar",
_("Analysis Bar"),
siChecked=self.main_window.with_analysis_bar,
siChecked=self.configuration.x_analyzer_activate_ab,
)
menu.separador()

Expand Down Expand Up @@ -1329,7 +1336,9 @@ def configurar(self, liMasOpciones=None, siCambioTutor=False, siSonidos=False, s
self.configuration.graba()
self.put_view()
elif resp == "analysis_bar":
self.main_window.activate_analysis_bar(not self.main_window.with_analysis_bar)
self.configuration.x_analyzer_activate_ab = not self.configuration.x_analyzer_activate_ab
self.configuration.graba()
self.main_window.activate_analysis_bar(self.configuration.x_analyzer_activate_ab)
self.put_view()

elif resp == "sonido":
Expand Down Expand Up @@ -1725,7 +1734,7 @@ def save_lcsb(self):
break

def save_pgn(self):
w = WindowSavePGN.WSave(self.main_window, self.game, self.configuration)
w = WindowSavePGN.WSave(self.main_window, self.game)
w.exec_()

def save_pgn_clipboard(self):
Expand Down
3 changes: 0 additions & 3 deletions bin/Code/ManagerSolo.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,9 +475,6 @@ def informacion(self):
self.editEtiquetasPGN()

def configure_gs(self):
mt = _("Engine").lower()
mt = _X(_("Disable %1"), mt) if self.play_against_engine else _X(_("Enable %1"), mt)

li_mas_opciones = [("rotacion", _("Auto-rotate board"), Iconos.JS_Rotacion())]
resp = self.configurar(li_mas_opciones, siCambioTutor=True, siSonidos=True)

Expand Down
2 changes: 1 addition & 1 deletion bin/Code/Openings/OpeningLines.py
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,7 @@ def exportarPGN(self, ws, result):
ws.write("\n\n")
tags = "".join(['[%s "%s"]\n' % (k, v) for k, v in liTags])
ws.write(tags)
ws.write("\n%s" % game.pgnBase())
ws.write("\n%s" % game.pgn_base())

ws.pb_close()

Expand Down
Loading

0 comments on commit 487a3ef

Please sign in to comment.