Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/jarabe/journal/expandedentry.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/jarabe/journal/expandedentry.py')
-rw-r--r--src/jarabe/journal/expandedentry.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/jarabe/journal/expandedentry.py b/src/jarabe/journal/expandedentry.py
index 88c0b41..924f872 100644
--- a/src/jarabe/journal/expandedentry.py
+++ b/src/jarabe/journal/expandedentry.py
@@ -17,6 +17,7 @@
import logging
from gettext import gettext as _
import StringIO
+import time
import hippo
import cairo
@@ -29,6 +30,7 @@ from sugar.graphics.icon import CanvasIcon
from sugar.graphics.xocolor import XoColor
from sugar.graphics.entry import CanvasEntry
from sugar.graphics.canvastextview import CanvasTextView
+from sugar.util import format_size
from jarabe.journal.keepicon import KeepIcon
from jarabe.journal.palettes import ObjectPalette, BuddyPalette
@@ -118,6 +120,9 @@ class ExpandedEntry(hippo.CanvasBox):
self._preview = self._create_preview()
first_column.append(self._preview)
+ technical_box = self._create_technical()
+ first_column.append(technical_box)
+
# Second column
description_box, self._description = self._create_description()
@@ -216,6 +221,37 @@ class ExpandedEntry(hippo.CanvasBox):
box.append(preview_box)
return box
+ def _create_technical(self):
+ vbox = hippo.CanvasBox()
+ vbox.props.spacing = style.DEFAULT_SPACING
+
+ lines = [
+ _('Kind: %s') % (self._metadata.get('mime_type') or _('Unknown'),),
+ _('Date: %s') % (self._format_date(),),
+ _('Size: %s') % (format_size(model.get_file_size(self._metadata['uid'])),),
+ ]
+
+ for line in lines:
+ text = hippo.CanvasText(text=line,
+ font_desc=style.FONT_NORMAL.get_pango_desc())
+ text.props.color = style.COLOR_BUTTON_GREY.get_int()
+
+ if gtk.widget_get_default_direction() == gtk.TEXT_DIR_RTL:
+ text.props.xalign = hippo.ALIGNMENT_END
+ else:
+ text.props.xalign = hippo.ALIGNMENT_START
+
+ vbox.append(text)
+
+ return vbox
+
+ def _format_date(self):
+ if 'timestamp' in self._metadata:
+ timestamp = float(self._metadata['timestamp'])
+ return time.strftime('%x', time.localtime(timestamp))
+ else:
+ return _('No date')
+
def _create_buddy_list(self):
vbox = hippo.CanvasBox()