blob: 45ae36da7bbcfbb350de9f59880f64bd7e7f9fb1 (
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
78
79
80
81
82
83
|
#! -*- coding: utf-8 -*-
#(c) Stefan Heher 2009
from time import strftime
import pygtk
import gtk
from sugar.activity import activity
from sugar.datastore import datastore
from sugar import profile
from session import Session
class ReckonPrimerActivity(activity.Activity):
def __init__(self, handle):
activity.Activity.__init__(self, handle)
""" Create the official Sugar toolbox at the top of the screen"""
toolbox = activity.ActivityToolbox(self)
self.set_toolbox(toolbox)
toolbox.show()
file_location = activity.get_activity_root() + \
"/data/reckonprimer_report.txt"
file_handle = open(file_location, 'w')
file_handle.write("Report: " + profile.get_nick_name() + \
strftime(" %Y-%m-%d %H:%M:%S") + "\n")
file_handle.close()
title = "Report: " + profile.get_nick_name() + \
strftime(" %Y-%m-%d %H:%M:%S")
mime = "text/plain"
file_path = activity.get_activity_root() + \
"/data/reckonprimer_report.txt"
favorite = "1"
tags = "ReckonPrimer"
journal_object = datastore.create()
journal_object.metadata['title'] = title
journal_object.metadata['mime_type'] = mime
journal_object.file_path = file_path
journal_object.metadata['keep'] = favorite
journal_object.metadata['tags'] = tags
journal_object.metadata['icon-color'] = '#AFD600,#5B615C'
datastore.write( journal_object )
journal_object.destroy()
self.run_session()
def run_session(self):
session = Session("xo-user-name", self)
session.run()
|