Beispiel #1
0
Datei: app.py Projekt: skral/rez
def run(opts=None, parser=None):
    context_files = []
    for path in (opts.FILE or []):
        if os.path.exists(path):
            if os.path.isfile(path):
                context_files.append(path)
            else:
                pass  # TODO: suites
        else:
            open(path)  # raise IOError

    main_window = MainWindow()
    app.set_main_window(main_window)
    main_window.show()

    for filepath in context_files:
        main_window.open_context(filepath)
    main_window.cascade()

    sys.exit(app.exec_())
Beispiel #2
0
def run(opts=None, parser=None):
    main_window = MainWindow()
    app.set_main_window(main_window)
    main_window.show()

    if opts.diff:
        # open context in diff mode against another
        context_files = get_context_files(opts.diff)
        subwindow = main_window.open_context_and_diff_with_file(*context_files)

        if subwindow:
            subwindow.showMaximized()
    else:
        # open contexts
        context_files = get_context_files(opts.FILE or [])
        for filepath in context_files:
            subwindow = main_window.open_context(filepath)

        if len(context_files) == 1:
            subwindow.showMaximized()
        else:
            main_window.cascade()

    sys.exit(app.exec_())