Esempio n. 1
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()
Esempio n. 2
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))
Esempio n. 3
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