Features/Spent Times: Difference between revisions
No edit summary |
|||
| (2 intermediate revisions by one other user not shown) | |||
| Line 1: | Line 1: | ||
<noinclude> | <noinclude> | ||
[[Category: | [[Category:FeatureLanded|Optional Adhoc Autoconnect]] | ||
</noinclude> | </noinclude> | ||
| Line 33: | Line 32: | ||
This feature is already implemented and working on Australian au1c images. The implementation requires a small modification to sugar-toolkit and sugar-toolkit-gtk3 [https://github.com/tchx84/sugar-toolkit-gtk3-1/commits/spent-time-3 see initial implementation]. | This feature is already implemented and working on Australian au1c images. The implementation requires a small modification to sugar-toolkit and sugar-toolkit-gtk3 [https://github.com/tchx84/sugar-toolkit-gtk3-1/commits/spent-time-3 see initial implementation]. | ||
The change consist in modifying the base Activity class, using the launch time timestamp in conjuction with "set_active" and "save" methods, to calculate and accumulate the seconds for when the activity was "active". The spent time is stored as | The change consist in modifying the base Activity class, using the launch time timestamp in conjuction with "set_active" and "save" methods, to calculate and accumulate the seconds for when the activity was "active". The spent time is stored as a string of comma separated integers, each for each time the entry was launched. The new metadata array is called "spent_times". | ||
The scope of this feature is the time accumulation and metadata storage. | The scope of this feature is the time accumulation and metadata storage. | ||
== How to access this metadata == | |||
from sugar3.datastore import datastore | |||
entries, count = datastore.find(self._query()) | |||
for entry in entries: | |||
raw_data = entry.metadata.get('spent-times', None) | |||
if raw_data is not None: | |||
spent_times = map(int, raw_data.split(', ')) | |||
== User Experience == | == User Experience == | ||
The user experienced is untouched. | The user experienced is untouched. | ||