Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/jarabe/journal/thumbsview.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/jarabe/journal/thumbsview.py')
-rw-r--r--src/jarabe/journal/thumbsview.py86
1 files changed, 58 insertions, 28 deletions
diff --git a/src/jarabe/journal/thumbsview.py b/src/jarabe/journal/thumbsview.py
index cf943ca..be518c1 100644
--- a/src/jarabe/journal/thumbsview.py
+++ b/src/jarabe/journal/thumbsview.py
@@ -27,56 +27,80 @@ from jarabe.journal import entry
class _Cell(Cell):
- def __init__(self):
+ def __init__(self, use_details):
Cell.__init__(self)
self._last_thumb_uid = None
self._last_thumb_offset = None
self._last_thumb_mtime = None
+ self.padding = style.DEFAULT_SPACING
+
cell = gtk.HBox()
- cell.props.border_width = style.DEFAULT_PADDING
self.add(cell)
# toolbar
toolbar = gtk.VBox()
+ toolbar.set_size_request(style.GRID_CELL_SIZE / 2, -1)
cell.pack_start(toolbar, expand=False)
keep = KeepIcon()
toolbar.pack_start(keep, expand=False)
self.add_field(keep)
- details = DetailsIcon()
- toolbar.pack_start(details, expand=False)
- self.add_field(details)
-
- # main
+ if use_details:
+ details = DetailsIcon()
+ toolbar.pack_start(details, expand=False)
+ self.add_field(details)
- main = gtk.VBox()
- main.props.spacing = style.DEFAULT_PADDING
- cell.pack_end(main)
+ # image widgets
- self._icon = ObjectIcon(pixel_size=style.MEDIUM_ICON_SIZE)
+ self._icon = ObjectIcon(
+ detail=use_details,
+ paint_border=True,
+ paint_fill=True,
+ pixel_size=style.MEDIUM_ICON_SIZE)
self._icon.set_size_request(preview.THUMB_WIDTH, preview.THUMB_HEIGHT)
self._icon.show()
self.add_field(self._icon)
- self._thumb = Thumb()
+ self._thumb = Thumb(
+ detail=use_details,
+ paint_border=False,
+ paint_fill=True)
self._thumb.set_size_request(preview.THUMB_WIDTH, preview.THUMB_HEIGHT)
self._thumb.show()
self.add_field(self._thumb)
- self._thumb_box = gtk.HBox()
- main.pack_start(self._thumb_box, expand=False)
+ # image box
+
+ table = gtk.Table(3, 4, False)
+ table.props.row_spacing = style.DEFAULT_PADDING
+ cell.pack_end(table)
+
+ left_padding = gtk.EventBox()
+ table.attach(left_padding, 0, 1, 0, 2, gtk.EXPAND, gtk.SHRINK, 0, 0)
+
+ self._image = gtk.EventBox()
+ table.attach(self._image, 1, 2, 0, 1, gtk.SHRINK, gtk.SHRINK, 0, 0)
+
+ right_padding = gtk.EventBox()
+ table.attach(right_padding, 2, 3, 0, 2, gtk.EXPAND, gtk.SHRINK, 0, 0)
+
+ padding = gtk.EventBox()
+ padding.props.visible_window = False
+ padding.set_size_request(style.GRID_CELL_SIZE / 2, -1)
+ table.attach(padding, 3, 4, 0, 1, gtk.SHRINK, gtk.SHRINK, 0, 0)
+
+ # text box
title = Title(max_line_count=2)
- main.pack_start(title, expand=False)
+ table.attach(title, 1, 4, 1, 2, gtk.EXPAND | gtk.FILL, gtk.SHRINK, 0, 0)
self.add_field(title)
- date = Timestamp(wrap=True, xalign=0.0)
- date.set_size_request(preview.THUMB_WIDTH, -1)
- main.pack_start(date, expand=False)
+ date = Timestamp()
+ table.attach(date, 1, 4, 2, 3, gtk.EXPAND | gtk.FILL, gtk.SHRINK, 0, 0)
self.add_field(date)
self.show_all()
@@ -99,10 +123,11 @@ class _Cell(Cell):
self._set_thumb_widget(self._thumb)
def _set_thumb_widget(self, widget):
- if widget not in self._thumb_box.get_children():
- for child in self._thumb_box.get_children():
- self._thumb_box.remove(child)
- self._thumb_box.pack_start(widget, expand=False)
+ if widget is self._image.child:
+ return
+ if self._image.child is not None:
+ self._image.remove(self._image.child)
+ self._image.add(widget)
class ThumbsView(HomogeneView):
@@ -110,14 +135,19 @@ class ThumbsView(HomogeneView):
def __init__(self, selection):
HomogeneView.__init__(self, selection)
- cell_width = style.DEFAULT_PADDING * 2 + \
- style.GRID_CELL_SIZE + \
- preview.THUMB_WIDTH
+ if not selection:
+ padding = style.GRID_CELL_SIZE / 2 - style.DEFAULT_PADDING
+ self.padding_left = padding
+ self.padding_right = padding
+
+ cell_width = style.DEFAULT_SPACING * 2 + \
+ style.GRID_CELL_SIZE + \
+ preview.THUMB_WIDTH
- cell_height = style.DEFAULT_PADDING * 2 + \
+ cell_height = style.DEFAULT_SPACING * 2 + \
preview.THUMB_HEIGHT + \
style.DEFAULT_PADDING * 2 + \
- entry.TEXT_HEIGHT * 4
+ entry.TEXT_HEIGHT * 3
self.cell_size = (cell_width, cell_height)
@@ -125,7 +155,7 @@ class ThumbsView(HomogeneView):
preview.fetched.connect(self.__preview_fetched_cb)
def do_cell_new(self):
- return _Cell()
+ return _Cell(not self.hover_selection)
def __frame_scrolled_cb(self, table):
preview.discard_queue(table.frame_range)