1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import gtk, pygtk, os, sys, gobject
import Globals as G
class BarraLateral(gtk.VBox):
__gsignals__ = {"SET_CONJUNTOS":(gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,))}
def __init__(self):
gtk.VBox.__init__(self)
self.tipos_conjuntos= None # Combobox con Opciones de Tipos de tipos_conjuntos
self.objetos= None # VBox con los objetos del tipo seleccionado.
self.tipos_conjuntos= gtk.ComboBox()
''' Llena el combo con los tipos posibles de conjuntos. (solo se ejecuta al inicio de la aplicaciĆ³n)'''
liststore= gtk.ListStore(gobject.TYPE_STRING)
self.tipos_conjuntos.set_model(liststore)
text= gtk.CellRendererText()
self.tipos_conjuntos.pack_start(text, True)
self.tipos_conjuntos.add_attribute(text, 'text', 0)
for conjunto in G.TIPOSCONJUNTOS:
self.tipos_conjuntos.append_text(conjunto)
self.tipos_conjuntos.set_active(1)
self.pack_start(self.tipos_conjuntos, False, False, 0)
self.objetos= gtk.VBox()
scroll= gtk.ScrolledWindow()
scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
scroll.add_with_viewport (self.objetos)
self.pack_start(scroll, True, True, 0)
self.tipos_conjuntos.connect("changed", self.set_change)
def set_up(self):
self.set_change(self.tipos_conjuntos)
def set_change(self, combo):
self.emit("SET_CONJUNTOS", G.FUNCIONESCONJUNTOS[combo.get_active_text()]())
self.show_all()
class BarraSuperior(gtk.Toolbar):
def __init__(self):
gtk.Toolbar.__init__(self)
atras = gtk.Button("go-previous")
atras.props.sensitive = True
atras.show()
item = gtk.ToolItem()
item.add(atras)
item.show()
self.insert(item,-1)
self.show_all()
|