Skip to content

Commit

Permalink
Version R2.16a
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasmonk committed Oct 3, 2024
1 parent de46854 commit c3655d3
Show file tree
Hide file tree
Showing 36 changed files with 289 additions and 146 deletions.
Binary file modified Resources/IntFiles/Iconos.bin
Binary file not shown.
1 change: 1 addition & 0 deletions Resources/IntFiles/Iconos.dic
Original file line number Diff line number Diff line change
Expand Up @@ -532,3 +532,4 @@ AI=1055409,1056083
Advice=1056083,1057168
PauseBlue=1057168,1058181
Forest=1058181,1059441
Analisis=1059441,1059832
Binary file modified Resources/IntFiles/Iconos_dark.bin
Binary file not shown.
1 change: 1 addition & 0 deletions Resources/IntFiles/Iconos_dark.dic
Original file line number Diff line number Diff line change
Expand Up @@ -532,3 +532,4 @@ AI=1045106,1045894
Advice=1045894,1047372
PauseBlue=1047372,1048310
Forest=1048310,1049985
Analisis=1049985,1050636
Binary file modified Resources/IntFiles/Iconos_sepia.bin
Binary file not shown.
1 change: 1 addition & 0 deletions Resources/IntFiles/Iconos_sepia.dic
Original file line number Diff line number Diff line change
Expand Up @@ -532,3 +532,4 @@ AI=966338,967181
Advice=967181,968588
PauseBlue=968588,969533
Forest=969533,970955
Analisis=970955,971598
Binary file modified Resources/Locale/fr/LC_MESSAGES/lucaschess.mo
Binary file not shown.
Binary file modified Resources/Locale/hu/LC_MESSAGES/lucaschess.mo
Binary file not shown.
2 changes: 1 addition & 1 deletion Resources/Locale/hu/lang.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
NAME=Magyar
AUTHOR=József Oláh
%=99
%=100
4 changes: 3 additions & 1 deletion bin/Code/Analysis/Analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,11 @@ def active_position(self):
return move_active.position, move_active.from_sq, move_active.to_sq

def get_game(self):
game_original = self.move.game
game_original: Game.Game = self.move.game
if self.move.movimiento():
game_send = game_original.copy_until_move(self.move)
if len(game_send) == 0:
game_send = game_original.copia()
else:
game_send = game_original.copia()
if self.pos_mov_active > -1:
Expand Down
22 changes: 11 additions & 11 deletions bin/Code/Analysis/WindowAnalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,31 +318,31 @@ def __init__(self, tb_analysis, ventana, is_white, must_save, tab_analysis_init,

ly_motor = Colocacion.H().control(self.lbPuntuacion).relleno().control(self.lb_engine).control(self.lb_time)

lyV = Colocacion.V()
lyV.control(tb_work)
lyV.otro(ly_tabl)
lyV.otro(lytb).espacio(20)
lyV.otro(ly_motor)
lyV.control(scroll)
lyV.relleno()
ly_v = Colocacion.V()
ly_v.control(tb_work)
ly_v.otro(ly_tabl)
ly_v.otro(lytb).espacio(20)
ly_v.otro(ly_motor)
ly_v.control(scroll)
# ly_v.relleno()

wm = OneAnalysis(self, tab_analysis_init)
tab_analysis_init.wmu = wm

# Layout
self.ly = Colocacion.H().margen(10)
self.ly.otro(lyV)
self.ly.otro(ly_v)
self.ly.control(wm)

lyM = Colocacion.H().margen(0).otro(self.ly).relleno()
ly_m = Colocacion.H().margen(0).otro(self.ly).relleno()

layout = Colocacion.V()
layout.otro(lyM)
layout.otro(ly_m)
layout.margen(3)
layout.setSpacing(1)
self.setLayout(layout)

self.restore_video(siTam=False)
self.restore_video(siAncho=False)
wm.cambiadoRM(tab_analysis_init.pos_selected)
self.activate_analysis(tab_analysis_init)

Expand Down
2 changes: 1 addition & 1 deletion bin/Code/Analysis/WindowAnalysisVariations.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def start_clock(self, funcion):
self.timer.start(1000)

def stop_clock(self):
if hasattr(self, "timer"):
if hasattr(self, "timer") and self.timer:
self.timer.stop()
delattr(self, "timer")

Expand Down
5 changes: 4 additions & 1 deletion bin/Code/Board/Board.py
Original file line number Diff line number Diff line change
Expand Up @@ -1382,7 +1382,10 @@ def dbvisual_close(self):
self.dbVisual.close()

def dbvisual_contains(self, fenm2):
return fenm2 in self.dbVisual.dbFEN and len(self.dbVisual.dbFEN[fenm2]) > 0
try:
return fenm2 in self.dbVisual.dbFEN and len(self.dbVisual.dbFEN[fenm2]) > 0
except AttributeError:
return False

def dbvisual_list(self, fenm2):
return self.dbVisual.dbFEN[fenm2]
Expand Down
4 changes: 2 additions & 2 deletions bin/Code/Databases/DBgames.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,8 @@ def remove_data(self, li_recnos):
else:
for recno in li_recnos:
rowid = self.li_row_ids[recno]
sql += " WHERE ROWID=?"
self.conexion.execute(sql, [rowid, ])
sqln = f"{sql} WHERE ROWID=?"
self.conexion.execute(sqln, [rowid, ])
self.conexion.commit()

def get_summary(self, pvBase, dicAnalisis, with_figurines, allmoves=True):
Expand Down
105 changes: 82 additions & 23 deletions bin/Code/Databases/WDB_Games.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,8 @@ def setInfoMove(self, infoMove):
def updateStatus(self):
if self.terminado:
return
if not self.summaryActivo:
txt = ""
else:
recs = self.db_games.reccount()
if self.summaryActivo:
game = self.summaryActivo.get("game", Game.Game())
nj = len(game)
if nj > 1:
Expand All @@ -233,9 +232,10 @@ def updateStatus(self):
txt = ""
si_pte = self.db_games.if_there_are_records_to_read()
if not si_pte:
recs = self.db_games.reccount()
if recs:
txt += "%s: %d" % (_("Games"), recs)
else:
txt += f'{_("Working...")}'
if self.where:
where = self.where
wxpv = 'XPV LIKE "'
Expand All @@ -249,8 +249,19 @@ def updateStatus(self):
pgn = g.pgn_base_raw(translated=True)
where = where[:pos] + pgn + where[pos + len(wxpv) + pos_apos + 1:]
txt += " | %s: %s" % (_("Filter"), where)
if si_pte:
QtCore.QTimer.singleShot(1000, self.updateStatus)
else:
si_pte = self.db_games.if_there_are_records_to_read()
txt = ""
if not si_pte:
if recs:
txt += "%s: %d" % (_("Games"), recs)
else:
txt += f'{_("Working...")}'

if si_pte:
QtCore.QTimer.singleShot(500, self.updateStatus)

self.grid.refresh()

self.status.showMessage(txt, 0)

Expand Down Expand Up @@ -1409,7 +1420,8 @@ def tw_exportar_db(self, lista):
if not dbpath:
return
if dbpath == ":n":
dbpath = new_database(self, self.configuration)
name = os.path.basename(self.db_games.path_file) if self.is_temporary else ""
dbpath = new_database(self, self.configuration, name=name)
if dbpath is None:
return

Expand All @@ -1432,7 +1444,7 @@ def tw_exportar_pgn(self, only_selected=False):
remove_comments = dic_result["REMCOMMENTSVAR"]
ws = WindowSavePGN.FileSavePGN(self, dic_result)
if ws.open():
pb = QTUtil2.BarraProgreso1(self, _("Saving..."), formato1="%p%")
pb = QTUtil2.BarraProgreso1(self, _("Saving..."), formato1="%v/%m (%p%)")
pb.mostrar()
if only_selected:
li_sel = self.grid.recnosSeleccionados()
Expand All @@ -1441,7 +1453,10 @@ def tw_exportar_pgn(self, only_selected=False):
pb.set_total(len(li_sel))
for n, recno in enumerate(li_sel):
pb.pon(n)
game = self.db_games.read_game_recno(recno)
try:
game = self.db_games.read_game_recno(recno)
except AttributeError:
return
if pb.is_canceled():
break
if game is None:
Expand Down Expand Up @@ -1469,6 +1484,8 @@ def tw_exportar_csv(self, only_selected):
dic_csv.get("FOLDER", self.configuration.carpeta), "csv")
if not path_csv:
return
if not path_csv.lower().endswith(".csv"):
path_csv = path_csv.strip() + ".csv"
dic_csv["FOLDER"] = os.path.dirname(path_csv)
self.configuration.write_variables("CSV", dic_csv)
pb = QTUtil2.BarraProgreso1(self, _("Saving..."))
Expand Down Expand Up @@ -1508,16 +1525,20 @@ def tw_exportar_csv(self, only_selected):
writer.writerow(li_data)

if not pb.is_canceled():
QTUtil2.temporary_message(self, _("Saved"), 0.8)
if not self.is_temporary:
self.changes = False
pb.close()
if not pb.is_canceled():
Code.startfile(path_csv)

def tw_importar_pgn(self):
files = SelectFiles.select_pgns(self)
if not files:
return None
def tw_importar_pgn(self, path_pgn=None):
if path_pgn is None:
files = SelectFiles.select_pgns(self)
if not files:
return None
else:
files = [path_pgn,]

dl_tmp = QTVarios.ImportarFicheroPGN(self)
if self.db_games.allows_duplicates:
Expand Down Expand Up @@ -1656,7 +1677,6 @@ def url_id(url):
continue
fen = row[pos_fen]
pv = row[pos_moves]
del row[pos_moves]
if dic_gid_pv:
gid = url_id(row[pos_gameurl])
opening = dic_gid_pv.get(gid)
Expand All @@ -1668,6 +1688,7 @@ def url_id(url):
eco = ""
row.append(name)
row.append(eco)
del row[pos_moves]

with_commit = pos % 100000 == 0
self.db_games.add_reg_lichess(sql, fen, pv, row, with_commit)
Expand All @@ -1685,16 +1706,17 @@ def url_id(url):


class WOptionsDatabase(QtWidgets.QDialog):
def __init__(self, owner, configuration, dic_data):
def __init__(self, owner, configuration, dic_data, with_import_pgn=False, name=""):
super(WOptionsDatabase, self).__init__(owner)

self.new = len(dic_data) == 0

self.dic_data = dic_data
self.dic_data_resp = None
self.with_import_pgn = with_import_pgn

def d_str(key):
return dic_data.get(key, "")
def d_str(key, default=""):
return dic_data.get(key, default)

def d_true(key):
return dic_data.get(key, True)
Expand All @@ -1713,7 +1735,7 @@ def d_false(key):
valid_rx = r'^[^<>:;,?"*|/\\]+'

lb_name = Controles.LB2P(self, _("Name"))
self.ed_name = Controles.ED(self, d_str("NAME")).controlrx(valid_rx)
self.ed_name = Controles.ED(self, d_str("NAME", name)).controlrx(valid_rx)

ly_name = Colocacion.H().control(lb_name).control(self.ed_name)

Expand Down Expand Up @@ -1774,6 +1796,16 @@ def d_false(key):
x1 = -2
ly_group = Colocacion.V().otro(ly_group).espacio(x1).otro(ly_subgroup_l1).espacio(x1).otro(ly_subgroup_l2)

self.path_import_pgn = None
ly_import_pgn = None
if self.with_import_pgn:
self.lb_import_pgn = Controles.LB2P(self, f'{_("Import")}/{_("PGN")}')
self.pb_select_import_pgn = Controles.PB(self, "", self.select_pgn, False)
self.pb_select_import_pgn.setSizePolicy(
QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
)
ly_import_pgn = Colocacion.H().control(self.lb_import_pgn).control(self.pb_select_import_pgn)

gb_group = Controles.GB(self, "%s (%s)" % (_("Group"), _("optional")), ly_group)

lb_summary = Controles.LB2P(self, _("Opening explorer depth (0=disable)"))
Expand Down Expand Up @@ -1819,6 +1851,8 @@ def d_false(key):
layout.otro(ly_name).espacio(x0).control(gb_group).espacio(x0)
layout.otro(ly_summary).espacio(x0)
layout.otro(ly_external).espacio(x0)
if ly_import_pgn:
layout.otro(ly_import_pgn).espacio(x0)
layout.control(gb_restrictions)
layout.margen(9)

Expand All @@ -1840,6 +1874,23 @@ def select_external(self):

self.bt_external.set_text(self.external_folder)

def select_pgn(self):
key_var = "OPENINGLINES"
dic_var = self.configuration.read_variables(key_var)
carpeta = dic_var.get("CARPETAPGN", self.configuration.carpeta)

fichero_pgn = SelectFiles.leeFichero(self, carpeta, "pgn", titulo=_("File to import"))
if not fichero_pgn:
return
dic_var["CARPETAPGN"] = os.path.dirname(fichero_pgn)
self.configuration.write_variables(key_var, dic_var)
self.path_import_pgn = fichero_pgn
name_pgn = os.path.basename(fichero_pgn)
self.pb_select_import_pgn.set_text(name_pgn)
name = self.ed_name.texto().strip()
if not name:
self.ed_name.set_text(name_pgn[:-4])

def remove_external(self):
self.external_folder = ""
self.bt_external.set_text("")
Expand Down Expand Up @@ -1929,15 +1980,17 @@ def save(self):
"ALLOWS_COMPLETE_GAMES": self.chb_complete.valor(),
"ALLOWS_ZERO_MOVES": self.chb_zeromoves.valor(), "SUMMARY_DEPTH": self.sb_summary.valor(),
"FILEPATH": filepath_in_databases, "EXTERNAL_FOLDER": self.external_folder,
"FILEPATH_WITH_DATA": filepath_with_data
"FILEPATH_WITH_DATA": filepath_with_data,
}
if self.with_import_pgn:
self.dic_data_resp["IMPORT_PGN"] = self.path_import_pgn

self.accept()


def new_database(owner, configuration):
def new_database(owner, configuration, with_import_pgn=False, name = ""):
dic_data = {}
w = WOptionsDatabase(owner, configuration, dic_data)
w = WOptionsDatabase(owner, configuration, dic_data, with_import_pgn, name)
if w.exec_():
filepath = w.dic_data_resp["FILEPATH"]
if w.external_folder:
Expand All @@ -1947,9 +2000,15 @@ def new_database(owner, configuration):
for key, value in w.dic_data_resp.items():
db.save_config(key, value)
db.close()
return filepath
if with_import_pgn:
return filepath, w.dic_data_resp["IMPORT_PGN"]
else:
return filepath
else:
return None
if with_import_pgn:
return None, None
else:
return None


class WTags(LCDialog.LCDialog):
Expand Down
Loading

0 comments on commit c3655d3

Please sign in to comment.