예제 #1
0
파일: gameMan.py 프로젝트: SpyyZ158/BEE2.4
def add_game(_=None, refresh_menu=True):
    """Ask for, and load in a game to export to."""

    messagebox.showinfo(
        message='Select the folder where the game executable is located '
                '(portal2' + EXE_SUFFIX + ')...',
        parent=TK_ROOT,
        title='BEE2 - Add Game',
        )
    exe_loc = filedialog.askopenfilename(
        title='Find Game Exe',
        filetypes=[('Executable', '.exe')],
        initialdir='C:',
        )
    if exe_loc:
        folder = os.path.dirname(exe_loc)
        gm_id, name = find_steam_info(folder)
        if name is None or gm_id is None:
            messagebox.showinfo(
                message='This does not appear to be a valid game folder!',
                parent=TK_ROOT,
                icon=messagebox.ERROR,
                title='BEE2 - Add Game',
                )
            return False
        invalid_names = [gm.name for gm in all_games]
        while True:
            name = ask_string(
                prompt="Enter the name of this game:",
                title='BEE2 - Add Game',
                initialvalue=name,
                )
            if name in invalid_names:
                messagebox.showinfo(
                    icon=messagebox.ERROR,
                    parent=TK_ROOT,
                    message='This name is already taken!',
                    title='BEE2 - Add Game',
                    )
            elif name is None:
                return False
            elif name == '':
                messagebox.showinfo(
                    icon=messagebox.ERROR,
                    parent=TK_ROOT,
                    message='Please enter a name for this game!',
                    title='BEE2 - Add Game',
                    )
            else:
                break

        new_game = Game(name, gm_id, folder)
        new_game.edit_gameinfo(add_line=True)
        all_games.append(new_game)
        if refresh_menu:
            add_menu_opts(game_menu)
        save()
        return True
예제 #2
0
def add_game(_=None, refresh_menu=True):
    """Ask for, and load in a game to export to."""

    messagebox.showinfo(
        message='Select the folder where the game executable is located '
        '(portal2.exe)...',
        parent=TK_ROOT,
        title='BEE2 - Add Game',
    )
    exe_loc = filedialog.askopenfilename(
        title='Find Game Exe',
        filetypes=[('Executable', '.exe')],
        initialdir='C:',
    )
    if exe_loc:
        folder = os.path.dirname(exe_loc)
        gm_id, name = find_steam_info(folder)
        if name == "ERR" or gm_id == -1:
            messagebox.showinfo(
                message='This does not appear to be a valid game folder!',
                parent=TK_ROOT,
                icon=messagebox.ERROR,
                title='BEE2 - Add Game',
            )
            return False
        invalid_names = [gm.name for gm in all_games]
        while True:
            name = ask_string(
                prompt="Enter the name of this game:",
                title='BEE2 - Add Game',
            )
            if name in invalid_names:
                messagebox.showinfo(
                    icon=messagebox.ERROR,
                    parent=TK_ROOT,
                    message='This name is already taken!',
                    title='BEE2 - Add Game',
                )
            elif name is None:
                return False
            elif name == '':
                messagebox.showinfo(
                    icon=messagebox.ERROR,
                    parent=TK_ROOT,
                    message='Please enter a name for this game!',
                    title='BEE2 - Add Game',
                )
            else:
                break

        new_game = Game(name, gm_id, folder)
        new_game.edit_gameinfo(add_line=True)
        all_games.append(new_game)
        if refresh_menu:
            add_menu_opts(game_menu)
        save()
        return True
예제 #3
0
파일: gameMan.py 프로젝트: mariovct/BEE2.4
def add_game(e=None, refresh_menu=True):
    """Ask for, and load in a game to export to."""

    messagebox.showinfo(
        message=_('Select the folder where the game executable is located '
                  '({appname})...').format(appname='portal2' + EXE_SUFFIX),
        parent=TK_ROOT,
        title=_('BEE2 - Add Game'),
        )
    exe_loc = filedialog.askopenfilename(
        title=_('Find Game Exe'),
        filetypes=[(_('Executable'), '.exe')],
        initialdir='C:',
        )
    if exe_loc:
        folder = os.path.dirname(exe_loc)
        gm_id, name = find_steam_info(folder)
        if name is None or gm_id is None:
            messagebox.showinfo(
                message=_('This does not appear to be a valid game folder!'),
                parent=TK_ROOT,
                icon=messagebox.ERROR,
                title=_('BEE2 - Add Game'),
                )
            return False

        # Mel doesn't use PeTI, so that won't make much sense...
        if gm_id == utils.STEAM_IDS['MEL']:
            messagebox.showinfo(
                message=_("Portal Stories: Mel doesn't have an editor!"),
                parent=TK_ROOT,
                icon=messagebox.ERROR,
                title=_('BEE2 - Add Game'),
            )
            return False

        invalid_names = [gm.name for gm in all_games]
        while True:
            name = ask_string(
                prompt=_("Enter the name of this game:"),
                title=_('BEE2 - Add Game'),
                initialvalue=name,
                )
            if name in invalid_names:
                messagebox.showinfo(
                    icon=messagebox.ERROR,
                    parent=TK_ROOT,
                    message=_('This name is already taken!'),
                    title=_('BEE2 - Add Game'),
                    )
            elif name is None:
                return False
            elif name == '':
                messagebox.showinfo(
                    icon=messagebox.ERROR,
                    parent=TK_ROOT,
                    message=_('Please enter a name for this game!'),
                    title=_('BEE2 - Add Game'),
                    )
            else:
                break

        new_game = Game(name, gm_id, folder, {})
        new_game.edit_gameinfo(add_line=True)
        all_games.append(new_game)
        if refresh_menu:
            add_menu_opts(game_menu)
        save()
        return True
예제 #4
0
파일: gameMan.py 프로젝트: BenVlodgi/BEE2.4
def add_game(e=None, refresh_menu=True):
    """Ask for, and load in a game to export to."""

    messagebox.showinfo(
        message=_("Select the folder where the game executable is located " "({appname})...").format(
            appname="portal2" + EXE_SUFFIX
        ),
        parent=TK_ROOT,
        title=_("BEE2 - Add Game"),
    )
    exe_loc = filedialog.askopenfilename(
        title=_("Find Game Exe"), filetypes=[(_("Executable"), ".exe")], initialdir="C:"
    )
    if exe_loc:
        folder = os.path.dirname(exe_loc)
        gm_id, name = find_steam_info(folder)
        if name is None or gm_id is None:
            messagebox.showinfo(
                message=_("This does not appear to be a valid game folder!"),
                parent=TK_ROOT,
                icon=messagebox.ERROR,
                title=_("BEE2 - Add Game"),
            )
            return False

        # Mel doesn't use PeTI, so that won't make much sense...
        if gm_id == utils.STEAM_IDS["MEL"]:
            messagebox.showinfo(
                message=_("Portal Stories: Mel doesn't have an editor!"),
                parent=TK_ROOT,
                icon=messagebox.ERROR,
                title=_("BEE2 - Add Game"),
            )
            return False

        invalid_names = [gm.name for gm in all_games]
        while True:
            name = ask_string(prompt=_("Enter the name of this game:"), title=_("BEE2 - Add Game"), initialvalue=name)
            if name in invalid_names:
                messagebox.showinfo(
                    icon=messagebox.ERROR,
                    parent=TK_ROOT,
                    message=_("This name is already taken!"),
                    title=_("BEE2 - Add Game"),
                )
            elif name is None:
                return False
            elif name == "":
                messagebox.showinfo(
                    icon=messagebox.ERROR,
                    parent=TK_ROOT,
                    message=_("Please enter a name for this game!"),
                    title=_("BEE2 - Add Game"),
                )
            else:
                break

        new_game = Game(name, gm_id, folder)
        new_game.edit_gameinfo(add_line=True)
        all_games.append(new_game)
        if refresh_menu:
            add_menu_opts(game_menu)
        save()
        return True