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
35 app_name = "cetherled"
40 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 self.device = etherled.NetworkedDevice()
48 path = os.path.join(glade_dir, path)
49 SimpleGladeApp.__init__(self, path, root, domain, **kwargs)
56 self.table_leds.attach(led, j, j+1, i, i+1)
60 def on_btn_salir_clicked(self, widget, *args):
63 def on_btn_enviar_clicked(self, widget, *args):
64 self.device.matrix = self.leds2matrix()
66 def on_btn_recibir_clicked(self, widget, *args):
67 self.device.matrix = self.leds2matrix()
69 def on_main_window_delete_event(self, widget, event, *args):
72 def leds2matrix(self):
74 for row in xrange(16):
75 for col in xrange(16):
76 matrix[row,col] = int(self.tabla[row,col].prendido)
77 etherled.protocol._print_matrix(matrix)
80 def matrix2leds(self, matrix):
81 for row in xrange(16):
82 for col in xrange(16):
83 self.tabla[row,col].prendido = matrix[row,col]
84 etherled.protocol._print_matrix(matrix)
89 main_window = MainWindow()
94 if __name__ == '__main__':