예제 #1
0
파일: roadmeet.py 프로젝트: rijilks/scbdo
    def __init__(self, configpath=None, etype='rms'):
        """Meet constructor."""
        # logger and log handler
        self.log = logging.getLogger('scbdo')
        self.log.setLevel(logging.DEBUG)
        self.loghandler = None  # set in loadconfig to meet dir

        if etype not in ROADRACE_TYPES:
            etype = 'rms'  # Default is 'road mass start'
        self.etype = etype

        # meet configuration path and options
        if configpath is None:
            configpath = '.'  # None assumes 'current dir'
        self.configpath = configpath
        self.line1 = ''
        self.line2 = ''
        self.line3 = ''
        self.bibs_in_results = True
        self.cats_in_results = False
        self.distance = 20  # Race distance in km (integer!)
        self.logos = ''  # string list of logo filenames
        self.docindex = 0

        # printer preferences
        self.printprefs = gtk.PrintSettings()  # filled in with loadconfig

        # hardware connections
        self.timer = timy.timy()
        self.timer_port = ''
        self.rfu = wheeltime.wheeltime()
        self.rfu_addr = ''
        self.scb = uscbsrv.uscbsrv()

        b = gtk.Builder()
        b.add_from_file(os.path.join(scbdo.UI_PATH, 'roadmeet.ui'))
        self.window = b.get_object('meet')
        self.window.connect('key-press-event', self.key_event)
        self.clock = b.get_object('menu_clock')
        self.clock_label = b.get_object('menu_clock_label')
        self.clock_label.modify_font(pango.FontDescription("monospace"))
        self.menu_rfustat_img = b.get_object('menu_rfustat_img')
        self.status = b.get_object('status')
        self.log_buffer = b.get_object('log_buffer')
        self.log_view = b.get_object('log_view')
        self.log_view.modify_font(pango.FontDescription("monospace 12"))
        self.log_scroll = b.get_object('log_box').get_vadjustment()
        self.context = self.status.get_context_id('SCBdo Meet')
        self.menu_race_close = b.get_object('menu_race_close')
        self.menu_race_abort = b.get_object('menu_race_abort')
        self.race_box = b.get_object('race_box')
        self.stat_but = b.get_object('race_stat_but')
        self.action_model = b.get_object('race_action_model')
        self.action_combo = b.get_object('race_action_combo')
        self.action_entry = b.get_object('race_action_entry')
        b.get_object('race_tab_img').set_from_file(scbdo.SCB_LOGOFILE)
        b.connect_signals(self)

        # run state
        self.running = True
        self.started = False
        self.curevent = None
        self.rfustat = False
        self.rfid_cb = None

        # format and connect status and log handlers
        f = logging.Formatter('%(levelname)s:%(name)s: %(message)s')
        self.sh = loghandler.statusHandler(self.status, self.context)
        self.sh.setLevel(logging.INFO)  # show info upon status bar
        self.sh.setFormatter(f)
        self.log.addHandler(self.sh)
        self.lh = loghandler.textViewHandler(self.log_buffer, self.log_view,
                                             self.log_scroll)
        self.lh.setLevel(logging.INFO)  # show info up in log view
        self.lh.setFormatter(f)
        self.log.addHandler(self.lh)

        # scrachpad buffer
        self.scratch_buf = b.get_object('scratch_buffer')
        self.scratch_idx = 0
        b.get_object('scratch_view').modify_font(
            pango.FontDescription("monospace 18"))

        # get rider db and pack into a dialog
        self.rdb = riderdb.riderdb()
        b.get_object('riders_box').add(
            self.rdb.mkview(cat=True, series=False, refid=True))

        # select event page in notebook.
        b.get_object('meet_nb').set_current_page(1)

        # get event db -> loadconfig makes event if not already made
        self.edb = eventdb.eventdb([])

        # start timer
        glib.timeout_add_seconds(1, self.timeout)
예제 #2
0
    def __init__(self, configpath=None, etype='rms'):
        """Meet constructor."""
        # logger and log handler
        self.log = logging.getLogger('scbdo')
        self.log.setLevel(logging.DEBUG)
        self.loghandler = None	# set in loadconfig to meet dir

        if etype not in ROADRACE_TYPES:
            etype = 'rms'	# Default is 'road mass start'
        self.etype = etype

        # meet configuration path and options
        if configpath is None:
            configpath = '.'	# None assumes 'current dir'
        self.configpath = configpath
        self.line1 = ''
        self.line2 = ''
        self.line3 = ''
        self.bibs_in_results = True
        self.cats_in_results = False
        self.distance = 20	# Race distance in km (integer!)
        self.logos = ''		# string list of logo filenames
        self.docindex = 0

        # printer preferences
        self.printprefs = gtk.PrintSettings()	# filled in with loadconfig

        # hardware connections
        self.timer = timy.timy()
        self.timer_port = ''
        self.rfu = wheeltime.wheeltime()
        self.rfu_addr = ''
        self.scb = uscbsrv.uscbsrv()

        b = gtk.Builder()
        b.add_from_file(os.path.join(scbdo.UI_PATH, 'roadmeet.ui'))
        self.window = b.get_object('meet')
        self.window.connect('key-press-event', self.key_event)
        self.clock = b.get_object('menu_clock')
        self.clock_label = b.get_object('menu_clock_label')
        self.clock_label.modify_font(pango.FontDescription("monospace"))
        self.menu_rfustat_img = b.get_object('menu_rfustat_img')
        self.status = b.get_object('status')
        self.log_buffer = b.get_object('log_buffer')
        self.log_view = b.get_object('log_view')
        self.log_view.modify_font(pango.FontDescription("monospace 12"))
        self.log_scroll = b.get_object('log_box').get_vadjustment()
        self.context = self.status.get_context_id('SCBdo Meet')
        self.menu_race_close = b.get_object('menu_race_close')
        self.menu_race_abort = b.get_object('menu_race_abort')
        self.race_box = b.get_object('race_box')
        self.stat_but = b.get_object('race_stat_but')
        self.action_model = b.get_object('race_action_model')
        self.action_combo = b.get_object('race_action_combo')
        self.action_entry = b.get_object('race_action_entry')
        b.get_object('race_tab_img').set_from_file(scbdo.SCB_LOGOFILE)
        b.connect_signals(self)

        # run state
        self.running = True
        self.started = False
        self.curevent = None
        self.rfustat = False
        self.rfid_cb = None

        # format and connect status and log handlers
        f = logging.Formatter('%(levelname)s:%(name)s: %(message)s')
        self.sh = loghandler.statusHandler(self.status, self.context)
        self.sh.setLevel(logging.INFO)	# show info upon status bar
        self.sh.setFormatter(f)
        self.log.addHandler(self.sh)
        self.lh = loghandler.textViewHandler(self.log_buffer,
                      self.log_view, self.log_scroll)
        self.lh.setLevel(logging.INFO)	# show info up in log view
        self.lh.setFormatter(f)
        self.log.addHandler(self.lh)

        # scrachpad buffer
        self.scratch_buf = b.get_object('scratch_buffer')
        self.scratch_idx = 0
        b.get_object('scratch_view').modify_font(
                                       pango.FontDescription("monospace 18"))

        # get rider db and pack into a dialog
        self.rdb = riderdb.riderdb()
        b.get_object('riders_box').add(self.rdb.mkview(cat=True,
                                                  series=False,refid=True))

        # select event page in notebook.
        b.get_object('meet_nb').set_current_page(1)

        # get event db -> loadconfig makes event if not already made
        self.edb = eventdb.eventdb([])

        # start timer
        glib.timeout_add_seconds(1, self.timeout)
예제 #3
0
    def __init__(self, configpath=None):
        """Meet constructor."""
        # logger and log handler
        self.log = logging.getLogger('scbdo')
        self.log.setLevel(logging.DEBUG)
        self.loghandler = None	# set in loadconfig to meet dir

        # meet configuration path and options
        if configpath is None:
            configpath = '.'	# None assumes 'current dir'
        self.configpath = configpath
        self.line1 = ''
        self.line2 = ''
        self.line3 = ''
        self.bibs_in_results = True
        self.showevno = True
        self.tracklen_n = 250	# numerator
        self.tracklen_d = 1	# d3nominator
        self.logos = ''		# string list of logo filenames

        # hardware connections
        self.scb = sender.sender('NULL')
        self.announce = uscbsrv.uscbsrv(80)
        self.scbport = 'NULL'
        self.annport = ''
        self.main_timer = timy.timy('', name='main')
        self.main_port = ''
        self.backup_timer = timy.timy('', name='bkup')
        self.backup_port = ''
        self.timer = self.main_timer

        b = gtk.Builder()
        b.add_from_file(os.path.join(scbdo.UI_PATH, 'trackmeet.ui'))
        self.window = b.get_object('meet')
        self.window.connect('key-press-event', self.key_event)
        self.clock = b.get_object('menu_clock')
        self.clock_label = b.get_object('menu_clock_label')
        self.clock_label.modify_font(pango.FontDescription("monospace"))
        self.status = b.get_object('status')
        self.log_buffer = b.get_object('log_buffer')
        self.log_view = b.get_object('log_view')
        self.log_view.modify_font(pango.FontDescription("monospace 9"))
        self.log_scroll = b.get_object('log_box').get_vadjustment()
        self.context = self.status.get_context_id('SCBdo Meet')
        self.menubut_main = b.get_object('menu_timing_main')
        self.menubut_backup = b.get_object('menu_timing_backup')
        self.menu_race_info = b.get_object('menu_race_info')
        self.menu_race_properties = b.get_object('menu_race_properties')
        self.menu_race_close = b.get_object('menu_race_close')
        self.menu_race_abort = b.get_object('menu_race_abort')
        self.race_box = b.get_object('race_box')
        self.new_race_pop = b.get_object('menu_race_new_types')
        b.connect_signals(self)

        # additional obs
        self.scbwin = None

        # run state
        self.running = True
        self.started = False
        self.curevent = None

        # format and connect status and log handlers
        f = logging.Formatter('%(levelname)s:%(name)s: %(message)s')
        self.sh = loghandler.statusHandler(self.status, self.context)
        self.sh.setLevel(logging.INFO)	# show info upon status bar
        self.sh.setFormatter(f)
        self.log.addHandler(self.sh)
        self.lh = loghandler.textViewHandler(self.log_buffer,
                      self.log_view, self.log_scroll)
        self.lh.setLevel(logging.INFO)	# show info up in log view
        self.lh.setFormatter(f)
        self.log.addHandler(self.lh)

        # get rider db and pack into scrolled pane
        self.rdb = riderdb.riderdb()
        b.get_object('rider_box').add(self.rdb.mkview())

        # get event db and pack into scrolled pane
        self.edb = eventdb.eventdb()
        b.get_object('event_box').add(self.edb.mkview())
        self.edb.view.connect('row-activated', self.event_row_activated_cb)
        self.edb.set_evno_change_cb(self.race_evno_change)

	# now, connect each of the race menu types if present in builder
        for etype in self.edb.racetypes:
            lookup = 'mkrace_' + etype.replace(' ', '_')
            mi = b.get_object(lookup)
            if mi is not None:
                mi.connect('activate', self.menu_race_make_activate_cb, etype)

        # start timers
        glib.timeout_add_seconds(1, self.menu_clock_timeout)
        glib.timeout_add(50, self.timeout)
예제 #4
0
파일: trackmeet.py 프로젝트: rijilks/scbdo
    def __init__(self, configpath=None):
        """Meet constructor."""
        # logger and log handler
        self.log = logging.getLogger('scbdo')
        self.log.setLevel(logging.DEBUG)
        self.loghandler = None  # set in loadconfig to meet dir

        # meet configuration path and options
        if configpath is None:
            configpath = '.'  # None assumes 'current dir'
        self.configpath = configpath
        self.line1 = ''
        self.line2 = ''
        self.line3 = ''
        self.bibs_in_results = True
        self.showevno = True
        self.tracklen_n = 250  # numerator
        self.tracklen_d = 1  # d3nominator
        self.logos = ''  # string list of logo filenames

        # hardware connections
        self.scb = sender.sender('NULL')
        self.announce = uscbsrv.uscbsrv(80)
        self.scbport = 'NULL'
        self.annport = ''
        self.main_timer = timy.timy('', name='main')
        self.main_port = ''
        self.backup_timer = timy.timy('', name='bkup')
        self.backup_port = ''
        self.timer = self.main_timer

        b = gtk.Builder()
        b.add_from_file(os.path.join(scbdo.UI_PATH, 'trackmeet.ui'))
        self.window = b.get_object('meet')
        self.window.connect('key-press-event', self.key_event)
        self.clock = b.get_object('menu_clock')
        self.clock_label = b.get_object('menu_clock_label')
        self.clock_label.modify_font(pango.FontDescription("monospace"))
        self.status = b.get_object('status')
        self.log_buffer = b.get_object('log_buffer')
        self.log_view = b.get_object('log_view')
        self.log_view.modify_font(pango.FontDescription("monospace 9"))
        self.log_scroll = b.get_object('log_box').get_vadjustment()
        self.context = self.status.get_context_id('SCBdo Meet')
        self.menubut_main = b.get_object('menu_timing_main')
        self.menubut_backup = b.get_object('menu_timing_backup')
        self.menu_race_info = b.get_object('menu_race_info')
        self.menu_race_properties = b.get_object('menu_race_properties')
        self.menu_race_close = b.get_object('menu_race_close')
        self.menu_race_abort = b.get_object('menu_race_abort')
        self.race_box = b.get_object('race_box')
        self.new_race_pop = b.get_object('menu_race_new_types')
        b.connect_signals(self)

        # additional obs
        self.scbwin = None

        # run state
        self.running = True
        self.started = False
        self.curevent = None

        # format and connect status and log handlers
        f = logging.Formatter('%(levelname)s:%(name)s: %(message)s')
        self.sh = loghandler.statusHandler(self.status, self.context)
        self.sh.setLevel(logging.INFO)  # show info upon status bar
        self.sh.setFormatter(f)
        self.log.addHandler(self.sh)
        self.lh = loghandler.textViewHandler(self.log_buffer, self.log_view,
                                             self.log_scroll)
        self.lh.setLevel(logging.INFO)  # show info up in log view
        self.lh.setFormatter(f)
        self.log.addHandler(self.lh)

        # get rider db and pack into scrolled pane
        self.rdb = riderdb.riderdb()
        b.get_object('rider_box').add(self.rdb.mkview())

        # get event db and pack into scrolled pane
        self.edb = eventdb.eventdb()
        b.get_object('event_box').add(self.edb.mkview())
        self.edb.view.connect('row-activated', self.event_row_activated_cb)
        self.edb.set_evno_change_cb(self.race_evno_change)

        # now, connect each of the race menu types if present in builder
        for etype in self.edb.racetypes:
            lookup = 'mkrace_' + etype.replace(' ', '_')
            mi = b.get_object(lookup)
            if mi is not None:
                mi.connect('activate', self.menu_race_make_activate_cb, etype)

        # start timers
        glib.timeout_add_seconds(1, self.menu_clock_timeout)
        glib.timeout_add(50, self.timeout)