Ejemplo n.º 1
0
    def muestraInformacion(self):
        li = []
        li.append("%s: %d" % (_("Errors"), self.errores))
        if self.siAyuda:
            li.append(_("Help activated"))
        self.ponRotulo1("\n".join(li))

        tgm = 0
        for tr in self.game["TRIES"]:
            tgm += tr["TIME"]

        mens = "\n" + "\n".join(self.liMensBasic)
        mens += "\n%s:\n    %s %s\n    %s %s" % (
            _("Working time"), time.strftime("%H:%M:%S", time.gmtime(tgm)),
            _("Current"), time.strftime("%H:%M:%S", time.gmtime(
                self.tm)), _("Total"))

        self.ponRotulo2(mens)

        if self.siAyuda:
            dicNAGs = TrListas.dicNAGs()
            mens3 = ""
            fenM2 = self.partida.ultPosicion.fenM2()
            reg = self.dbop.getfenvalue(fenM2)
            if reg:
                mens3 = reg.get("COMENTARIO", "")
                ventaja = reg.get("VENTAJA", 0)
                valoracion = reg.get("VALORACION", 0)
                if ventaja:
                    mens3 += "\n %s" % dicNAGs[ventaja]
                if valoracion:
                    mens3 += "\n %s" % dicNAGs[valoracion]
            self.ponRotulo3(mens3 if mens3 else None)
    def __init__(self, wmoves):
        QtGui.QTreeWidget.__init__(self)
        self.wmoves = wmoves
        self.itemActivo = None
        self.setAlternatingRowColors(True)

        self.dicItems = {}

        self.posMoves = 0
        self.posTransposition = 1
        self.posBookmark = 2
        self.posAnalisis = 3
        self.posComment = 4
        self.setHeaderLabels((_("Moves"), "", "", _("Analysis"), _("Comments"), ""))
        self.setColumnHidden(5, True)
        self.setIndentation(14)
        self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.customContextMenuRequested.connect(self.menuContexto)

        self.setStyleSheet("selection-background-color: #F1D369; selection-color: #000000;")

        ftxt = Controles.TipoLetra(puntos=9)

        self.setFont(ftxt)

        self.connect(self, QtCore.SIGNAL("itemExpanded(QTreeWidgetItem *)"), self.expandido)
        self.connect(self, QtCore.SIGNAL("itemSelectionChanged()"), self.seleccionadoISC)
        self.connect(self, QtCore.SIGNAL("itemDoubleClicked(QTreeWidgetItem *,int)"), self.dobleClick)

        self.noIcon = QtGui.QIcon()
        self.iconBookmark = Iconos.Favoritos()
        self.iconTransposition = Iconos.Transposition()

        dicNAGs = TrListas.dicNAGs()
        self.dicValoracion = collections.OrderedDict()
        self.dicValoracion[BUENO] = (dicNAGs[1], PantallaColores.nag2ico(1, 16))
        self.dicValoracion[MALO] = (dicNAGs[2], PantallaColores.nag2ico(2, 16))
        self.dicValoracion[MUY_BUENO] = (dicNAGs[3], PantallaColores.nag2ico(3, 16))
        self.dicValoracion[MUY_MALO] = (dicNAGs[4], PantallaColores.nag2ico(4, 16))
        self.dicValoracion[INTERESANTE] = (dicNAGs[5], PantallaColores.nag2ico(5, 16))
        self.dicValoracion[DUDOSA] = (dicNAGs[6], PantallaColores.nag2ico(6, 16))
        self.dicValoracion[SIN_VALORACION] = (_("No rating"), self.noIcon)

        self.dicVentaja = collections.OrderedDict()
        self.dicVentaja[V_SIN] = (_("Undefined"), self.noIcon)
        self.dicVentaja[V_IGUAL] = (dicNAGs[11], Iconos.V_Blancas_Igual_Negras())
        self.dicVentaja[V_BLANCAS] = (dicNAGs[14], Iconos.V_Blancas())
        self.dicVentaja[V_BLANCAS_MAS] = (dicNAGs[16], Iconos.V_Blancas_Mas())
        self.dicVentaja[V_BLANCAS_MAS_MAS] = (dicNAGs[18], Iconos.V_Blancas_Mas_Mas())
        self.dicVentaja[V_NEGRAS] = (dicNAGs[15], Iconos.V_Negras())
        self.dicVentaja[V_NEGRAS_MAS] = (dicNAGs[17], Iconos.V_Negras_Mas())
        self.dicVentaja[V_NEGRAS_MAS_MAS] = (dicNAGs[19], Iconos.V_Negras_Mas_Mas())
Ejemplo n.º 3
0
    def __init__(self, wmoves):
        QtGui.QTreeWidget.__init__(self)
        self.wmoves = wmoves
        self.itemActivo = None
        self.setAlternatingRowColors(True)

        self.dicItems = {}

        self.posMoves = 0
        self.posTransposition = 1
        self.posBookmark = 2
        self.posAnalisis = 3
        self.posComment = 4
        self.setHeaderLabels((_("Moves"), "", "", _("Analysis"), _("Comments"), ""))
        self.setColumnHidden(5, True)
        self.setIndentation(14)
        self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.customContextMenuRequested.connect(self.menuContexto)

        self.setStyleSheet("selection-background-color: #F1D369; selection-color: #000000;")

        ftxt = Controles.TipoLetra(puntos=9)

        self.setFont(ftxt)

        self.connect(self, QtCore.SIGNAL("itemExpanded(QTreeWidgetItem *)"), self.expandido)
        self.connect(self, QtCore.SIGNAL("itemSelectionChanged()"), self.seleccionadoISC)
        self.connect(self, QtCore.SIGNAL("itemDoubleClicked(QTreeWidgetItem *,int)"), self.dobleClick)

        self.noIcon = QtGui.QIcon()
        self.iconBookmark = Iconos.Favoritos()
        self.iconTransposition = Iconos.Transposition()

        dicNAGs = TrListas.dicNAGs()
        self.dicValoracion = collections.OrderedDict()
        self.dicValoracion[BUENO] = (dicNAGs[1], PantallaColores.nag2ico(1,16))
        self.dicValoracion[MALO] = (dicNAGs[2], PantallaColores.nag2ico(2,16))
        self.dicValoracion[MUY_BUENO] = (dicNAGs[3], PantallaColores.nag2ico(3,16))
        self.dicValoracion[MUY_MALO] = (dicNAGs[4], PantallaColores.nag2ico(4,16))
        self.dicValoracion[INTERESANTE] = (dicNAGs[5], PantallaColores.nag2ico(5,16))
        self.dicValoracion[DUDOSA] = (dicNAGs[6], PantallaColores.nag2ico(6,16))
        self.dicValoracion[SIN_VALORACION] = (_("No rating"), self.noIcon )

        self.dicVentaja = collections.OrderedDict()
        self.dicVentaja[V_SIN] = ( _("Undefined"), self.noIcon )
        self.dicVentaja[V_IGUAL] = ( dicNAGs[11], Iconos.V_Blancas_Igual_Negras() )
        self.dicVentaja[V_BLANCAS] = ( dicNAGs[14], Iconos.V_Blancas() )
        self.dicVentaja[V_BLANCAS_MAS] = ( dicNAGs[16], Iconos.V_Blancas_Mas() )
        self.dicVentaja[V_BLANCAS_MAS_MAS] = ( dicNAGs[18], Iconos.V_Blancas_Mas_Mas() )
        self.dicVentaja[V_NEGRAS] = ( dicNAGs[15], Iconos.V_Negras() )
        self.dicVentaja[V_NEGRAS_MAS] = ( dicNAGs[17], Iconos.V_Negras_Mas() )
        self.dicVentaja[V_NEGRAS_MAS_MAS] = ( dicNAGs[19], Iconos.V_Negras_Mas_Mas() )
Ejemplo n.º 4
0
    def __init__(self, owner, procesador):
        QtGui.QTreeWidget.__init__(self)
        self.owner = owner
        self.dbCache = owner.dbCache
        self.setAlternatingRowColors(True)
        self.listaMoves = owner.listaMoves
        self.procesador = procesador
        # self.setSelectionMode(self.ExtendedSelection)
        # self.setDragDropMode(self.InternalMove)
        # self.setDragEnabled(True)
        # self.setDropIndicatorShown(True)
        self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.customContextMenuRequested.connect(self.menuContexto)

        self.setHeaderLabels(
            (_("Moves"), _("Points"), _("Comments"), _("Variants"), "", ""))
        self.setColumnHidden(4, True)

        dicNAGs = TrListas.dicNAGs()
        self.dicValoracion = collections.OrderedDict()
        self.dicValoracion["1"] = (MUY_BUENO, dicNAGs[3])
        self.dicValoracion["2"] = (BUENO, dicNAGs[1])
        self.dicValoracion["3"] = (MALO, dicNAGs[2])
        self.dicValoracion["4"] = (MUY_MALO, dicNAGs[4])
        self.dicValoracion["5"] = (INTERESANTE, dicNAGs[5])
        self.dicValoracion["6"] = (DUDOSA, dicNAGs[6])
        self.dicValoracion["0"] = (SIN_VALORACION, _("No rating"))

        ftxt = Controles.TipoLetra(puntos=9)

        self.setFont(ftxt)

        self.connect(
            self,
            QtCore.SIGNAL(
                "currentItemChanged(QTreeWidgetItem *,QTreeWidgetItem *)"),
            self.seleccionado)
        self.connect(self,
                     QtCore.SIGNAL("itemDoubleClicked(QTreeWidgetItem *,int)"),
                     self.editado)

        hitem = self.header()
        hitem.setClickable(True)
        self.connect(hitem, QtCore.SIGNAL("sectionDoubleClicked(int)"),
                     self.editadoH)

        self.dicItemMoves = {}
        self.ponMoves(self.listaMoves)

        self.sortItems(4, QtCore.Qt.AscendingOrder)
Ejemplo n.º 5
0
def cambiaColoresPGN(ventana, configuracion):
    liGen = [(None, None)]

    dicNAGs = TrListas.dicNAGs()
    config = FormLayout.Colorbox(dicNAGs[1], 80, 20, siSTR=True)
    liGen.append((config, configuracion.color_nag1))

    config = FormLayout.Colorbox(dicNAGs[2], 80, 20, siSTR=True)
    liGen.append((config, configuracion.color_nag2))

    config = FormLayout.Colorbox(dicNAGs[3], 80, 20, siSTR=True)
    liGen.append((config, configuracion.color_nag3))

    config = FormLayout.Colorbox(dicNAGs[4], 80, 20, siSTR=True)
    liGen.append((config, configuracion.color_nag4))

    config = FormLayout.Colorbox(dicNAGs[5], 80, 20, siSTR=True)
    liGen.append((config, configuracion.color_nag5))

    config = FormLayout.Colorbox(dicNAGs[6], 80, 20, siSTR=True)
    liGen.append((config, configuracion.color_nag6))

    resultado = FormLayout.fedit(liGen,
                                 title=_("PGN"),
                                 parent=ventana,
                                 icon=Iconos.Vista(),
                                 siDefecto=True)
    if resultado:
        accion, liResp = resultado
        if accion == "defecto":
            configuracion.coloresPGNdefecto()
            configuracion.graba()
            cambiaColoresPGN(ventana, configuracion)
        else:
            configuracion.color_nag1 = liResp[0]
            configuracion.color_nag2 = liResp[1]
            configuracion.color_nag3 = liResp[2]
            configuracion.color_nag4 = liResp[3]
            configuracion.color_nag5 = liResp[4]
            configuracion.color_nag6 = liResp[5]
            configuracion.graba()
Ejemplo n.º 6
0
    def __init__(self, owner, procesador):
        QtWidgets.QTreeWidget.__init__(self)
        self.owner = owner
        self.dbCache = owner.dbCache
        self.setAlternatingRowColors(True)
        self.listaMoves = owner.listaMoves
        self.procesador = procesador
        self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.customContextMenuRequested.connect(self.menuContexto)

        self.setHeaderLabels(
            (_("Moves"), _("Points"), _("Comments"), _("Variations"), "", ""))
        self.setColumnHidden(4, True)

        dicNAGs = TrListas.dicNAGs()
        self.dicValoracion = collections.OrderedDict()
        self.dicValoracion["1"] = (VERY_GOOD_MOVE, dicNAGs[3])
        self.dicValoracion["2"] = (GOOD_MOVE, dicNAGs[1])
        self.dicValoracion["3"] = (BAD_MOVE, dicNAGs[2])
        self.dicValoracion["4"] = (VERY_POOR_MOVE, dicNAGs[4])
        self.dicValoracion["5"] = (SPECULATIVE_MOVE, dicNAGs[5])
        self.dicValoracion["6"] = (QUESTIONABLE_MOVE, dicNAGs[6])
        self.dicValoracion["0"] = (NO_RATING, _("No rating"))

        ftxt = Controles.TipoLetra(puntos=9)

        self.setFont(ftxt)

        self.currentItemChanged.connect(self.seleccionado)
        self.itemDoubleClicked.connect(self.editado)

        hitem = self.header()
        hitem.setSectionsClickable(True)
        hitem.sectionDoubleClicked.connect(self.editadoH)

        self.dicItemMoves = {}
        self.ponMoves(self.listaMoves)

        self.sortItems(4, QtCore.Qt.AscendingOrder)
Ejemplo n.º 7
0
def cambiaColoresPGN(ventana, configuracion):
    liGen = [(None, None)]

    dicNAGs = TrListas.dicNAGs()
    config = FormLayout.Colorbox(dicNAGs[1], 80, 20, siSTR=True)
    liGen.append(( config, configuracion.color_nag1 ))

    config = FormLayout.Colorbox(dicNAGs[2], 80, 20, siSTR=True)
    liGen.append(( config, configuracion.color_nag2 ))

    config = FormLayout.Colorbox(dicNAGs[3], 80, 20, siSTR=True)
    liGen.append(( config, configuracion.color_nag3 ))

    config = FormLayout.Colorbox(dicNAGs[4], 80, 20, siSTR=True)
    liGen.append(( config, configuracion.color_nag4 ))

    config = FormLayout.Colorbox(dicNAGs[5], 80, 20, siSTR=True)
    liGen.append(( config, configuracion.color_nag5 ))

    config = FormLayout.Colorbox(dicNAGs[6], 80, 20, siSTR=True)
    liGen.append(( config, configuracion.color_nag6 ))

    resultado = FormLayout.fedit(liGen, title=_("PGN"), parent=ventana, icon=Iconos.Vista(), siDefecto=True)
    if resultado:
        accion, liResp = resultado
        if accion == "defecto":
            configuracion.coloresPGNdefecto()
            configuracion.graba()
            cambiaColoresPGN(ventana, configuracion)
        else:
            configuracion.color_nag1 = liResp[0]
            configuracion.color_nag2 = liResp[1]
            configuracion.color_nag3 = liResp[2]
            configuracion.color_nag4 = liResp[3]
            configuracion.color_nag5 = liResp[4]
            configuracion.color_nag6 = liResp[5]
            configuracion.graba()
    def __init__(self, wParent):
        QtGui.QWidget.__init__(self, wParent)

        self.wParent = wParent

        self.jg = None
        self.partida = None

        configuracion = VarGen.configuracion

        puntos = configuracion.puntosPGN

        f = Controles.TipoLetra(puntos=puntos, peso=75)
        f9 = Controles.TipoLetra(puntos=puntos)
        ftxt = f9

        # Apertura
        self.lbApertura = Controles.LB(self, "").ponFuente(f).alinCentrado().ponColorFondoN("#eeeeee", "#474d59").ponWrap()
        self.lbApertura.hide()

        # Valoracion
        liOpciones = [("-", "-")]
        dicNAGs = TrListas.dicNAGs()

        carpNAGs = "./IntFiles/NAGs"

        for x in dicNAGs:
            if x:
                fsvg = "%s/$%d.svg" % (carpNAGs, x)
                if os.path.isfile(fsvg):
                    liOpciones.append(("$%d : %s" % (x, dicNAGs[x]), str(x), QTVarios.fsvg2ico(fsvg, 16)))
                else:
                    liOpciones.append(("$%d : %s" % (x, dicNAGs[x]), str(x)))
        self.maxNAGs = 10
        self.liNAGs = []
        for x in range(self.maxNAGs):
            cb = Controles.CB(self, liOpciones, "").ponAnchoMinimo().capturaCambiado(self.valoracionCambiada).ponFuente(f9)
            if x:
                cb.hide()
            self.liNAGs.append(cb)

        btNAGS = Controles.PB(self, "", self.masNAGs).ponIcono(Iconos.Mas()).anchoFijo(22)

        liOpciones = [(x, x) for x in ("-", "!", "!!", "?", "??", "!?", "?!")]
        self.valoracionDirecta = Controles.CB(self, liOpciones, "-").ponAnchoFijo(42).capturaCambiado(self.valoracionDirectaCambiada)

        lyH = Colocacion.H().control(self.valoracionDirecta).control(self.liNAGs[0]).control(btNAGS)
        ly = Colocacion.V().otro(lyH)
        for x in range(1, self.maxNAGs):
            ly.control(self.liNAGs[x])

        self.gbValoracion = Controles.GB(self, _("Rating"), ly).ponFuente(f)

        # Comentarios
        self.comentario = Controles.EM(self, siHTML=False).capturaCambios(self.comentarioCambiado).ponFuente(ftxt).anchoMinimo(200)
        ly = Colocacion.H().control(self.comentario).margen(3)
        self.gbComentario = Controles.GB(self, _("Comments"), ly).ponFuente(f)

        # Variantes
        self.variantes = Variantes(self)

        self.splitter = splitter = QtGui.QSplitter(self)
        self.splitter.setOrientation(QtCore.Qt.Vertical)
        splitter.addWidget(self.gbComentario)
        splitter.addWidget(self.variantes)

        layout = Colocacion.V()
        layout.control(self.lbApertura)
        layout.control(self.gbValoracion)
        layout.control(self.splitter)
        layout.margen(1)

        self.setLayout(layout)
Ejemplo n.º 9
0
def cambiaColores(parent, configuracion):
    separador = (None, None)

    liColor = []
    liColor.append(separador)
    liColor.append((_("By default") + ":", False))
    liColor.append(separador)

    palette = configuracion.palette
    palette_std = QtGui.QApplication.style().standardPalette()

    liPalette = []
    def xcolor(txt, tipo):
        config = FormLayout.Colorbox( txt, 40, 20, siSTR=True)
        color = QtGui.QColor(palette[tipo]) if palette else palette_std.color(getattr(QtGui.QPalette, tipo))
        liColor.append((config, color))
        liPalette.append(tipo)

    xcolor(_("General background"), "Window")
    xcolor(_("General foreground"), "WindowText")
    liColor.append(separador)
    xcolor(_("Text entry background"), "Base")
    xcolor(_("Text entry foreground"), "Text")
    xcolor(_("Alternate background"), "AlternateBase")
    liColor.append(separador)
    xcolor(_("Tool tip background"), "ToolTipBase")
    xcolor(_("Tool tip foreground"), "ToolTipText")
    liColor.append(separador)
    xcolor(_("Button background"), "Button")
    xcolor(_("Button foreground"), "ButtonText")
    xcolor(_("Bright text"), "BrightText")
    liColor.append(separador)
    xcolor(_("Links"), "Link")

    # QtGui.QPalette.Window	10	A general background color.
    # QtGui.QPalette.WindowText	0	A general foreground color.
    # QtGui.QPalette.Base	9	Used mostly as the background color for text entry widgets, but can also be used for other painting - such as the background of combobox drop down lists and toolbar handles. It is usually white or another light color.
    # QtGui.QPalette.AlternateBase	16	Used as the alternate background color in views with alternating row colors (see QAbstractItemView::setAlternatingRowColors()).
    # QtGui.QPalette.ToolTipBase	18	Used as the background color for QToolTip and QWhatsThis. Tool tips use the Inactive color group of QPalette, because tool tips are not active windows.
    # QtGui.QPalette.ToolTipText	19	Used as the foreground color for QToolTip and QWhatsThis. Tool tips use the Inactive color group of QPalette, because tool tips are not active windows.
    # QtGui.QPalette.Text	6	The foreground color used with Base. This is usually the same as the WindowText, in which case it must provide good contrast with Window and Base.
    # QtGui.QPalette.Button	1	The general button background color. This background can be different from Window as some styles require a different background color for buttons.
    # QtGui.QPalette.ButtonText	8	A foreground color used with the Button color.
    # QtGui.QPalette.BrightText	7	A text color that is very different from WindowText, and contrasts well with e.g. Dark. Typically used for text that needs to be drawn where Text or WindowText would give poor contrast, such as on pressed push buttons. Note that text colors can be used for things other than just words; text colors are usually used for text, but it's quite common to use the text color roles for lines, icons, etc.

    liPGN = []
    liPGN.append(separador)
    liPGN.append((_("By default") + ":", False))
    liPGN.append(separador)

    dicNAGs = TrListas.dicNAGs()
    config = FormLayout.Colorbox(dicNAGs[1], 40, 20, siSTR=True)
    liPGN.append((config, configuracion.color_nag1))

    config = FormLayout.Colorbox(dicNAGs[2], 40, 20, siSTR=True)
    liPGN.append((config, configuracion.color_nag2))

    config = FormLayout.Colorbox(dicNAGs[3], 40, 20, siSTR=True)
    liPGN.append((config, configuracion.color_nag3))

    config = FormLayout.Colorbox(dicNAGs[4], 40, 20, siSTR=True)
    liPGN.append((config, configuracion.color_nag4))

    config = FormLayout.Colorbox(dicNAGs[5], 40, 20, siSTR=True)
    liPGN.append((config, configuracion.color_nag5))

    config = FormLayout.Colorbox(dicNAGs[6], 40, 20, siSTR=True)
    liPGN.append((config, configuracion.color_nag6))

    liTables = []
    liTables.append(separador)
    liTables.append((_("By default") + ":", False))
    liTables.append(separador)

    liTables.append((None, _("Selected row")))
    config = FormLayout.Colorbox(_("Background"), 40, 20, siSTR=True)
    color = "#678DB2" if configuracion.tablaSelBackground is None else configuracion.tablaSelBackground
    liTables.append((config, color))

    lista = []
    lista.append((liColor, _("Windows"), ""))
    lista.append((liPGN, _("PGN"), ""))
    lista.append((liTables, _("Tables"), ""))

    # Editamos
    resultado = FormLayout.fedit(lista, title=_("Colors"), parent=parent, anchoMinimo=240, icon=Iconos.Opciones())

    if resultado:
        accion, resp = resultado

        liColor, liPGN, liTables = resp

        if liColor[0]:
            palette = None
        else:
            palette = {}
            for n, tipo in enumerate(liPalette):
                palette[tipo] = liColor[n+1]
        configuracion.palette = palette

        if liPGN[0]:
            configuracion.coloresPGNdefecto()
        else:
            (configuracion.color_nag1, configuracion.color_nag2, configuracion.color_nag3,
             configuracion.color_nag4, configuracion.color_nag5, configuracion.color_nag6) = liPGN[1:]

        if liTables[0]:
            configuracion.tablaSelBackground = None
        else:
            configuracion.tablaSelBackground = liTables[1]

        configuracion.graba()

        return True
    else:
        return False
Ejemplo n.º 10
0
    def __init__(self, panelOpening, configuracion):
        QtGui.QWidget.__init__(self)

        self.panelOpening = panelOpening
        self.dbop = panelOpening.dbop

        self.partidabase = panelOpening.partidabase
        self.num_jg_inicial = len(self.partidabase)
        self.posJugada = self.num_jg_inicial

        confTablero = configuracion.confTablero("POSLINES", 32)
        self.tablero = Tablero.Tablero(self, confTablero)
        self.tablero.crea()
        self.tablero.ponerPiezasAbajo(True)
        self.tablero.ponMensajero(self.mueveHumano)
        self.tablero.dispatchSize(self.ajustaAncho)
        self.tablero.dbVisual_setFichero(self.dbop.nomFichero)
        self.tablero.dbVisual_setShowAllways(True)

        self.dbop.setdbVisual_Tablero(self.tablero)  # To close

        self.intervalo = 1400

        tipoLetra = Controles.TipoLetra(puntos=configuracion.puntosPGN)

        lybt, bt = QTVarios.lyBotonesMovimiento(self,
                                                "",
                                                siTiempo=True,
                                                siLibre=False,
                                                tamIcon=24)

        self.lbPGN = Controles.LB(self).ponWrap()
        self.lbPGN.colocate = self.colocatePartida
        self.lbPGN.setStyleSheet(
            "QLabel{ border-style: groove; border-width: 2px; border-color: LightSlateGray; padding: 8px;}"
        )
        self.lbPGN.ponFuente(tipoLetra)
        self.lbPGN.setOpenExternalLinks(False)

        def muestraPos(txt):
            self.colocatePartida(int(txt))

        self.connect(self.lbPGN, QtCore.SIGNAL("linkActivated(QString)"),
                     muestraPos)

        self.siFigurines = configuracion.figurinesPGN

        dicNAGs = TrListas.dicNAGs()
        self.dicValoracion = collections.OrderedDict()
        self.dicValoracion[BUENO] = (dicNAGs[1],
                                     PantallaColores.nag2ico(1, 16))
        self.dicValoracion[MALO] = (dicNAGs[2], PantallaColores.nag2ico(2, 16))
        self.dicValoracion[MUY_BUENO] = (dicNAGs[3],
                                         PantallaColores.nag2ico(3, 16))
        self.dicValoracion[MUY_MALO] = (dicNAGs[4],
                                        PantallaColores.nag2ico(4, 16))
        self.dicValoracion[INTERESANTE] = (dicNAGs[5],
                                           PantallaColores.nag2ico(5, 16))
        self.dicValoracion[DUDOSA] = (dicNAGs[6],
                                      PantallaColores.nag2ico(6, 16))
        self.dicValoracion[SIN_VALORACION] = (_("No rating"), QtGui.QIcon())

        self.dicVentaja = collections.OrderedDict()
        self.dicVentaja[V_SIN] = (_("Undefined"), QtGui.QIcon())
        self.dicVentaja[V_IGUAL] = (dicNAGs[11],
                                    Iconos.V_Blancas_Igual_Negras())
        self.dicVentaja[V_BLANCAS] = (dicNAGs[14], Iconos.V_Blancas())
        self.dicVentaja[V_BLANCAS_MAS] = (dicNAGs[16], Iconos.V_Blancas_Mas())
        self.dicVentaja[V_BLANCAS_MAS_MAS] = (dicNAGs[18],
                                              Iconos.V_Blancas_Mas_Mas())
        self.dicVentaja[V_NEGRAS] = (dicNAGs[15], Iconos.V_Negras())
        self.dicVentaja[V_NEGRAS_MAS] = (dicNAGs[17], Iconos.V_Negras_Mas())
        self.dicVentaja[V_NEGRAS_MAS_MAS] = (dicNAGs[19],
                                             Iconos.V_Negras_Mas_Mas())

        # Valoracion
        liOpciones = [(tit[0], k, tit[1])
                      for k, tit in self.dicValoracion.iteritems()]
        self.cbValoracion = Controles.CB(self, liOpciones, 0).capturaCambiado(
            self.cambiadoValoracion)
        self.cbValoracion.ponFuente(tipoLetra)

        # Ventaja
        liOpciones = [(tit, k, icon)
                      for k, (tit, icon) in self.dicVentaja.iteritems()]
        self.cbVentaja = Controles.CB(self, liOpciones,
                                      0).capturaCambiado(self.cambiadoVentaja)
        self.cbVentaja.ponFuente(tipoLetra)

        # Comentario
        self.emComentario = Controles.EM(self, siHTML=False).capturaCambios(
            self.cambiadoComentario)
        self.emComentario.ponFuente(tipoLetra)
        self.emComentario.altoFijo(5 * configuracion.altoFilaPGN)
        lyVal = Colocacion.H().control(self.cbValoracion).control(
            self.cbVentaja)
        lyEd = Colocacion.V().otro(lyVal).control(self.emComentario)

        # Apertura
        self.lbApertura = Controles.LB(self).alinCentrado().ponFuente(
            tipoLetra).ponWrap()

        lyt = Colocacion.H().relleno().control(self.tablero).relleno()

        lya = Colocacion.H().relleno().control(self.lbPGN).relleno()

        layout = Colocacion.V()
        layout.otro(lyt)
        layout.otro(lybt)
        layout.otro(lya)
        layout.otro(lyEd)
        layout.control(self.lbApertura)
        layout.relleno()
        self.setLayout(layout)

        self.ajustaAncho()

        self.siReloj = False

        self.ponPartida(self.partidabase)
Ejemplo n.º 11
0
    def __init__(self, panelOpening, configuracion):
        QtWidgets.QWidget.__init__(self)

        self.panelOpening = panelOpening
        self.dbop = panelOpening.dbop

        self.configuracion = configuracion

        self.partidabase = panelOpening.partidabase
        self.num_jg_inicial = len(self.partidabase)
        self.pos_move = self.num_jg_inicial

        config_board = configuracion.config_board("POSLINES", 32)
        self.tablero = Tablero.Tablero(self, config_board)
        self.tablero.crea()
        self.tablero.ponerPiezasAbajo(True)
        self.tablero.set_dispatcher(self.mueve_humano)
        self.tablero.dispatchSize(self.ajustaAncho)
        self.tablero.dbVisual_setFichero(self.dbop.nom_fichero)
        self.tablero.dbVisual_setShowAllways(True)
        self.tablero.dbVisual_setSaveAllways(True)

        self.tablero.ponerPiezasAbajo(self.dbop.getconfig("WHITEBOTTOM", True))

        self.dbop.setdbVisual_Tablero(self.tablero)  # To close

        self.intervalo = configuracion.x_interval_replay

        tipoLetra = Controles.TipoLetra(puntos=configuracion.x_pgn_fontpoints)

        lybt, bt = QTVarios.lyBotonesMovimiento(self,
                                                "",
                                                siTiempo=True,
                                                siLibre=False,
                                                tamIcon=24)

        self.lbPGN = Controles.LB(self).ponWrap()
        self.lbPGN.colocate = self.colocatePartida
        self.lbPGN.setStyleSheet(
            "QLabel{ border-style: groove; border-width: 2px; border-color: LightSlateGray; padding: 8px;}"
        )
        self.lbPGN.ponFuente(tipoLetra)
        self.lbPGN.setOpenExternalLinks(False)

        def muestraPos(txt):
            self.colocatePartida(int(txt))

        self.lbPGN.linkActivated.connect(muestraPos)

        self.siFigurines = configuracion.x_pgn_withfigurines

        dicNAGs = TrListas.dicNAGs()
        self.dicValoracion = collections.OrderedDict()
        self.dicValoracion[GOOD_MOVE] = (dicNAGs[1],
                                         PantallaColores.nag2ico(1, 16))
        self.dicValoracion[BAD_MOVE] = (dicNAGs[2],
                                        PantallaColores.nag2ico(2, 16))
        self.dicValoracion[VERY_GOOD_MOVE] = (dicNAGs[3],
                                              PantallaColores.nag2ico(3, 16))
        self.dicValoracion[VERY_POOR_MOVE] = (dicNAGs[4],
                                              PantallaColores.nag2ico(4, 16))
        self.dicValoracion[SPECULATIVE_MOVE] = (dicNAGs[5],
                                                PantallaColores.nag2ico(5, 16))
        self.dicValoracion[QUESTIONABLE_MOVE] = (dicNAGs[6],
                                                 PantallaColores.nag2ico(
                                                     6, 16))
        self.dicValoracion[NO_RATING] = (_("No rating"), QtGui.QIcon())

        self.dicVentaja = collections.OrderedDict()
        self.dicVentaja[V_SIN] = (_("Undefined"), QtGui.QIcon())
        self.dicVentaja[V_IGUAL] = (dicNAGs[11],
                                    Iconos.V_Blancas_Igual_Negras())
        self.dicVentaja[V_BLANCAS] = (dicNAGs[14], Iconos.V_Blancas())
        self.dicVentaja[V_BLANCAS_MAS] = (dicNAGs[16], Iconos.V_Blancas_Mas())
        self.dicVentaja[V_BLANCAS_MAS_MAS] = (dicNAGs[18],
                                              Iconos.V_Blancas_Mas_Mas())
        self.dicVentaja[V_NEGRAS] = (dicNAGs[15], Iconos.V_Negras())
        self.dicVentaja[V_NEGRAS_MAS] = (dicNAGs[17], Iconos.V_Negras_Mas())
        self.dicVentaja[V_NEGRAS_MAS_MAS] = (dicNAGs[19],
                                             Iconos.V_Negras_Mas_Mas())

        # Valoracion
        li_options = [(tit[0], k, tit[1])
                      for k, tit in self.dicValoracion.items()]
        self.cbValoracion = Controles.CB(self, li_options, 0).capturaCambiado(
            self.cambiadoValoracion)
        self.cbValoracion.ponFuente(tipoLetra)

        # Ventaja
        li_options = [(tit, k, icon)
                      for k, (tit, icon) in self.dicVentaja.items()]
        self.cbVentaja = Controles.CB(self, li_options,
                                      0).capturaCambiado(self.cambiadoVentaja)
        self.cbVentaja.ponFuente(tipoLetra)

        # Comentario
        self.emComentario = Controles.EM(self, siHTML=False).capturaCambios(
            self.cambiadoComentario)
        self.emComentario.ponFuente(tipoLetra)
        self.emComentario.altoFijo(5 * configuracion.x_pgn_rowheight)
        lyVal = Colocacion.H().control(self.cbValoracion).control(
            self.cbVentaja)
        lyEd = Colocacion.V().otro(lyVal).control(self.emComentario)

        # Apertura
        self.lbApertura = Controles.LB(self).alinCentrado().ponFuente(
            tipoLetra).ponWrap()

        lyt = Colocacion.H().relleno().control(self.tablero).relleno()

        lya = Colocacion.H().relleno().control(self.lbPGN).relleno()

        layout = Colocacion.V()
        layout.otro(lyt)
        layout.otro(lybt)
        layout.otro(lya)
        layout.otro(lyEd)
        layout.control(self.lbApertura)
        layout.relleno().margen(0)
        self.setLayout(layout)

        self.ajustaAncho()

        self.siReloj = False

        self.ponPartida(self.partidabase)
Ejemplo n.º 12
0
    def __init__(self, wParent):
        QtGui.QWidget.__init__(self, wParent)

        self.wParent = wParent

        self.jg = None
        self.partida = None

        puntos = VarGen.configuracion.puntosPGN

        f = Controles.TipoLetra(puntos=puntos, peso=75)
        # ftxt = Controles.TipoLetra( nombre="Courier New", puntos=puntos )
        f9 = Controles.TipoLetra(puntos=puntos)
        ftxt = f9

        # Apertura
        self.lbApertura = Controles.LB(
            self, "").ponFuente(f).alinCentrado().ponColorFondoN(
                "#eeeeee", "#474d59").ponWrap()
        self.lbApertura.hide()

        # Valoracion
        liOpciones = [("-", "-")]
        dicNAGs = TrListas.dicNAGs()

        carpNAGs = "./IntFiles/NAGs"

        for x in dicNAGs:
            if x:
                fsvg = "%s/$%d.svg" % (carpNAGs, x)
                if os.path.isfile(fsvg):
                    liOpciones.append(("$%d : %s" % (x, dicNAGs[x]), str(x),
                                       QTVarios.fsvg2ico(fsvg, 16)))
                else:
                    liOpciones.append(("$%d : %s" % (x, dicNAGs[x]), str(x)))
        self.maxNAGs = 10
        self.liNAGs = []
        for x in range(self.maxNAGs):
            cb = Controles.CB(self, liOpciones,
                              "").ponAnchoMinimo().capturaCambiado(
                                  self.valoracionCambiada).ponFuente(f9)
            if x:
                cb.hide()
            self.liNAGs.append(cb)

        liOpciones = [(x, x) for x in ("-", "!", "!!", "?", "??", "!?", "?!")]
        self.valoracionDirecta = Controles.CB(
            self, liOpciones, "-").ponAnchoFijo(42).capturaCambiado(
                self.valoracionDirectaCambiada)

        lyH = Colocacion.H().control(self.valoracionDirecta).control(
            self.liNAGs[0])
        ly = Colocacion.V().otro(lyH)
        for x in range(1, self.maxNAGs):
            ly.control(self.liNAGs[x])

        self.gbValoracion = Controles.GB(self, _("Rating"), ly).ponFuente(f)

        # Comentarios
        self.comentario = Controles.EM(self, siHTML=False).capturaCambios(
            self.comentarioCambiado).ponFuente(ftxt).anchoMinimo(200)

        ly = Colocacion.H().control(self.comentario)
        self.gbComentario = Controles.GB(self, _("Comments"), ly).ponFuente(f)

        # Variantes
        liAcciones = (
            (_("Append"), Iconos.Mas(), self.tbMasVariante),
            None,
            ("%s+%s" % (_("Append"), _("Engine")), Iconos.MasR(),
             self.tbMasVarianteR),
            None,
            (_("Edit"), Iconos.ComentarioEditar(), self.tbEditarVariante),
            None,
            (_("Remove"), Iconos.Borrar(), self.tbBorrarVariante),
            None,
        )
        tbVariantes = Controles.TBrutina(self,
                                         liAcciones,
                                         siTexto=False,
                                         tamIcon=16)

        self.variantes = Controles.EM(self, siHTML=False).capturaCambios(
            self.variantesCambiado).ponFuente(ftxt)
        self.variantes.capturaDobleClick(self.variantesDobleClick)
        self.variantes.setReadOnly(True)
        ly = Colocacion.V().control(tbVariantes).control(self.variantes)
        self.gbVariantes = Controles.GB(self, _("Variants"), ly).ponFuente(f)

        self.splitter = splitter = QtGui.QSplitter(self)
        self.splitter.setOrientation(QtCore.Qt.Vertical)
        splitter.addWidget(self.gbComentario)
        splitter.addWidget(self.gbVariantes)

        layout = Colocacion.V()
        layout.control(self.lbApertura)
        layout.control(self.gbValoracion)
        layout.control(self.splitter)
        # layout.control(self.gbComentario)
        # layout.control(self.gbVariantes)
        layout.margen(5)

        self.setLayout(layout)
Ejemplo n.º 13
0
    def __init__(self, wParent):
        QtGui.QWidget.__init__(self, wParent)

        self.wParent = wParent

        self.jg = None
        self.partida = None

        puntos = VarGen.configuracion.puntosPGN

        f = Controles.TipoLetra(puntos=puntos, peso=75)
        # ftxt = Controles.TipoLetra( nombre="Courier New", puntos=puntos )
        f9 = Controles.TipoLetra(puntos=puntos)
        ftxt = f9

        # Apertura
        self.lbApertura = Controles.LB(self, "").ponFuente(f).alinCentrado().ponColorFondoN("#eeeeee", "#474d59").ponWrap()
        self.lbApertura.hide()

        # Valoracion
        liOpciones = [("-", "-")]
        dicNAGs = TrListas.dicNAGs()

        carpNAGs = "./IntFiles/NAGs"

        for x in dicNAGs:
            if x:
                fsvg = "%s/$%d.svg" % (carpNAGs, x)
                if os.path.isfile(fsvg):
                    liOpciones.append(("$%d : %s" % ( x, dicNAGs[x]), str(x), QTVarios.fsvg2ico(fsvg, 16)))
                else:
                    liOpciones.append(("$%d : %s" % ( x, dicNAGs[x]), str(x)))
        self.maxNAGs = 10
        self.liNAGs = []
        for x in range(self.maxNAGs):
            cb = Controles.CB(self, liOpciones, "").ponAnchoMinimo().capturaCambiado(self.valoracionCambiada).ponFuente(
                f9)
            if x:
                cb.hide()
            self.liNAGs.append(cb)

        liOpciones = [(x, x) for x in ("-", "!", "!!", "?", "??", "!?", "?!" )]
        self.valoracionDirecta = Controles.CB(self, liOpciones, "-").ponAnchoFijo(42).capturaCambiado(self.valoracionDirectaCambiada)

        lyH = Colocacion.H().control(self.valoracionDirecta).control(self.liNAGs[0])
        ly = Colocacion.V().otro(lyH)
        for x in range(1, self.maxNAGs):
            ly.control(self.liNAGs[x])

        self.gbValoracion = Controles.GB(self, _("Rating"), ly).ponFuente(f)

        # Comentarios
        self.comentario = Controles.EM(self, siHTML=False).capturaCambios(self.comentarioCambiado).ponFuente(
            ftxt).anchoMinimo(200)

        ly = Colocacion.H().control(self.comentario)
        self.gbComentario = Controles.GB(self, _("Comments"), ly).ponFuente(f)

        # Variantes
        liAcciones = (
            ( _("Append"), Iconos.Mas(), "tbMasVariante" ), None,
            ( "%s+%s" % (_("Append"), _("Engine")), Iconos.MasR(), "tbMasVarianteR" ), None,
            ( _("Edit"), Iconos.ComentarioEditar(), "tbEditarVariante" ), None,
            ( _("Remove"), Iconos.Borrar(), "tbBorrarVariante" ), None,
        )
        tbVariantes = Controles.TB(self, liAcciones, siTexto=False, tamIcon=16)

        self.variantes = Controles.EM(self, siHTML=False).capturaCambios(self.variantesCambiado).ponFuente(ftxt)
        self.variantes.capturaDobleClick(self.variantesDobleClick)

        ly = Colocacion.V().control(tbVariantes).control(self.variantes)
        self.gbVariantes = Controles.GB(self, _("Variants"), ly).ponFuente(f)

        layout = Colocacion.V()
        layout.control(self.lbApertura)
        layout.control(self.gbValoracion)
        layout.control(self.gbComentario)
        layout.control(self.gbVariantes)
        layout.margen(5)

        self.setLayout(layout)