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-19 03:04:02 (GMT)
committer Rogelio Mita <rogeliomita@activitycentral.com>2013-06-19 03:04:02 (GMT)
commita90236a8b5ddbd63fe0fa15068bedbfa08207123 (patch)
tree9358dc1548ed84f5b34708586db484f7e0ca417f
parent24b481515065ca940bfde17447e7ac42e41c3128 (diff)
Page groups buttons
-rw-r--r--CeibalEncuesta/gtk2/CeibalEncuesta/Iconos/next-page-normal.pngbin0 -> 782 bytes
-rw-r--r--CeibalEncuesta/gtk2/CeibalEncuesta/Iconos/next-page-over.pngbin0 -> 845 bytes
-rw-r--r--CeibalEncuesta/gtk2/CeibalEncuesta/Iconos/prev-page-normal.pngbin0 -> 800 bytes
-rw-r--r--CeibalEncuesta/gtk2/CeibalEncuesta/Iconos/prev-page-over.pngbin0 -> 909 bytes
-rw-r--r--CeibalEncuesta/gtk2/CeibalEncuesta/Widgets.py100
5 files changed, 82 insertions, 18 deletions
diff --git a/CeibalEncuesta/gtk2/CeibalEncuesta/Iconos/next-page-normal.png b/CeibalEncuesta/gtk2/CeibalEncuesta/Iconos/next-page-normal.png
new file mode 100644
index 0000000..57d2ee2
--- /dev/null
+++ b/CeibalEncuesta/gtk2/CeibalEncuesta/Iconos/next-page-normal.png
Binary files differ
diff --git a/CeibalEncuesta/gtk2/CeibalEncuesta/Iconos/next-page-over.png b/CeibalEncuesta/gtk2/CeibalEncuesta/Iconos/next-page-over.png
new file mode 100644
index 0000000..cbd85a0
--- /dev/null
+++ b/CeibalEncuesta/gtk2/CeibalEncuesta/Iconos/next-page-over.png
Binary files differ
diff --git a/CeibalEncuesta/gtk2/CeibalEncuesta/Iconos/prev-page-normal.png b/CeibalEncuesta/gtk2/CeibalEncuesta/Iconos/prev-page-normal.png
new file mode 100644
index 0000000..ee0af17
--- /dev/null
+++ b/CeibalEncuesta/gtk2/CeibalEncuesta/Iconos/prev-page-normal.png
Binary files differ
diff --git a/CeibalEncuesta/gtk2/CeibalEncuesta/Iconos/prev-page-over.png b/CeibalEncuesta/gtk2/CeibalEncuesta/Iconos/prev-page-over.png
new file mode 100644
index 0000000..9edf1ac
--- /dev/null
+++ b/CeibalEncuesta/gtk2/CeibalEncuesta/Iconos/prev-page-over.png
Binary files differ
diff --git a/CeibalEncuesta/gtk2/CeibalEncuesta/Widgets.py b/CeibalEncuesta/gtk2/CeibalEncuesta/Widgets.py
index ea28b5f..1914b56 100644
--- a/CeibalEncuesta/gtk2/CeibalEncuesta/Widgets.py
+++ b/CeibalEncuesta/gtk2/CeibalEncuesta/Widgets.py
@@ -33,6 +33,13 @@ import Globales as G
HOME = os.environ["HOME"]
WORKPATH = os.path.join(HOME, "CeibalEncuesta")
ICON = 'Iconos/ceibal.png'
+NEXT_PAGE_NORMAL = "Iconos/next-page-normal.png"
+NEXT_PAGE_OVER = "Iconos/next-page-over.png"
+PREV_PAGE_NORMAL = "Iconos/prev-page-normal.png"
+PREV_PAGE_OVER = "Iconos/prev-page-over.png"
+QUESTION_FONT_SIZE = "16"
+OPTIONS_FONT_SIZE = "12"
+GRADO_FONT_SIZE = "10"
def draw_rounded(cr, area, radius):
@@ -98,9 +105,9 @@ class Panel(gtk.Paned):
# Group title
halign = gtk.Alignment(0.92, 0, 0, 0)
- halign.set_padding(27, 0, 0, 0)
+ halign.set_padding(25, 0, 0, 0)
self.current_group_label = gtk.Label("")
- self.current_group_label.modify_font(pango.FontDescription("20"))
+ self.current_group_label.modify_font(pango.FontDescription(GRADO_FONT_SIZE))
halign.add(self.current_group_label)
container.pack_start(halign)
@@ -144,7 +151,7 @@ class Panel(gtk.Paned):
cr.stroke()
cr.set_source_color(gdk.color_parse("#E3F6CE"))
- draw_rounded(cr, (50, w - scrollbar_w - 16, 25 + 35, h - 8), 20)
+ draw_rounded(cr, (58 + 3, w - scrollbar_w - 16, 25 + 35, h - 8), 20)
cr.fill_preserve()
return False
@@ -192,13 +199,13 @@ class Panel(gtk.Paned):
break
event = gdk.Event(gdk.EXPOSE)
- if accion == "Pag. Anterior":
+ if accion == "":
if index_visible > 0:
map(self.__hide_groups, grupos)
map(self.__show_groups, [grupos[index_visible - 1]])
self.box_encuesta.queue_draw()
- 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]])
@@ -938,7 +945,7 @@ class Pregunta(gtk.VBox):
print "Widget no Considerado", widget
label = gtk.Label(self.pregunta["name"])
- pangoFont = pango.FontDescription("30")
+ pangoFont = pango.FontDescription(QUESTION_FONT_SIZE)
label.modify_font(pangoFont)
label.set_line_wrap(True)
@@ -961,7 +968,7 @@ class Pregunta(gtk.VBox):
# --- END QUESTION TITLE INDENT
# --- OPTIONS INDENT: horizontal alignment for question's options
- halign = gtk.Alignment(0.2, 0, 0, 0)
+ halign = gtk.Alignment(0.2, 0.1, 0, 0)
# Vertical list of question's options
vbbox = gtk.VButtonBox()
@@ -1151,9 +1158,9 @@ class Widget_TextInput(gtk.Entry):
gtk.Entry.__init__(self)
- font_description = pango.FontDescription("24")
+ font_description = pango.FontDescription(OPTIONS_FONT_SIZE)
self.modify_font(font_description)
- self.set_size_request(24*20, -1)
+ self.set_size_request(int(OPTIONS_FONT_SIZE)*30, -1)
self.nombre = "TextInput"
@@ -1534,7 +1541,7 @@ class MyContainer(gtk.HBox):
if self.text_label:
self.label = gtk.Label(label)
- self.label.modify_font(pango.FontDescription("24"))
+ self.label.modify_font(pango.FontDescription(OPTIONS_FONT_SIZE))
align = gtk.Alignment(0, 0, 0, 0)
align.set_padding(10, 0, 50, 0)
@@ -1605,17 +1612,26 @@ class ToolbarEncuesta(gtk.HBox):
gtk.HBox.__init__(self)
- 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 = PageButton(
+ "",
+ img=PREV_PAGE_NORMAL,
+ imgs={"enter": PREV_PAGE_OVER}
+ )
+ self.anterior.set_tooltip_text(u"Ir a la Página de Preguntas Anterior")
+ self.anterior.connect("pressed", self.__button_clicked)
- 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 = PageButton(
+ "Siguiente",
+ img=NEXT_PAGE_NORMAL,
+ imgs={"enter": NEXT_PAGE_OVER}
+ )
+ 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(0.03, 0, 0, 0)
+ halign_prev = gtk.Alignment(0.0, 0, 0, 0)
+ halign_prev.set_padding(0, 0, 8, 0)
halign_prev.add(self.anterior)
halign_next = gtk.Alignment(0.85, 0, 0, 0)
halign_next.add(self.siguiente)
@@ -1631,6 +1647,54 @@ class ToolbarEncuesta(gtk.HBox):
self.emit("accion", widget.get_label())
+class PageButton(gtk.Button):
+
+ __gsignals__ = {
+ "enter-notify-event" : "override"
+ }
+
+ def __init__(self, label, img, imgs, *args, **kwargs):
+
+ gtk.Button.__init__(self, label, *args, **kwargs)
+
+ self.imgs = {
+ "normal": img,
+ "leave": img,
+ }
+
+ img_normal = gtk.Image()
+ img_normal_pixbuf = gdk.pixbuf_new_from_file(img)
+ img_normal_scaled = img_normal_pixbuf.scale_simple(
+ 45, 45, gdk.INTERP_BILINEAR)
+ img_normal.set_from_pixbuf(img_normal_scaled)
+
+ self.set_image(img_normal)
+ self.set_relief(gtk.RELIEF_NONE)
+
+ self.imgs.update(imgs)
+
+ #self.connect("activate", self.__button_event, "")
+ self.connect("enter", self.__button_event, "enter")
+ self.connect("leave", self.__button_event, "leave")
+ #self.connect("released", self.__button_event, "")
+ #self.connect("set-focus-child", self.__button_event, "")
+
+ 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 = gdk.pixbuf_new_from_file(self.imgs[img_file])
+ img_scaled = img_pixbuf.scale_simple(
+ 45, 45, gdk.INTERP_BILINEAR)
+ img.set_from_pixbuf(img_scaled)
+
+ self.set_image(img)
+
class InfoWidget(gtk.EventBox):
"""
Widget con información sobre encuesta en proceso.
@@ -2048,7 +2112,7 @@ class Wizard(gtk.Dialog):
self.vbox.pack_start(scroll, True, True, 0)
self.set_border_width(5)
- self.set_size_request(500, 300)
+ self.set_size_request(640, 480)
def __abrir_encuesta(self, widget):
"""