Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/expresar.py
diff options
context:
space:
mode:
Diffstat (limited to 'expresar.py')
-rw-r--r--expresar.py120
1 files changed, 0 insertions, 120 deletions
diff --git a/expresar.py b/expresar.py
deleted file mode 100644
index aa66208..0000000
--- a/expresar.py
+++ /dev/null
@@ -1,120 +0,0 @@
-import gtk
-import gobject
-import math
-
-from parser import parser
-from sintetizar import sintetizar
-
-DELAY = 1300
-LENGHT = 4
-
-class MyGUI:
-
- def __init__( self, title):
- self.window = gtk.Window()
- self.title = title
- self.window.set_title(title)
-
- self._pressButton_counter = 0
- self.window.set_size_request( 260, -1)
- self.window.connect("destroy", self.destroy)
-
- self.listaSecciones = []
- parser(self.listaSecciones)
- self.lenghtSecciones = int(math.sqrt(len(self.listaSecciones)))
-
- self.hbox = gtk.HBox()
-
- self.table = gtk.Table(LENGHT, LENGHT, True)
- self.indiceSecciones = 0
- self.create_interior(self.table, self.listaSecciones)
-
- self.window.add(self.hbox)
- self.window.show_all()
- self._button_index = 0
- self._button_index_2 = 0
- self._indice = 0
- self._button_list = []
- gobject.timeout_add(DELAY, self.__timeout_cb, self.table)
-
- def create_interior( self, table, listaSecciones):
- self.hbox.add(table)
- inicio_left = 0
- fin_right = 1
- inicio_top = 0
- fin_bottom = 1
- indiceListaSecciones = 0
- for colu in range(LENGHT):
- for fila in range(LENGHT):
- #boton = gtk.Button(str(fila)+"-"+str(colu))
- boton = gtk.Button(self.listaSecciones[indiceListaSecciones][1])
- boton.connect('key-press-event', self.__pressButton_count)
- table.attach(boton, inicio_left, fin_right, inicio_top, fin_bottom)
- boton.show()
- indiceListaSecciones = indiceListaSecciones + 1
- inicio_top = inicio_top + 1
- fin_bottom = fin_bottom + 1
-
- inicio_top = 0
- fin_bottom = 1
- inicio_left = inicio_left + 1
- fin_right = fin_right + 1
-
- #self.table.attach(child, left_attach, right_attach, top_attach, bottom_attach)
- table.show()
-
- def __timeout_cb(self, table):
-
- buttons = table.get_children()
- buttons.reverse()
-
- if (self._pressButton_counter == 1):
- self._button_index_2 = (self._button_index_2 + 1) % len(self._button_list)
- self._button_list[self._button_index_2].grab_focus()
- self._button_list[self._button_index_2].modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color('red'))
- self._button_list[self._button_index_2 - 1].modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color('green'))
- elif (self._pressButton_counter == 0):
- self._button_index = (self._button_index) % len(buttons)
-
- self._button_list = buttons[self._button_index:self._button_index+LENGHT]
-
- for i in self._button_list:
- i.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color('green'))
-
- for cero in range(self._button_index):
- buttons[cero].modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color('gray'))
-
- self._button_index = self._button_index + LENGHT
-
- indice = self._button_index
- while indice < len(buttons):
- buttons[indice].modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color('gray'))
- indice = indice + 1
-
- else:
- self._pressButton_counter = 0
- self.__newWindow(self._button_list[self._button_index_2], self._button_list[self._button_index_2].get_label())
-
- return True
-
- def __pressButton_count(self, table, arg):
- self._pressButton_counter = self._pressButton_counter + 1
-
- def __newWindow(self, button, button_label):
- #self.hbox.remove(self.table)
- #label = gtk.Label()
- #label.set_text(button_label)
- #self.hbox.add(label)
- #label.show()
- #self.hbox.show()
- sintetizar(button_label)
-
- def main( self):
- gtk.main()
-
- def destroy(self, w):
- gtk.main_quit()
-
-if __name__ == "__main__":
- m = MyGUI( "Table example")
- m.main()