def on_sync_progress(self, progress, percentage):
        # Logger.debug('InstallScreen: syncing in progress')

        # Hide the status indicator when we are seeding because that was somehow confusing people :(
        if percentage != 1:
            self.view.ids.status_image.show()
        else:
            self.view.ids.status_image.hide()
        self._set_status_label(progress.get('msg'), progress.get('mods'))

        # By request: show an empty progress bar if seeding (progress == 100%)
        if percentage == 1:
            percentage = 0

        self.view.ids.progress_bar.value = percentage * 100

        tsplugin_request_action = progress.get('tsplugin_request_action')
        message_box = progress.get('message_box')
        if message_box:
            on_dismiss = None
            if tsplugin_request_action:
                on_dismiss = self.on_tsplugin_action

            message_box_instance = MessageBox(text=message_box['text'],
                                              title=message_box['title'],
                                              markup=message_box['markup'],
                                              on_dismiss=on_dismiss)
            message_box_instance.chain_open()
def run_the_game(mods,
                 ip=None,
                 port=None,
                 password=None,
                 teamspeak_urls=None,
                 battleye=True):
    """Run the game with the right parameters.
    Handle the exceptions by showing an appropriate message on error.
    """

    # Gathering data
    settings = kivy.app.App.get_running_app().settings
    custom_args = create_game_parameters()
    mission_file = get_mission_file_parameter()
    mod_dir = settings.get(
        'launcher_moddir'
    )  # Why from there? This should be in mod.parent_location but it isn't!

    mods_paths = []
    for mod in mods:
        mod_full_path = os.path.join(mod_dir, mod.foldername)
        mods_paths.append(mod_full_path)

    # Running all the programs
    ts_run_on_start = devmode.get_ts_run_on_start(default=True)
    if ts_run_on_start:
        if teamspeak_urls:
            if isinstance(teamspeak_urls, basestring):
                teamspeak.run_and_connect([teamspeak_urls])
            else:
                teamspeak.run_and_connect(teamspeak_urls)
    else:
        Logger.info(
            'Third party: Not running teamspeak because of devmode settings.')

    if settings.get('run_facetracknoir'):
        Logger.info('Third party: Trying to run FaceTrackNoIR...')
        headtracking.run_faceTrackNoIR()

    if settings.get('run_trackir'):
        Logger.info('Third party: Trying to run TrackIR...')
        headtracking.run_TrackIR()

    if settings.get('run_opentrack'):
        Logger.info('Third party: Trying to run Opentrack...')
        headtracking.run_opentrack()

    Logger.info('Third party: Running the game')
    try:
        _ = Arma.run_game(mod_list=mods_paths,
                          custom_args=custom_args,
                          ip=ip,
                          port=port,
                          password=password,
                          mission_file=mission_file,
                          battleye=battleye,
                          force_32bit='-win32' in custom_args,
                          force_64bit='-win64' in custom_args)
        # Note: although run_game returns an object, due to the way steam works,
        # it is unreliable. You never know whether it is the handle to Arma,
        # Steam or Arma's own launcher.
        # The only way to be sure is to analyze the process list :(

    except ArmaNotInstalled:
        text = "Arma 3 does not seem to be installed."
        no_arma_info = MessageBox(text, title='Arma not installed!')
        no_arma_info.chain_open()

    except steam.SteamNotInstalled:
        text = "Steam does not seem to be installed."
        no_steam_info = MessageBox(text, title='Steam not installed!')
        no_steam_info.chain_open()

    except OSError as ex:
        error_message = unicode_helpers.fs_to_u(ex.strerror)
        text = "Error while launching Arma 3:\n{}.".format(error_message)

        # Give a more specific error message in case of elevation required
        if ex.errno == errno.EINVAL and hasattr(
                ex, 'winerror') and ex.winerror == 740:
            # ex.winerror == winerror.ERROR_ELEVATION_REQUIRED
            text += textwrap.dedent('''

            Your Steam installation requires Administrator privileges to be run.
            Either run the launcher as Administrator or change required privileges of Steam.exe.

            (right click->properties->Compatibility->Run this program as an administrator)
            ''')

        error_info = MessageBox(text, title='Error while launching Arma 3!')
        error_info.chain_open()

    arma_may_be_running(newly_launched=True)