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-20 03:29:47 (GMT)
committer Rogelio Mita <rogeliomita@activitycentral.com>2013-06-20 03:29:47 (GMT)
commit1cb822e72dafa9b2f61f5a1ae5f1a848be8a9c9f (patch)
tree17be458fa243dbe7f56be7228e63cd7b9f9a5aaf
parent264dfea3846cdaf43092529e5e166805795c6e7b (diff)
Style porting to gtk3
-rw-r--r--CeibalEncuesta/gtk3/CeibalEncuesta.activity/activity/activity.info4
-rwxr-xr-xCeibalEncuesta/gtk3/CeibalEncuesta/CeibalEncuesta.py14
-rw-r--r--CeibalEncuesta/gtk3/CeibalEncuesta/Iconos/next-page-active.pngbin0 -> 811 bytes
-rw-r--r--CeibalEncuesta/gtk3/CeibalEncuesta/Iconos/next-page-down.pngbin0 -> 839 bytes
-rw-r--r--CeibalEncuesta/gtk3/CeibalEncuesta/Iconos/next-page-inactive.pngbin0 -> 826 bytes
-rw-r--r--CeibalEncuesta/gtk3/CeibalEncuesta/Iconos/next-page-over.pngbin0 -> 800 bytes
-rw-r--r--CeibalEncuesta/gtk3/CeibalEncuesta/Iconos/prev-page-active.pngbin0 -> 799 bytes
-rw-r--r--CeibalEncuesta/gtk3/CeibalEncuesta/Iconos/prev-page-down.pngbin0 -> 791 bytes
-rw-r--r--CeibalEncuesta/gtk3/CeibalEncuesta/Iconos/prev-page-over.pngbin0 -> 809 bytes
-rwxr-xr-xCeibalEncuesta/gtk3/CeibalEncuesta/Widgets.py371
-rwxr-xr-xCeibalEncuesta/gtk3/MANIFEST14
11 files changed, 297 insertions, 106 deletions
diff --git a/CeibalEncuesta/gtk3/CeibalEncuesta.activity/activity/activity.info b/CeibalEncuesta/gtk3/CeibalEncuesta.activity/activity/activity.info
index 32b0777..7c6f4c9 100644
--- a/CeibalEncuesta/gtk3/CeibalEncuesta.activity/activity/activity.info
+++ b/CeibalEncuesta/gtk3/CeibalEncuesta.activity/activity/activity.info
@@ -3,5 +3,5 @@ name = CeibalEncuesta
license = GPLv2+
icon = ceibal
exec = sugar-activity CeibalEncuesta.CeibalEncuesta
-activity_version = 4.3
-bundle_id = org.laptop.CeibalEncuesta \ No newline at end of file
+activity_version = 4.3.1
+bundle_id = org.laptop.CeibalEncuesta
diff --git a/CeibalEncuesta/gtk3/CeibalEncuesta/CeibalEncuesta.py b/CeibalEncuesta/gtk3/CeibalEncuesta/CeibalEncuesta.py
index ead8d23..99281c8 100755
--- a/CeibalEncuesta/gtk3/CeibalEncuesta/CeibalEncuesta.py
+++ b/CeibalEncuesta/gtk3/CeibalEncuesta/CeibalEncuesta.py
@@ -85,7 +85,6 @@ class CeibalEncuesta(Gtk.Window):
self.set_resizable(True)
self.set_size_request(640, 480)
- self.set_border_width(5)
self.set_position(Gtk.WindowPosition.CENTER)
@@ -103,7 +102,7 @@ class CeibalEncuesta(Gtk.Window):
box.pack_start(self.__get_menu(), False, False, 5)
box.pack_start(self.infowidget, False, False, 5)
- box.pack_start(self.panel, True, True, 0)
+ box.pack_end(self.panel, True, True, 0)
self.add(box)
@@ -127,7 +126,7 @@ class CeibalEncuesta(Gtk.Window):
if not os.path.exists(BACKUP_PATH):
self.__save_json(path=BACKUP_PATH)
- self.fullscreen()
+ self.show_all()
def __init(self, widget = None):
"""
@@ -166,6 +165,10 @@ class CeibalEncuesta(Gtk.Window):
if reset: self.__init()
+ self.fullscreen()
+ self.panel.box_encuesta.queue_draw()
+
+
def __key_press_event(self, widget, event):
"""
Eventos de Teclas.
@@ -323,6 +326,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/gtk3/CeibalEncuesta/Iconos/next-page-active.png b/CeibalEncuesta/gtk3/CeibalEncuesta/Iconos/next-page-active.png
new file mode 100644
index 0000000..11141a4
--- /dev/null
+++ b/CeibalEncuesta/gtk3/CeibalEncuesta/Iconos/next-page-active.png
Binary files differ
diff --git a/CeibalEncuesta/gtk3/CeibalEncuesta/Iconos/next-page-down.png b/CeibalEncuesta/gtk3/CeibalEncuesta/Iconos/next-page-down.png
new file mode 100644
index 0000000..8f8ee7f
--- /dev/null
+++ b/CeibalEncuesta/gtk3/CeibalEncuesta/Iconos/next-page-down.png
Binary files differ
diff --git a/CeibalEncuesta/gtk3/CeibalEncuesta/Iconos/next-page-inactive.png b/CeibalEncuesta/gtk3/CeibalEncuesta/Iconos/next-page-inactive.png
new file mode 100644
index 0000000..3994d45
--- /dev/null
+++ b/CeibalEncuesta/gtk3/CeibalEncuesta/Iconos/next-page-inactive.png
Binary files differ
diff --git a/CeibalEncuesta/gtk3/CeibalEncuesta/Iconos/next-page-over.png b/CeibalEncuesta/gtk3/CeibalEncuesta/Iconos/next-page-over.png
new file mode 100644
index 0000000..70d2f91
--- /dev/null
+++ b/CeibalEncuesta/gtk3/CeibalEncuesta/Iconos/next-page-over.png
Binary files differ
diff --git a/CeibalEncuesta/gtk3/CeibalEncuesta/Iconos/prev-page-active.png b/CeibalEncuesta/gtk3/CeibalEncuesta/Iconos/prev-page-active.png
new file mode 100644
index 0000000..b97095b
--- /dev/null
+++ b/CeibalEncuesta/gtk3/CeibalEncuesta/Iconos/prev-page-active.png
Binary files differ
diff --git a/CeibalEncuesta/gtk3/CeibalEncuesta/Iconos/prev-page-down.png b/CeibalEncuesta/gtk3/CeibalEncuesta/Iconos/prev-page-down.png
new file mode 100644
index 0000000..2dabefe
--- /dev/null
+++ b/CeibalEncuesta/gtk3/CeibalEncuesta/Iconos/prev-page-down.png
Binary files differ
diff --git a/CeibalEncuesta/gtk3/CeibalEncuesta/Iconos/prev-page-over.png b/CeibalEncuesta/gtk3/CeibalEncuesta/Iconos/prev-page-over.png
new file mode 100644
index 0000000..9c3efc1
--- /dev/null
+++ b/CeibalEncuesta/gtk3/CeibalEncuesta/Iconos/prev-page-over.png
Binary files differ
diff --git a/CeibalEncuesta/gtk3/CeibalEncuesta/Widgets.py b/CeibalEncuesta/gtk3/CeibalEncuesta/Widgets.py
index 200c306..c28c508 100755
--- a/CeibalEncuesta/gtk3/CeibalEncuesta/Widgets.py
+++ b/CeibalEncuesta/gtk3/CeibalEncuesta/Widgets.py
@@ -20,6 +20,7 @@
import os
import base64
+from math import pi
import gi
from gi.repository import Gtk
@@ -32,6 +33,61 @@ import Globales as G
HOME = os.environ["HOME"]
WORKPATH = os.path.join(HOME, "CeibalEncuesta")
+ICON = 'Iconos/ceibal.png'
+NEXT_PAGE_ACTIVE = "Iconos/next-page-active.png"
+NEXT_PAGE_OVER = "Iconos/next-page-over.png"
+NEXT_PAGE_DOWN = "Iconos/next-page-down.png"
+PREV_PAGE_ACTIVE = "Iconos/prev-page-active.png"
+PREV_PAGE_OVER = "Iconos/prev-page-over.png"
+PREV_PAGE_DOWN = "Iconos/prev-page-down.png"
+QUESTION_FONT_SIZE = "16"
+OPTIONS_FONT_SIZE = "12"
+GRADO_FONT_SIZE = "10"
+
+
+def draw_rounded(cr, area, radius):
+ """ draws rectangles with rounded (circular arc) corners """
+ a,b,c,d = area
+ cr.arc(a + radius, c + radius, radius, 2*(pi/2), 3*(pi/2))
+ cr.arc(b - radius, c + radius, radius, 3*(pi/2), 4*(pi/2))
+ cr.arc(b - radius, d - radius, radius, 0*(pi/2), 1*(pi/2))
+ cr.arc(a + radius, d - radius, radius, 1*(pi/2), 2*(pi/2))
+ cr.close_path()
+
+
+class Container2(Gtk.VBox):
+
+ def do_draw(self, cr):
+
+ top_allocation = self.get_toplevel().get_allocation()
+ top_level_height = top_allocation.height
+ x,y,w,h = (0, 0, top_allocation.width, top_level_height)
+
+ h = self.get_parent().size_request().height
+
+ if h < top_level_height:
+ h = top_level_height
+
+ cr.set_source_rgb(55/255.0, 55/255.0, 55/255.0)
+ cr.rectangle(x, y, w, h)
+ cr.fill_preserve()
+ cr.stroke()
+
+ scrollbar = self.get_parent().get_parent().get_vscrollbar()
+ scrollbar_w = scrollbar.size_request().width
+ scrollbar_h = scrollbar.size_request().height
+
+ cr.set_source_rgb(126/255.0, 173/255.0, 69/255.0)
+ draw_rounded(cr, (8, w - scrollbar_w - 16 - 25, 25, h - 8 - 25), 20)
+ cr.fill_preserve()
+ cr.stroke()
+
+ cr.set_source_rgb(209/255.0, 232/255.0, 197/255.0)
+ draw_rounded(cr, (58 + 3, w - scrollbar_w - 16, 25 + 35, h - 8), 20)
+ cr.fill_preserve()
+
+ Gtk.VBox.do_draw(self, cr)
+
class Panel(Gtk.Paned):
@@ -72,29 +128,33 @@ class Panel(Gtk.Paned):
self.pack1(box, resize = False, shrink = True)
# Derecha
- base_box = Gtk.VBox()
+ self._window = Gtk.ScrolledWindow(vadjustment=Gtk.Adjustment())
+ self._window.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
+ self._window.set_shadow_type(Gtk.ShadowType.NONE)
- self.box_encuesta = Gtk.VBox()
- scroll = Gtk.ScrolledWindow()
+ # Make scrolleable main box questions container, one group
+ container = Container2()
- scroll.set_policy(
- Gtk.PolicyType.AUTOMATIC,
- Gtk.PolicyType.AUTOMATIC)
+ self.box_encuesta = Gtk.VBox()
- scroll.add_with_viewport(self.box_encuesta)
+ # Group title
+ halign = Gtk.Alignment()
+ halign.set(0.92, 0, 0, 0)
+ halign.set_padding(25, 0, 0, 0)
+ self.current_group_label = Gtk.Label("")
+ self.current_group_label.modify_font(Pango.FontDescription(GRADO_FONT_SIZE))
+ halign.add(self.current_group_label)
+ container.pack_start(halign, False, False, 0)
+ container.pack_start(self.box_encuesta, True, True, 0)
self.toolbar_encuesta = ToolbarEncuesta()
+ container.pack_end(self.toolbar_encuesta, False, False, 30)
+ self._window.add_with_viewport(container)
- base_box.pack_start(scroll, True, True, 0)
- base_box.pack_start(self.toolbar_encuesta, False, False, 0)
-
- self.pack2(base_box, resize = True, shrink = True)
+ self.pack2(self._window, resize = True, shrink = False)
self.show_all()
- self.scroll_list.hide()
- self.box_encuesta.hide()
-
self.toolbar_encuesta.connect("accion", self.__accion_encuesta)
def __check_sensibility_butons(self):
@@ -130,6 +190,8 @@ class Panel(Gtk.Paned):
a otro según valor de accion.
"""
+ self._window.get_vadjustment().set_value(0)
+
index_visible = 0
grupos = self.box_encuesta.get_children()
@@ -139,12 +201,12 @@ class Panel(Gtk.Paned):
index_visible = grupos.index(child)
break
- if accion == "Pag. Anterior":
+ if accion == "":
if index_visible > 0:
map(self.__hide_groups, grupos)
map(self.__show_groups, [grupos[index_visible - 1]])
- elif accion == "Pag. Siguiente":
+ elif accion == "Siguiente":
if index_visible < len(grupos)-1:
map(self.__hide_groups, grupos)
map(self.__show_groups, [grupos[index_visible + 1]])
@@ -773,7 +835,7 @@ class Grupo(Gtk.Frame):
self.indice = indice_grupo # indice del grupo en la encuesta
self.grupo = grupo.copy() # Diccionario del grupo en la encuesta
- self.set_label(self.grupo["name"])
+ self.set_shadow_type(Gtk.ShadowType.NONE)
self.box_preguntas = Gtk.VBox()
self.add(self.box_preguntas)
@@ -785,7 +847,7 @@ class Grupo(Gtk.Frame):
for indice in keys:
pregunta = Pregunta(indice, preguntas[indice])
- self.box_preguntas.pack_start(pregunta, False, True, 3)
+ self.box_preguntas.pack_start(pregunta, True, False, 3)
pregunta.connect("new", self.__change)
pregunta.connect("text_and_change", self.__emit_text_and_change)
@@ -821,7 +883,7 @@ class Grupo(Gtk.Frame):
if dict["fields"].get(child.indice, False):
child.update(dict["fields"][child.indice])
-class Pregunta(Gtk.HBox):
+class Pregunta(Gtk.VBox):
"""
Box con Pregunta.
@@ -849,11 +911,15 @@ class Pregunta(Gtk.HBox):
def __init__(self, indice_pregunta, pregunta):
- Gtk.HBox.__init__(self)
+ Gtk.VBox.__init__(self)
self.indice = indice_pregunta
self.pregunta = pregunta.copy()
+ # CEIBAL ICON PIXBUF
+ # TODO: def question_icon(self, scaled_size)
+ self.question_icon = GdkPixbuf.Pixbuf.new_from_file(ICON)
+
self.widget_obtions = None
widget = self.pregunta["widget_type"]
@@ -877,14 +943,39 @@ class Pregunta(Gtk.HBox):
print "Widget no Considerado", widget
label = Gtk.Label(self.pregunta["name"])
-
- pangoFont = Pango.FontDescription("10")
-
+ pangoFont = Pango.FontDescription(QUESTION_FONT_SIZE)
label.modify_font(pangoFont)
- label.modify_fg(0, Gdk.Color(0, 0, 65000))
-
- self.pack_start(label, False, True, 5)
- self.pack_end(self.widget_obtions, True, True, 0)
+ label.set_line_wrap(True)
+
+ # --- QUESTION TITLE INDENT: horizontal alignment
+ halign = Gtk.Alignment()
+ halign.set(0, 0, 1, 0)
+ halign.set_padding(50, 0, 50, 0)
+
+ # CEIBAL ICON | Question title
+ question_hbox = Gtk.HBox()
+ question_icon = Gtk.Image()
+ scaled_qicon = self.question_icon.scale_simple(
+ 60, 60, GdkPixbuf.InterpType.BILINEAR)
+ question_icon.set_from_pixbuf(scaled_qicon)
+ question_hbox.pack_start(question_icon, False, False, 10)
+ title = label
+ question_hbox.pack_start(title, False, False, 25)
+
+ halign.add(question_hbox)
+ self.pack_start(halign, False, False, 0)
+ # --- END QUESTION TITLE INDENT
+
+ # --- OPTIONS INDENT: horizontal alignment for question's options
+ halign = Gtk.Alignment()
+ halign.set(0.2, 0.1, 0, 0)
+
+ # Vertical list of question's options
+ vbbox = Gtk.VButtonBox()
+ vbbox.add(self.widget_obtions)
+ halign.add(vbbox)
+ self.pack_end(halign, False, False, 0)
+ # -- END OPTIONS INDENT
self.show_all()
@@ -1060,6 +1151,10 @@ class Widget_TextInput(Gtk.Entry):
Gtk.Entry.__init__(self)
+ font_description = Pango.FontDescription(OPTIONS_FONT_SIZE)
+ self.modify_font(font_description)
+ self.set_size_request(int(OPTIONS_FONT_SIZE)*30, -1)
+
self.nombre = "TextInput"
self.options = options.copy()
@@ -1163,7 +1258,7 @@ class Widget_TextInput(Gtk.Entry):
self.emit("text_and_change", key, text, activan)
-class Widget_RadioButon(Gtk.ButtonBox):
+class Widget_RadioButon(Gtk.VButtonBox):
"""
Contenedor de opciones para respuestas posibles en una pregunta.
@@ -1181,7 +1276,7 @@ class Widget_RadioButon(Gtk.ButtonBox):
def __init__(self, options):
- Gtk.ButtonBox.__init__(self)
+ Gtk.VButtonBox.__init__(self)
self.nombre = "RadioButton"
@@ -1203,8 +1298,6 @@ class Widget_RadioButon(Gtk.ButtonBox):
text = self.options[key].get("text", "")
imagen = self.options[key].get("img", "")
- if text: radio.set_label(text)
-
if imagen:
loader = GdkPixbuf.PixbufLoader()
image_string = base64.b64decode(imagen)
@@ -1218,7 +1311,8 @@ class Widget_RadioButon(Gtk.ButtonBox):
radio.join_group(self.null_button)
- self.pack_start(radio, False, False, 3)
+ r = MyContainer(radio, text)
+ self.pack_start(r, False, False, 3)
self.null_button.set_active(True)
@@ -1236,7 +1330,7 @@ class Widget_RadioButon(Gtk.ButtonBox):
options = self.get_children()
for child in options:
-
+ child = child.get_button()
if child.get_active():
activas.append(child.indice)
@@ -1255,7 +1349,7 @@ class Widget_RadioButon(Gtk.ButtonBox):
activan = []
for child in options:
-
+ child = child.get_button()
if child.get_active():
activan.append(child.indice)
@@ -1272,6 +1366,7 @@ class Widget_RadioButon(Gtk.ButtonBox):
options = self.get_children()
for child in options:
+ child = child.get_button()
if child.indice in dict.get("default", []):
child.set_active(True)
@@ -1294,6 +1389,7 @@ class Widget_RadioButon(Gtk.ButtonBox):
activan = []
for child in options:
+ child = child.get_button()
child.set_active(False)
self.null_button.set_active(True)
@@ -1301,7 +1397,7 @@ class Widget_RadioButon(Gtk.ButtonBox):
### Porque se debe avisar que esta pregunta se ha desactivado.
self.emit("new", activan)
-class Widget_MultipleCheckBox(Gtk.Table):
+class Widget_MultipleCheckBox(Gtk.VButtonBox):
"""
Contenedor de opciones para respuestas posibles en una pregunta.
@@ -1321,17 +1417,7 @@ class Widget_MultipleCheckBox(Gtk.Table):
self.nombre = "MultipleCheckBox"
- columns = 2
-
- rows = int(len(options)/columns)
-
- while rows*columns < int(len(options)):
- rows += 1
-
- Gtk.Table.__init__(
- self, rows = rows,
- columns = columns,
- homogeneous = True)
+ Gtk.VButtonBox.__init__(self)
self.options = options.copy()
self.updating = False
@@ -1339,19 +1425,13 @@ class Widget_MultipleCheckBox(Gtk.Table):
keys = self.options.keys()
keys.sort()
- col = 0
- row = 0
-
for key in keys:
check = MyCheckButton(key)
- text = self.options[key].get("text", "")
+ text = self.options[key].get("text", None)
imagen = self.options[key].get("img", "")
- if text:
- check.set_label(text)
-
if imagen:
loader = GdkPixbuf.PixbufLoader()
image_string = base64.b64decode(imagen)
@@ -1363,15 +1443,8 @@ class Widget_MultipleCheckBox(Gtk.Table):
check.set_image(Gtk.Image.new_from_pixbuf(pixbuf))
- self.attach_defaults(check,
- col, col+1,
- row, row+1)
-
- col += 1
-
- if col == columns:
- col = 0
- row += 1
+ c = MyContainer(check, text)
+ self.pack_start(c, False, False, 3)
check.connect("toggled", self.__change)
@@ -1387,7 +1460,7 @@ class Widget_MultipleCheckBox(Gtk.Table):
options = self.get_children()
for child in options:
-
+ child = child.get_button()
if child.get_active():
activas.append(child.indice)
@@ -1406,7 +1479,7 @@ class Widget_MultipleCheckBox(Gtk.Table):
activan = []
for child in options:
-
+ child = child.get_button()
if child.get_active():
activan.append(child.indice)
@@ -1423,6 +1496,7 @@ class Widget_MultipleCheckBox(Gtk.Table):
options = self.get_children()
for child in options:
+ child = child.get_button()
if child.indice in dict.get("default", []):
child.set_active(True)
@@ -1441,11 +1515,42 @@ class Widget_MultipleCheckBox(Gtk.Table):
activan = []
for child in options:
+ child = child.get_button()
child.set_active(False)
### Porque se debe avisar que esta pregunta se ha desactivado.
self.emit("new", activan)
+
+class MyContainer(Gtk.HBox):
+
+ def __init__(self, button, label):
+
+ Gtk.HBox.__init__(self)
+
+ self.button = button
+ self.text_label = label
+ self.label = None
+
+ if self.text_label:
+ self.label = Gtk.Label(label)
+ self.label.modify_font(Pango.FontDescription(OPTIONS_FONT_SIZE))
+
+ align = Gtk.Alignment()
+ align.add(self.button)
+ self.pack_start(align, False, False, 0)
+ if self.label:
+ align = Gtk.Alignment()
+ align.set_padding(0, 0, 20, 0)
+ align.add(self.label)
+ self.pack_start(align, False, False, 0)
+
+ self.show_all()
+
+ def get_button(self):
+ return self.button
+
+
class MyCheckButton(Gtk.CheckButton):
def __init__(self, indice):
@@ -1487,7 +1592,7 @@ class My_Alert_Dialog(Gtk.Dialog):
self.vbox.pack_start(label, True, True, 0)
-class ToolbarEncuesta(Gtk.Toolbar):
+class ToolbarEncuesta(Gtk.HBox):
__gsignals__ = {
"accion":(GObject.SIGNAL_RUN_FIRST,
@@ -1495,38 +1600,97 @@ class ToolbarEncuesta(Gtk.Toolbar):
def __init__(self):
- Gtk.Toolbar.__init__(self)
+ Gtk.HBox.__init__(self)
- separador = Gtk.SeparatorToolItem()
- separador.props.draw = False
- separador.set_size_request(0, -1)
- separador.set_expand(True)
+ self.anterior = PageButton(
+ "",
+ img=PREV_PAGE_ACTIVE,
+ imgs={"enter": PREV_PAGE_OVER, "down": PREV_PAGE_DOWN}
+ )
+ self.anterior.set_tooltip_text(u"Ir a la Página de Preguntas Anterior")
+ self.anterior.connect("pressed", self.__button_clicked)
+
+ self.siguiente = PageButton(
+ "Siguiente",
+ img=NEXT_PAGE_ACTIVE,
+ imgs={"enter": NEXT_PAGE_OVER, "down": NEXT_PAGE_DOWN}
+ )
+ self.siguiente.set_tooltip_text(u"Ir a la Siguiente Página de Preguntas")
+ self.siguiente.connect("pressed", self.__button_clicked)
+
+ # DOWN BUTTONS: < prev next >
+ # TODO: self.__draw_pagination_buttons(self, parent_widget=vbox)
+ halign_prev = Gtk.Alignment()
+ halign_prev.set_padding(0, 0, 5, 0)
+ halign_prev.add(self.anterior)
+ halign_next = Gtk.Alignment()
+ halign_next.set(0.85, 0, 0, 0)
+ halign_next.add(self.siguiente)
+
+ self.pack_start(halign_prev, True, True, 0)
+ self.pack_end(halign_next, True, True, 0)
+ #vbox.pack_start(hbox, False, False, 10)
+ # -- END DOWN BUTTONS
- self.insert(separador, -1)
+ self.show_all()
- item = Gtk.ToolItem()
- item.set_expand(False)
- self.anterior = Gtk.Button("Pag. Anterior")
- self.anterior.set_tooltip_text("Ir a la Página de Preguntas Anterior")
- self.anterior.connect("clicked", self.__button_clicked)
- self.anterior.show()
- item.add(self.anterior)
- self.insert(item, -1)
+ def __button_clicked(self, widget):
- item = Gtk.ToolItem()
- item.set_expand(False)
- self.siguiente = Gtk.Button("Pag. Siguiente")
- self.siguiente.set_tooltip_text("Ir a la Siguiente Página de Preguntas")
- self.siguiente.connect("clicked", self.__button_clicked)
- self.siguiente.show()
- item.add(self.siguiente)
- self.insert(item, -1)
+ self.emit("accion", widget.accion)
- self.show_all()
+class PageButton(Gtk.Button):
- def __button_clicked(self, widget):
+ __gsignals__ = {
+ "enter-notify-event" : "override"
+ }
+
+ def __init__(self, label, img, imgs, *args, **kwargs):
+
+ Gtk.Button.__init__(self, None, *args, **kwargs)
- self.emit("accion", widget.get_label())
+ self.accion = label
+
+ self.imgs = {
+ "normal": img,
+ "leave": img,
+ }
+
+ self.img_normal = Gtk.Image()
+ img_normal_pixbuf = GdkPixbuf.Pixbuf.new_from_file(img)
+ img_normal_scaled = img_normal_pixbuf.scale_simple(
+ 45, 45, GdkPixbuf.InterpType.BILINEAR)
+ self.img_normal.set_from_pixbuf(img_normal_scaled)
+
+ box = Gtk.HBox()
+ if label:
+ label = Gtk.Label(label)
+ label.set_padding(10, 0)
+ label.modify_fg(0, Gdk.color_parse("#B40404"))
+ box.pack_start(label, False, False, 0)
+ box.pack_start(self.img_normal, False, False, 0)
+ self.add(box)
+
+ self.set_relief(Gtk.ReliefStyle.NONE)
+
+ self.imgs.update(imgs)
+
+ self.connect("activate", self.__button_event, "down")
+ self.connect("enter", self.__button_event, "enter")
+ self.connect("leave", self.__button_event, "leave")
+
+ def do_enter_notify_event(self, widget):
+
+ self.emit("enter")
+
+ def __button_event(self, widget, img_file=None):
+
+ if img_file is None: return
+
+ img = Gtk.Image()
+ img_pixbuf = GdkPixbuf.Pixbuf.new_from_file(self.imgs[img_file])
+ img_scaled = img_pixbuf.scale_simple(
+ 45, 45, GdkPixbuf.InterpType.BILINEAR)
+ self.img_normal.set_from_pixbuf(img_scaled)
class InfoWidget(Gtk.EventBox):
"""
@@ -1659,12 +1823,12 @@ class GeneralWidget(Gtk.Box):
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()
@@ -1675,13 +1839,11 @@ class GeneralWidget(Gtk.Box):
self.pack_start(self.scroll_list, True, True, 0)
- box = Gtk.Box(orientation = Gtk.Orientation.HORIZONTAL)
+ box = Gtk.Box(orientation = Gtk.Orientation.VERTICAL)
- #anterior = Gtk.Button("Anterior")
continuar = Gtk.Button("Continuar")
siguiente = Gtk.Button("Siguiente")
- #box.pack_start(anterior, True, True, 0)
box.pack_start(continuar, True, True, 0)
box.pack_start(siguiente, True, True, 0)
@@ -1689,9 +1851,9 @@ class GeneralWidget(Gtk.Box):
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)
@@ -1815,6 +1977,19 @@ class ComboGrupos(Gtk.ComboBoxText):
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.
diff --git a/CeibalEncuesta/gtk3/MANIFEST b/CeibalEncuesta/gtk3/MANIFEST
index f3d3680..02f71a9 100755
--- a/CeibalEncuesta/gtk3/MANIFEST
+++ b/CeibalEncuesta/gtk3/MANIFEST
@@ -1,16 +1,24 @@
-setup.cfg
scripts/ceibalencuesta
scripts/ceibalencuestauninstall
MANIFEST
+setup.py
+setup.cfg
data/.empty
CeibalEncuesta/CeibalEncuestaUninstall.py
-setup.py
+CeibalEncuesta/__init__.py
CeibalEncuesta/CeibalEncuesta.py
CeibalEncuesta/Widgets.py
CeibalEncuesta/Globales.py
CeibalEncuesta/CssStyle.css
CeibalEncuesta/Iconos/ceibal.png
-CeibalEncuesta/Iconos/screen.svg
+CeibalEncuesta/Iconos/screen.png
+CeibalEncuesta/Iconos/next-page-active.png
+CeibalEncuesta/Iconos/next-page-down.png
+CeibalEncuesta/Iconos/next-page-inactive.png
+CeibalEncuesta/Iconos/next-page-over.png
+CeibalEncuesta/Iconos/prev-page-active.png
+CeibalEncuesta/Iconos/prev-page-down.png
+CeibalEncuesta/Iconos/prev-page-over.png
chardet/big5freq.py
chardet/big5prober.py
chardet/chardistribution.py