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
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
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