Skip to content

Commit

Permalink
Version R 2.01a
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasmonk committed Apr 10, 2022
1 parent cf2af40 commit cc5fedd
Show file tree
Hide file tree
Showing 17 changed files with 8,149 additions and 2,411 deletions.
Binary file modified Resources/IntFiles/Iconos.bin
Binary file not shown.
10,375 changes: 8,004 additions & 2,371 deletions Resources/Locale/zh/LC_MESSAGES/lcopenings.po

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions bin/Code/Analysis/AnalysisEval.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,20 @@ def __init__(self):
conf = Code.configuration

self.eval_lines = EvalLines()
self.eval_lines.restore_list(conf.x_eval_lines)
self.eval_lines.restore_list(conf.eval_lines)
self.eval_lines_max_y = self.eval_lines.max_y()
self.eval_lines_max_x = self.eval_lines.max_x()

self.blunder = conf.x_eval_blunder
self.error = conf.x_eval_error
self.inaccuracy = conf.x_eval_inaccuracy
self.very_good_depth = conf.x_eval_very_good_depth
self.good_depth = conf.x_eval_good_depth
self.max_mate = conf.x_eval_max_mate
self.max_elo = conf.x_eval_max_elo
self.min_elo = conf.x_eval_min_elo
self.very_bad_factor = conf.x_eval_very_bad_factor
self.bad_factor = conf.x_eval_bad_factor
self.blunder = conf.eval_blunder
self.error = conf.eval_error
self.inaccuracy = conf.eval_inaccuracy
self.very_good_depth = conf.eval_very_good_depth
self.good_depth = conf.eval_good_depth
self.max_mate = conf.eval_max_mate
self.max_elo = conf.eval_max_elo
self.min_elo = conf.eval_min_elo
self.very_bad_factor = conf.eval_very_bad_factor
self.bad_factor = conf.eval_bad_factor

def escala10(self, rm):
if rm.mate:
Expand Down
16 changes: 8 additions & 8 deletions bin/Code/Base/Game.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,13 +719,13 @@ def calc_elo_color(self, is_white):
move.stateOME = std
last = std
move.calc_elo()
elo_factor = 1
if move.bad_move:
elo_factor = Code.configuration.x_eval_bad_factor
elif move.verybad_move:
elo_factor = Code.configuration.x_eval_very_bad_factor
elif move.questionable_move:
elo_factor = Code.configuration.x_eval_questionable_factor
elo_factor = move.factor_elo()
# if move.bad_move:
# elo_factor = Code.configuration.eval_bad_factor
# elif move.verybad_move:
# elo_factor = Code.configuration.eval_very_bad_factor
# elif move.questionable_move:
# elo_factor = Code.configuration.eval_questionable_factor
nummoves[std] += 1
sumelos[std] += move.elo * elo_factor
factormoves[std] += elo_factor
Expand Down Expand Up @@ -1203,6 +1203,6 @@ def calc_formula_elo(move): # , limit=200.0):
# q.write(",".join(titLG) + "\r\n")
# q.write(",".join(dataLG) + "\r\n")

return min(3500, max(0, x))
return min(3500, x if x > 0 else 0)
except:
return 0.0
11 changes: 11 additions & 0 deletions bin/Code/Base/Move.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,17 @@ def calc_elo(self):
self.bad_move = False
self.verybad_move = False

def factor_elo(self):
elo_factor = 1
if self.analysis:
if self.bad_move:
elo_factor = Code.configuration.eval_bad_factor
elif self.verybad_move:
elo_factor = Code.configuration.eval_very_bad_factor
elif self.questionable_move:
elo_factor = Code.configuration.eval_questionable_factor
return elo_factor

def distancia(self):
return Position.distancia(self.from_sq, self.to_sq)

Expand Down
50 changes: 38 additions & 12 deletions bin/Code/Config/Configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,18 +197,44 @@ def __init__(self, user):
self.x_analyzer_depth = 0
self.x_analyzer_priority = Priorities.priorities.low

self.x_eval_lines = [(100.0, 0.9), (300, 2.0), (800, 3.0), (3500, 4.0)]
self.x_eval_blunder = 1.5
self.x_eval_error = 0.7
self.x_eval_inaccuracy = 0.3
self.x_eval_very_good_depth = 7
self.x_eval_good_depth = 4
self.x_eval_max_mate = 15
self.x_eval_max_elo = 3300.0
self.x_eval_min_elo = 800.0
self.x_eval_very_bad_factor = 12
self.x_eval_bad_factor = 4
self.x_eval_questionable_factor = 2
# self.x_eval_lines = [(100.0, 0.9), (300, 2.0), (800, 3.0), (3500, 4.0)]
# self.x_eval_blunder = 1.5
# self.x_eval_error = 0.7
# self.x_eval_inaccuracy = 0.3
# self.x_eval_very_good_depth = 7
# self.x_eval_good_depth = 4
# self.x_eval_max_mate = 15
# self.x_eval_max_elo = 3300.0
# self.x_eval_min_elo = 800.0
# self.x_eval_very_bad_factor = 12
# self.x_eval_bad_factor = 4
# self.x_eval_questionable_factor = 2

self.eval_lines = [(100.0, 0.9), (300, 2.0), (800, 3.0), (3500, 4.0)]
self.eval_blunder = 1.75
self.eval_error = 0.75
self.eval_inaccuracy = 0.33
self.eval_very_good_depth = 7
self.eval_good_depth = 4
self.eval_max_mate = 15
self.eval_max_elo = 3300.0
self.eval_min_elo = 200.0
self.eval_very_bad_factor = 12
self.eval_bad_factor = 6
self.eval_questionable_factor = 2

# self.eval_lines = [(150.0, 0.91), (390, 2.07), (530, 3.07), (775, 3.8), (900, 4.5)]
# self.eval_blunder = 1.84
# self.eval_error = 0.76
# self.eval_inaccuracy = 0.33
# self.eval_very_good_depth = 7
# self.eval_good_depth = 4
# self.eval_max_mate = 10
# self.eval_max_elo = 3300.0
# self.eval_min_elo = 0.0
# self.eval_very_bad_factor = 2.25
# self.eval_bad_factor = 2
# self.eval_questionable_factor = 1.1

self.x_sound_beep = False
self.x_sound_our = False
Expand Down
6 changes: 5 additions & 1 deletion bin/Code/Menus/BasicMenus.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,11 @@ def menu_information(procesador):
menu.opcion("mail", _("Contact") + " (%s)" % "[email protected]", Iconos.Mail())
menu.separador()
if procesador.configuration.is_main:
menu.opcion("actualiza", _("Check for updates"), Iconos.Actualiza())
menu.separador()
submenu = menu.submenu(_("Updates"), Iconos.Update())
submenu.opcion("actualiza", _("Check for updates"), Iconos.Actualiza())
submenu.separador()
submenu.opcion("actualiza_manual", _("Manual update"), Iconos.Zip())
menu.separador()

menu.opcion("acercade", _("About"), Iconos.Aplicacion64())
Expand Down
7 changes: 7 additions & 0 deletions bin/Code/Procesador.py
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,9 @@ def informacion_run(self, resp):
elif resp == "actualiza":
self.actualiza()

elif resp == "actualiza_manual":
self.actualiza_manual()

def adTitulo(self):
return "<b>" + Code.lucas_chess + "</b><br>" + _X(_("version %1"), self.version)

Expand All @@ -1159,6 +1162,10 @@ def actualiza(self):
if Update.update(self.main_window):
self.reiniciar()

def actualiza_manual(self):
if Update.update_manual(self.main_window):
self.reiniciar()

def unMomento(self, mensaje=None):
return QTUtil2.mensEspera.start(self.main_window, mensaje if mensaje else _("One moment please..."), physical_pos="ad")

Expand Down
2 changes: 1 addition & 1 deletion bin/Code/QT/FormLayout.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ def __init__(self, datalist, comment="", parent=None, dispatch=None):
super(FormTabWidget, self).__init__(parent)
layout = Colocacion.V()
self.tabwidget = QtWidgets.QTabWidget()
self.tabwidget.setFont(Controles.TipoLetra(peso=100, puntos=Code.configuration.x_pgn_fontpoints))
self.tabwidget.setFont(Controles.TipoLetra(puntos=Code.configuration.x_pgn_fontpoints))
layout.control(self.tabwidget)
self.setLayout(layout)
self.widgetlist = []
Expand Down
16 changes: 16 additions & 0 deletions bin/Code/QT/Iconos.py
Original file line number Diff line number Diff line change
Expand Up @@ -3932,3 +3932,19 @@ def Engine():
return QtGui.QIcon(pmEngine())


def pmZip():
return PM(980552,981448)


def Zip():
return QtGui.QIcon(pmZip())


def pmUpdate():
return PM(981448,982532)


def Update():
return QtGui.QIcon(pmUpdate())


4 changes: 2 additions & 2 deletions bin/Code/QT/SelectFiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ def leeCreaFichero(owner, carpeta, extension, titulo=None):
def salvaFichero(main_window, titulo, carpeta, extension, siConfirmarSobreescritura=True):
titulo, filtro = _lfTituloFiltro(extension, titulo)
if siConfirmarSobreescritura:
resp = QtWidgets.QFileDialog.getSaveFileName(main_window, titulo, carpeta, filtro)
resp = QtWidgets.QFileDialog.getSaveFileName(main_window, titulo, dir=carpeta, filter=filtro)
else:
resp = QtWidgets.QFileDialog.getSaveFileName(
main_window, titulo, carpeta, filtro, options=QtWidgets.QFileDialog.DontConfirmOverwrite
main_window, titulo, dir=carpeta, filter=filtro, options=QtWidgets.QFileDialog.DontConfirmOverwrite
)
return resp[0] if resp else resp
43 changes: 40 additions & 3 deletions bin/Code/Update.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import os
import shutil
import urllib.request
import zipfile

import Code
from Code import Util
from Code.QT import QTUtil2
from Code.QT import QTUtil2, SelectFiles

WEBUPDATES = "https://lucaschess.pythonanywhere.com/static/updater/updates_%s.txt" % ("win32" if Code.is_windows else "linux")
WEBUPDATES = "https://lucaschess.pythonanywhere.com/static/updater/updates_%s.txt" % (
"win32" if Code.is_windows else "linux"
)


def update_file(titulo, urlfichero, tam):
Expand Down Expand Up @@ -70,7 +73,9 @@ def update(main_window):
if base == base_version:
if current_version < version:
if not update_file(_X(_("version %1"), version.decode()), urlfichero.decode(), int(tam)):
mens_error = _X(_("An error has occurred during the upgrade to version %1"), version.decode())
mens_error = _X(
_("An error has occurred during the upgrade to version %1"), version.decode()
)
else:
done_update = True

Expand Down Expand Up @@ -121,3 +126,35 @@ def test_update(procesador):
elif nresp == 3:
procesador.configuration.x_check_for_update = False
procesador.configuration.graba()


def update_manual(main_window):
config = Code.configuration

dic = config.read_variables("MANUAL_UPDATE")

folder = dic.get("FOLDER", config.folder_userdata())

path_zip = SelectFiles.leeFichero(main_window, folder, "zip")
if not path_zip or not Util.exist_file(path_zip):
return

dic["FOLDER"] = os.path.dirname(path_zip)
config.write_variables("MANUAL_UPDATE", dic)

folder_actual = os.path.join(Code.folder_root, "bin", "actual")
shutil.rmtree(folder_actual, ignore_errors=True)
Util.create_folder(folder_actual)

shutil.copy(path_zip, folder_actual)

local_file = os.path.join(folder_actual, os.path.basename(path_zip))

zp = zipfile.ZipFile(local_file, "r")
zp.extractall(folder_actual)

path_act_py = os.path.join(folder_actual, "act.py")

exec(open(path_act_py).read())

return True
2 changes: 1 addition & 1 deletion bin/Code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def relative_root(path):


BASE_VERSION = "B" # Para el control de updates que necesitan reinstalar entero
VERSION = "R 2.01"
VERSION = "R 2.01a"
DEBUG = False
DEBUG_ENGINE = False

Expand Down
4 changes: 4 additions & 0 deletions bin/_genicons/Formatos.tema
Original file line number Diff line number Diff line change
Expand Up @@ -696,3 +696,7 @@ ODT windows8 icons8_typewriter_with_paper_32px.png
Engines windows8 icons8_services_30px.png
ConfEngines windows8 icons8_automatic_32px_1.png
Engine windows8 icons8_gear_30px.png

Zip windows8 icons8_zip_code_32px.png

Update windows8 icons8_registry_editor_32px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/_genicons/windows8/icons8_zip_code_32px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion bin/bug.log
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Version R 2.01
Version R 2.01a

0 comments on commit cc5fedd

Please sign in to comment.