Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/jarabe/journal/listview.py
blob: f4406b2024ae66c5bd67156f978cbed4b43949d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Copyright (C) 2010, Aleksey Lim
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

import gobject
import logging

import hippo

from sugar.graphics import style

from jarabe.journal.homogeneview import HomogeneView
from jarabe.journal.homogeneview import Cell
from jarabe.journal.widgets import *


class _Cell(Cell):

    def __init__(self):
        Cell.__init__(self)

        self._row = gtk.HBox()
        self._row.props.spacing = style.DEFAULT_SPACING
        self.add(self._row)

        keep = KeepIcon(box_width=style.GRID_CELL_SIZE)
        self._row.pack_start(keep, expand=False)

        icon = ObjectIcon(size=style.STANDARD_ICON_SIZE)
        self._row.pack_start(icon, expand=False)

        title = Title(xalign=0, yalign=0.5, xscale=1, yscale=0)
        self._row.pack_start(title)

        details = DetailsIcon()
        self._row.pack_end(details, expand=False)

        date = Timestamp()
        self._row.pack_end(date, expand=False)

        buddies = Buddies(buddies_max=3,
                xalign=0, yalign=0.5, xscale=1, yscale=0.15)
        self._row.pack_end(buddies, expand=False)

        self.show_all()

    def do_fill_in_cell_content(self, table, metadata):
        for i in self._row.get_children():
            i.check_out(metadata)


class ListView(HomogeneView):

    def __init__(self):
        HomogeneView.__init__(self, _Cell)
        self.frame_size = (None, 1)
        self.cell_size = (None, style.GRID_CELL_SIZE)