示例#1
0
def main():
    """Run the application."""
    configpath = None

    # expand configpath on cmd line to realpath _before_ doing chdir
    if len(sys.argv) > 2:
        print(u'usage: voladisp [configdir]\n')
        sys.exit(1)
    elif len(sys.argv) == 2:
        rdir = sys.argv[1]
        if not os.path.isdir(rdir):
            rdir = os.path.dirname(rdir)
        configpath = os.path.realpath(rdir)

    metarace.init()
    if configpath is not None:
        os.chdir(configpath)
    app = voladisp(configpath)
    app.loadconfig()
    app.start()
    try:
        metarace.mainloop()
    except:
        app.shutdown(u'Exception from main loop.')
        raise
示例#2
0
def main():
    """Run the announce application."""
    metarace.init()
    app = rr_announce()
    app.loadconfig()
    app.show()
    app.start()
    try:
        metarace.mainloop()
    except:
        app.shutdown()
        raise
示例#3
0
def main():
    """Run the app locader."""
    configpath = None

    # check for a provided path
    if len(sys.argv) > 2:
        print(u'usage: metarace [configdir]\n')
        sys.exit(1)
    elif len(sys.argv) == 2:
        configpath = os.path.realpath(sys.argv[1])

    # load environ
    metarace.init()

    # check for user-supplied path
    app = None
    event = None
    callcreate = False
    if configpath is not None:
        if os.path.exists(configpath):  # assume the intent was to open
            event = event_identify(configpath)
            if event is not None:
                print(u'Loading ' + event[2] + u'...')
                if event[0] == u'track':
                    from metarace import trackmeet
                    app = trackmeet.trackmeet(configpath)
                    app.loadconfig()
                    app.window.show()
                    app.start()
                else:
                    from metarace import roadmeet
                    app = roadmeet.roadmeet(configpath, event[3])
                    app.loadconfig()
                    app.window.show()
                    app.start()
                print(u'Done.')
        else:
            # assume the intent was to create a new event,
            callcreate = True
            ## for now take no action
    if app is None:  # no event was loaded, so make an apploader
        app = apploader(configpath)
        app.show()
    try:
        metarace.mainloop()
    except:
        app.shutdown(u'Exception from main loop.')
        if app.subapp is not None:
            app.subapp.shutdown()
        raise
示例#4
0
def main():
    """Run the application."""
    configpath = None
    # expand config on cmd line to realpath _before_ doing chdir
    if len(sys.argv) > 2:
        print(u'usage: irtt_start [configdir]\n')
        sys.exit(1)
    elif len(sys.argv) == 2:
        configpath = os.path.realpath(os.path.dirname(sys.argv[1]))

    metarace.init()
    if configpath is not None:
        os.chdir(configpath)
    app = irtt_start()
    app.loadconfig()
    app.show()
    app.start()
    try:
        metarace.mainloop()
    except:
        app.shutdown()
        raise
示例#5
0
文件: rru.py 项目: amoydream/Metarace
    t.sane()
    return False


def dosync(t):
    t.sync()
    return False


if __name__ == "__main__":
    import metarace
    import gtk
    import time
    import random
    import json
    metarace.init()
    t = rru()
    lh = logging.StreamHandler()
    lh.setLevel(logging.DEBUG)
    lh.setFormatter(
        logging.Formatter("%(asctime)s %(levelname)s:%(name)s: %(message)s"))
    t.log.addHandler(lh)
    try:
        t.start()
        t.setport(u'/dev/ttyUSB0')

        t.setcb(printtag)
        glib.timeout_add_seconds(2, doconfig, t)
        glib.timeout_add_seconds(3, dosync, t)
        metarace.mainloop()
    except: