From b0652578af8d820254f2df9c59da929b03261262 Mon Sep 17 00:00:00 2001 From: Esteban Arias Date: Mon, 20 Sep 2010 19:58:33 +0000 Subject: view config --- diff --git a/PrestametuVoz.activity/config_nuevo.py b/PrestametuVoz.activity/config_nuevo.py index 5605817..ab6e85e 100644 --- a/PrestametuVoz.activity/config_nuevo.py +++ b/PrestametuVoz.activity/config_nuevo.py @@ -31,54 +31,53 @@ from manejar_datos import cargar_datos, cargar_planillas class VentanaConfig(gtk.Table): def __init__(self): - - self.lista_tarjetas = [] + gtk.Table.__init__(self, 6, 2) + self.lista_tarjetas = [] self.pos_actual = 0 self.posicion = gtk.Label('1/' + str(settings.TABLA_ANCHO * settings.TABLA_ALTO)) - etiqueta_titulo = gtk.Label('Titulo : ') - self.titulo = gtk.Entry(30) - self.imagen = gtk.Image() - self.boton_imagen = gtk.FileChooserButton('Agregar imagen') - etiqueta_sonido = gtk.Label('Sonido : ') - self.boton_sonido = gtk.FileChooserButton('Agregar sonido') - boton_ingresar = gtk.Button('Ingresar Sig') + self.attach(self.posicion,0,2,0,1) - gtk.Table.__init__(self, 5, 1) + self.imagen = gtk.Image() + self.imagen.show() + self.imagen.set_size_request(settings.BUTTON_SIZE, settings.BUTTON_SIZE) + self.imagen.set_from_file(os.path.join(os.getcwd(),'icons','sin_foto.png')) + self.attach(self.imagen,0,2,1,2) - self.attach(self.posicion,0,1,0,1) - + etiqueta_titulo = gtk.Label('Título : ') etiqueta_titulo.show() + self.attach(etiqueta_titulo,0,1,2,3) + + self.titulo = gtk.Entry(30) self.titulo.show() self.titulo.set_width_chars(10) + self.attach(self.titulo,1,2,2,3) - caja_titulo = gtk.HBox() - caja_titulo.pack_start(etiqueta_titulo) - caja_titulo.pack_start(self.titulo) - - self.attach(caja_titulo,0,1,1,2) - self.imagen.show() - self.imagen.set_size_request(settings.IMAGE_CONFIG_SIZE, settings.IMAGE_CONFIG_SIZE) - self.imagen.set_from_file(os.path.join(os.getcwd(),'icons','sin_foto.png')) - + etiqueta_imagen = gtk.Label('Imagen : ') + etiqueta_imagen.show() + self.attach(etiqueta_imagen,0,1,3,4) + + self.boton_imagen = gtk.FileChooserButton('Agregar imagen') self.boton_imagen.show() - - caja_imagen = gtk.VBox() - caja_imagen.pack_start(self.imagen) - caja_imagen.pack_start(self.boton_imagen) - self.attach(caja_imagen,0,1,2,3) + self.attach(self.boton_imagen,1,2,3,4) + etiqueta_sonido = gtk.Label('Sonido : ') etiqueta_sonido.show() + self.attach(etiqueta_sonido,0,1,4,5) + self.boton_sonido = gtk.FileChooserButton('Agregar sonido') self.boton_sonido.show() - caja_sonido = gtk.HBox() - caja_sonido.pack_start(etiqueta_sonido) - caja_sonido.pack_start(self.boton_sonido) - self.attach(caja_sonido,0,1,3,4) - + self.attach(self.boton_sonido,1,2,4,5) + + boton_ingresar_ant = gtk.Button('Anterior') + boton_ingresar_ant.show() + boton_ingresar_ant.connect("clicked", self.ingresar_ant, "anterior") + self.attach(boton_ingresar_ant,0,1,5,6) + + boton_ingresar = gtk.Button('Siguiente') boton_ingresar.show() boton_ingresar.connect("clicked", self.ingresar_siguiente, "siguiente") - self.attach(boton_ingresar,0,1,4,5) + self.attach(boton_ingresar,1,2,5,6) self.cargar_demo() @@ -100,8 +99,17 @@ class VentanaConfig(gtk.Table): self.posicion.set_label(str(self.pos_actual + 1) + '/'+ str(settings.TABLA_ANCHO * settings.TABLA_ALTO)) self.actualizar_ventana() + def ingresar_ant(self, widget, info): + self.pos_actual -= 1 + if self.pos_actual < 0: + self.pos_actual = (settings.TABLA_ALTO * settings.TABLA_ANCHO) -1 + self.titulo.set_text(self.lista_tarjetas[self.pos_actual].titulo) + self.posicion.set_label(str(self.pos_actual + 1) + '/'+ str(settings.TABLA_ANCHO * settings.TABLA_ALTO)) + self.actualizar_ventana() + def actualizar_ventana(self): self.imagen.clear() + self.titulo.set_text(self.lista_tarjetas[self.pos_actual].titulo) self.imagen.set_from_file(self.lista_tarjetas[self.pos_actual].imagen) self.boton_imagen.set_filename(self.lista_tarjetas[self.pos_actual].imagen) self.boton_sonido.set_filename(self.lista_tarjetas[self.pos_actual].audio) diff --git a/PrestametuVoz.activity/settings.py b/PrestametuVoz.activity/settings.py index 804cc67..0847fcd 100644 --- a/PrestametuVoz.activity/settings.py +++ b/PrestametuVoz.activity/settings.py @@ -5,14 +5,7 @@ def _get_button_size(): return 100 return 150 -def _get_image_config_size(): - if style._compute_zoom_factor() == 0.72: - return 300 - return 500 - - TABLA_ALTO = 3 TABLA_ANCHO = 4 BUTTON_SIZE = _get_button_size() -IMAGE_CONFIG_SIZE = _get_image_config_size() -- cgit v0.9.1