Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRogelio Mita <rogeliomita@activitycentral.com>2013-06-18 19:22:23 (GMT)
committer Rogelio Mita <rogeliomita@activitycentral.com>2013-06-18 19:22:23 (GMT)
commit24b481515065ca940bfde17447e7ac42e41c3128 (patch)
treeadc074daf42ac0d6fb142262dc2df50c3fddb046
parentc5534c77ec913e8780197523e9975bb437838f58 (diff)
Adding group label for current selected course in list
-rw-r--r--CeibalEncuesta/gtk2/CeibalEncuesta/CeibalEncuesta.py5
-rw-r--r--CeibalEncuesta/gtk2/CeibalEncuesta/Widgets.py35
2 files changed, 33 insertions, 7 deletions
diff --git a/CeibalEncuesta/gtk2/CeibalEncuesta/CeibalEncuesta.py b/CeibalEncuesta/gtk2/CeibalEncuesta/CeibalEncuesta.py
index 9af09de..6e032bf 100644
--- a/CeibalEncuesta/gtk2/CeibalEncuesta/CeibalEncuesta.py
+++ b/CeibalEncuesta/gtk2/CeibalEncuesta/CeibalEncuesta.py
@@ -331,6 +331,11 @@ class CeibalEncuesta(gtk.Window):
self.infowidget.hide()
self.infowidget.set_encuestado(encuestado)
+ combo_box = getattr(self.panel.lista, "combo", None)
+ if combo_box:
+ current_group_text = "Grupo: %s" % combo_box.get_current_group()
+ self.panel.current_group_label.set_text(current_group_text)
+
def __get_menu(self):
"""
Crea y devuelve el menú de la aplicación.
diff --git a/CeibalEncuesta/gtk2/CeibalEncuesta/Widgets.py b/CeibalEncuesta/gtk2/CeibalEncuesta/Widgets.py
index 7b32abc..ea28b5f 100644
--- a/CeibalEncuesta/gtk2/CeibalEncuesta/Widgets.py
+++ b/CeibalEncuesta/gtk2/CeibalEncuesta/Widgets.py
@@ -96,6 +96,14 @@ class Panel(gtk.Paned):
self.box_encuesta = gtk.VBox()
+ # Group title
+ halign = gtk.Alignment(0.92, 0, 0, 0)
+ halign.set_padding(27, 0, 0, 0)
+ self.current_group_label = gtk.Label("")
+ self.current_group_label.modify_font(pango.FontDescription("20"))
+ halign.add(self.current_group_label)
+ container.pack_start(halign)
+
container.pack_start(self.box_encuesta, True, True)
self.toolbar_encuesta = ToolbarEncuesta()
container.pack_end(self.toolbar_encuesta, False, False, 30)
@@ -131,12 +139,12 @@ class Panel(gtk.Paned):
cr.stroke()
cr.set_source_color(gdk.color_parse("#38610B"))
- draw_rounded(cr, (8, w - scrollbar_w - 16 - 25, 0, h - 8 - 25), 20)
+ draw_rounded(cr, (8, w - scrollbar_w - 16 - 25, 25, h - 8 - 25), 20)
cr.fill_preserve()
cr.stroke()
cr.set_source_color(gdk.color_parse("#E3F6CE"))
- draw_rounded(cr, (50, w - scrollbar_w - 16, 16, h - 8), 20)
+ draw_rounded(cr, (50, w - scrollbar_w - 16, 25 + 35, h - 8), 20)
cr.fill_preserve()
return False
@@ -1754,12 +1762,12 @@ class GeneralWidget(gtk.VBox):
self.listas[item].append(encuestado)
- combo = ComboGrupos()
+ self.combo = ComboGrupos()
- self.pack_start(combo, False, False, 0)
+ self.pack_start(self.combo, False, False, 0)
for g in grupos:
- combo.append_text(g)
+ self.combo.append_text(g)
self.scroll_list = gtk.ScrolledWindow()
@@ -1782,9 +1790,9 @@ class GeneralWidget(gtk.VBox):
self.show_all()
- combo.connect("new", self.__new_group)
+ self.combo.connect("new", self.__new_group)
- combo.select(grupos[0])
+ self.combo.select(grupos[0])
self.__new_group(None, grupos[0]) # Forzar nueva lista
continuar.connect("clicked", self.__continuar)
@@ -1915,6 +1923,19 @@ class ComboGrupos(gtk.ComboBox):
self.show_all()
+ def get_current_group(self):
+
+ count = 0
+ model = self.get_model()
+ item = model.get_iter_first()
+
+ while item:
+ if count == self.get_active():
+ return model.get_value(item, 0)
+
+ item = model.iter_next(item)
+ count += 1
+
def select(self, valor):
"""
Setea el combo a un valor específico.