1
0
Fork 0
mirror of synced 2024-07-02 21:20:54 +12:00
Rare/rare/utils/models.py
Stelios Tsampas b0ec5c5fcb Move all download preparations inside InstallDialog.
InstallDialog now returns a InstallQueueItemModel ready
to be downloaded or queued.

Renamed a few model attributes to match legendary's names.

InstallDialog can be run silently for auto-downloads.
2021-05-25 23:52:25 +03:00

37 lines
1.3 KiB
Python

import os
class InstallOptionsModel:
def __init__(self, app_name: str, path: str = os.path.expanduser("~/legendary"),
max_workers: int = os.cpu_count() * 2, repair: bool = False, dl_only: bool = False,
ignore_space_req: bool = False, force: bool = False, sdl_list: list = ['']
):
self.app_name = app_name
self.path = path
self.max_workers = max_workers
self.repair = repair
self.dl_only = dl_only
self.ignore_space_req = ignore_space_req
self.force = force
self.sdl_list = sdl_list
class InstallDownloadModel:
def __init__(self, dlmanager, analysis, game, igame, repair: bool, repair_file: str):
self.dlmanager = dlmanager
self.analysis = analysis
self.game = game
self.igame = igame
self.repair = repair
self.repair_file = repair_file
class InstallQueueItemModel:
def __init__(self, status_q=None, download: InstallDownloadModel = None, options: InstallOptionsModel = None):
self.status_q = status_q
self.download = download
self.options = options
def __bool__(self):
return (self.status_q is not None) and (self.download is not None) and (self.options is not None)