diff options
author | Rogelio Mita <rogeliomita@activitycentral.com> | 2013-07-16 15:54:06 (GMT) |
---|---|---|
committer | Rogelio Mita <rogeliomita@activitycentral.com> | 2013-07-16 15:54:06 (GMT) |
commit | fb9fa014bf6a353d466597822593a170639dd4dc (patch) | |
tree | aabe91a0f96fe6d164825a0fe2b043019571379e | |
parent | 081ad5c5ded6fa7c4912fa9948a3bb14ad1cd57b (diff) |
issue #4236: After finish button is pressed, the system must be allowed to return to the previous questions.
-rw-r--r-- | CeibalEncuesta/gtk2/CeibalEncuesta/Widgets.py | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/CeibalEncuesta/gtk2/CeibalEncuesta/Widgets.py b/CeibalEncuesta/gtk2/CeibalEncuesta/Widgets.py index 21233ee..7ca4ebe 100644 --- a/CeibalEncuesta/gtk2/CeibalEncuesta/Widgets.py +++ b/CeibalEncuesta/gtk2/CeibalEncuesta/Widgets.py @@ -243,29 +243,18 @@ class Panel(gtk.Paned): self._window.get_vadjustment().set_value(0) elif accion == "Siguiente" and self.toolbar_encuesta.siguiente.active: - if index_visible == len(grupos) - 1: - self.toolbar_encuesta.encuesta_actual.finalizar() - map(self.__hide_groups, grupos) - - self.toolbar_encuesta.anterior.hide() - self.toolbar_encuesta.siguiente.hide() - - align = gtk.Alignment(0.5, 0, 0, 0) - label = gtk.Label("Encuesta finalizada") - pangoFont = pango.FontDescription(QUESTION_FONT_SIZE) - label.modify_font(pangoFont) - align.add(label) - self.box_encuesta.pack_start(align, False, False, 0) - align.show_all() - - return - if index_visible < len(grupos)-1: + if index_visible < len(grupos) - 1: map(self.__hide_groups, grupos) map(self.__show_groups, [grupos[index_visible + 1]]) self.box_encuesta.queue_draw() self._window.get_vadjustment().set_value(0) + if index_visible == len(grupos) - 2: + self.toolbar_encuesta.encuesta_actual.finalizar() + self.toolbar_encuesta.siguiente.hide() + return + self.__check_sensibility_butons() def load_encuestados(self, encuestados): @@ -340,6 +329,17 @@ class Panel(gtk.Paned): grupo.connect("new", self.__change) grupo.connect("text_and_change", self.__emit_text_and_change) + # Grupo que indica finalizacion de encuesta + grupo_final = Grupo(len(grupos), {'fields': {}}) + self.box_encuesta.pack_start(grupo_final, False, True, 5) + align = gtk.Alignment(0.5, 0, 0, 0) + label = gtk.Label("Encuesta finalizada") + pangoFont = pango.FontDescription(QUESTION_FONT_SIZE) + label.modify_font(pangoFont) + align.add(label) + grupo_final.box_preguntas.pack_start(align, False, False, 0) + # end grupo que infica finalizacion de encuesta + self.__check_sensitive() grupos = self.box_encuesta.get_children() @@ -397,7 +397,7 @@ class Panel(gtk.Paned): grupos = self.box_encuesta.get_children() # grupos de preguntas - for grupo in grupos: + for grupo in grupos[:-1]: preguntas = grupo.box_preguntas.get_children() for preg in preguntas: @@ -407,7 +407,7 @@ class Panel(gtk.Paned): preguntas_a_checkear = [] # preguntas posteriores a la modificada ### Obtener preguntas posteriores a la que ha lanzado "new". - for grupo in grupos[grupos.index(widget_grupo):]: + for grupo in grupos[grupos.index(widget_grupo):-1]: for preg in grupo.box_preguntas.get_children(): @@ -575,7 +575,7 @@ class Panel(gtk.Paned): grupos = self.box_encuesta.get_children() # grupos de preguntas ### Actualiza Respuestas. - for grupo in grupos: + for grupo in grupos[:-1]: if not grupo.indice in dict.keys(): continue @@ -585,7 +585,7 @@ class Panel(gtk.Paned): ### Obtener todas las opciones activas opciones_activas = [] grupos = self.box_encuesta.get_children() # grupos de preguntas - for grupo in grupos: + for grupo in grupos[:-1]: preguntas = grupo.box_preguntas.get_children() for preg in preguntas: opciones_activas = opciones_activas + preg.widget_obtions.get_active_options() @@ -594,7 +594,7 @@ class Panel(gtk.Paned): preguntas_para_activar = [] preguntas_para_desactivar = [] - for grupo in grupos: + for grupo in grupos[:-1]: preguntas = grupo.box_preguntas.get_children() for preg in preguntas: @@ -631,7 +631,7 @@ class Panel(gtk.Paned): grupos = self.box_encuesta.get_children() # grupos de preguntas - for grupo in grupos: + for grupo in grupos[:-1]: preguntas = grupo.box_preguntas.get_children() for pregunta in preguntas: @@ -1733,7 +1733,7 @@ class ToolbarEncuesta(gtk.HBox): self.emit("accion", widget.accion) panel = self.get_toplevel().panel - if not self.encuesta_actual.finalizada and len(panel.visible_questions()) == 0: + if len(panel.visible_questions()) == 0: self.__button_clicked(widget) |