Exemplo n.º 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()
Exemplo n.º 2
0
    def __init__(self, wowner, manager, alm, show_analysis):
        titulo = _("Result of analysis")
        icono = Iconos.Estadisticas()
        extparam = "estadisticasv1"
        QTVarios.WDialogo.__init__(self, wowner, titulo, icono, extparam)
        self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint
                            | QtCore.Qt.Dialog
                            | QtCore.Qt.WindowTitleHint
                            | QtCore.Qt.WindowMinimizeButtonHint)

        self.alm = alm
        self.procesador = manager.procesador
        self.manager = manager
        self.configuration = manager.configuration
        self.show_analysis = show_analysis
        self.colorWhite = QTUtil.qtColorRGB(231, 244, 254)

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

        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.register_grid(gridAll)
        gridW = Grid.Grid(self, xcol(), siSelecFilas=True, xid="W")
        anchoGrid = max(gridW.fixMinWidth(), anchoGrid)
        self.register_grid(gridW)
        gridB = Grid.Grid(self, xcol(), siSelecFilas=True, xid="B")
        anchoGrid = max(gridB.fixMinWidth(), anchoGrid)
        self.register_grid(gridB)

        self.emIndexes = Controles.EM(self, alm.indexesHTML).read_only()
        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(self.emIndexes).otro(ly0).relleno()
        wIdx = QtWidgets.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

        config_board = Code.configuration.config_board("ANALISISGRAPH", 48)
        self.board = Board.Board(self, config_board)
        self.board.crea()
        self.board.ponerPiezasAbajo(alm.is_white_bottom)
        self.board.dispatchSize(self.boardSizeChanged)

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

        self.rbShowValues = Controles.RB(self,
                                         _("Values"),
                                         rutina=self.cambiadoShow).activa(True)
        self.rbShowElo = Controles.RB(self,
                                      _("Elo performance"),
                                      rutina=self.cambiadoShow)
        self.chbShowLostPoints = Controles.CHB(
            self, _("Show lost points"),
            self.getShowLostPoints()).capture_changes(
                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().set_position("W")
        ancho = self.board.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.restore_video()

        gridAll.gotop()
        gridB.gotop()
        gridW.gotop()
        self.grid_left_button(gridAll, 0, None)
        th = self.board.height()
        self.tabGrid.setFixedHeight(th)
        self.adjustSize()
        self.emIndexes.setFixedHeight(th - 72)