Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/pysamples/journal-stats.py
diff options
context:
space:
mode:
Diffstat (limited to 'pysamples/journal-stats.py')
-rw-r--r--pysamples/journal-stats.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/pysamples/journal-stats.py b/pysamples/journal-stats.py
index 2d8a5d3..1342a69 100644
--- a/pysamples/journal-stats.py
+++ b/pysamples/journal-stats.py
@@ -14,15 +14,17 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
def myblock(tw, x): # ignore second argument
''' Load journal stats to heap (Sugar only) '''
import os
import glob
+ from gettext import gettext as _
+
MAX = 19
DIROFINTEREST = 'datastore'
-
class ParseJournal():
''' Simple parser of datastore '''
@@ -78,7 +80,6 @@ def myblock(tw, x): # ignore second argument
activity_list.append([_('other'), count])
return activity_list
-
def hascomponent(path, component):
''' Return metadata attribute, if any '''
if not os.path.exists(os.path.join(path, 'metadata')):
@@ -92,7 +93,6 @@ def myblock(tw, x): # ignore second argument
return False
return data
-
def isactivity(path):
''' Return activity name '''
activity = hascomponent(path, 'activity')
@@ -101,7 +101,6 @@ def myblock(tw, x): # ignore second argument
else:
return activity.split('.')[-1]
-
def isdsdir(path):
''' Only interested if it is a datastore directory '''
if not os.path.isdir(path):
@@ -110,12 +109,11 @@ def myblock(tw, x): # ignore second argument
return False
return True
-
data = ParseJournal()
activity_list = data.get_sorted()
for a in activity_list:
tw.lc.heap.append(a[0])
tw.lc.heap.append(a[1])
-
+
tw.lc.heap.append(activity_list[0][1])
return