Ejemplo n.º 1
0
    def load_sprites(self):
        ''' Carga las señales.'''
        seniales = G.get_palabras_FGR_T0201()
        posiciones = G.get_Posicion_Palabras_FGR_T0201()
        w, h = (0, 0)
        for palabra in seniales:
            boton = Sprite_Palabras(self.main, palabra)
            boton.set_colores(colorbas=JAMG.get_blanco(),
                              colorbor=JAMG.get_blanco(),
                              colorcara=JAMG.get_blanco())
            boton.set_text(color=JAMG.get_negro())
            boton.set_font_from_file(JAMG.get_Font_fawn()[0], tamanio=25)
            boton.set_tamanios(tamanio=(0, 0),
                               grosorbor=1,
                               detalle=1,
                               espesor=1)
            ancho, alto = boton.get_tamanio()
            if ancho > w: w = ancho
            if alto > h: h = alto

            random.seed()
            posicion = random.choice(posiciones)
            boton.set_posicion(punto=posicion)
            posiciones.remove(posicion)
            self.add(boton)

        for boton in self.sprites():
            boton.set_tamanios(tamanio=(w, h),
                               grosorbor=1,
                               detalle=1,
                               espesor=1)

        # el sprite para seleccionar las señales
        self.main.controles.get_recuadro_select((w, h))
Ejemplo n.º 2
0
 def run_dialog_intro(self, button):
     from BiblioJAM.JAMDialog import JAMDialog
     dialog = JAMDialog(mensaje="¿Abandonas el Juego?",
                        funcion_ok=self.ok_intro,
                        funcion_cancel=self.cancel_intro)
     fuente, tamanio = JAMG.get_Font_fawn()
     dialog.set_font_from_file(fuente, tamanio=40)
     dialog.boton_aceptar.set_font_from_file(fuente, tamanio=25)
     dialog.boton_cancelar.set_font_from_file(fuente, tamanio=25)
     a, b, c = JAMG.get_estilo_papel_quemado()
     dialog.set_colors_dialog(base=c, bordes=c)
     dialog.set_colors_buttons(colorbas=a, colorbor=b, colorcara=c)
     self.estado = "Dialog"
     dialog.draw(self.ventana)
     pygame.display.update()
     while self.estado == "Dialog":
         self.reloj.tick(35)
         while gtk.events_pending():
             gtk.main_iteration(False)
         G.Traduce_posiciones(self.VA, self.VH)
         dialog.clear(self.ventana, self.fondo)
         dialog.update()
         pygame.event.clear()
         dialog.draw(self.ventana)
         self.ventana_real.blit(
             pygame.transform.scale(self.ventana, self.resolucionreal),
             (0, 0))
         pygame.display.update()
     dialog.clear(self.ventana, self.fondo)
     self.ventana_real.blit(
         pygame.transform.scale(self.ventana, self.resolucionreal), (0, 0))
     pygame.display.update()
Ejemplo n.º 3
0
 def get_labels_carteles(self, texto, centro):
     ''' Etiquetas sobre los carteles.'''
     palabras = texto.split(" ")
     renglon1 = "%s %s" % (palabras[0], palabras[1])
     label = JAMLabel(renglon1)
     label.set_text(color=JAMG.get_blanco())
     fuente, tamanio = JAMG.get_Font_fawn()
     label.set_font_from_file(fuente, tamanio=30)
     x, y = centro
     w, h = label.get_tamanio()
     label.set_posicion(punto=(x - w / 2, y - h))
     self.add(label)
     if len(palabras) > 2:
         renglon2 = ""
         ww, hh = label.get_tamanio()
         for palabra in palabras[2:]:
             renglon2 += palabra + " "
         label = JAMLabel(renglon2)
         label.set_text(color=JAMG.get_blanco())
         fuente, tamanio = JAMG.get_Font_fawn()
         label.set_font_from_file(fuente, tamanio=30)
         w, h = label.get_tamanio()
         label.set_posicion(punto=(x - w / 2, y + hh - h))
         self.add(label)
     else:
         label.set_posicion(punto=(x - w / 2, y))
Ejemplo n.º 4
0
    def __init__(self, main, texto, valor):
        pygame.sprite.Sprite.__init__(self)
        self.main = main
        self.valor = valor

        self.select = False

        textos = texto.split("\n")

        sprites = []
        for texto in textos:
            sprites.append(Sprite_Texto_Afirmacion(texto))
        imagenes = []
        w, h = (345, 0)
        for sprite in sprites:
            imagen = sprite.image
            imagenes.append(imagen)
            if w < sprite.rect.w: w = sprite.rect.w
            h += sprite.rect.h

        self.final_unselect = JAMG.get_Rectangulo(JAMG.get_blanco(), (w, h))
        self.final_select = JAMG.get_Rectangulo(JAMG.get_amarillo1(), (w, h))

        self.image = self.final_unselect
        self.rect = self.image.get_rect()

        x, y, w, h = self.rect
        for img in imagenes:
            w1, h2 = img.get_size()
            self.final_unselect.blit(img, (w / 2 - w1 / 2, y))
            self.final_select.blit(img, (w / 2 - w1 / 2, y))
            y += h2
Ejemplo n.º 5
0
 def get_recuadro_select(self, tamanio):
     ''' Un Sprite para seleccionar las señales. '''
     sup = JAMG.get_Rectangulo_Transparente(tamanio)
     sup = JAMG.get_my_surface_whit_border(sup, JAMG.get_naranja1(), 10)
     self.recuadro_select = pygame.sprite.Sprite()
     self.recuadro_select.image = sup
     self.recuadro_select.rect = self.recuadro_select.image.get_rect()
    def get_botones_letras(self):
        simbols = JAMG.get_letras_up()
        botones_letras = []
        for letra in simbols:
            boton = JAMButton(letra, None)
            boton.set_font_from_file(self.fuente, tamanio=20)
            boton.set_tamanios(tamanio=(0, 0),
                               grosorbor=1,
                               detalle=1,
                               espesor=1)
            boton.set_colores(colorbas=(0, 153, 255, 255),
                              colorbor=(0, 153, 255, 255),
                              colorcara=(255, 255, 255, 255))
            #boton.set_text(color = (0,153,255,255))
            boton.connect(callback=self.set_buffer, sonido_select=None)
            botones_letras.append(boton)

        simbols = JAMG.get_numeros()
        botones_numeros = []
        for letra in simbols:
            boton = JAMButton(letra, None)
            boton.set_font_from_file(self.fuente, tamanio=20)
            boton.set_tamanios(tamanio=(0, 0),
                               grosorbor=1,
                               detalle=1,
                               espesor=1)
            boton.set_colores(colorbas=(0, 153, 255, 255),
                              colorbor=(0, 153, 255, 255),
                              colorcara=(255, 255, 255, 255))
            #boton.set_text(color = (0,153,255,255))
            boton.connect(callback=self.set_buffer, sonido_select=None)
            botones_numeros.append(boton)

        botones_especiales = []
        for letra in ['', ' ', '']:
            boton = JAMButton(letra, None)
            #boton.set_font_from_file(self.fuente, tamanio = 20)
            boton.set_tamanios(tamanio=(0, 0),
                               grosorbor=1,
                               detalle=1,
                               espesor=1)
            boton.set_colores(colorbas=(0, 153, 255, 255),
                              colorbor=(0, 153, 255, 255),
                              colorcara=(255, 255, 255, 255))
            #boton.set_text(color = (0,153,255,255))
            boton.connect(callback=self.set_buffer, sonido_select=None)
            botones_especiales.append(boton)

        imagen = os.path.join(G.IMAGENES, "back.png")
        boton = botones_especiales[0]
        boton.set_imagen(origen=imagen)
        boton.connect(callback=self.set_back_space, sonido_select=None)

        imagen = os.path.join(G.IMAGENES, "enter.png")
        boton = botones_especiales[2]
        boton.set_imagen(origen=imagen)
        boton.connect(callback=self.set_enter, sonido_select=None)

        return (botones_letras, botones_numeros, botones_especiales)
 def __init__(self, main, texto, valor):
     JAMButton.__init__(self, texto, None)
     self.valor = valor
     fuente, tamanio = JAMG.get_Font_fawn()
     self.set_font_from_file(fuente, tamanio=30)
     self.set_text(color=JAMG.get_blanco())
     self.set_colores(colorbas=JAMG.get_negro(), colorcara=JAMG.get_negro())
     self.set_tamanios(tamanio=(0, 0), grosorbor=1, detalle=1, espesor=1)
	def get_sprite_frase(self):
		labels= []
		for frase in self.frase.split("\n"):
			label= JAMLabel(frase)
			label.set_text(color= JAMG.get_blanco())
			label.set_contenedor(colorbas= JAMG.get_negro(), grosor=1, colorbor=JAMG.get_negro())
			label.set_font_from_file(JAMG.get_Font_fawn()[0], tamanio= 50)
			labels.append(label)
		return labels
Ejemplo n.º 9
0
 def set_active(self, valor):
     if valor:
         self.active = True
         self.boton_active.set_imagen(origen=JAMG.get_icon_ok(),
                                      tamanio=(20, 20))
     elif not valor:
         self.active = False
         self.boton_active.set_imagen(origen=JAMG.get_icon_cancel(),
                                      tamanio=(20, 20))
	def __init__(self, texto):
		JAMButton.__init__(self, texto, None)
		self.ubicado = False
		fuente, tamanio = JAMG.get_Font_fawn()
		self.set_font_from_file(fuente, tamanio = 30)
		self.set_tamanios(tamanio = (150, 25), grosorbor=1, detalle=1, espesor=1)
		self.colorcara, self.colorbase, self.colorborde, g, d, e = JAMG.get_default_jambutton_values()
		self.colormarca = (92,193,235,255)
		self.reset()
Ejemplo n.º 11
0
    def load(self):
        a, b, c = JAMG.get_estilo_papel_quemado()
        self.etiqueta = Etiqueta("Alarma")
        self.etiqueta.set_colores(colorbas=a, colorbor=b, colorcara=c)
        self.etiqueta.set_tamanios(tamanio=(0, 0), grosorbor=1, espesor=1)
        self.etiqueta.set_text(tamanio=24)

        self.etiqueta_tiempo = Etiqueta("%s:%s" % (self.horas, self.minutos))
        self.etiqueta_tiempo.set_tamanios(tamanio=(0, 0),
                                          grosorbor=1,
                                          espesor=1)
        self.etiqueta_tiempo.set_text(tamanio=40)

        self.botonminutos_down = JAMButton("", "down.png")
        self.botonminutos_down.set_imagen(origen="down.png", tamanio=(20, 20))
        self.botonminutos_down.set_colores(colorbas=a, colorbor=b, colorcara=c)
        self.botonminutos_down.set_tamanios(tamanio=(0, 0),
                                            grosorbor=1,
                                            espesor=1)

        self.botonminutos_up = JAMButton("", "up.png")
        self.botonminutos_up.set_imagen(origen="up.png", tamanio=(20, 20))
        self.botonminutos_up.set_colores(colorbas=a, colorbor=b, colorcara=c)
        self.botonminutos_up.set_tamanios(tamanio=(0, 0),
                                          grosorbor=1,
                                          espesor=1)

        self.botonhoras_down = JAMButton("", "down.png")
        self.botonhoras_down.set_imagen(origen="down.png", tamanio=(20, 20))
        self.botonhoras_down.set_colores(colorbas=a, colorbor=b, colorcara=c)
        self.botonhoras_down.set_tamanios(tamanio=(0, 0),
                                          grosorbor=1,
                                          espesor=1)

        self.botonhoras_up = JAMButton("", "up.png")
        self.botonhoras_up.set_imagen(origen="up.png", tamanio=(20, 20))
        self.botonhoras_up.set_colores(colorbas=a, colorbor=b, colorcara=c)
        self.botonhoras_up.set_tamanios(tamanio=(0, 0), grosorbor=1, espesor=1)

        self.boton_active = JAMButton("", JAMG.get_icon_ok())
        self.boton_active.set_imagen(origen=JAMG.get_icon_ok(),
                                     tamanio=(20, 20))
        self.boton_active.set_colores(colorbas=a, colorbor=b, colorcara=c)
        self.boton_active.set_tamanios(tamanio=(0, 0), grosorbor=1, espesor=1)

        self.base = self.get_base(color=b, tamanio=self.geometria())
        w = self.get_tamanio()[0] - sep * 2
        self.etiqueta_tiempo.set_tamanios(tamanio=(w, 0),
                                          grosorbor=1,
                                          espesor=1)
        self.add([
            self.base, self.etiqueta, self.etiqueta_tiempo,
            self.botonminutos_up, self.botonminutos_down, self.botonhoras_up,
            self.botonhoras_down, self.boton_active
        ])
        self.set_posicion(punto=(0, 0))
 def get_labels_carteles(self, texto, centro):
     ''' Etiquetas sobre los carteles. '''
     label = JAMLabel(texto)
     label.set_text(color=JAMG.get_blanco())
     fuente, tamanio = JAMG.get_Font_fawn()
     label.set_font_from_file(fuente, tamanio=tamanio)
     x, y = centro
     w, h = label.get_tamanio()
     label.set_posicion(punto=(x - w / 2, y - h / 2))
     self.add(label)
Ejemplo n.º 13
0
 def __init__(self, main, nombre):
     JAMButton.__init__(self, ".................", None)
     self.main = main
     self.nombre = nombre
     self.set_colores(colorbas=JAMG.get_negro(),
                      colorbor=JAMG.get_blanco(),
                      colorcara=JAMG.get_negro())
     self.set_text(color=JAMG.get_blanco())
     self.set_font_from_file(JAMG.get_Font_fawn()[0], tamanio=25)
     self.set_tamanios(tamanio=(0, 0), grosorbor=1, detalle=1, espesor=1)
     self.connect(callback=self.main.deja_en)
    def set_imagen(self, origen):
        self.origen_imagen = origen
        self.original_imagen = pygame.transform.scale(
            pygame.image.load(origen), (128, 128))

        self.final_unselect = self.original_imagen.copy()
        self.final_select = JAMG.get_my_surface_whit_border(
            self.original_imagen.copy(), (255, 255, 255, 255), 10)
        self.final_marca = JAMG.get_my_surface_whit_border(
            self.original_imagen.copy(), (240, 150, 0, 255), 10)

        self.image = self.final_unselect
        self.rect = self.image.get_rect()
Ejemplo n.º 15
0
 def __init__(self, main):
     pygame.sprite.OrderedUpdates.__init__(self)
     self.main = main
     self.imagenes = G.get_Presentacion()
     self.siguiente = None
     self.anterior = None
     salir = None
     self.imagen_actual = None
     self.estado = True
     fuente, tamanio = JAMG.get_Font_fawn()
     w, h = G.RESOLUCION
     self.siguiente = JAMButton("Siguiente", None)
     self.siguiente.set_text(color=JAMG.get_blanco())
     self.siguiente.set_font_from_file(fuente, tamanio=40)
     self.siguiente.set_colores(colorbas=JAMG.get_negro(),
                                colorcara=JAMG.get_negro())
     self.siguiente.set_tamanios(tamanio=(150, 0),
                                 grosorbor=1,
                                 detalle=1,
                                 espesor=1)
     ww, hh = self.siguiente.get_tamanio()
     self.siguiente.set_posicion(punto=(w - ww - 20, h - hh - 20))
     self.siguiente.connect(callback=self.next, sonido_select=None)
     self.add(self.siguiente)
     self.anterior = JAMButton("Anterior", None)
     self.anterior.set_text(color=JAMG.get_blanco())
     self.anterior.set_font_from_file(fuente, tamanio=40)
     self.anterior.set_colores(colorbas=JAMG.get_negro(),
                               colorcara=JAMG.get_negro())
     self.anterior.set_tamanios(tamanio=(150, 0),
                                grosorbor=1,
                                detalle=1,
                                espesor=1)
     ww, hh = self.anterior.get_tamanio()
     self.anterior.set_posicion(punto=(20, h - hh - 20))
     self.anterior.connect(callback=self.previous, sonido_select=None)
     self.add(self.anterior)
     salir = JAMButton("Salir", None)
     salir.set_text(color=JAMG.get_blanco())
     salir.set_font_from_file(fuente, tamanio=40)
     salir.set_colores(colorbas=JAMG.get_negro(),
                       colorcara=JAMG.get_negro())
     salir.set_tamanios(tamanio=(150, 0), grosorbor=1, detalle=1, espesor=1)
     ww, hh = salir.get_tamanio()
     salir.set_posicion(punto=(w / 2 - ww / 2, 20))
     salir.connect(callback=self.volver, sonido_select=None)
     self.add(salir)
     self.imagen_actual = self.imagenes[0]
     self.main.fondo = self.imagen_actual
Ejemplo n.º 16
0
 def load_sprites(self):
     palabras = [
         "PEDALES", "INFLADOR", "CUADRO", "LUCES", "FRENOS", "ASIENTO",
         "PLATO"
     ]
     x, y = self.main.seniales.get_posicion()
     w, h = self.main.seniales.get_tamanio()
     x += w + 5
     for pal in palabras:
         label = JAMLabel(pal)
         label.set_font_from_file(JAMG.get_Font_fawn()[0], tamanio=50)
         label.set_text(color=JAMG.get_blanco())
         label.set_posicion(punto=(x, y))
         y += label.get_tamanio()[1] + 5
         self.add(label)
Ejemplo n.º 17
0
    def verifica_palabra(self):
        for letra in self.palabra_select:
            if not letra.ubicada: return
        # Si todos se han ubicado
        self.palabra_select.ubicada = True
        palabra = ""
        for pal in self.palabra_select.sprites():
            palabra += pal.get_text()

        for plbra in self.main.carteles.sprites():
            # tacha la palabra encontrada
            if palabra == plbra.get_text():
                plbra.set_text(color=JAMG.get_verde1())
                #plbra.tacha()

        if self.imagen_palabra_select: self.imagen_palabra_select.kill()
        self.imagen_palabra_select = Sprite_Imagen_Palabra(self, palabra)
        self.add(self.imagen_palabra_select)
        self.palabra_select = None
        self.main.correct()

        fin = True
        for palabra in self.palabras:
            pal = self.palabras[palabra]
            if not pal.ubicada: return
        if fin == True:
            return self.main.victory()
Ejemplo n.º 18
0
 def load(self):
     pygame.event.set_blocked([
         JOYAXISMOTION, JOYBALLMOTION, JOYHATMOTION, JOYBUTTONUP,
         JOYBUTTONDOWN, KEYUP, USEREVENT
     ])
     pygame.event.set_allowed([
         MOUSEMOTION, MOUSEBUTTONUP, MOUSEBUTTONDOWN, KEYDOWN, VIDEORESIZE,
         VIDEOEXPOSE, QUIT, ACTIVEEVENT
     ])
     pygame.mouse.set_visible(True)
     A, B = G.RESOLUCION
     self.ventana = pygame.Surface((A, B), flags=HWSURFACE)
     self.ventana_real = pygame.display.get_surface()
     C = pygame.display.Info().current_w
     D = pygame.display.Info().current_h
     self.resolucionreal = (C, D)
     self.VA = float(C) / float(A)
     self.VH = float(D) / float(B)
     self.fondo1, self.fondo2 = G.get_Fondos_FGR_T0302()
     self.textos = Textos_Intro()
     self.botonesmenu = ButtonsMenu(self)
     from Globals import Controles
     self.controles = Controles(self)
     self.seniales = Seniales(self)
     self.sonido_error, self.sonido_exito = G.get_Sonidos()
     self.sound_select = JAMG.get_sound_select()
     self.reloj = pygame.time.Clock()
Ejemplo n.º 19
0
 def set_imagen(self, origen):
     imagen = pygame.image.load(origen)
     self.final_unselect = imagen
     self.final_select = JAMG.get_my_surface_whit_border(
         imagen.copy(), (255, 255, 255, 255), 10)
     self.image = self.final_unselect
     self.rect = self.image.get_rect()
	def __init__(self, texto):
		pygame.sprite.Sprite.__init__(self)
		string_to_render = ""
		fuente = self.get_Font()
		string_to_render = unicode( texto.decode("utf-8") )
		self.image = fuente.render(string_to_render, 1, JAMG.get_blanco())
		self.rect = self.image.get_rect()
Ejemplo n.º 21
0
 def __init__(self, letra):
     JAMButton.__init__(self, '', None)
     fuente, tamanio = JAMG.get_Font_fawn()
     self.set_font_from_file(fuente, tamanio=30)
     self.letra = letra
     #if self.letra: self.set_text(texto = self.letra)
     self.set_tamanios(tamanio=(50, 50), grosorbor=1, detalle=1, espesor=1)
Ejemplo n.º 22
0
    def __init__(self, main, texto):
        JAMButton.__init__(self, texto, None)
        self.main = main
        self.ubicada = False

        self.set_font_from_file(JAMG.get_Font_fawn()[0], tamanio=30)
        self.set_tamanios(tamanio=(0, 0), grosorbor=1, detalle=1, espesor=1)
        self.connect(callback=self.main.verifica, sonido_select=None)
 def get_labels(self, afirmacion):
     fuente, tamanio = JAMG.get_Font_fawn()
     tamanio = 50
     labels = []
     textos = afirmacion.split("\n")
     for t in textos:
         label = JAMLabel(t)
         label.set_text(color=JAMG.get_blanco())
         label.set_font_from_file(fuente, tamanio=tamanio)
         labels.append(label)
     x, y, w, h = self.sprite_imagen.rect
     labels.reverse()
     for label in labels:
         w1, h1 = label.get_tamanio()
         y -= h1 + 10
         label.set_posicion((G.RESOLUCION[0] / 2 - w1 / 2, y))
     return labels
Ejemplo n.º 24
0
 def __init__(self, nombre, imagen):
     JAMButton.__init__(self, '', imagen)
     self.nombre = nombre
     self.set_tamanios(tamanio=(50, 50), grosorbor=1, detalle=1, espesor=1)
     imagen = pygame.image.load(imagen)
     self.final_select = JAMG.get_Rectangulo((240, 150, 0, 255), (50, 50))
     self.final_select.blit(imagen, (0, 0))
     self.final_unselect = imagen
     self.image = self.final_unselect
     self.rect = self.image.get_rect()
Ejemplo n.º 25
0
 def __init__(self, usuario):
     JAMButton.__init__(self, '', None)
     fuente, tamanio = JAMG.get_Font_fawn()
     self.usuario = usuario  # diccionario cargado desde archivo shelve.
     imagen = self.usuario['personaje']
     self.set_imagen(origen=imagen)
     self.set_alineacion_label("izquierda")
     self.set_font_from_file(fuente, tamanio=25)
     self.set_text(texto=self.usuario['nombre'], color=(255, 255, 255, 255))
     self.set_colores(colorbas=(0, 157, 224, 255),
                      colorbor=(0, 157, 224, 255),
                      colorcara=(92, 193, 235, 255))
	def __init__(self, main):
		pygame.sprite.OrderedUpdates.__init__(self)
		self.main = main
		imagen = G.get_Flecha()

		salir = JAMButton("",None)
		salir.set_imagen(origen = imagen, tamanio=(100,55))
		salir.set_colores(colorbas =JAMG.get_negro(), colorcara=JAMG.get_negro())
		salir.set_tamanios(tamanio =(0,0), grosorbor=1, detalle=1, espesor=1)
		salir.set_posicion(punto = (10,10))
		#salir.connect (callback = self.main.run_dialog_intro)
		salir.connect (callback = self.main.salir, sonido_select = None)
		self.add(salir)

		jugar = JAMButton("Jugar",None)
		jugar.set_text(color=JAMG.get_blanco())
		fuente, tamanio = JAMG.get_Font_fawn()
		jugar.set_font_from_file(fuente, tamanio= 50)
		jugar.set_colores(colorbas=JAMG.get_negro(), colorcara=JAMG.get_negro())
		jugar.set_tamanios(tamanio=(200,0), grosorbor=1, detalle=1, espesor=1)
		w,h = G.RESOLUCION
		ww,hh = jugar.get_tamanio()
		jugar.set_posicion(punto= (w-ww-10,h-hh-10))
		jugar.connect (callback= self.run_Instruc)
		self.add(jugar)
    def __init__(self):
        pygame.sprite.OrderedUpdates.__init__(self)
        self.fuente, tamanio = JAMG.get_Font_fawn()

        self.tamanio = None
        self.base = None
        self.text_buffer = ""
        self.callback_enter = None

        self.letras, self.numeros, self.especiales = self.get_botones_letras()
        botones = self.letras + self.numeros + self.especiales
        self.set_normaliza_tamanios_botones(botones)
        self.set_posicion()

        self.base = pygame.sprite.Sprite()
        self.base.image = JAMG.get_Rectangulo_Transparente(self.tamanio)
        self.base.rect = self.base.image.get_rect()

        self.add(self.base)
        self.add(self.letras)
        self.add(self.numeros)
        self.add(self.especiales)
	def __init__(self, senial):
		JAMButton.__init__(self, '',None)
		imagen2, self.nombre, categoria = senial
		imagen1 = os.path.join(G.IMAGENES, "FGR_T0103", "memory_logo.jpg")
		self.set_imagen(origen = imagen1, tamanio=(175, 175))
		self.set_tamanios(tamanio = (175, 175), grosorbor=1, detalle=1, espesor=1)
		self.imagen1 = pygame.transform.scale(pygame.image.load(imagen1),(175, 175))
		simbolo = pygame.transform.scale(pygame.image.load(imagen2),(120, 120))
		fondo = pygame.image.load(os.path.join(G.IMAGENES, "FGR_T0103", "fondo_blanco.jpg"))
		fondo = pygame.transform.scale(fondo,(175, 175))
		texto = JAMLabel(categoria)
		fuente, tamanio = JAMG.get_Font_fawn()
		texto.set_font_from_file(fuente, tamanio = 35)
		w,h = texto.get_tamanio()
		texto = texto.image
		fondo.blit(simbolo, (175/2-120/2, 5))
		fondo.blit(texto, (175/2-w/2, 175-(h+5)))
		self.imagen2 = fondo
		#self.imagen2 = JAMG.pegar_imagenes_centradas(texto, fondo)
		self.reset()
Ejemplo n.º 29
0
    def __init__(self, main):
        pygame.sprite.Sprite.__init__(self)
        self.main = main
        self.acumula = 0

        w, h = G.RESOLUCION
        self.tamanio = (w / 2 - 10, 10)
        self.posicion = (w / 2, 10)

        rect1 = JAMG.get_Rectangulo(JAMG.get_verde1(), self.tamanio)
        w, y = rect1.get_size()
        a = w / 6 * 3
        rect2 = JAMG.get_Rectangulo(JAMG.get_amarillo1(), (a, self.tamanio[1]))
        imagen = JAMG.pegar_imagenes_alineado_derecha(rect2, rect1)
        a = w / 6
        rect3 = JAMG.get_Rectangulo(JAMG.get_rojo1(), (a, self.tamanio[1]))
        self.imagen_original = JAMG.pegar_imagenes_alineado_derecha(
            rect3, imagen)

        self.image = self.imagen_original.copy()
        self.rect = self.image.get_rect()
        self.rect.x, self.rect.y = self.posicion
Ejemplo n.º 30
0
    def load(self):
        pygame.event.set_blocked([
            JOYAXISMOTION, JOYBALLMOTION, JOYHATMOTION, JOYBUTTONUP,
            JOYBUTTONDOWN
        ])
        pygame.event.set_allowed([
            MOUSEMOTION, MOUSEBUTTONUP, MOUSEBUTTONDOWN, KEYDOWN, KEYUP,
            VIDEORESIZE, VIDEOEXPOSE, USEREVENT, QUIT, ACTIVEEVENT
        ])
        pygame.mouse.set_visible(True)

        a, b, c = JAMG.get_estilo_papel_quemado()
        if not self.reloj: self.reloj = pygame.time.Clock()
        if not self.fondo: self.fondo = self.get_fondo(color=b)

        if not self.dialog:
            self.dialog = JAMDialog()
            self.dialog.set_text(tamanio=24)
            d, e, f = JAMG.get_estilo_celeste()
            self.dialog.set_colors_dialog(base=e, bordes=f)
            self.dialog.set_colors_buttons(colorbas=a, colorbor=b, colorcara=c)
            self.dialog.set_text_buttons(tamanio=24)

        if not pygame.mixer.get_init():
            pygame.mixer.init(44100, -16, 2, 2048)
        pygame.mixer.music.set_volume(1.0)

        if not self.controles: self.controles = pygame.sprite.OrderedUpdates()
        if not self.cerrar:
            self.cerrar = JAMButton("", JAMG.get_icon_exit())
            self.cerrar.set_imagen(origen=JAMG.get_icon_exit(),
                                   tamanio=(20, 20))
            self.cerrar.set_tamanios(tamanio=(0, 0), grosorbor=1, espesor=1)
            self.cerrar.set_colores(colorbas=a, colorbor=b, colorcara=c)
            x = RESOLUCION[0] - self.cerrar.get_tamanio()[0]
            self.cerrar.set_posicion(punto=(x, 0))
            self.cerrar.connect(callback=self.selecciona_mensaje_salir)
        if not self.jamclock:
            self.jamclock = JAMClock()
            self.jamclock.set_tamanios(2)
            self.jamclock.set_colors_base(c, a)
            y = self.cerrar.get_tamanio()[1] + SEPARADOR
            self.jamclock.set_posicion(punto=(SEPARADOR, y))
            self.sonidoalarma = JAMG.get_alarma_reloj1()
            self.duracionalarma = 30
        if not self.jamcalendar:
            self.jamcalendar = JAMCalendar()
            self.jamcalendar.set_gama_colors(colorselect=a,
                                             colorbor=b,
                                             colorcara=c)
            self.jamcalendar.set_text(tamanio=24)
            x = RESOLUCION[0] - self.jamcalendar.get_tamanio()[0] - SEPARADOR
            y = self.cerrar.get_tamanio()[1] + SEPARADOR
            self.jamcalendar.set_posicion(punto=(x, y))
        if not self.controlalarma:
            self.controlalarma = ControlAlarma()
            x, y = self.jamcalendar.get_posicion()
            w, h = self.jamcalendar.get_tamanio()
            x = x + w / 2 - self.controlalarma.get_tamanio()[0] / 2
            y += h + SEPARADOR * 5
            self.controlalarma.set_posicion(punto=(x, y))
            self.controlalarma.boton_active.connect(
                callback=self.active_alarma)

        self.controles.add(self.jamclock)
        self.controles.add(self.jamcalendar)
        self.controles.add(self.cerrar)
        self.controles.add(self.controlalarma)
        self.load_conf()

        self.estado = True