Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/jarabe/journal/listview.py
blob: 9d1e4c0bb294cc7c6b14bd0e0e64a080c560af53 (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
70
71
72
73
74
75
76
77
# 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

from sugar.graphics import style

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


class _Cell(Cell):

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

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

        keep = KeepIcon()
        row.pack_start(keep, expand=False)
        self.add_field(keep)

        icon = ObjectIcon(
                paint_box=False,
                pixel_size=style.STANDARD_ICON_SIZE)
        row.pack_start(icon, expand=False)
        self.add_field(icon)

        title = Title()
        title_alignment = gtk.Alignment(
                xalign=0, yalign=0.5, xscale=1, yscale=0)
        title_alignment.add(title)
        row.pack_start(title_alignment)
        self.add_field(title)

        details = DetailsIcon()
        row.pack_end(details, expand=False)
        self.add_field(details)

        date = Timestamp()
        row.pack_end(date, expand=False)
        self.add_field(date)

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

        self.show_all()


class ListView(HomogeneView):

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

    def do_cell_new(self):
        return _Cell()