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

Commit

Permalink
Version 9.04
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasmonk committed May 10, 2015
1 parent b020e40 commit 7626007
Show file tree
Hide file tree
Showing 76 changed files with 253 additions and 121 deletions.
2 changes: 1 addition & 1 deletion Code/Albums.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ def leeCSV(self):
Cromo("Penguin", _("Penguin"), 4, 62, 0, 0, 20, 37, 400, 150, 1, "s", 7),
Cromo("Snake", _("Snake"), 4, 64, 0, 0, 15, 36, 400, 150, 1, "t", 8),
Cromo("Shark", _("Shark"), 4, 66, 0, 0, 10, 35, 400, 150, 1, "c", 8),
Cromo("Turkey", _("Turkey"), 4, 67, 0, 0, 10, 30, 400, 150, 1, "s", 8),
Cromo("Turkey", _("Turkeycock"), 4, 67, 0, 0, 10, 30, 400, 150, 1, "s", 8),
Cromo("Monkey", _("Monkey"), 4, 68, 0, 0, 10, 28, 400, 150, 1, "t", 8),
Cromo("Wolf", _("Wolf"), 5, 70, 0, 0, 10, 26, 300, 150, 1, "k", 8),
Cromo("Fox", _("Fox"), 5, 72, 0, 0, 10, 24, 300, 150, 1, "c", 9),
Expand Down
2 changes: 1 addition & 1 deletion Code/AnalisisGraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def wHistogram(ncolor, siDiferencias, x, y):
style=estilo,
fill=True,
show_legend=False,
css=['IntFiles/PyGal/style.css', 'IntFiles/PyGal/graph.css'],
css=['./IntFiles/PyGal/style.css', './IntFiles/PyGal/graph.css'],
label_font_size=7)
chart.x_labels = x
chart.add("0", y)
Expand Down
2 changes: 1 addition & 1 deletion Code/AnalisisIndexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import Code.SAK as SAK

def calc_formula(cual, cp, mrm): # , limit=200.0):
f = open("IntFiles/Formulas/%s.formula" % cual, "rb")
f = open("./IntFiles/Formulas/%s.formula" % cual, "rb")
formula = f.read()
f.close()
piew = pieb = 0
Expand Down
2 changes: 1 addition & 1 deletion Code/BaseConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def lee(self, txt):

def ejecutable(self):
tipo = "Linux" if VarGen.isLinux else "Windows"
return "Engines%s/%s/%s" % ( tipo, self.carpeta, self.path )
return "./Engines%s/%s/%s" % ( tipo, self.carpeta, self.path )

def puntuacion(self):
return self.categorias.puntuacion()
Expand Down
2 changes: 1 addition & 1 deletion Code/BookGuide.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def __init__(self, wowner, nomFichero=None):
self.dbAnalisis = DBanalisis()

def pathGuide(self, nameGuide):
return os.path.join(self.configuracion.carpeta, nameGuide + ".pgo")
return Util.dirRelativo(os.path.join(self.configuracion.carpeta, nameGuide + ".pgo"))

def getOtras(self):
li = Util.listdir(self.configuracion.carpeta)
Expand Down
12 changes: 7 additions & 5 deletions Code/Configuracion.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import Code.CajonDesastre as CajonDesastre
import Code.TrListas as TrListas

LCFILEFOLDER = "lc.folder"
LCBASEFOLDER = "UsrData"
LCFILEFOLDER = os.path.abspath("./lc.folder")
LCBASEFOLDER = os.path.abspath("./UsrData")

def activeFolder():
if os.path.isfile(LCFILEFOLDER):
Expand All @@ -36,11 +36,11 @@ def activeFolder():
return LCBASEFOLDER

def isDefaultFolder():
return activeFolder() == LCBASEFOLDER
return activeFolder() == os.path.abspath(LCBASEFOLDER)

def changeFolder(nueva):
if nueva:
if os.path.abspath(nueva) == os.path.abspath(LCBASEFOLDER):
if os.path.abspath(nueva) == LCBASEFOLDER:
return changeFolder(None)
f = open(LCFILEFOLDER, "wb")
f.write(nueva)
Expand Down Expand Up @@ -577,7 +577,9 @@ def lee(self):
fich = dg("DBGAMESFEN", self.ficheroDBgamesFEN)
if os.path.isfile(fich):
self.ficheroDBgamesFEN = fich
self.ficheroBookGuide = dg("BOOKGUIDE", self.ficheroBookGuide)
fich = dg("BOOKGUIDE", self.ficheroBookGuide)
if os.path.isfile(fich):
self.ficheroBookGuide = fich

self.elo = dg("ELO", 0)
self.eloNC = dg("ELONC", 1600)
Expand Down
2 changes: 1 addition & 1 deletion Code/DBgames.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def inicia():

class DBgames:
def __init__(self, nomFichero, segundosBuffer=0.8):
self.nomFichero = nomFichero
self.nomFichero = Util.dirRelativo(nomFichero)
self.liCamposBase = ["EVENT", "SITE", "DATE", "WHITE", "BLACK", "RESULT", "ECO", "WHITEELO", "BLACKELO",
"PLIES"]
self.liCamposWork = ["XPV", "PGN"]
Expand Down
4 changes: 2 additions & 2 deletions Code/EnginesMicElo.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ def convert(liMotores):
return li

def listaPersonal():
lme = MotoresExternos.ListaMotoresExternos("IntFiles/michelep.pkt")
lme = MotoresExternos.ListaMotoresExternos("./IntFiles/michelep.pkt")
lme.leer()
for mt in lme.liMotores:
mt.book = None
return convert(lme.liMotores)

def listaGM():
dic = {"champion": _("Champion"), "expert": _("Expert"), "master": _("Master")}
lme = MotoresExternos.ListaMotoresExternos("IntFiles/micheleg.pkt")
lme = MotoresExternos.ListaMotoresExternos("./IntFiles/micheleg.pkt")
lme.leer()
liR = dic.keys()
for mt in lme.liMotores:
Expand Down
2 changes: 1 addition & 1 deletion Code/EnginesWindows.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def mas(cm):
mas(cm)

cm = ConfigMotor("roce", "Roman Hartmann", "0.0390", "http://www.rocechess.ch/rocee.html")
cm.path = "roce39"
cm.path = "roce39.exe"
cm.elo = 1854
mas(cm)

Expand Down
6 changes: 3 additions & 3 deletions Code/Gestor60.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class Control60:
def __init__(self, gestor, siJugador):

self.db = Util.recuperaVar("IntFiles/lista60.dkv")
self.db = Util.recuperaVar("./IntFiles/lista60.dkv")
# prnt len(self.db)
# t = 0
# b = 0
Expand Down Expand Up @@ -194,7 +194,7 @@ def jugar(self, numero=None):
self.ordenPZ += d[k]

self.errores = 0
self.iniTiempo = time.clock()
self.iniTiempo = time.time()
self.pendientes = len(self.liMovs)
self.estado = kJugando

Expand Down Expand Up @@ -257,7 +257,7 @@ def mueveHumano(self, desde, hasta, coronacion=None):
self.atajosRatonReset()

def ponResultado(self):
tiempo = int((time.clock() - self.iniTiempo) * 100.0)
tiempo = int((time.time() - self.iniTiempo) * 100.0)
self.finJuego()
self.ponPosicion(self.cp)

Expand Down
4 changes: 2 additions & 2 deletions Code/GestorElo.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def siguienteJugada(self):
self.pensando(True)
self.desactivaTodas()

iniT = time.clock()
iniT = time.time()

siPensar = True

Expand Down Expand Up @@ -432,7 +432,7 @@ def siguienteJugada(self):
else:
dT, hT = 10, 35

difT = time.clock() - iniT
difT = time.time() - iniT
t = random.randint(dT * 10, hT * 10) * 0.01
if difT < t:
time.sleep(t - difT)
Expand Down
3 changes: 1 addition & 2 deletions Code/GestorEntMaq.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ def relojStop(self, siUsuario):
self.refresh()

def procesarAccion(self, clave):

if clave == k_cancelar:
self.finalizar()

Expand All @@ -315,6 +314,7 @@ def procesarAccion(self, clave):
self.atras()

elif clave == k_ayudaMover:
self.analizaTutorFinal()
self.ayudaMover(999)

elif clave == k_reiniciar:
Expand Down Expand Up @@ -720,7 +720,6 @@ def eligeJugadaBookAjustada(self):
return self.eligeJugadaBookBase(book, "pr")

def mueveHumano(self, desde, hasta, coronacion=None):

if self.siJuegaHumano:
self.paraHumano()
else:
Expand Down
4 changes: 2 additions & 2 deletions Code/GestorEntTac.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ def siguienteJugada(self):
self.activaColor(siBlancas)

if not self.siSeguirJugando:
self.iniReloj = time.clock()
self.iniReloj = time.time()

def finLinea(self):
self.compruebaComentarios()
Expand Down Expand Up @@ -429,7 +429,7 @@ def mueveHumano(self, desde, hasta, coronacion=None):
return False

if not self.siSeguirJugando:
segundos = time.clock() - self.iniReloj
segundos = time.time() - self.iniReloj
self.tactica.masSegundos(segundos)
self.movimientosPiezas(jg.liMovs)

Expand Down
4 changes: 2 additions & 2 deletions Code/GestorFideFics.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class GestorFideFics(Gestor.Gestor):
def selecciona(self, tipo):
if tipo == "Fics":
self._db = "IntFiles/FicsElo.db"
self._db = "./IntFiles/FicsElo.db"
self.tipoJuego = kJugFics
self._activo = self.configuracion.ficsActivo
self._ponActivo = self.configuracion.ponFicsActivo
Expand All @@ -28,7 +28,7 @@ def selecciona(self, tipo):
self._TIPO = "FICS"

else:
self._db = "IntFiles/FideElo.db"
self._db = "./IntFiles/FideElo.db"
self.tipoJuego = kJugFide
self._activo = self.configuracion.fideActivo
self._ponActivo = self.configuracion.ponFideActivo
Expand Down
8 changes: 4 additions & 4 deletions Code/GestorMate.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ def __init__(self, mate):
liDepth = [2, 4, 6, 10]
self.depth = liDepth[mate - 1]

fmt = "IntFiles/Mate/mate%d.lst"%mate
fmt = "./IntFiles/Mate/mate%d.lst"%mate
with open(fmt) as f:
dic = {}
for nlinea, linea in enumerate(f):
linea = linea.strip()
if linea:
dic[nlinea] = [ uno.split(",") for uno in linea.split("|") ]

# dic = Util.recuperaVar("IntFiles/mate.nvd")
# dic = Util.recuperaVar("./IntFiles/mate.nvd")
self.dicMate = dic
self.nivelMaximo = len(self.dicMate) / 10

Expand Down Expand Up @@ -179,10 +179,10 @@ def inicia(self, bloque):
self.liFenPV = self.configNivel.dameFenPV(self.mateNivel.nivel, bloque)
self.posFenPV = -1

self.tiempoInicial = time.clock()
self.tiempoInicial = time.time()

def final(self, errores):
tiempo = int(time.clock() - self.tiempoInicial)
tiempo = int(time.time() - self.tiempoInicial)

siRecord = self.mateNivel.grabaBloque(self.bloque, errores, tiempo)

Expand Down
2 changes: 1 addition & 1 deletion Code/GestorPGN.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def paste(self):
def jugadaDia(self):
self.pensando(True)
dia = Util.hoy().day
lid = Util.LIdisk("IntFiles/31.pkl")
lid = Util.LIdisk("./IntFiles/31.pkl")
dic = lid[dia - 1]
lid.close()
txt = dic["PGN"]
Expand Down
4 changes: 2 additions & 2 deletions Code/Init.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
DEBUG = False
VERSION = "9.03a"
VERSION = "9.04"

import sys

Expand Down Expand Up @@ -39,7 +39,7 @@ def init():

if resp == kFinReinicio:
if sys.argv[0].endswith(".py"):
exe = sys.argv[0]
exe = "./%s"%sys.argv[0]
else:
exe = "Lucas.exe" if VarGen.isWindows else "Lucas"
VarGen.startfile(exe)
Expand Down
2 changes: 1 addition & 1 deletion Code/Memoria.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def dameListaFen(self, piezas):

li = []

f = open("Trainings/Checkmates by Eduardo Sadier/131279 positions of mate in two.fns", "rb")
f = open("./Trainings/Checkmates by Eduardo Sadier/131279 positions of mate in two.fns", "rb")
for l in f:
if l:
pz = 0
Expand Down
8 changes: 4 additions & 4 deletions Code/Presentacion.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __init__( self, procesador ):
self.pantalla = procesador.pantalla
self.tablero = self.pantalla.tablero

fmt = "IntFiles/Mate/mate1.lst"
fmt = "./IntFiles/Mate/mate1.lst"
with open(fmt) as f:
li = [linea for linea in f.read().split("\n") if linea.strip()]
linea = random.choice(li)
Expand All @@ -30,7 +30,7 @@ def __init__( self, procesador ):
self.cp = ControlPosicion.ControlPosicion()
self.cp.leeFen(fen)

self.iniTime = time.clock()
self.iniTime = time.time()

self.siBlancas = " w " in fen
self.tablero.bloqueaRotacion(False)
Expand All @@ -41,7 +41,7 @@ def __init__( self, procesador ):
self.tablero.ponIndicador(self.siBlancas)

def muestraMensaje(self):
tm = time.clock() - self.iniTime
tm = time.time() - self.iniTime

mensaje = "%s: %0.02f"%(_("Time"), tm)
if tm < 10.0:
Expand Down Expand Up @@ -105,7 +105,7 @@ def m(cl, t=4.0):

def partidaDia(procesador, hx):
dia = Util.hoy().day
lid = Util.LIdisk("IntFiles/31.pkl")
lid = Util.LIdisk("./IntFiles/31.pkl")
dic = lid[dia - 1]
lid.close()

Expand Down
9 changes: 9 additions & 0 deletions Code/Procesador.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import Code.QT.WBDatabaseFEN as WBDatabaseFEN
import Code.QT.PantallaWorkMap as PantallaWorkMap
import Code.QT.PantallaVoice as PantallaVoice
import Code.QT.PantallaBMT as PantallaBMT

class Procesador():
"""
Expand Down Expand Up @@ -134,6 +135,10 @@ def iniciarGUI(self):
elif comandoL.endswith(".lcf"):
self.externDatabaseFEN(comando)
return
elif comandoL.endswith(".bmt"):
self.inicio()
self.externBMT(comando)
return
elif comando == "-play":
fen = sys.argv[2]
self.juegaExterno(fen)
Expand Down Expand Up @@ -695,6 +700,10 @@ def tools(self):
# elif resp.startswith("del_xfcc"):
# self.xfccDel(resp)

def externBMT(self, fichero):
self.configuracion.ficheroBMT = fichero
PantallaBMT.pantallaBMT(self)

def externDatabase(self, fichero):
self.configuracion.ficheroDBgames = fichero
self.database()
Expand Down
17 changes: 15 additions & 2 deletions Code/QT/Delegados.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def generaPM(piezas):
for k in "KQRNBkqrnb":
dicPZ[k] = piezas.render(k)

carpNAGs = "IntFiles/NAGs"
carpNAGs = "./IntFiles/NAGs"
for f in os.listdir(carpNAGs):
if f.endswith(".svg") and f.startswith("$") and len(f) > 5:
nag = f[1:-4]
Expand Down Expand Up @@ -107,9 +107,11 @@ class EtiquetaPGN(QtGui.QStyledItemDelegate):
Delegado para la muestra con html
"""

def __init__(self, siBlancas):
def __init__(self, siBlancas, siAlineacion=False, siFondo=False):
self.siBlancas = siBlancas # None = no hacer
self.siFigurinesPGN = siBlancas is not None
self.siAlineacion = siAlineacion
self.siFondo = siFondo
QtGui.QStyledItemDelegate.__init__(self, None)

def rehazPosicion(self):
Expand Down Expand Up @@ -152,6 +154,10 @@ def paint(self, painter, option, index):
if option.state & QtGui.QStyle.State_Selected:
painter.fillRect(rect, QtGui.QColor("#678DB2")) # sino no se ve en CDE-Motif-Windows
# painter.fillRect(option.rect, palette.highlight().color())
elif self.siFondo:
fondo = index.model().getFondo(index)
if fondo:
painter.fillRect(rect, fondo)

if indicadorInicial:
painter.save()
Expand Down Expand Up @@ -188,6 +194,13 @@ def paint(self, painter, option, index):
ancho += wpz * len(liNAGs)

x = xTotal + (wTotal - ancho) / 2
if self.siAlineacion:
alineacion = index.model().getAlineacion(index)
if alineacion == "i":
x = xTotal+3
elif alineacion == "d":
x = xTotal + (wTotal - ancho - 3)

y = yTotal + (hTotal - hPGN * 0.9) / 2

if iniPZ:
Expand Down
Loading

0 comments on commit 7626007

Please sign in to comment.