Пример #1
0
    def __init__(self, wowner, gestor, alm, muestraAnalisis):
        titulo = _("Result of analysis")
        icono = Iconos.Estadisticas()
        extparam = "estadisticasv1"
        QTVarios.WDialogo.__init__(self, wowner, titulo, icono, extparam)
        self.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.WindowTitleHint
                            | QtCore.Qt.WindowMinimizeButtonHint)

        self.alm = alm
        self.procesador = gestor.procesador
        self.gestor = gestor
        self.configuracion = gestor.configuracion
        self.siPawns = not gestor.procesador.configuracion.centipawns
        self.muestraAnalisis = muestraAnalisis
        self.colorWhite = QTUtil.qtColorRGB(231, 244, 254)

        def xcol():
            oColumnas = Columnas.ListaColumnas()
            oColumnas.nueva("NUM", _("N."), 50, siCentrado=True)
            oColumnas.nueva("MOVE",
                            _("Move"),
                            120,
                            siCentrado=True,
                            edicion=Delegados.EtiquetaPGN(True, True, True))
            oColumnas.nueva("BEST",
                            _("Best move"),
                            120,
                            siCentrado=True,
                            edicion=Delegados.EtiquetaPGN(True, True, True))
            oColumnas.nueva("DIF", _("Difference"), 80, siCentrado=True)
            oColumnas.nueva("PORC", "%", 80, siCentrado=True)
            oColumnas.nueva("ELO", _("Elo"), 80, siCentrado=True)
            return oColumnas

        self.dicLiJG = {
            "A": self.alm.lijg,
            "W": self.alm.lijgW,
            "B": self.alm.lijgB
        }
        gridAll = Grid.Grid(self, xcol(), siSelecFilas=True, xid="A")
        anchoGrid = gridAll.fixMinWidth()
        self.registrarGrid(gridAll)
        gridW = Grid.Grid(self, xcol(), siSelecFilas=True, xid="W")
        anchoGrid = max(gridW.fixMinWidth(), anchoGrid)
        self.registrarGrid(gridW)
        gridB = Grid.Grid(self, xcol(), siSelecFilas=True, xid="B")
        anchoGrid = max(gridB.fixMinWidth(), anchoGrid)
        self.registrarGrid(gridB)

        lbIndexes = Controles.LB(self, alm.indexesHTML)
        pbSave = Controles.PB(self,
                              _("Save to game comments"),
                              self.saveIndexes,
                              plano=False)
        pbSave.ponIcono(Iconos.Grabar())
        ly0 = Colocacion.H().control(pbSave).relleno()
        ly = Colocacion.V().control(lbIndexes).otro(ly0).relleno()
        wIdx = QtGui.QWidget()
        wIdx.setLayout(ly)

        self.tabGrid = tabGrid = Controles.Tab()
        tabGrid.nuevaTab(gridAll, _("All moves"))
        tabGrid.nuevaTab(gridW, _("White"))
        tabGrid.nuevaTab(gridB, _("Black"))
        tabGrid.nuevaTab(wIdx, _("Indexes"))
        tabGrid.dispatchChange(self.tabChanged)
        self.tabActive = 0

        confTablero = VarGen.configuracion.confTablero("ANALISISGRAPH", 48)
        self.tablero = Tablero.Tablero(self, confTablero)
        self.tablero.crea()
        self.tablero.ponerPiezasAbajo(True)
        self.tablero.dispatchSize(self.tableroSizeChanged)

        self.capturas = WCapturas.CapturaLista(self, self.tablero)
        ly_tc = Colocacion.H().control(self.tablero).control(self.capturas)

        self.rbShowValues = Controles.RB(self,
                                         _("Values"),
                                         rutina=self.cambiadoShow).activa(True)
        self.rbShowElo = Controles.RB(self,
                                      _("Elo perfomance"),
                                      rutina=self.cambiadoShow)
        self.chbShowLostPoints = Controles.CHB(
            self, _("Show lost points"),
            self.getShowLostPoints()).capturaCambiado(
                self, self.showLostPointsChanged)
        ly_rb = Colocacion.H().espacio(40).control(
            self.rbShowValues).espacio(20).control(
                self.rbShowElo).espacio(30).control(
                    self.chbShowLostPoints).relleno(1)

        layout = Colocacion.G()
        layout.controlc(tabGrid, 0, 0)
        layout.otroc(ly_rb, 1, 0)
        layout.otroc(ly_tc, 0, 1, numFilas=2)

        Controles.Tab().ponPosicion("W")
        ancho = self.tablero.width() + anchoGrid
        self.htotal = [
            Histogram.Histogram(self, alm.hgame, gridAll, ancho, True),
            Histogram.Histogram(self, alm.hwhite, gridW, ancho, True),
            Histogram.Histogram(self, alm.hblack, gridB, ancho, True),
            Histogram.Histogram(self, alm.hgame, gridAll, ancho, False,
                                alm.eloT),
            Histogram.Histogram(self, alm.hwhite, gridW, ancho, False,
                                alm.eloW),
            Histogram.Histogram(self, alm.hblack, gridB, ancho, False,
                                alm.eloB)
        ]
        lh = Colocacion.V()
        for x in range(6):
            lh.control(self.htotal[x])
            if x:
                self.htotal[x].hide()

        layout.otroc(lh, 2, 0, 1, 3)
        self.setLayout(layout)

        self.recuperarVideo(siTam=False)

        gridAll.gotop()
        gridB.gotop()
        gridW.gotop()
        self.gridBotonIzquierdo(gridAll, 0, None)
        self.tabGrid.setFixedHeight(self.tablero.height())
        self.adjustSize()
Пример #2
0
 def creaCapturas(self):
     self.capturas = WCapturas.CapturaLista(self, self.tablero)