コード例 #1
0
    def loadconfig(self):
        """Load race config from disk."""
        self.riders.clear()
        #self.results.clear()

        # defaults
        # +type specific overrides
        cr = ConfigParser.ConfigParser({
            'startlist': '',
            'start': '',
            'lstart': '',
            'places': '',
            'limit': ''
        })
        cr.add_section('race')
        cr.add_section('riders')
        if os.path.isfile(self.configpath):
            self.log.debug('Attempting to read config from ' +
                           repr(self.configpath))
            cr.read(self.configpath)

        # re-load starters/results
        for rs in cr.get('race', 'startlist').split():
            (r, s) = strops.bibstr2bibser(rs)
            self.addrider(r, s)
            if cr.has_option('riders', rs):
                # bbb.sss = comment,inrace,hcap,finish,mbunch
                nr = self.getrider(r, s)
                ril = csv.reader([cr.get('riders', rs)]).next()
                lr = len(ril)
                if lr > 0:
                    nr[COL_COMMENT] = ril[0]
                if lr > 1:
                    nr[COL_INRACE] = strops.confopt_bool(ril[1])
                if lr > 2:
                    nr[COL_HCAP] = tod.str2tod(ril[2])
                if lr > 3:
                    nr[COL_FINISH] = tod.str2tod(ril[3])
                if lr > 4:
                    nr[COL_MBUNCH] = tod.str2tod(ril[4])
                if nr[COL_HCAP] is None:
                    nr[COL_HCAP] = tod.ZERO  # default to 'scratch'
                if self.limit_tod is not None:
                    if nr[COL_HCAP] > self.limit_tod:
                        self.log.error('Handicap greater than limit for ' +
                                       rs + ' set to limit.')
                        nr[COL_HCAP] = self.limit_tod

        places = strops.reformat_bibserplacelist(cr.get('race', 'places'))
        #!!!
        #self.ctrl_places.set_text(places)
        #self.ctrl_places.set_sensitive(False)
        #self.recalculate()

        # re-join an existing timer state
        self.set_start(tod.str2tod(cr.get('race', 'start')),
                       tod.str2tod(cr.get('race', 'lstart')))
コード例 #2
0
ファイル: rhcp.py プロジェクト: gusgollings/scbdo
    def loadconfig(self):
        """Load race config from disk."""
        self.riders.clear()
        #self.results.clear()

        # defaults
        # +type specific overrides
        cr = ConfigParser.ConfigParser({'startlist':'',
					'start':'',
                                        'lstart':'',
                                        'places':'',
                                        'limit':''
                                       })
        cr.add_section('race')
        cr.add_section('riders')
        if os.path.isfile(self.configpath):
            self.log.debug('Attempting to read config from '
                               + repr(self.configpath))
            cr.read(self.configpath)

        # re-load starters/results
        for rs in cr.get('race', 'startlist').split():
            (r, s) = strops.bibstr2bibser(rs)
            self.addrider(r, s)
            if cr.has_option('riders', rs):
                # bbb.sss = comment,inrace,hcap,finish,mbunch
                nr = self.getrider(r, s)
                ril = csv.reader([cr.get('riders', rs)]).next()
                lr = len(ril)
                if lr > 0:
                    nr[COL_COMMENT] = ril[0]
                if lr > 1:
                    nr[COL_INRACE] = strops.confopt_bool(ril[1])
                if lr > 2:
                    nr[COL_HCAP] = tod.str2tod(ril[2])
                if lr > 3:
                    nr[COL_FINISH] = tod.str2tod(ril[3])
                if lr > 4:
                    nr[COL_MBUNCH] = tod.str2tod(ril[4])
                if nr[COL_HCAP] is None:
                    nr[COL_HCAP] = tod.ZERO		# default to 'scratch'
                if self.limit_tod is not None:
                    if nr[COL_HCAP] > self.limit_tod:
                        self.log.error('Handicap greater than limit for '
                                        + rs + ' set to limit.')
                        nr[COL_HCAP] = self.limit_tod

        places = strops.reformat_bibserplacelist(cr.get('race', 'places'))
#!!!
        #self.ctrl_places.set_text(places)
        #self.ctrl_places.set_sensitive(False)
        #self.recalculate()

        # re-join an existing timer state
        self.set_start(tod.str2tod(cr.get('race', 'start')),
                       tod.str2tod(cr.get('race', 'lstart')))
コード例 #3
0
ファイル: irtt.py プロジェクト: rijilks/scbdo
 def on_start(self, curoft):
     for i in self.unstarters:
         if curoft + tod.tod('10') == self.unstarters[i]:
             self.log.info('about to load rider ' + i)
             (bib, series) = strops.bibstr2bibser(i)
             #!!! TODO -> use bib.ser ?
             self.sl.setrider(bib, series)
             self.sl.toarmstart()
             self.meet.timer.arm(0)
             self.start_unload = self.unstarters[i] + tod.tod('10')
             glib.timeout_add_seconds(180, self.add_starter, i)
             break
コード例 #4
0
ファイル: irtt.py プロジェクト: gusgollings/scbdo
 def on_start(self, curoft):
     for i in self.unstarters:
         if curoft + tod.tod('10') == self.unstarters[i]:
             self.log.info('about to load rider ' + i)
             (bib, series) = strops.bibstr2bibser(i)
             #!!! TODO -> use bib.ser ?
             self.sl.setrider(bib, series)
             self.sl.toarmstart()
             self.meet.timer.arm(0)
             self.start_unload = self.unstarters[i] + tod.tod('10')
             glib.timeout_add_seconds(180, self.add_starter, i)
             break
コード例 #5
0
ファイル: irtt.py プロジェクト: rijilks/scbdo
    def loadconfig(self):
        """Load race config from disk."""
        self.riders.clear()
        self.results.clear()

        # failsafe defaults -> dual timer, C0 start, PA/PB
        # type specific overrides

        cr = ConfigParser.ConfigParser({
            'startlist': '',
            'start': '',
            'lstart': ''
        })
        cr.add_section('race')
        cr.add_section('riders')
        if os.path.isfile(self.configpath):
            self.log.debug('Attempting to read config from ' +
                           repr(self.configpath))
            cr.read(self.configpath)

        # re-load starters/results
        self.onestart = False
        for rs in cr.get('race', 'startlist').split():
            (r, s) = strops.bibstr2bibser(rs)
            self.addrider(r, s)
            wst = None
            tst = None
            ft = None
            if cr.has_option('riders', rs):
                # bbb.sss = comment,wall_start,timy_start,finish,place
                nr = self.getrider(r, s)
                ril = csv.reader([cr.get('riders', rs)]).next()
                lr = len(ril)
                if lr > 0:
                    nr[COL_COMMENT] = ril[0]
                if lr > 1:
                    wst = tod.str2tod(ril[1])
                if lr > 2:
                    tst = tod.str2tod(ril[2])
                if lr > 3:
                    ft = tod.str2tod(ril[3])
            nri = self.getiter(r, s)
            self.settimes(nri, wst, tst, ft, doplaces=False)
        self.placexfer()

        # re-join any existing timer state -> no, just do a start
        self.set_syncstart(tod.str2tod(cr.get('race', 'start')),
                           tod.str2tod(cr.get('race', 'lstart')))
コード例 #6
0
ファイル: irtt.py プロジェクト: gusgollings/scbdo
    def loadconfig(self):
        """Load race config from disk."""
        self.riders.clear()
        self.results.clear()

        # failsafe defaults -> dual timer, C0 start, PA/PB
        # type specific overrides

        cr = ConfigParser.ConfigParser({'startlist':'',
					'start':'',
                                        'lstart':''
                                       })
        cr.add_section('race')
        cr.add_section('riders')
        if os.path.isfile(self.configpath):
            self.log.debug('Attempting to read config from '
                               + repr(self.configpath))
            cr.read(self.configpath)

        # re-load starters/results
        self.onestart = False
        for rs in cr.get('race', 'startlist').split():
            (r, s) = strops.bibstr2bibser(rs)
            self.addrider(r, s)
            wst = None
            tst = None
            ft = None
            if cr.has_option('riders', rs):
                # bbb.sss = comment,wall_start,timy_start,finish,place
                nr = self.getrider(r, s)
                ril = csv.reader([cr.get('riders', rs)]).next()
                lr = len(ril)
                if lr > 0:
                    nr[COL_COMMENT] = ril[0]
                if lr > 1:
                    wst = tod.str2tod(ril[1])
                if lr > 2:
                    tst = tod.str2tod(ril[2])
                if lr > 3:
                    ft = tod.str2tod(ril[3])
            nri = self.getiter(r, s)
            self.settimes(nri, wst, tst, ft, doplaces=False)
        self.placexfer()

        # re-join any existing timer state -> no, just do a start
        self.set_syncstart(tod.str2tod(cr.get('race', 'start')),
                           tod.str2tod(cr.get('race', 'lstart')))