Esempio n. 1
0
def simple_downloader(url, destination, callback, callback_args=None):
    """Default downloader used for runners"""
    if not callback_args:
        callback_args = {}
    dialog = DownloadDialog(url, destination)
    dialog.run()
    return callback(**callback_args)
Esempio n. 2
0
def download_steam(downloader=None, callback=None, callback_data=None):
    """Downloads steam with `downloader` then calls `callback`"""
    steam_installer_path = os.path.join(settings.TMP_PATH, "SteamInstall.msi")
    if not downloader:
        dialog = DownloadDialog(STEAM_INSTALLER_URL, steam_installer_path)
        dialog.run()
    else:
        downloader(STEAM_INSTALLER_URL, steam_installer_path, callback,
                   callback_data)
    return steam_installer_path
Esempio n. 3
0
 def on_runner_installed(*args):
     config_path = system.create_folder("~/.atari800")
     bios_archive = os.path.join(config_path, "atari800-bioses.zip")
     dlg = DownloadDialog(self.bios_url, bios_archive)
     dlg.run()
     if not system.path_exists(bios_archive):
         ErrorDialog("Could not download Atari800 BIOS archive")
         return
     extract.extract_archive(bios_archive, config_path)
     os.remove(bios_archive)
     config = LutrisConfig(runner_slug="atari800")
     config.raw_runner_config.update({"bios_path": config_path})
     config.save()
     if callback:
         callback()
Esempio n. 4
0
 def install(self):
     success = super(atari800, self).install()
     if not success:
         return False
     config_path = os.path.expanduser("~/.atari800")
     if not os.path.exists(config_path):
         os.makedirs(config_path)
     bios_archive = os.path.join(config_path, 'atari800-bioses.zip')
     dlg = DownloadDialog(self.bios_url, bios_archive)
     dlg.run()
     if not os.path.exists(bios_archive):
         ErrorDialog("Could not download Atari800 BIOS archive")
         return
     extract_archive(bios_archive, config_path)
     os.remove(bios_archive)
     runner_config = LutrisConfig(runner='atari800')
     runner_config.config_type = 'runner'
     runner_config.runner_config = {'atari800': {'bios_path': config_path}}
     runner_config.save()
Esempio n. 5
0
    def install(self, version=None, downloader=None, callback=None):
        installer_path = get_steam_installer_dest()

        def on_steam_downloaded(*args):
            prefix = self.get_or_create_default_prefix()
            self.msi_exec(installer_path,
                          quiet=True,
                          prefix=prefix,
                          wine_path=self.get_executable(),
                          working_dir="/tmp",
                          blocking=True)
            if callback:
                callback()

        if downloader:
            downloader(STEAM_INSTALLER_URL, installer_path, on_steam_downloaded)
        else:
            dialog = DownloadDialog(STEAM_INSTALLER_URL, installer_path)
            dialog.run()
            on_steam_downloaded()