示例#1
0
def main():
    import srt_slave
    sys.argv.pop(0)
    sync = sys.argv.pop(0)
    fname = sys.argv[0]
    if sync.lower() == 'false':
        sync = False
    else:
        sync = True
    conn = get_passed_conns(gtype=JSONSock)[0]
    iface = srt_slave.new_iface(conn, sync)
    if sync:
        iface.wait_ready()
        iface.lock(wait=True)
    fname = path.abspath(fname)
    d = {"__file__": fname, "__name__": "__main__"}
    if "SRT_AUTOLOG_FILE" in os.environ:
        iface.record(os.environ["SRT_AUTOLOG_FILE"])
    try:
        os.chdir(path.dirname(fname))
    except:
        print_except()
    try:
        execfile(fname, d, d)
    except:
        import traceback
        iface.slave_error(fname, traceback.format_exc())
        print_except()
示例#2
0
def main():
    import srt_slave, srt_wkgtk
    from gi.repository import GLib, Gtk, GObject
    uri = sys.argv[1]
    try:
        os.chdir(sys.argv[2])
    except:
        pass
    conn = get_passed_conns(gtype=JSONSock)[0]
    iface = srt_slave.new_iface(conn, False)
    # TODO
    iface.slave.connect("quit", Gtk.main_quit)
    ui = srt_wkgtk.SrtUI(uri, {"IFace": iface})
    ui.show_all()
    Gtk.main()