예제 #1
0
파일: hatariui.py 프로젝트: ggnkua/hatari
def main():
    info = UInfo()
    actions = UIActions()
    try:
        longopts = [
            "embed", "fullscreen", "nomenu", "help", "left=", "right=", "top=",
            "bottom=", "panel="
        ]
        opts, floppies = getopt.getopt(sys.argv[1:], "efnhl:r:t:b:p:",
                                       longopts)
        del longopts
    except getopt.GetoptError as err:
        usage(actions, err)

    menu = True
    embed = False
    fullscreen = False

    error = None
    for opt, arg in opts:
        print(opt, arg)
        if opt in ("-e", "--embed"):
            # GtkSocket window embedding needs both Python UI (Gtk3) and Hatari (SDL2) to run on X server
            if "DISPLAY" in os.environ and "WAYLAND_DISPLAY" not in os.environ:
                embed = True
            else:
                print(
                    "WARNING: ignoring embed option (Hatari window embedding works only under X11)"
                )
        elif opt in ("-f", "--fullscreen"):
            fullscreen = True
        elif opt in ("-n", "--nomenu"):
            menu = False
        elif opt in ("-h", "--help"):
            usage(actions)
        elif opt in ("-l", "--left"):
            error = actions.set_actions(arg, "left")
        elif opt in ("-r", "--right"):
            error = actions.set_actions(arg, "right")
        elif opt in ("-t", "--top"):
            error = actions.set_actions(arg, "top")
        elif opt in ("-b", "--bottom"):
            error = actions.set_actions(arg, "bottom")
        elif opt in ("-p", "--panel"):
            error = actions.add_panel(arg)
        else:
            assert False, "getopt returned unhandled option"
        if error:
            usage(actions, error)

    if len(floppies) > 1:
        usage(actions, "multiple floppy images given: %s" % str(floppies))
    if floppies:
        if not os.path.exists(floppies[0]):
            usage(actions, "floppy image '%s' doesn't exist" % floppies[0])

    actions.run(floppies, menu, fullscreen, embed)
예제 #2
0
def main():
    info = UInfo()
    actions = UIActions()
    try:
        longopts = ["embed", "fullscreen", "nomenu", "help",
            "left=", "right=", "top=", "bottom=", "panel="]
        opts, floppies = getopt.getopt(sys.argv[1:], "efnhl:r:t:b:p:", longopts)
        del longopts
    except getopt.GetoptError, err:
        usage(actions, err)
예제 #3
0
def main():
    info = UInfo()
    actions = UIActions()
    try:
        longopts = [
            "embed", "fullscreen", "nomenu", "help", "left=", "right=", "top=",
            "bottom=", "panel="
        ]
        opts, floppies = getopt.getopt(sys.argv[1:], "efnhl:r:t:b:p:",
                                       longopts)
        del longopts
    except getopt.GetoptError as err:
        usage(actions, err)

    menu = True
    embed = False
    fullscreen = False

    error = None
    for opt, arg in opts:
        print(opt, arg)
        if opt in ("-e", "--embed"):
            embed = True
        elif opt in ("-f", "--fullscreen"):
            fullscreen = True
        elif opt in ("-n", "--nomenu"):
            menu = False
        elif opt in ("-h", "--help"):
            usage(actions)
        elif opt in ("-l", "--left"):
            error = actions.set_actions(arg, "left")
        elif opt in ("-r", "--right"):
            error = actions.set_actions(arg, "right")
        elif opt in ("-t", "--top"):
            error = actions.set_actions(arg, "top")
        elif opt in ("-b", "--bottom"):
            error = actions.set_actions(arg, "bottom")
        elif opt in ("-p", "--panel"):
            error = actions.add_panel(arg)
        else:
            assert False, "getopt returned unhandled option"
        if error:
            usage(actions, error)

    if len(floppies) > 1:
        usage(actions, "multiple floppy images given: %s" % str(floppies))
    if floppies:
        if not os.path.exists(floppies[0]):
            usage(actions, "floppy image '%s' doesn't exist" % floppies[0])

    actions.run(floppies, menu, fullscreen, embed)
예제 #4
0
def main():
    import sys
    from hatari import Hatari
    hatariobj = Hatari()
    if len(sys.argv) > 1:
        if sys.argv[1] in ("-h", "--help"):
            print("usage: %s [hatari options]" % os.path.basename(sys.argv[0]))
            return
        args = sys.argv[1:]
    else:
        args = None
    hatariobj.run(args)

    info = UInfo()
    debugui = HatariDebugUI(hatariobj, True)
    debugui.window.show_all()
    gtk.main()
    debugui.save_options()