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

Commit

Permalink
Version 11.03
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasmonk committed Dec 1, 2017
1 parent e0b394d commit b811043
Show file tree
Hide file tree
Showing 25 changed files with 189 additions and 79 deletions.
8 changes: 4 additions & 4 deletions Code/Analisis.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,12 +472,9 @@ def guiDispatch(rm):
rm = mrm.liMultiPV[posAct]
rm.ponBlunder(0)
mj = mrm.liMultiPV[0]

rm_pts = rm.puntosABS()

dif = mj.puntosABS() - rm_pts
if dif == 0 and len(mrm.liMultiPV) > 2:
jg.masCritica1_4("1")
fen = jg.posicionBase.fen()

if self.siVariantes:
Expand All @@ -487,7 +484,6 @@ def guiDispatch(rm):
jg.analisis2variantes(Partida.Partida(), self.alm, self.siBorrarPrevio)

if dif >= self.kblunders:
jg.masCritica1_4("2" if dif < 100 else "4")
rm.ponBlunder(dif)

self.grabaTactic(dicPGN, partida, njg, mrm, posAct)
Expand All @@ -509,6 +505,10 @@ def guiDispatch(rm):
if self.bmtbrilliancies:
self.grabaBMT(False, fen, mrm, posAct, clpartida, txtPartida)
self.siBMTbrilliancies = True
else:
nag, color = mrm.setNAG_Color(rm)
if nag:
jg.masCritica1_4(str(nag))

# Ponemos el texto original en la ultima
if siPonerPGNOriginalBlunders and self.oriblunders:
Expand Down
4 changes: 2 additions & 2 deletions Code/AperturasStd.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,11 @@ def listaAperturasPosibles(self, partida, siTodas=False):

return li if li else None


ap = ListaAperturasStd()
apTrain = ListaAperturasStd()


def reset():
configuracion = VarGen.configuracion
ap.reset(configuracion, False, False)
apTrain.reset(configuracion, True, True)
apTrain.reset(configuracion, True, True)
3 changes: 1 addition & 2 deletions Code/GestorEntPos.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ def mueveHumano(self, desde, hasta, coronacion=None):
return False

if siMirarTutor:

fenM2 = self.partida.ultPosicion.fenM2()
if self.siDirigido and (fenM2 in self.dicDirigidoFenM2):
liOpciones = self.dicDirigidoFenM2[fenM2]
Expand Down Expand Up @@ -532,7 +531,7 @@ def mueveRival(self, desde, hasta, coronacion):

self.error = ""

if self.siDirigido and (self.partida.ultPosicion.fenM2() not in self.dicDirigidoFenM2):
if self.siTutorActivado and self.siDirigido and (self.partida.ultPosicion.fenM2() not in self.dicDirigidoFenM2):
self.lineaTerminadaOpciones()

return True
Expand Down
12 changes: 5 additions & 7 deletions Code/GestorSolo.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,10 @@ def file(self):
menu = QTVarios.LCMenu(self.pantalla)
if self.ultimoFichero:
menuR = menu.submenu(_("Save"), Iconos.Grabar())
menuR.opcion("save", "%s: %s" %( _("Save"), self.ultimoFichero), Iconos.Grabar())
rpath = os.path.relpath(self.ultimoFichero)
if rpath.count("..") > 0:
rpath = self.ultimoFichero
menuR.opcion("save", "%s: %s" %( _("Save"), rpath), Iconos.Grabar())
menuR.separador()
menuR.opcion("saveas", _("Save as"), Iconos.GrabarComo())
else:
Expand Down Expand Up @@ -616,18 +619,13 @@ def file(self):
elif resp == "saveas":
self.grabarComo()





# k_recuperar, k_grabar, k_grabarComo,

# def recuperar(self):
# menu = QTVarios.LCMenu(self.pantalla)
# menu.opcion("open", _("File") + " ...", Iconos.Recuperar())
# menu.separador()
#
#

# resp = menu.lanza()
# if resp:
# if resp == "open":
Expand Down
24 changes: 17 additions & 7 deletions Code/GestorTurnOnLights.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,20 @@ def inicio(self, num_theme, num_block, tol):

self.next_line_run()

def pon_rotulos(self):
r1 = self.line.label
if self.lb_previous:
r1 += "<br><b>%s</b>" % self.lb_previous
if self.num_line:
av_secs, txt = self.block.calc_current(self.num_line - 1, self.total_time_used, self.errores, self.ayudas)
r1 += "<br><b>%s: %s - %0.2f\"" % (_("Current"), txt, av_secs)
self.ponRotulo1(r1)
if self.num_line < self.num_lines:
r2 = "<b>%d/%d</b>" % (self.num_line + 1, self.num_lines)
else:
r2 = None
self.ponRotulo2(r2)

def next_line(self):
if self.num_line < self.num_lines:
self.line = self.block.line(self.num_line)
Expand All @@ -68,18 +82,12 @@ def next_line(self):
self.siRivalConBlancas = not siBlancas
self.ponPosicion(self.partida.ultPosicion)
self.ponPiezasAbajo(siBlancas)
r1 = self.line.label
if self.lb_previous:
r1 += "<br><b>%s</b>" % self.lb_previous
self.ponRotulo1(r1)
r2 = "<b>%d/%d</b>" % (self.num_line+1, self.num_lines)
self.ponRotulo2(r2)
self.pgnRefresh(True)

self.partida.pendienteApertura = False
self.pon_rotulos()

def next_line_run(self):

liOpciones = [k_mainmenu, k_ayuda, k_reiniciar]
self.pantalla.ponToolBar(liOpciones)

Expand Down Expand Up @@ -198,13 +206,15 @@ def finLinea(self):
'</table></center></big><hr>' +
txt_more_line
)
self.pon_rotulos()
QTUtil2.mensaje(self.pantalla, mens, _("Result of training"))

else:
if self.tol.go_fast:
self.next_line_run()
return
QTUtil2.mensajeTemporal(self.pantalla, _("This line training is completed."), 1.3)
self.pon_rotulos()

self.estado = kFinJuego
self.desactivaTodas()
Expand Down
2 changes: 1 addition & 1 deletion Code/Init.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from Code.Constantes import *

DEBUG = False
VERSION = "11.02"
VERSION = "11.03"

if DEBUG:
prlkn("DEBUG " * 20)
Expand Down
4 changes: 2 additions & 2 deletions Code/Jugada.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def abandonaRival(self):
self.siAbandono = ABANDONORIVAL

def masCritica1_4(self, critica):
li = self.critica.split(" ")
li = self.critica.strip().split(" ")
ln = []
for x in li:
if x not in ("1", "2", "3", "4"):
Expand Down Expand Up @@ -408,7 +408,7 @@ def calc_elo(self, formula):
pts = mrm.liMultiPV[pos].puntosABS_5()
pts0 = mrm.liMultiPV[0].puntosABS_5()
lostp_abs = pts0 - pts
self.elo = max(int(eval(formula.replace("xlost", str(lostp_abs)))), 800)
self.elo = min(max(int(eval(formula.replace("xlost", str(lostp_abs)))), 800), 3500)
self.verybad_move = lostp_abs > 200
self.bad_move = lostp_abs > 90 if not self.verybad_move else False
else:
Expand Down
17 changes: 14 additions & 3 deletions Code/QT/PantallaSavePGN.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,15 +535,26 @@ def aceptar(self):
else:
self.reject()


class FileSavePGN:
def __init__(self, owner, dic_vars):
self.owner = owner
self.file = dic_vars["FILE"]
self.overwrite = dic_vars["OVERWRITE"]
self.codec = dic_vars["CODEC"]
if self.codec == "default":
self.codec = "UTF-8"

if self.codec == "default" or self.codec is None:
self.codec = "utf-8"
elif self.codec == "file":
self.codec = "utf-8"
if Util.existeFichero(self.file):
with open(self.file) as f:
u = chardet.universaldetector.UniversalDetector()
for n, x in enumerate(f):
u.feed(x)
if n == 1000:
break
u.close()
self.codec = u.result.get("encoding", "utf-8")
self.xum = None

def open(self):
Expand Down
3 changes: 2 additions & 1 deletion Code/QT/QTVarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ def listaDB(configuracion, siFEN):
# database = menu.lanza()
# if database is None:
# return None
#

# if database == other:
# database = QTUtil2.leeCreaFichero(owner, carpeta, ext, rot)
# if database:
Expand All @@ -1109,6 +1109,7 @@ def listaDB(configuracion, siFEN):
# configuracion.graba()
# return database


def createDB(owner, configuracion, siFEN):
if siFEN:
ext = "lcf"
Expand Down
64 changes: 45 additions & 19 deletions Code/QT/Scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def read(self):
dic = Util.iniBase8dic(self.fich_vars)
self.opacity = float(dic.get("OPACITY", 0.3))
self.last_width = int(dic.get("LAST_WIDTH", 0))
self.last_height = int(dic.get("LAST_HEIGHT", self.last_width))
self.tolerance = int(dic.get("TOLERANCE", 6))
self.scanner = dic.get("SCANNER", "")
self.ask = dic.get("ASK", "True") == "True"
Expand All @@ -23,6 +24,7 @@ def write(self):
dic = {
"OPACITY": self.opacity,
"LAST_WIDTH": self.last_width,
"LAST_HEIGHT": self.last_height,
"TOLERANCE": self.tolerance,
"SCANNER": self.scanner,
"ASK": self.ask
Expand All @@ -45,13 +47,13 @@ def __init__(self, folder_scanners, fich_png):
self.path = None
self.selecting = False
self.selected = False
self.x = self.y = self.width = 0
self.x = self.y = self.width = self.height = 0

def quit(self, ok):
self.hide()
if ok:
self.vars.write()
rect = QtCore.QRect(self.x, self.y, self.width, self.width)
rect = QtCore.QRect(self.x, self.y, self.width, self.height)
desktop = QtGui.QPixmap.grabWindow(QtGui.QApplication.desktop().winId(), 0, 0,
QTUtil.anchoEscritorio(), QTUtil.altoEscritorio())
selected_pixmap = desktop.copy(rect)
Expand All @@ -71,29 +73,37 @@ def paintEvent(self, event):
def setPath(self, point):
width = point.x() - self.x
height = point.y() - self.y
width = max(width, height)
if width > 0:
self.width = width
self.setPathW()
siAltModifier = (int(QtGui.QApplication.keyboardModifiers()) & QtCore.Qt.AltModifier) > 0
if siAltModifier:
if width > 0 and height > 0:
self.width = width
self.height = height
self.setPathW()
else:
width = max(width, height)
if width > 0:
self.height = self.width = width
self.setPathW()

def setPathW(self):
celda = self.width / 8
self.width = celda * 8
celdaw = self.width / 8
self.width = celdaw * 8
celdah = self.height / 8
self.height = celdah * 8
rect = QtGui.QPainterPath()
x = self.x
y = self.y
width = self.width
for c in range(8):
dx = x + c * celda
dx = x + c * celdaw
rect.moveTo(dx, y)
rect.lineTo(dx + celda, y)
rect.lineTo(dx + celda, y + width)
rect.lineTo(dx, y + width)
rect.lineTo(dx + celdaw, y)
rect.lineTo(dx + celdaw, y + self.height)
rect.lineTo(dx, y + self.height)
rect.lineTo(dx, y)
for f in range(1, 8):
dy = y + f * celda
dy = y + f * celdah
rect.moveTo(x, dy)
rect.lineTo(x + width, dy)
rect.lineTo(x + self.width, dy)
rect.closeSubpath()

self.path = rect
Expand All @@ -111,6 +121,7 @@ def mousePressEvent(self, eventMouse):
self.x = origin.x()
self.y = origin.y()
self.width = 0
self.height = 0
elif eventMouse.button() == QtCore.Qt.RightButton:
self.quit(True)
self.close()
Expand All @@ -122,17 +133,21 @@ def mouseReleaseEvent(self, eventMouse):
if self.width < 10:
if self.vars.last_width > 10:
self.width = self.vars.last_width
self.height = self.vars.last_height
self.setPathW()
else:
self.vars.last_width = self.width
self.vars.last_height = self.height

def keyPressEvent(self, event):
k = event.key()
m = int(event.modifiers())
siCtrl = (m & QtCore.Qt.ControlModifier) > 0
siAlt = (m & QtCore.Qt.AltModifier) > 0
x = self.x
y = self.y
width = self.width
height = self.height

if k in (QtCore.Qt.Key_Return, QtCore.Qt.Key_Enter, QtCore.Qt.Key_S):
self.quit(True)
Expand All @@ -156,30 +171,41 @@ def keyPressEvent(self, event):
if k == QtCore.Qt.Key_Right:
if siCtrl:
width += 8
height += 8
elif siAlt:
width += 8
else:
x += 1
elif k == QtCore.Qt.Key_Left:
if siCtrl:
width -= 8
height -= 8
elif siAlt:
width -= 8
else:
x -= 1
elif k == QtCore.Qt.Key_Up:
if siCtrl:
width += 8
y -= 8
height -= 8
width -= 8
elif siAlt:
height -= 8
else:
y -= 1
elif k == QtCore.Qt.Key_Down:
if siCtrl:
width -= 8
y += 8
height += 8
width += 8
elif siAlt:
height += 8
else:
y += 1

if self.selected:
self.x = x
self.y = y
self.width = width
self.height = height
self.setPathW()

event.ignore()
4 changes: 0 additions & 4 deletions Code/QT/TabTipos.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,3 @@ def mousePressEvent(self, event):
def borrar(self):
self.guion.borrarPizarraActiva()





Loading

0 comments on commit b811043

Please sign in to comment.