예제 #1
0
파일: activity.py 프로젝트: shaunix/blip
 def get_commits_action (self):
     weeknum = self.handler.request.query.get('weeknum', None)
     if weeknum != None:
         weeknum = int(weeknum)
         thisweek = utils.weeknum ()
         ago = thisweek - weeknum
         revs = db.Revision.select_revisions (branch=self.handler.record,
                                              weeknum=weeknum)
         cnt = revs.count()
         revs = list(revs[:20])
     else:
         revs = db.Revision.select_revisions (branch=self.handler.record,
                                              week_range=(utils.weeknum()-52,))
         cnt = revs.count()
         revs = list(revs[:10])
     if weeknum == None:
         title = (utils.gettext('Showing %i of %i commits:')
                  % (len(revs), cnt))
     elif ago == 0:
         title = (utils.gettext('Showing %i of %i commits from this week:')
                  % (len(revs), cnt))
     elif ago == 1:
         title = (utils.gettext('Showing %i of %i commits from last week:')
                  % (len(revs), cnt))
     else:
         title = (utils.gettext('Showing %i of %i commits from %i weeks ago:')
                  % (len(revs), cnt, ago))
     return self.get_commits_div (revs, title)
예제 #2
0
파일: activity.py 프로젝트: shaunix/blip
    def get_tab (self):
        tab = html.Div ()
        of = db.OutputFile.select (type=u'graphs',
                                   ident=self.handler.record.ident,
                                   filename=u'commits-0.png')
        try:
            of = of[0] 
            graph = html.Graph.activity_graph (of,
                                               self.handler.record.pulse_url,
                                               'commits', utils.gettext ('%i commits'),
                                               'activity', {'action': 'commits'})
            tab.add_content (graph)
        except IndexError:
            pass

        revs = db.Revision.select_revisions (branch=self.handler.record,
                                             week_range=(utils.weeknum()-52,))
        cnt = revs.count()
        revs = list(revs[:10])
        title = (utils.gettext('Showing %i of %i commits:') % (len(revs), cnt))
        div = self.get_commits_div (revs, title)
        tab.add_content (div)
        return tab
예제 #3
0
파일: activity.py 프로젝트: shaunix/blip
    def get_graphmap_action (self):
        id = self.handler.request.query.get ('id')
        num = self.handler.request.query.get ('num')
        filename = self.handler.request.query.get ('filename')

        graph = None
        of = db.OutputFile.select (type=u'graphs', ident=self.handler.record.ident, filename=filename)
        try:
            of = of[0]
            graph = html.Graph.activity_graph (of, self.handler.record.pulse_url,
                                               'commits', utils.gettext ('%i commits'),
                                               'activity', {'action': 'commits'},
                                               count=int(id), num=int(num), map_only=True)
        except:
            pass
        return graph
예제 #4
0
파일: activity.py 프로젝트: shaunix/blip
 def get_tab_title (self):
     return utils.gettext ('Activity')