def check_requirements_troubleshooting(dummy_var):
    """Show a modal popup with all the checked registry values for debugging purposes."""

    from utils.context import ignore_exceptions
    """Run all the registry checks. If any of them fails, raises TeamspeakNotInstalled()."""

    executable_path = addon_installer_path = install_location = config_location = \
        steam_path = arma_path = user_path = \
        '[color=FF0000]*** Cannot get data! ***[/color]'

    with ignore_exceptions(Exception):
        executable_path = teamspeak.get_executable_path()

    with ignore_exceptions(Exception):
        addon_installer_path = teamspeak.get_addon_installer_path()

    with ignore_exceptions(Exception):
        install_location = teamspeak.get_install_location()

    with ignore_exceptions(Exception):
        config_location = teamspeak.get_config_location()

    with ignore_exceptions(Exception):
        arma_path = Arma.get_installation_path()

    with ignore_exceptions(Exception):
        steam_path = steam.get_steam_exe_path()

    for _ in xrange(10):
        Logger.info('')

    message = textwrap.dedent('''
        All the fields below should point to a location on your drive.
        If one of those fields says "Cannot get data", it means a program is missing and
        must be installed.
        If ALL fields report "Cannot get data" it means something (an antivirus?) is
        actively blocking access to the registry and you must add an exception in this
        software for the launcher.

        {}

        TS executable path: {}
        TS addon installer path: {}
        TS install location: {}
        TS config flag: {}

        Arma location: {}

        Steam location: {}

        {}
        '''.format('*' * 70, executable_path, addon_installer_path,
                   install_location, config_location, arma_path, steam_path,
                   '*' * 70))
    Logger.info(message)

    box = MessageBox(message,
                     title='Launcher registry troubleshooting.',
                     markup=True,
                     on_dismiss=cancel_dismiss,
                     hide_button=True)
    box.open()

    return False
def check_requirements(verbose=True):
    """Check if all the required third party programs are installed in the system.
    Return True if the check passed.
    If verbose == true, show a message box in case of a failed check.
    """

    # TODO: move me to a better place
    try:
        teamspeak.check_installed()
    except teamspeak.TeamspeakNotInstalled as ex:
        if verbose:
            try:
                detailed_message = ex.args[0]
                detailed_message += '\n\n'

            except IndexError:
                detailed_message = ''

            message = textwrap.dedent('''
                Your Teamspeak installation is too old or not installed correctly.

                [color=FF0000]{}[/color][ref=https://www.teamspeak.com/downloads][color=3572b0]>> Click here to get Teamspeak <<[/color][/ref]

                (Re)Install Teamspeak and restart the launcher.
                ''').format(detailed_message)
            box = MessageBox(message,
                             title='Teamspeak required!',
                             markup=True,
                             on_dismiss=cancel_dismiss,
                             hide_button=True)
            box.open()

        return False

    try:
        steam.get_steam_exe_path()
    except steam.SteamNotInstalled:
        if verbose:
            message = textwrap.dedent('''
                Steam does not seem to be installed.
                Having Steam is required in order to play {}.

                [ref=http://store.steampowered.com/about/][color=3572b0]>> Click here to get Steam <<[/color][/ref]

                Install Steam and restart the launcher.
                '''.format(launcher_config.launcher_name))

            box = MessageBox(message,
                             title='Steam required!',
                             markup=True,
                             on_dismiss=cancel_dismiss,
                             hide_button=True)
            box.open()

        return False

    try:
        Arma.get_installation_path()
    except ArmaNotInstalled:
        if verbose:
            message = textwrap.dedent('''
                Cannot find Arma 3 installation directory.
                This happens after clicking "Verify integrity of game cache" on Steam.

                [b]To fix this problem you have to run the original Arma 3 launcher once
                or move this launcher directly to Arma 3 directory.
                Afterwards, restart this launcher.[/b]

                [ref=steam://run/107410][color=3572b0]>> Click here to run the Arma 3 launcher <<[/color][/ref]
                ''')

            box = MessageBox(message,
                             title='Arma 3 required!',
                             markup=True,
                             on_dismiss=cancel_dismiss,
                             hide_button=True)
            box.open()

        return False

    # Arma is not using the dev version
    # Note: we assume no 32/64bit forcing because the executables are at the same version anyway
    arma_path = os.path.join(Arma.get_installation_path(),
                             Arma.get_executable())
    Logger.info(
        'check_requirements: Checking for arma exe file version: {}'.format(
            arma_path))
    arma_version = exe_version_checker.get_version(arma_path)

    if not arma_version:
        Logger.error('check_requirements: Checking the file failed')
    else:
        Logger.info('Got version: {}'.format(arma_version))

        if arma_version.minor % 2:
            Logger.error(
                'check_requirements: The user is using the development branch of Arma!'
            )

            if verbose:
                message = textwrap.dedent('''
                    You seem to be using the Development Build of Arma!

                    You will not be able to connect to the game server while you are using
                    the Development Build.

                    To change this, open Steam and click:
                    Arma 3 -> Properties -> BETAS

                    Then, select "NONE - Opt out of all beta programs" and wait for the
                    game to finish downloading.

                    Afterwards, restart this launcher.[/b]
                    ''')

                box = MessageBox(message,
                                 title='Arma 3 Development Build detected!',
                                 markup=True,
                                 on_dismiss=cancel_dismiss,
                                 hide_button=True)
                box.open()

            return False

    return True