示例#1
0
 def placexfer(self, placestr):
     """Transfer places in placestr to model."""
     self.clearplaces()
     self.results = []
     placeset = set()
     place = 1
     count = 0
     for placegroup in placestr.split():
         for bib in placegroup.split('-'):
             if bib not in placeset:
                 placeset.add(bib)
                 r = self.getrider(bib)
                 if r is not None:
                     r[COL_PLACE] = place
                     self.results.append([
                         str(place), r[COL_BIB],
                         strops.fitname(r[COL_FIRSTNAME], r[COL_LASTNAME],
                                        SCB_RESNAME_WIDTH), r[COL_CLUB]
                     ])
                     i = self.getiter(bib)
                     self.riders.swap(self.riders.get_iter(count), i)
                     count += 1
                 else:
                     self.log.warn('Ignoring non-starter: ' + repr(bib))
                     # 'champs' mode -> only allow reg'd starters
                     #self.addrider(bib)
                     #r = self.getrider(bib)
             else:
                 self.log.error('Ignoring duplicate no: ' + repr(bib))
         place = count + 1  ## FIX FOR incorrect deat heats testit
     if count > 0:
         self.onestart = True
示例#2
0
文件: race.py 项目: gusgollings/scbdo
 def placexfer(self, placestr):
     """Transfer places in placestr to model."""
     self.clearplaces()
     self.results = []
     placeset = set()
     place = 1
     count = 0
     for placegroup in placestr.split():
         for bib in placegroup.split('-'):
             if bib not in placeset:
                 placeset.add(bib)
                 r = self.getrider(bib)
                 if r is not None:
                     r[COL_PLACE] = place
                     self.results.append([str(place), r[COL_BIB],
                        strops.fitname(r[COL_FIRSTNAME],
                        r[COL_LASTNAME], SCB_RESNAME_WIDTH),
                        r[COL_CLUB]])
                     i = self.getiter(bib)
                     self.riders.swap(self.riders.get_iter(count), i)
                     count += 1
                 else:
                     self.log.warn('Ignoring non-starter: ' + repr(bib))
                     # 'champs' mode -> only allow reg'd starters
                     #self.addrider(bib) 
                     #r = self.getrider(bib)
             else:
                 self.log.error('Ignoring duplicate no: ' +repr(bib))
         place = count+1	## FIX FOR incorrect deat heats testit
     if count > 0:
         self.onestart = True
示例#3
0
    def delayed_announce(self):
        """Initialise the announcer's screen after a delay."""
        if self.winopen:
            self.meet.announce.clrall()
            self.meet.ann_title(' '.join([
                'Event', self.evno, ':',
                self.meet.edb.getvalue(self.event, eventdb.COL_PREFIX),
                self.meet.edb.getvalue(self.event, eventdb.COL_INFO)
            ]))

            # clear page
            self.meet.announce.linefill(1, '_')
            self.meet.announce.linefill(19, '_')

            # write out riders
            count = 0
            curline = 4
            posoft = 0
            for r in self.riders:
                count += 1
                if count == 14:
                    curline = 4
                    posoft = 41
                xtra = '    '
                if r[COL_INFO] is not None and r[COL_INFO] != '':
                    xtra = strops.truncpad(r[COL_INFO], 4, 'r')

                clubstr = ''
                if r[COL_CLUB] != '':
                    clubstr = ' (' + r[COL_CLUB] + ')'
                namestr = strops.truncpad(
                    strops.fitname(r[COL_FIRSTNAME], r[COL_LASTNAME],
                                   25 - len(clubstr)) + clubstr, 25)

                placestr = '   '
                if r[COL_PLACE] != '':
                    placestr = strops.truncpad(r[COL_PLACE] + '.', 3)
                elif r[COL_DNF]:
                    placestr = 'dnf'
                bibstr = strops.truncpad(r[COL_BIB], 3, 'r')
                self.meet.announce.postxt(
                    curline, posoft,
                    ' '.join([placestr, bibstr, namestr, xtra]))
                curline += 1

            tp = ''
            if self.start is not None and self.finish is not None:
                et = self.finish - self.start
                if self.timetype == '200m':
                    tp = '200m: '
                else:
                    tp = 'Time: '
                tp += et.timestr(3) + '    '
                dist = self.meet.get_distance(self.distance, self.units)
                if dist:
                    tp += 'Avg: ' + et.speedstr(dist)
            self.meet.announce.setline(21, tp)
        return False
示例#4
0
文件: race.py 项目: gusgollings/scbdo
    def delayed_announce(self):
        """Initialise the announcer's screen after a delay."""
        if self.winopen:
            self.meet.announce.clrall()
            self.meet.ann_title(' '.join([
                  'Event', self.evno, ':',
                  self.meet.edb.getvalue(self.event, eventdb.COL_PREFIX),
                  self.meet.edb.getvalue(self.event, eventdb.COL_INFO)]))

            # clear page
            self.meet.announce.linefill(1, '_')
            self.meet.announce.linefill(19, '_')

            # write out riders
            count = 0
            curline = 4
            posoft = 0
            for r in self.riders:
                count += 1
                if count == 14:
                    curline = 4
                    posoft = 41
                xtra = '    '
                if r[COL_INFO] is not None and r[COL_INFO] != '':
                    xtra = strops.truncpad(r[COL_INFO], 4, 'r')

                clubstr = ''
                if r[COL_CLUB] != '':
                    clubstr = ' (' + r[COL_CLUB] + ')'
                namestr = strops.truncpad(strops.fitname(r[COL_FIRSTNAME],
                              r[COL_LASTNAME], 25-len(clubstr))+clubstr, 25)

                placestr = '   '
                if r[COL_PLACE] != '':
                    placestr = strops.truncpad(r[COL_PLACE] + '.', 3)
                elif r[COL_DNF]:
                    placestr = 'dnf'
                bibstr = strops.truncpad(r[COL_BIB], 3, 'r')
                self.meet.announce.postxt(curline, posoft, ' '.join([
                      placestr, bibstr, namestr, xtra]))
                curline += 1

            tp = ''
            if self.start is not None and self.finish is not None:
                et = self.finish - self.start
                if self.timetype == '200m':
                    tp = '200m: '
                else:
                    tp = 'Time: '
                tp += et.timestr(3) + '    '
                dist = self.meet.get_distance(self.distance, self.units)
                if dist:
                    tp += 'Avg: ' + et.speedstr(dist)
            self.meet.announce.setline(21, tp)
        return False
示例#5
0
    def delayed_announce(self):
        """Initialise the announcer's screen after a delay."""
        if self.winopen:
            self.meet.announce.clrall()

            self.meet.ann_title(' '.join([
                'Event', self.evno, ':',
                self.meet.edb.getvalue(self.event, eventdb.COL_PREFIX),
                self.meet.edb.getvalue(self.event, eventdb.COL_INFO),
                '- Standings'
            ]))
            self.meet.announce.linefill(1, '_')
            ha = ['   ', '  #', 'Rider'.ljust(25), ' Pts']
            for n in self.nicknames:
                ha.append(strops.truncpad(n, 4, 'r'))
            ha.append('Tot Time'.rjust(10))
            self.meet.announce.setline(3, ' '.join(ha))

            l = 4
            for r in self.riders:
                plstr = ''
                if r[COL_PLACE] != '':
                    plstr = r[COL_PLACE]
                    if plstr.isdigit():
                        plstr += '.'
                plstr = strops.truncpad(plstr, 3, 'l')
                bibstr = strops.truncpad(r[COL_BIB], 3, 'r')
                clubstr = ''
                if r[COL_CLUB] != '':
                    clubstr = ' (' + r[COL_CLUB] + ')'
                namestr = strops.truncpad(
                    strops.fitname(r[COL_FIRST], r[COL_LAST],
                                   25 - len(clubstr)) + clubstr, 25)
                ptsstr = '    '
                if r[COL_TOTAL] > 0:
                    ptsstr = strops.truncpad(str(r[COL_TOTAL]), 4, 'r')
                ol = [plstr, bibstr, namestr, ptsstr]
                for c in range(0, len(self.nicknames)):
                    if len(r[COL_POINTS]) > c:
                        ol.append(strops.truncpad(r[COL_POINTS][c], 4, 'r'))
                    else:
                        ol.append('    ')
                if r[COL_TIME] != tod.ZERO:
                    ol.append(strops.truncpad(r[COL_TIME].rawtime(3), 10, 'r'))
                else:
                    ol.append('          ')
                self.meet.announce.setline(l, ' '.join(ol))
                l += 1

        return False
示例#6
0
 def do_startlist(self):
     """Show startlist on scoreboard."""
     self.meet.scbwin = None
     self.timerwin = False
     startlist = []
     for r in self.riders:
         startlist.append([
             r[COL_BIB],
             strops.fitname(r[COL_FIRST], r[COL_LAST], SCB_STARTERS_NW),
             r[COL_CLUB]
         ])
     self.meet.scbwin = scbwin.scbtable(self.meet.scb,
                                        self.meet.racenamecat(self.event),
                                        SCB_STARTERS_FMT, startlist)
     self.meet.scbwin.reset()
示例#7
0
 def do_startlist(self):
     """Show startlist on scoreboard."""
     self.meet.scbwin = None
     self.timerwin = False
     startlist = []
     for r in self.riders:
         startlist.append([r[COL_BIB],
                           strops.fitname(r[COL_FIRST],
                                          r[COL_LAST],
                                          SCB_STARTERS_NW),
                               r[COL_CLUB]])
     self.meet.scbwin = scbwin.scbtable(self.meet.scb,
                                        self.meet.racenamecat(self.event),
                    SCB_STARTERS_FMT, startlist)
     self.meet.scbwin.reset()
示例#8
0
    def delayed_announce(self):
        """Initialise the announcer's screen after a delay."""
        if self.winopen:
            self.meet.announce.clrall()

            self.meet.ann_title(' '.join([
                  'Event', self.evno, ':',
                  self.meet.edb.getvalue(self.event, eventdb.COL_PREFIX),
                  self.meet.edb.getvalue(self.event, eventdb.COL_INFO),
                  '- Standings']))
            self.meet.announce.linefill(1, '_')
            ha = [ '   ', '  #', 'Rider'.ljust(25), ' Pts']
            for n in self.nicknames:
                ha.append(strops.truncpad(n, 4, 'r'))
            ha.append('Tot Time'.rjust(10))
            self.meet.announce.setline(3, ' '.join(ha))

            l = 4
            for r in self.riders:
                plstr = ''
                if r[COL_PLACE] != '':
                    plstr = r[COL_PLACE]
                    if plstr.isdigit():
                        plstr += '.'
                plstr = strops.truncpad(plstr, 3, 'l')
                bibstr = strops.truncpad(r[COL_BIB], 3, 'r')
                clubstr = ''
                if r[COL_CLUB] != '':
                    clubstr = ' (' + r[COL_CLUB] + ')'
                namestr = strops.truncpad(strops.fitname(r[COL_FIRST],
                              r[COL_LAST], 25-len(clubstr))+clubstr, 25)
                ptsstr = '    '
                if r[COL_TOTAL] > 0:
                    ptsstr = strops.truncpad(str(r[COL_TOTAL]), 4, 'r')
                ol = [plstr, bibstr, namestr, ptsstr]
                for c in range(0, len(self.nicknames)):
                    if len(r[COL_POINTS]) > c:
                        ol.append(strops.truncpad(r[COL_POINTS][c], 4, 'r'))
                    else:
                        ol.append('    ')
                if r[COL_TIME] != tod.ZERO:
                    ol.append(strops.truncpad(r[COL_TIME].rawtime(3), 10, 'r'))
                else:
                    ol.append('          ')
                self.meet.announce.setline(l, ' '.join(ol))
                l += 1

        return False
示例#9
0
文件: race.py 项目: gusgollings/scbdo
 def do_startlist(self):
     """Show start list on scoreboard."""
     self.meet.scbwin = None
     self.timerwin = False
     startlist = []
     for r in self.riders:
         if not r[5]:
             nfo = r[4]			# Try info field
             if nfo is None or nfo == '':
                 nfo = r[3]			# fall back on club/affil
             startlist.append([r[0], strops.fitname(r[1], r[2],
                              SCB_STARTNAME_WIDTH), nfo])
     self.meet.scbwin = scbwin.scbtable(self.meet.scb,
                          self.meet.racenamecat(self.event),
                          SCB_STARTERS_FMT, startlist)
     self.meet.scbwin.reset()
示例#10
0
 def do_places(self):
     """Show race result on scoreboard."""
     resvec = []
     hdr = self.meet.racenamecat(self.event,
                     scbdo.SCB_LINELEN - 3) + ' pt'
     for r in self.riders:
         resvec.append([r[COL_PLACE], r[COL_BIB],
                      strops.fitname(r[COL_FIRST], r[COL_LAST],
                                     SCB_RESPOINTS_NW),
                      str(r[COL_TOTAL])])
     self.meet.scbwin = None
     self.meet.scbwin = scbwin.scbtable(self.meet.scb,
                                        hdr,
                             SCB_RESPOINTS_FMT,
                             resvec, delay=90, pagesz=5)
     self.meet.scbwin.reset()
     return False
示例#11
0
 def do_startlist(self):
     """Show start list on scoreboard."""
     self.meet.scbwin = None
     self.timerwin = False
     startlist = []
     for r in self.riders:
         if not r[5]:
             nfo = r[4]  # Try info field
             if nfo is None or nfo == '':
                 nfo = r[3]  # fall back on club/affil
             startlist.append([
                 r[0],
                 strops.fitname(r[1], r[2], SCB_STARTNAME_WIDTH), nfo
             ])
     self.meet.scbwin = scbwin.scbtable(self.meet.scb,
                                        self.meet.racenamecat(self.event),
                                        SCB_STARTERS_FMT, startlist)
     self.meet.scbwin.reset()
示例#12
0
 def do_places(self):
     """Show race result on scoreboard."""
     resvec = []
     hdr = self.meet.racenamecat(self.event, scbdo.SCB_LINELEN - 3) + ' pt'
     for r in self.riders:
         resvec.append([
             r[COL_PLACE], r[COL_BIB],
             strops.fitname(r[COL_FIRST], r[COL_LAST], SCB_RESPOINTS_NW),
             str(r[COL_TOTAL])
         ])
     self.meet.scbwin = None
     self.meet.scbwin = scbwin.scbtable(self.meet.scb,
                                        hdr,
                                        SCB_RESPOINTS_FMT,
                                        resvec,
                                        delay=90,
                                        pagesz=5)
     self.meet.scbwin.reset()
     return False