Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/jarabe/journal/listview.py
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2012-08-06 07:59:48 (GMT)
committer Simon Schampijer <simon@schampijer.de>2012-08-13 21:15:43 (GMT)
commitd9fbf9db79b9abab2491ebbdc169985e38a59055 (patch)
tree1f38143d402256496259d982a59ae34d6a294fcb /src/jarabe/journal/listview.py
parent5ad6ae0166db14d384c9d4cbf53575de015d29f4 (diff)
Views: Replace the hippo based layout with one using GTK+ containers
The requirement was to be able to position and size the widgets with different layouts in the Views. We need to be able to have fixed positions (e.g. the owner icon and current activity icon) and we need to be able to change the position (e.g. BuddyIcon in the Neighborhood View) and move the widget by drag and drop (e.g. RandomLayout). The implementation uses a gtk.Container (SugarViewContainer) without an associated GdkWindow to hold the widgets since we do not want to do drawing in this container. The desired layout and the owner icon and optional activity icon are passed at initialization time. A ViewLayout is responsible to calculate the positions and sizes for the SugarViewContainer. To keep track of the positions it uses a grid that is initialized on the first allocation. The owner icon (activity icon) will be added to the grid to make sure it keeps the fixed position. The SpreadLayout derives now from the ViewLayout. The SpreadLayout which is used in the GroupBox and in the MeshContainer does add all it's children to the grid in order to use the collision detection from the grid to not place icons over each other. The RandomLayout does place all it's children in the grid as well for collision detection purposes. The Journal has been made hippo-free as well. We set white background in the ExpandedEntry of the Detail View. For that we change the ExpandedEntry class to subclass gtk.EventBox because the gtk.VBox doesn't have a gtk.gdk.Window associated and the background can't be set otherwise. This patch is based on the work from Walter Bender, Daniel Drake and Raul Gutierrez Segales. Signed-off-by: Simon Schampijer <simon@laptop.org> Signed-off-by: Manuel QuiƱones <manuq@laptop.org> Signed-off-by: Daniel Narvaez <dwnarvaez@gmail.com>
Diffstat (limited to 'src/jarabe/journal/listview.py')
-rw-r--r--src/jarabe/journal/listview.py50
1 files changed, 23 insertions, 27 deletions
diff --git a/src/jarabe/journal/listview.py b/src/jarabe/journal/listview.py
index 57836f2..f6a867f 100644
--- a/src/jarabe/journal/listview.py
+++ b/src/jarabe/journal/listview.py
@@ -18,14 +18,14 @@ import logging
from gettext import gettext as _
import time
+import glib
import gobject
import gtk
-import hippo
import gconf
import pango
from sugar.graphics import style
-from sugar.graphics.icon import CanvasIcon, Icon, CellRendererIcon
+from sugar.graphics.icon import Icon, CellRendererIcon
from sugar.graphics.xocolor import XoColor
from sugar import util
@@ -33,6 +33,7 @@ from jarabe.journal.listmodel import ListModel
from jarabe.journal.palettes import ObjectPalette, BuddyPalette
from jarabe.journal import model
from jarabe.journal import misc
+from jarabe.view.eventicon import EventIcon
UPDATE_INTERVAL = 300
@@ -370,38 +371,33 @@ class BaseListView(gtk.Bin):
self._progress_bar = None
def _show_message(self, message, show_clear_query=False):
- canvas = hippo.Canvas()
+ box = gtk.VBox()
self.remove(self.child)
- self.add(canvas)
- canvas.show()
-
- box = hippo.CanvasBox(orientation=hippo.ORIENTATION_VERTICAL,
- background_color=style.COLOR_WHITE.get_int(),
- yalign=hippo.ALIGNMENT_CENTER,
- spacing=style.DEFAULT_SPACING,
- padding_bottom=style.GRID_CELL_SIZE)
- canvas.set_root(box)
-
- icon = CanvasIcon(size=style.LARGE_ICON_SIZE,
- icon_name='activity-journal',
- stroke_color=style.COLOR_BUTTON_GREY.get_svg(),
- fill_color=style.COLOR_TRANSPARENT.get_svg())
- box.append(icon)
-
- text = hippo.CanvasText(text=message,
- xalign=hippo.ALIGNMENT_CENTER,
- font_desc=style.FONT_BOLD.get_pango_desc(),
- color=style.COLOR_BUTTON_GREY.get_int())
- box.append(text)
+
+ alignment = gtk.Alignment(0.5, 0.5, 0.1, 0.1)
+ self.add(alignment)
+
+ icon = EventIcon(pixel_size=style.LARGE_ICON_SIZE,
+ icon_name='activity-journal',
+ stroke_color=style.COLOR_BUTTON_GREY.get_svg(),
+ fill_color=style.COLOR_TRANSPARENT.get_svg())
+ box.pack_start(icon, expand=True, fill=False)
+
+ label = gtk.Label()
+ color = style.COLOR_BUTTON_GREY.get_html()
+ label.set_markup('<span weight="bold" color="%s">%s</span>' % ( \
+ color, glib.markup_escape_text(message)))
+ box.pack_start(label, expand=True, fill=False)
if show_clear_query:
button = gtk.Button(label=_('Clear search'))
button.connect('clicked', self.__clear_button_clicked_cb)
button.props.image = Icon(icon_name='dialog-cancel',
icon_size=gtk.ICON_SIZE_BUTTON)
- canvas_button = hippo.CanvasWidget(widget=button,
- xalign=hippo.ALIGNMENT_CENTER)
- box.append(canvas_button)
+ box.pack_start(button, expand=True, fill=False)
+
+ alignment.add(box)
+ alignment.show_all()
def __clear_button_clicked_cb(self, button):
self.emit('clear-clicked')