Exemplo n.º 1
0
    def __init__(self, w_parent, game, nj, procesador):

        main_window = w_parent

        self.procesador = procesador

        titulo = _("Moves tree")
        icono = Iconos.Arbol()
        extparam = "moves"
        QTVarios.WDialogo.__init__(self, main_window, titulo, icono, extparam)

        dicVideo = self.restore_dicvideo()

        self.dbCache = UtilSQL.DictSQL(Code.configuration.ficheroMoves)
        if nj >= 0:
            position = game.move(nj).position
        else:
            position = game.last_position
        self.listaMoves = ListaMoves(None, position.fen(), self.dbCache)

        tb = QTVarios.LCTB(self)
        tb.new(_("Save"), Iconos.Grabar(), self.grabar)
        tb.new(_("Cancel"), Iconos.Cancelar(), self.cancelar)

        self.infoMove = InfoMove(position.is_white)

        w = QtWidgets.QWidget(self)
        ly = Colocacion.V().control(tb).control(self.infoMove)
        w.setLayout(ly)

        self.wmoves = WMoves(self, procesador)

        self.splitter = splitter = QtWidgets.QSplitter(self)
        splitter.addWidget(w)
        splitter.addWidget(self.wmoves)

        ly = Colocacion.H().control(splitter).margen(0)

        self.setLayout(ly)

        self.wmoves.tree.setFocus()

        anchoBoard = self.infoMove.board.width()

        self.restore_video(anchoDefecto=869 - 242 + anchoBoard)
        if not dicVideo:
            dicVideo = {
                "TREE_3": 27,
                "SPLITTER": [260 - 242 + anchoBoard, 617],
                "TREE_1": 49,
                "TREE_2": 383,
                "TREE_4": 25,
            }
        sz = dicVideo.get("SPLITTER", None)
        if sz:
            self.splitter.setSizes(sz)
        for x in range(1, 6):
            w = dicVideo.get("TREE_%d" % x, None)
            if w:
                self.wmoves.tree.setColumnWidth(x, w)
    def __init__(self, wParent, partida, nj, procesador):

        pantalla = wParent

        self.procesador = procesador

        titulo = _("Moves tree")
        icono = Iconos.Arbol()
        extparam = "moves"
        QTVarios.WDialogo.__init__(self, pantalla, titulo, icono, extparam)

        dicVideo = self.recuperarDicVideo()

        self.dbCache = Util.DicSQL(VarGen.configuracion.ficheroMoves)
        if nj >= 0:
            posicion = partida.jugada(nj).posicion
        else:
            posicion = partida.ultPosicion
        self.listaMoves = ListaMoves(None, posicion.fen(), self.dbCache)

        tb = QTVarios.LCTB(self)
        tb.new(_("Save"), Iconos.Grabar(), self.grabar)
        tb.new(_("Cancel"), Iconos.Cancelar(), self.cancelar)

        self.infoMove = InfoMove(posicion.siBlancas)

        self.wmoves = WMoves(self, procesador)

        self.splitter = splitter = QtGui.QSplitter(self)
        splitter.addWidget(self.infoMove)
        splitter.addWidget(self.wmoves)

        ly = Colocacion.H().control(splitter).margen(0)

        layout = Colocacion.V().control(tb).otro(ly).margen(3)

        self.setLayout(layout)

        self.wmoves.tree.setFocus()

        anchoTablero = self.infoMove.tablero.width()

        self.recuperarVideo(anchoDefecto=869 - 242 + anchoTablero)
        if not dicVideo:
            dicVideo = {
                'TREE_3': 27,
                'SPLITTER': [260 - 242 + anchoTablero, 617],
                'TREE_1': 49,
                'TREE_2': 383,
                'TREE_4': 25
            }
        sz = dicVideo.get("SPLITTER", None)
        if sz:
            self.splitter.setSizes(sz)
        for x in range(1, 6):
            w = dicVideo.get("TREE_%d" % x, None)
            if w:
                self.wmoves.tree.setColumnWidth(x, w)
Exemplo n.º 3
0
    def __init__(self, panelOpening, procesador, configuration):
        QtWidgets.QWidget.__init__(self)

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

        self.procesador = procesador
        self.configuration = configuration
        self.game = None
        self.njg = None

        self.tabtree = TabTree(self, configuration)
        self.tabengine = TabEngine(self, procesador, configuration)
        # self.tabengine.tabButton(0, QtWidgets.QTabBar.RightSide).deleteLater()
        # self.tabengine.tabBar().setTabButton(0, QtWidgets.QTabBar.RightSide, 0)

        self.li_tabs = [("engine", self.tabengine), ("tree", self.tabtree)]
        self.tabActive = 0

        self.tabs = Controles.Tab(panelOpening)
        self.tabs.ponTipoLetra(puntos=self.configuration.x_pgn_fontpoints)
        self.tabs.setTabIcon(0, Iconos.Motor())
        self.tabs.nuevaTab(self.tabengine, _("Engine"))
        self.tabs.nuevaTab(self.tabtree, _("Tree"))
        self.tabs.setTabIcon(1, Iconos.Arbol())

        self.tabs.dispatchChange(self.tabChanged)

        tabButton = QtWidgets.QToolButton(self)
        tabButton.setIcon(Iconos.Nuevo())
        tabButton.clicked.connect(self.creaTab)
        li = [(_("Analysis of next move"), True),
              (_("Analysis of current move"), False)]
        self.cb_nextmove = Controles.CB(self, li, True).capture_changes(
            self.changedNextMove)

        corner_widget = QtWidgets.QWidget(self)
        lyCorner = Colocacion.H().control(
            self.cb_nextmove).control(tabButton).margen(0)
        corner_widget.setLayout(lyCorner)

        self.tabs.setCornerWidget(corner_widget)
        self.tabs.setTabsClosable(True)
        self.tabs.tabCloseRequested.connect(self.tabCloseRequested)

        self.tabs.quita_x(0)
        self.tabs.quita_x(1)

        layout = Colocacion.V()
        layout.control(self.tabs).margen(0)
        self.setLayout(layout)