2 # -*- coding: iso-8859-1 -*-
3 # vim: set expandtab tabstop=4 shiftwidth=4 :
4 #----------------------------------------------------------------------------
6 #----------------------------------------------------------------------------
7 # This file is part of etherled.
9 # etherled is free software; you can redistribute it and/or modify it
10 # under the terms of the GNU General Public License as published by the Free
11 # Software Foundation; either version 2 of the License, or (at your option)
14 # etherled is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
19 # You should have received a copy of the GNU General Public License along
20 # with etherled; if not, write to the Free Software Foundation, Inc., 59
21 # Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #----------------------------------------------------------------------------
23 # Creado: vie oct 27 22:16:20 ART 2005
24 # Autores: Leandro Lucarella <llucare@fi.uba.ar>
25 #----------------------------------------------------------------------------
29 from simplegladeapp import SimpleGladeApp
30 from simplegladeapp import bindtextdomain
31 from dispatcher import Dispatcher
34 app_name = "cetherled"
39 bindtextdomain(app_name, locale_dir)
42 class MainWindow(SimpleGladeApp):
44 def __init__(self, path="cetherled.glade", root="main_window",
45 domain=app_name, **kwargs):
46 #notificar = Dispatcher(self.actualizar)
47 path = os.path.join(glade_dir, path)
48 SimpleGladeApp.__init__(self, path, root, domain, **kwargs)
55 self.table_leds.attach(led, i, i+1, j, j+1)
59 def on_btn_salir_clicked(self, widget, *args):
62 def on_btn_enviar_clicked(self, widget, *args):
63 print self.tabla_a_stream()
65 def on_main_window_delete_event(self, widget, event, *args):
68 def imprimir_tabla(self, rotada=False):
71 rango = xrange(15, -1, -1)
73 for row in xrange(16):
74 print int(self.tabla[col,row].prendido),
78 def imprimir_stream(self, stream):
82 def tabla_a_stream(self):
84 for col in xrange(15, -1, -1):
87 i += int(self.tabla[col,row].prendido) << row
90 for row in xrange(8, 16):
91 i += int(self.tabla[col,row].prendido) << row
98 main_window = MainWindow()
104 if __name__ == '__main__':