Exemplo n.º 1
0
    def __init__(self, owner, name, title, icono, folder, li_tam_blocks):

        self.tol = TurnOnLights.read_tol(name, title, folder, li_tam_blocks)
        self.reinit = False

        titulo = _("Turn on the lights") + ": " + title
        extparam = "tol%s-%d" % (name, self.tol.work_level)
        QTVarios.WDialogo.__init__(self, owner, titulo, icono, extparam)

        self.colorTheme = QTUtil.qtColor("#F0F0F0")

        # Toolbar
        tb = Controles.TBrutina(self)
        tb.new(_("Close"), Iconos.MainMenu(), self.terminar)
        anterior, siguiente = self.tol.prev_next()
        if anterior:
            tb.new(_("Previous"), Iconos.Anterior(), self.goto_previous)
        if siguiente:
            tb.new(_("Next"), Iconos.Siguiente(), self.goto_next)
        tb.new(_("Config"), Iconos.Configurar(), self.config)
        tb.new(_("Information"), Iconos.Informacion(), self.colors)

        # Lista
        oColumnas = Columnas.ListaColumnas()
        work_level = self.tol.work_level + 1
        oColumnas.nueva("THEME",
                        _("Level %d/%d") % (work_level, self.tol.num_levels),
                        175)
        for x in range(self.tol.num_blocks):
            oColumnas.nueva("BLOCK%d" % x,
                            "%d" % (x + 1, ),
                            42,
                            siCentrado=True,
                            edicion=Delegados.PmIconosColor())

        self.grid = grid = Grid.Grid(self,
                                     oColumnas,
                                     altoFila=42,
                                     background="white")
        self.grid.setAlternatingRowColors(False)
        self.grid.tipoLetra(puntos=10, peso=500)
        nAnchoPgn = self.grid.anchoColumnas() + 20
        self.grid.setMinimumWidth(nAnchoPgn)
        self.registrarGrid(grid)

        # Colocamos ---------------------------------------------------------------
        ly = Colocacion.V().control(tb).control(self.grid)

        self.setLayout(ly)

        alto = self.tol.num_themes * 42 + 116
        self.recuperarVideo(siTam=True,
                            altoDefecto=alto,
                            anchoDefecto=nAnchoPgn)
Exemplo n.º 2
0
    def create_toolbar(self):
        self.tb = QtWidgets.QToolBar("BASIC", self)
        iconsTB = self.configuration.tipoIconos()
        self.tb.setToolButtonStyle(iconsTB)
        sz = 32 if iconsTB == QtCore.Qt.ToolButtonTextUnderIcon else 16
        self.tb.setIconSize(QtCore.QSize(sz, sz))
        style = "QToolBar {border-bottom: 1px solid gray; border-top: 1px solid gray;}"
        self.tb.setStyleSheet(style)
        # sp = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtGui, QtWidgets.QSizePolicy.Expanding)
        # self.tb.setSizePolicy(sp)
        self.tb.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.tb.customContextMenuRequested.connect(self.lanzaAtajos)

        self.dic_toolbar = {}

        dic_opciones = {
            TB_PLAY: (_("Play"), Iconos.Libre()),
            TB_COMPETE: (_("Compete"), Iconos.NuevaPartida()),
            TB_TRAIN: (_("Train"), Iconos.Entrenamiento()),
            TB_OPTIONS: (_("Options"), Iconos.Opciones()),
            TB_INFORMATION: (_("Information"), Iconos.Informacion()),
            TB_FILE: (_("File"), Iconos.File()),
            TB_SAVE: (_("Save"), Iconos.Grabar()),
            TB_SAVE_AS: (_("Save as"), Iconos.GrabarComo()),
            TB_OPEN: (_("Open"), Iconos.Recuperar()),
            TB_RESIGN: (_("Resign"), Iconos.Abandonar()),
            TB_REINIT: (_("Reinit"), Iconos.Reiniciar()),
            TB_TAKEBACK: (_("Takeback"), Iconos.Atras()),
            TB_ADJOURN: (_("Adjourn"), Iconos.Aplazar()),
            TB_Adjournments: (_("Adjournments"), Iconos.Aplazamientos()),
            TB_END_GAME: (_("End game"), Iconos.FinPartida()),
            TB_CLOSE: (_("Close"), Iconos.MainMenu()),
            TB_PREVIOUS: (_("Previous"), Iconos.Anterior()),
            TB_NEXT: (_("Next"), Iconos.Siguiente()),
            TB_QUIT: (_("Quit"), Iconos.FinPartida()),
            TB_PASTE_PGN: (_("Paste PGN"), Iconos.Pegar()),
            TB_READ_PGN: (_("Read PGN"), Iconos.Fichero()),
            TB_PGN_LABELS: (_("PGN Labels"), Iconos.InformacionPGN()),
            TB_OTHER_GAME: (_("Other game"), Iconos.FicheroRepite()),
            TB_MY_GAMES: (_("My games"), Iconos.NuestroFichero()),
            TB_DRAW: (_("Draw"), Iconos.Tablas()),
            TB_BOXROOMS_PGN: (_("Boxrooms PGN"), Iconos.BoxRooms()),
            TB_END: (_("End"), Iconos.MainMenu()),
            TB_SLOW: (_("Slow"), Iconos.Pelicula_Lento()),
            TB_PAUSE: (_("Pause"), Iconos.Pelicula_Pausa()),
            TB_CONTINUE: (_("Continue"), Iconos.Pelicula_Seguir()),
            TB_FAST: (_("Fast"), Iconos.Pelicula_Rapido()),
            TB_REPEAT: (_("Repeat"), Iconos.Pelicula_Repetir()),
            TB_PGN: (_("PGN"), Iconos.Pelicula_PGN()),
            TB_HELP: (_("Help"), Iconos.AyudaGR()),
            TB_LEVEL: (_("Level"), Iconos.Jugar()),
            TB_ACCEPT: (_("Accept"), Iconos.Aceptar()),
            TB_CANCEL: (_("Cancel"), Iconos.Cancelar()),
            TB_CONFIG: (_("Config"), Iconos.Configurar()),
            TB_UTILITIES: (_("Utilities"), Iconos.Utilidades()),
            TB_VARIATIONS: (_("Variations"), Iconos.VariationsG()),
            TB_TOOLS: (_("Tools"), Iconos.Tools()),
            TB_CHANGE: (_("Change"), Iconos.Cambiar()),
            TB_SHOW_TEXT: (_("Show text"), Iconos.Modificar()),
            TB_HELP_TO_MOVE: (_("Help to move"), Iconos.BotonAyuda()),
            TB_SEND: (_("Send"), Iconos.Enviar()),
            TB_STOP: (_("Play now"), Iconos.Stop()),
        }

        cf = self.manager.configuration
        peso = 75 if cf.x_tb_bold else 50
        puntos = cf.x_tb_fontpoints
        font = Controles.TipoLetra(puntos=puntos, peso=peso)

        for key, (titulo, icono) in dic_opciones.items():
            accion = QtWidgets.QAction(titulo, None)
            accion.setIcon(icono)
            accion.setIconText(titulo)
            accion.setFont(font)
            accion.triggered.connect(self.run_action)
            accion.key = key
            self.dic_toolbar[key] = accion
Exemplo n.º 3
0
    def __init__(self, procesador, name, title, icono, folder, li_tam_blocks,
                 one_line):
        self.one_line = one_line
        if one_line:
            self.tol = TurnOnLights.read_oneline_tol()
        else:
            self.tol = TurnOnLights.read_tol(name, title, folder,
                                             li_tam_blocks)
        self.reinit = False

        titulo = _("Turn on the lights") + ": " + title
        if self.tol.is_calculation_mode():
            tipo = _("Calculation mode")
            background = "#88AA3A"
        else:
            tipo = _("Memory mode")
            background = "#BDDBE8"

        self.procesador = procesador
        extparam = "tol%s-%d" % (name, self.tol.work_level)

        QTVarios.WDialogo.__init__(self, procesador.pantalla, titulo, icono,
                                   extparam)

        self.colorTheme = QTUtil.qtColor("#F0F0F0")

        lb = Controles.LB(self, tipo)
        lb.ponFondoN(background).alinCentrado().ponTipoLetra(puntos=14)

        # Toolbar
        tb = Controles.TBrutina(self)
        tb.new(_("Close"), Iconos.MainMenu(), self.terminar)
        anterior, siguiente, terminado = self.tol.prev_next()
        if terminado:
            tb.new(_("Rebuild"), Iconos.Reindexar(), self.rebuild)
        if anterior:
            tb.new(_("Previous"), Iconos.Anterior(), self.goto_previous)
        if siguiente:
            tb.new(_("Next"), Iconos.Siguiente(), self.goto_next)
        if one_line:
            tb.new(_("Change"), Iconos.TOLchange(), self.cambiar_one_line)
        tb.new(_("Config"), Iconos.Configurar(), self.config)
        tb.new(_("Information"), Iconos.Informacion(), self.colors)

        # Lista
        oColumnas = Columnas.ListaColumnas()
        work_level = self.tol.work_level + 1
        oColumnas.nueva("THEME",
                        _("Level %d/%d") % (work_level, self.tol.num_levels),
                        175)

        edicionIconos = Delegados.PmIconosColor()
        self.dicIconos = {}
        for k, pm in edicionIconos.dicpmIconos.iteritems():
            self.dicIconos[k] = QtGui.QIcon(pm)

        for x in range(self.tol.num_blocks):
            oColumnas.nueva("BLOCK%d" % x,
                            "%d" % (x + 1, ),
                            42,
                            siCentrado=True,
                            edicion=edicionIconos)

        self.grid = grid = Grid.Grid(self,
                                     oColumnas,
                                     altoFila=42,
                                     background="white")
        self.grid.setAlternatingRowColors(False)
        self.grid.tipoLetra(puntos=10, peso=500)
        nAnchoPgn = self.grid.anchoColumnas() + 20
        self.grid.setMinimumWidth(nAnchoPgn)
        self.registrarGrid(grid)

        # Colocamos ---------------------------------------------------------------
        ly = Colocacion.V().control(lb).control(tb).control(self.grid)

        self.setLayout(ly)

        alto = self.tol.num_themes * 42 + 146
        self.recuperarVideo(siTam=True,
                            altoDefecto=alto,
                            anchoDefecto=max(nAnchoPgn, 480))
Exemplo n.º 4
0
    def preparaTB(self):

        self.dicTB = {}

        liOpciones = (
            (_("Quit"), Iconos.Terminar(), k_terminar),
            (_("Play"), Iconos.Libre(), k_play),
            (_("Compete"), Iconos.NuevaPartida(), k_competir),
            (_("Train"), Iconos.Entrenamiento(), k_entrenamiento),
            (_("Options"), Iconos.Opciones(), k_opciones),
            (_("Information"), Iconos.Informacion(), k_informacion),
            (_("Save"), Iconos.Grabar(), k_grabar),
            (_("Save as"), Iconos.GrabarComo(), k_grabarComo),
            (_("Open"), Iconos.Recuperar(), k_recuperar),
            (_("Resign"), Iconos.Abandonar(), k_abandonar),
            (_("Reinit"), Iconos.Reiniciar(), k_reiniciar),
            (_("Takeback"), Iconos.Atras(), k_atras),
            (_("Adjourn"), Iconos.Aplazar(), k_aplazar),
            (_("End game"), Iconos.FinPartida(), k_finpartida),
            (_("Close"), Iconos.MainMenu(), k_mainmenu),
            (_("Reinit"), Iconos.Reiniciar(), k_ent_empezar),
            (_("Previous"), Iconos.Anterior(), k_anterior),
            (_("Next"), Iconos.Siguiente(), k_siguiente),
            (_("Quit"), Iconos.FinPartida(), k_pgnFin),
            (_("Paste PGN"), Iconos.Pegar(), k_pgnPaste),
            (_("Read PGN"), Iconos.Fichero(), k_pgnFichero),
            (_("PGN Labels"), Iconos.InformacionPGN(), k_pgnInformacion),
            (_("Other game"), Iconos.FicheroRepite(), k_pgnFicheroRepite),
            (_("My games"), Iconos.NuestroFichero(), k_pgnNuestroFichero),
            (_("Resign"), Iconos.Rendirse(), k_rendirse),
            (_("Draw"), Iconos.Tablas(), k_tablas),
            (_("Boxrooms PGN"), Iconos.Trasteros(), k_trasteros),
            (_("End"), Iconos.MainMenu(), k_peliculaTerminar),
            (_("Slow"), Iconos.Pelicula_Lento(), k_peliculaLento),
            (_("Pause"), Iconos.Pelicula_Pausa(), k_peliculaPausa),
            (_("Continue"), Iconos.Pelicula_Seguir(), k_peliculaSeguir),
            (_("Fast"), Iconos.Pelicula_Rapido(), k_peliculaRapido),
            (_("Repeat"), Iconos.Pelicula_Repetir(), k_peliculaRepetir),
            (_("PGN"), Iconos.Pelicula_PGN(), k_peliculaPGN),
            (_("Play"), Iconos.Jugar(), k_jugar),
            (_("Help"), Iconos.AyudaGR(), k_ayuda),
            (_("Level"), Iconos.Jugar(), k_mateNivel),
            (_("Accept"), Iconos.Aceptar(), k_aceptar),
            (_("Cancel"), Iconos.Cancelar(), k_cancelar),
            (_("Game of the day"), Iconos.LM(), k_jugadadia),
            (_("Config"), Iconos.Configurar(), k_configurar),
            (_("Utilities"), Iconos.Utilidades(), k_utilidades),
            (_("Variants"), Iconos.VariantesG(), k_variantes),
            (_("Tools"), Iconos.Tools(), k_tools),
            (_("Change"), Iconos.Cambiar(), k_cambiar),
            (_("Show text"), Iconos.Modificar(), k_showtext),
            (_("Help to move"), Iconos.BotonAyuda(), k_ayudaMover),
            (_("Send"), Iconos.Enviar(), k_enviar),
            # ( "Debug", Iconos.Camara(), 999),# Martin debug
        )

        cf = self.gestor.configuracion
        peso = 75 if cf.boldTB else 50
        puntos = cf.puntosTB
        font = Controles.TipoLetra(puntos=puntos, peso=peso)

        for titulo, icono, clave in liOpciones:
            accion = QtGui.QAction(titulo, None)
            accion.setIcon(icono)
            accion.setIconText(titulo)
            accion.setFont(font)
            self.connect(accion, QtCore.SIGNAL("triggered()"),
                         self.procesarAccion)
            accion.clave = clave
            self.dicTB[clave] = accion
Exemplo n.º 5
0
    def preparaTB(self):
        self.dicTB = {}

        dic_opciones = {
            TB_PLAY: (_("Play"), Iconos.Libre()),
            TB_COMPETE: (_("Compete"), Iconos.NuevaPartida()),
            TB_TRAIN: (_("Train"), Iconos.Entrenamiento()),
            TB_OPTIONS: (_("Options"), Iconos.Opciones()),
            TB_INFORMATION: (_("Information"), Iconos.Informacion()),
            TB_FILE: (_("File"), Iconos.File()),
            TB_SAVE: (_("Save"), Iconos.Grabar()),
            TB_SAVE_AS: (_("Save as"), Iconos.GrabarComo()),
            TB_OPEN: (_("Open"), Iconos.Recuperar()),
            TB_RESIGN: (_("Resign"), Iconos.Abandonar()),
            TB_REINIT: (_("Reinit"), Iconos.Reiniciar()),
            TB_TAKEBACK: (_("Takeback"), Iconos.Atras()),
            TB_ADJOURN: (_("Adjourn"), Iconos.Aplazar()),
            TB_ADJOURNS: (_("Adjourns"), Iconos.Aplazamientos()),
            TB_END_GAME: (_("End game"), Iconos.FinPartida()),
            TB_CLOSE: (_("Close"), Iconos.MainMenu()),
            TB_PREVIOUS: (_("Previous"), Iconos.Anterior()),
            TB_NEXT: (_("Next"), Iconos.Siguiente()),
            TB_QUIT: (_("Quit"), Iconos.FinPartida()),
            TB_PASTE_PGN: (_("Paste PGN"), Iconos.Pegar()),
            TB_READ_PGN: (_("Read PGN"), Iconos.Fichero()),
            TB_PGN_LABELS: (_("PGN Labels"), Iconos.InformacionPGN()),
            TB_OTHER_GAME: (_("Other game"), Iconos.FicheroRepite()),
            TB_MY_GAMES: (_("My games"), Iconos.NuestroFichero()),
            TB_DRAW: (_("Draw"), Iconos.Tablas()),
            TB_BOXROOMS_PGN: (_("Boxrooms PGN"), Iconos.BoxRooms()),
            TB_END: (_("End"), Iconos.MainMenu()),
            TB_SLOW: (_("Slow"), Iconos.Pelicula_Lento()),
            TB_PAUSE: (_("Pause"), Iconos.Pelicula_Pausa()),
            TB_CONTINUE: (_("Continue"), Iconos.Pelicula_Seguir()),
            TB_FAST: (_("Fast"), Iconos.Pelicula_Rapido()),
            TB_REPEAT: (_("Repeat"), Iconos.Pelicula_Repetir()),
            TB_PGN: (_("PGN"), Iconos.Pelicula_PGN()),
            TB_HELP: (_("Help"), Iconos.AyudaGR()),
            TB_LEVEL: (_("Level"), Iconos.Jugar()),
            TB_ACCEPT: (_("Accept"), Iconos.Aceptar()),
            TB_CANCEL: (_("Cancel"), Iconos.Cancelar()),
            # TB_GAME_OF_THE_DAY: (_("Game of the day"), Iconos.LM()),
            TB_CONFIG: (_("Config"), Iconos.Configurar()),
            TB_UTILITIES: (_("Utilities"), Iconos.Utilidades()),
            TB_VARIATIONS: (_("Variations"), Iconos.VariantesG()),
            TB_TOOLS: (_("Tools"), Iconos.Tools()),
            TB_CHANGE: (_("Change"), Iconos.Cambiar()),
            TB_SHOW_TEXT: (_("Show text"), Iconos.Modificar()),
            TB_HELP_TO_MOVE: (_("Help to move"), Iconos.BotonAyuda()),
            TB_SEND: (_("Send"), Iconos.Enviar()),
            TB_STOP: (_("Play now"), Iconos.Stop()),
        }

        cf = self.gestor.configuracion
        peso = 75 if cf.x_tb_bold else 50
        puntos = cf.x_tb_fontpoints
        font = Controles.TipoLetra(puntos=puntos, peso=peso)

        for clave, (titulo, icono) in dic_opciones.items():
            accion = QtWidgets.QAction(titulo, None)
            accion.setIcon(icono)
            accion.setIconText(titulo)
            accion.setFont(font)
            accion.triggered.connect(self.run_action)
            accion.clave = clave
            self.dicTB[clave] = accion