Skip to content
This repository was archived by the owner on May 4, 2021. It is now read-only.

Commit d44f3a5

Browse files
committed
Version 10.08
1 parent ca6902b commit d44f3a5

15 files changed

+318
-129
lines changed

Code/Configuracion.py

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import os
55

66
from PyQt4 import QtGui
7+
from PyQt4.QtCore import Qt
78

89
from Code import BaseConfig
910
from Code import CajonDesastre
@@ -110,6 +111,7 @@ def __init__(self, user):
110111

111112
self.puntosTB = 11
112113
self.boldTB = False
114+
self.iconsTB = Qt.ToolButtonTextUnderIcon
113115

114116
self.centipawns = False
115117

@@ -467,6 +469,7 @@ def graba(self, aplazamiento=None):
467469

468470
dic["PUNTOSTB"] = self.puntosTB
469471
dic["BOLDTB"] = self.boldTB
472+
dic["ICONSTB"] = self.iconsTB
470473

471474
dic["COLOR_NAG1"] = self.color_nag1
472475
dic["COLOR_NAG2"] = self.color_nag2
@@ -591,6 +594,7 @@ def lee(self):
591594

592595
self.puntosTB = dg("PUNTOSTB", self.puntosTB)
593596
self.boldTB = dg("BOLDTB", self.boldTB)
597+
self.iconsTB = dg("ICONSTB", self.iconsTB)
594598

595599
self.color_nag1 = dg("COLOR_NAG1", self.color_nag1)
596600
self.color_nag2 = dg("COLOR_NAG2", self.color_nag2)

Code/GM.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,10 @@ def listaGMpersonal(carpeta):
226226
siW = siB = False
227227
with open(os.path.join(carpeta, fich)) as f:
228228
for linea in f:
229-
gmp = GMpartida(linea.strip())
229+
try:
230+
gmp = GMpartida(linea.strip())
231+
except:
232+
continue
230233
if not siW:
231234
siW = gmp.isWhite(True)
232235
if not siB:
@@ -337,7 +340,10 @@ def masMaderaUno(self, dic, partida, xblancas, xnegras, tpResult):
337340
else:
338341
if not (siEmpate or (xblancas and siGanaBlancas) or (xnegras and siGanaNegras)):
339342
return
340-
self.write("%s|%s|%s|%s|%s|%s|%s\n" % (pv2xpv(pk.strip()), event, oponente, date, eco, result, color))
343+
def nopipe(txt):
344+
return txt.replace("|", " ").strip() if "|" in txt else txt
345+
346+
self.write("%s|%s|%s|%s|%s|%s|%s\n" % (pv2xpv(pk.strip()), nopipe(event), nopipe(oponente), nopipe(date), eco, result, color))
341347

342348
def xprocesa(self):
343349
self.close()

Code/Gestor.py

+19-1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ def __init__(self, procesador):
9797
# Informacion
9898
self.informacionActivable = True
9999

100+
self.nonDistract = None
101+
100102
# x Control del tutor
101103
# asi sabemos si ha habido intento de analisis previo (por ejemplo el usuario mientras piensa decide activar el tutor)
102104
self.siIniAnalizaTutor = False
@@ -127,6 +129,8 @@ def ponFinJuego(self):
127129
def finGestor(self):
128130
# se llama desde procesador.inicio, antes de borrar el gestor
129131
self.tablero.atajosRaton = None
132+
if self.nonDistract:
133+
self.pantalla.base.tb.setVisible(True)
130134

131135
def atajosRatonReset(self):
132136
self.atajosRatonDestino = None
@@ -711,7 +715,6 @@ def guardarPGN(self):
711715
"It is saved in the clipboard to paste it wherever you want.")))
712716

713717
def guardarGanados(self, siGanado):
714-
715718
conf = self.configuracion
716719

717720
if siGanado:
@@ -758,6 +761,21 @@ def quitaCapturas(self):
758761
self.pantalla.activaCapturas(False)
759762
self.ponVista()
760763

764+
def rightMouse(self, siShift, siControl, siAlt):
765+
if siControl:
766+
self.capturas()
767+
elif siAlt:
768+
self.nonDistract = self.pantalla.base.nonDistractMode(self.nonDistract)
769+
else:
770+
self.pgnInformacion(None, None)
771+
self.pantalla.ajustaTam()
772+
773+
def boardRightMouse(self, siShift, siControl, siAlt):
774+
self.rightMouse(siShift, siControl, siAlt)
775+
776+
def gridRightMouse(self, siShift, siControl, siAlt):
777+
self.rightMouse(siShift, siControl, siAlt)
778+
761779
def listado(self, tipo):
762780
if tipo == "pgn":
763781
return self.pgn.actual()

Code/GestorEntPos.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import codecs
22
import os
33

4+
from PyQt4.QtCore import Qt
5+
46
from Code import ControlPosicion
57
from Code import Gestor
68
from Code import Jugada
@@ -239,15 +241,22 @@ def ent_siguiente(self, tipo):
239241
self.inicio(pos, self.numEntrenos, self.titEntreno, self.liEntrenos, self.siTutorActivado, self.jump)
240242

241243
def controlTeclado(self, nkey):
242-
if nkey in (43, 16777239): # pulsado + o avpag
244+
if nkey in (Qt.Key_Plus, Qt.Key_PageDown):
243245
self.ent_siguiente(k_siguiente)
244-
elif nkey in (45, 16777238): # pulsado - o repag
246+
elif nkey in (Qt.Key_Minus, Qt.Key_PageUp):
245247
self.ent_siguiente(k_anterior)
246-
elif nkey == 80: # P: salva
248+
elif nkey == Qt.Key_T:
247249
li = self.fenInicial.split("|")
248250
li[2] = self.partida.pgnBaseRAW()
249251
self.saveSelectedPosition("|".join(li))
250252

253+
def listHelpTeclado(self):
254+
return [
255+
("+/%s"%_("Page Down"), _("Next position")),
256+
("-/%s"%_("Page Up"), _("Previous position")),
257+
("T", _("Save position in 'Selected positions' file")),
258+
]
259+
251260
def finPartida(self):
252261
self.procesador.inicio()
253262

Code/GestorEntTac.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import time
22

3+
from PyQt4.QtCore import Qt
4+
5+
36
from Code import ControlPosicion
47
from Code import Gestor
58
from Code import Jugada
@@ -226,12 +229,18 @@ def procesarAccion(self, clave):
226229
Gestor.Gestor.rutinaAccionDef(self, clave)
227230

228231
def controlTeclado(self, nkey):
229-
if nkey in (43, 16777239): # pulsado + o avpag
232+
if nkey in (Qt.Key_Plus, Qt.Key_PageDown):
230233
if self.estado == kFinJuego:
231234
self.ent_siguiente()
232-
elif nkey == 80:
235+
elif nkey == Qt.Key_T:
233236
self.saveSelectedPosition(self.fenInicial)
234237

238+
def listHelpTeclado(self):
239+
return [
240+
("+/%s"%_("Page Down"), _("Next position")),
241+
("T", _("Save position in 'Selected positions' file")),
242+
]
243+
235244
def reiniciar(self):
236245
cp = ControlPosicion.ControlPosicion()
237246
cp.leeFen(self.fen)

Code/GestorPartida.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import time
22

3+
from PyQt4.QtCore import Qt
4+
35
from Code import Partida
46
from Code import ControlPosicion
57
from Code import Gestor
@@ -411,9 +413,14 @@ def configurarGS(self):
411413
self.reiniciar(dic)
412414

413415
def controlTeclado(self, nkey):
414-
if nkey in (86, 80): # V,P
416+
if nkey in Qt.Key_V: # V
415417
self.paste(QTUtil.traePortapapeles())
416418

419+
def listHelpTeclado(self):
420+
return [
421+
("V", _("Paste position")),
422+
]
423+
417424
def paste(self, texto):
418425
cp = ControlPosicion.ControlPosicion()
419426
try:

Code/GestorSolo.py

+44-30
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import sys
33
import time
44

5+
from PyQt4.QtCore import Qt
6+
57
from Code import ControlPosicion
68
from Code import Gestor
79
from Code import PGN
@@ -676,34 +678,7 @@ def configurarGS(self):
676678
self.reiniciar()
677679

678680
elif resp == "posicion":
679-
resp = XVoyager.xVoyagerFEN(self.pantalla, self.configuracion, self.fen)
680-
if resp is not None:
681-
self.fen = resp
682-
self.bloqueApertura = None
683-
self.posicApertura = None
684-
685-
if self.xpgn:
686-
siInicio = self.fen == ControlPosicion.FEN_INICIAL
687-
li = self.xpgn.split("\n")
688-
lin = []
689-
siFen = False
690-
for linea in li:
691-
if linea.startswith("["):
692-
if "FEN " in linea:
693-
siFen = True
694-
if siInicio:
695-
continue
696-
linea = '[FEN "%s"]' % self.fen
697-
lin.append(linea)
698-
else:
699-
break
700-
if not siFen:
701-
linea = '[FEN "%s"]' % self.fen
702-
lin.append(linea)
703-
self.liPGN = lin
704-
self.xpgn = "\n".join(lin) + "\n\n*"
705-
706-
self.reiniciar()
681+
self.startPosition()
707682

708683
elif resp == "pasteposicion":
709684
texto = QTUtil.traePortapapeles()
@@ -771,11 +746,50 @@ def configurarGS(self):
771746
self.reiniciar(dic)
772747

773748
def controlTeclado(self, nkey):
774-
if nkey == 86: # V
749+
if nkey == Qt.Key_V:
775750
self.paste(QTUtil.traePortapapeles())
776-
elif nkey == 80: # P
751+
elif nkey == Qt.Key_T:
777752
li = [self.fen if self.fen else ControlPosicion.FEN_INICIAL,"",self.partida.pgnBaseRAW()]
778753
self.saveSelectedPosition("|".join(li))
754+
elif nkey == Qt.Key_S:
755+
self.startPosition()
756+
757+
def listHelpTeclado(self):
758+
return [
759+
("V", _("Paste position")),
760+
("T", _("Save position in 'Selected positions' file")),
761+
("S", _("Set start position"))
762+
]
763+
764+
def startPosition(self):
765+
resp = XVoyager.xVoyagerFEN(self.pantalla, self.configuracion, self.fen)
766+
if resp is not None:
767+
self.fen = resp
768+
self.bloqueApertura = None
769+
self.posicApertura = None
770+
771+
if self.xpgn:
772+
siInicio = self.fen == ControlPosicion.FEN_INICIAL
773+
li = self.xpgn.split("\n")
774+
lin = []
775+
siFen = False
776+
for linea in li:
777+
if linea.startswith("["):
778+
if "FEN " in linea:
779+
siFen = True
780+
if siInicio:
781+
continue
782+
linea = '[FEN "%s"]' % self.fen
783+
lin.append(linea)
784+
else:
785+
break
786+
if not siFen:
787+
linea = '[FEN "%s"]' % self.fen
788+
lin.append(linea)
789+
self.liPGN = lin
790+
self.xpgn = "\n".join(lin) + "\n\n*"
791+
792+
self.reiniciar()
779793

780794
def paste(self, texto):
781795
cp = ControlPosicion.ControlPosicion()

Code/Init.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
DEBUG = False
2-
VERSION = "10.07.2"
2+
VERSION = "10.08"
33

44
import os
55
import sys

Code/Procesador.py

+13-7
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def iniciaConUsuario(self, user):
7272
self.web = "http://www-lucaschess.rhcloud.com"
7373
self.blog = "http://lucaschess.blogspot.com"
7474

75-
self.liOpcionesInicio = [k_terminar, k_play, k_competicion, k_elo,
75+
self.liOpcionesInicio = [k_terminar, k_play,
7676
k_entrenamiento, k_tools, k_opciones, k_informacion] # Lo incluimos aqui porque sino no lo lee, en caso de aplazada
7777

7878
self.configuracion = Configuracion.Configuracion(user)
@@ -320,6 +320,12 @@ def menuPlay(self):
320320
menu.opcion(("free", None), _("Play against an engine of your choice"), Iconos.Libre())
321321
menu.separador()
322322

323+
menu.opcion(("competition", None), _("Competition"), Iconos.NuevaPartida())
324+
menu.separador()
325+
326+
menu.opcion(("elo", None), _("Elo-Rating"), Iconos.Elo())
327+
menu.separador()
328+
323329
# Principiantes ----------------------------------------------------------------------------------------
324330
menu1 = menu.submenu(_("Opponents for young players"), Iconos.RivalesMP())
325331

@@ -357,6 +363,12 @@ def menuPlay(self):
357363
if tipo == "free":
358364
self.procesarAccion(k_libre)
359365

366+
elif tipo == "competition":
367+
self.competicion()
368+
369+
elif tipo == "elo":
370+
self.elo()
371+
360372
elif tipo == "person":
361373
self.playPerson(rival)
362374
elif tipo == "animales":
@@ -440,9 +452,6 @@ def procesarAccion(self, clave):
440452
elif clave == k_libre:
441453
self.libre()
442454

443-
elif clave == k_competicion:
444-
self.competicion()
445-
446455
elif clave == k_entrenamiento:
447456
self.entrenamientos.lanza()
448457

@@ -452,9 +461,6 @@ def procesarAccion(self, clave):
452461
elif clave == k_tools:
453462
self.tools()
454463

455-
elif clave == k_elo:
456-
self.elo()
457-
458464
elif clave == k_informacion:
459465
self.informacion()
460466

0 commit comments

Comments
 (0)