Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
650c0c1cc4
|
@ -36,7 +36,8 @@ Using the exe file could cause errors
|
|||
|
||||
- For Arch Linux is an AUR package available: [rare-git](https://aur.archlinux.org/packages/rare-git)
|
||||
or [rare](https://aur.archlinux.org/packages/rare)
|
||||
- Other distributions have to install it with pip or clone the repo and install it manually: *python3 setup.py install*
|
||||
- For Debian-based Distros is a .deb package at the releases
|
||||
- Other distributions have to install it with pip or clone the repo and install it manually: *python3 setup.py install (--user)*
|
||||
|
||||
## Features
|
||||
|
||||
|
@ -51,6 +52,7 @@ Using the exe file could cause errors
|
|||
- Offline mode
|
||||
- More Translations (Need help)
|
||||
- More Information about Games
|
||||
More planned features are in projects
|
||||
|
||||
## Contributing
|
||||
There are more options to contribute.
|
||||
|
|
|
@ -1,26 +1,41 @@
|
|||
import os
|
||||
|
||||
from PyQt5.QtWidgets import QDialog, QFormLayout, QVBoxLayout, QSpinBox, QFileDialog, QLabel, QPushButton, QHBoxLayout
|
||||
from PyQt5.QtWidgets import QDialog, QFormLayout, QVBoxLayout, QSpinBox, QFileDialog, QLabel, QPushButton, QHBoxLayout, \
|
||||
QCheckBox
|
||||
|
||||
from Rare.utils.QtExtensions import PathEdit
|
||||
from custom_legendary.core import LegendaryCore
|
||||
|
||||
|
||||
class InstallDialog(QDialog):
|
||||
infos = 0
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, app_name, core: LegendaryCore, update=False):
|
||||
super(InstallDialog, self).__init__()
|
||||
self.layout = QVBoxLayout()
|
||||
|
||||
self.core = core
|
||||
self.game = self.core.get_game(app_name)
|
||||
self.form = QFormLayout()
|
||||
self.update_game = update
|
||||
self.layout.addWidget(QLabel(self.tr("<h3>Install {}</h3>").format(self.game.app_title)))
|
||||
default_path = os.path.expanduser("~/legendary")
|
||||
|
||||
# TODO read from config
|
||||
self.install_path_field = PathEdit(text=default_path, type_of_file=QFileDialog.DirectoryOnly)
|
||||
self.form.addRow(QLabel("Install directory"), self.install_path_field)
|
||||
if not update:
|
||||
self.install_path_field = PathEdit(text=default_path, type_of_file=QFileDialog.DirectoryOnly)
|
||||
self.form.addRow(QLabel("Install directory"), self.install_path_field)
|
||||
|
||||
self.max_workes = QSpinBox()
|
||||
self.form.addRow(QLabel(self.tr("Max workers (0: Default)")), self.max_workes)
|
||||
|
||||
self.force = QCheckBox()
|
||||
self.force.setChecked(False)
|
||||
self.form.addRow(QLabel(self.tr("Force download")), self.force)
|
||||
|
||||
self.ignore_free_space = QCheckBox()
|
||||
self.ignore_free_space.setChecked(False)
|
||||
self.form.addRow(QLabel(self.tr("Ignore free space (Warning!)")), self.ignore_free_space)
|
||||
|
||||
self.layout.addLayout(self.form)
|
||||
|
||||
self.ok_btn = QPushButton("Next")
|
||||
|
@ -42,7 +57,7 @@ class InstallDialog(QDialog):
|
|||
return self.infos
|
||||
|
||||
def ok(self):
|
||||
self.infos = self.install_path_field.text(), self.max_workes.value()
|
||||
self.infos = self.install_path_field.text() if not self.update_game else None, self.max_workes.value(), self.force.isChecked(), self.ignore_free_space.isChecked()
|
||||
self.close()
|
||||
|
||||
|
||||
|
@ -80,3 +95,4 @@ class InstallInfoDialog(QDialog):
|
|||
def cancel(self):
|
||||
self.accept = False
|
||||
self.close()
|
||||
|
||||
|
|
|
@ -148,7 +148,6 @@ class SyncWidget(QWidget):
|
|||
def change_path(self):
|
||||
path = PathInputDialog("Select directory", "Select savepath. Warning: Do not change if you are not sure",
|
||||
self.igame.save_path).get_path()
|
||||
print(path)
|
||||
if path != "":
|
||||
self.igame.save_path = path
|
||||
self.core.lgd.set_installed_game(self.igame.app_name, self.igame)
|
||||
|
|
|
@ -10,7 +10,7 @@ from PyQt5.QtCore import QThread, pyqtSignal, Qt
|
|||
from PyQt5.QtWidgets import QWidget, QMessageBox, QVBoxLayout, QLabel, QGridLayout, QProgressBar, QPushButton, QDialog, \
|
||||
QListWidget, QHBoxLayout
|
||||
|
||||
from Rare.Components.Dialogs.InstallDialog import InstallInfoDialog
|
||||
from Rare.Components.Dialogs.InstallDialog import InstallInfoDialog, InstallDialog
|
||||
from Rare.utils.Models import InstallOptions, KillDownloadException
|
||||
from custom_legendary.core import LegendaryCore
|
||||
from custom_legendary.downloader.manager import DLManager
|
||||
|
@ -190,7 +190,7 @@ class DownloadTab(QWidget):
|
|||
dlm, analysis, game, igame, repair, repair_file = self.core.prepare_download(
|
||||
app_name=options.app_name,
|
||||
base_path=options.path,
|
||||
force=False, # TODO allow overwrite
|
||||
force=options.force,
|
||||
no_install=options.download_only,
|
||||
status_q=status_queue,
|
||||
# max_shm=,
|
||||
|
@ -208,7 +208,7 @@ class DownloadTab(QWidget):
|
|||
# dl_timeout=,
|
||||
repair=options.repair,
|
||||
# repair_use_latest=,
|
||||
# ignore_space_req=,
|
||||
ignore_space_req=options.ignore_free_space,
|
||||
# disable_delta=,
|
||||
# override_delta_manifest=,
|
||||
# reset_sdl=,
|
||||
|
@ -226,6 +226,7 @@ class DownloadTab(QWidget):
|
|||
return
|
||||
|
||||
self.active_game = game
|
||||
self.installing_game_widget.setText(self.tr("Installing game: ")+self.active_game.app_title)
|
||||
self.thread = DownloadThread(dlm, self.core, status_queue, igame, options.repair, repair_file)
|
||||
self.thread.status.connect(self.status)
|
||||
self.thread.statistics.connect(self.statistics)
|
||||
|
@ -326,7 +327,11 @@ class DownloadTab(QWidget):
|
|||
|
||||
def update_game(self, app_name: str):
|
||||
print("Update ", app_name)
|
||||
self.install_game(InstallOptions(app_name))
|
||||
infos = InstallDialog(app_name, self.core, True).get_information()
|
||||
if infos != 0:
|
||||
path, max_workers, force, ignore_free_space = infos
|
||||
self.install_game(InstallOptions(app_name=app_name, max_workers=max_workers, path=path,
|
||||
force=force, ignore_free_space=ignore_free_space))
|
||||
|
||||
def repair(self):
|
||||
pass
|
||||
|
@ -339,7 +344,6 @@ class UpdateWidget(QWidget):
|
|||
super(UpdateWidget, self).__init__()
|
||||
self.core = core
|
||||
self.game = game
|
||||
print(self.game)
|
||||
|
||||
self.layout = QVBoxLayout()
|
||||
self.title = QLabel(self.game.title)
|
||||
|
|
|
@ -21,7 +21,7 @@ class BaseUninstalledWidget(QGroupBox):
|
|||
self.setContentsMargins(0, 0, 0, 0)
|
||||
|
||||
def install(self):
|
||||
infos = InstallDialog().get_information()
|
||||
infos = InstallDialog(self.game.app_name, self.core).get_information()
|
||||
if infos != 0:
|
||||
path, max_workers = infos
|
||||
self.install_game.emit(InstallOptions(app_name=self.game.app_name, max_workers=max_workers, path=path))
|
||||
path, max_workers, force, ignore_free_space = infos
|
||||
self.install_game.emit(InstallOptions(app_name=self.game.app_name, max_workers=max_workers, path=path, force=force, ignore_free_space=ignore_free_space))
|
||||
|
|
|
@ -36,11 +36,11 @@ class IconWidgetUninstalled(BaseUninstalledWidget):
|
|||
self.setLayout(self.layout)
|
||||
self.setFixedWidth(self.sizeHint().width())
|
||||
|
||||
def mousePressEvent(self, a0) -> None:
|
||||
def mousePressEvent(self, e) -> None:
|
||||
self.install()
|
||||
|
||||
def enterEvent(self, QEvent):
|
||||
def enterEvent(self, e):
|
||||
self.info_label.setText(self.tr("Install Game"))
|
||||
|
||||
def leaveEvent(self, QEvent):
|
||||
def leaveEvent(self, e):
|
||||
self.info_label.setText("")
|
||||
|
|
16
Rare/Main.py
16
Rare/Main.py
|
@ -1,3 +1,4 @@
|
|||
import configparser
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
@ -23,11 +24,22 @@ class App(QApplication):
|
|||
def __init__(self):
|
||||
super(App, self).__init__(sys.argv)
|
||||
# init Legendary
|
||||
self.core = LegendaryCore()
|
||||
try:
|
||||
self.core = LegendaryCore()
|
||||
except configparser.MissingSectionHeaderError as e:
|
||||
logger.warning(f"Config is corrupt: {e}")
|
||||
if config_path := os.environ.get('XDG_CONFIG_HOME'):
|
||||
path = os.path.join(config_path, 'legendary')
|
||||
else:
|
||||
path = os.path.expanduser('~/.config/legendary')
|
||||
with open(os.path.join(path, "config.ini"), "w") as config_file:
|
||||
config_file.write("[Legendary]")
|
||||
self.core = LegendaryCore()
|
||||
if not "Legendary" in self.core.lgd.config.sections():
|
||||
self.core.lgd.config.add_section("Legendary")
|
||||
self.core.lgd.save_config()
|
||||
|
||||
# set Application name for settings
|
||||
self.setApplicationName("Rare")
|
||||
self.setOrganizationName("Rare")
|
||||
settings = QSettings()
|
||||
|
@ -46,12 +58,14 @@ class App(QApplication):
|
|||
self.setStyleSheet(open(style_path + "RareStyle.qss").read())
|
||||
self.setWindowIcon(QIcon(style_path + "Logo.png"))
|
||||
|
||||
# launch app
|
||||
self.launch_dialog = LaunchDialog(self.core)
|
||||
self.launch_dialog.start_app.connect(self.start_app)
|
||||
self.launch_dialog.show()
|
||||
|
||||
def start_app(self):
|
||||
self.mainwindow = MainWindow(self.core)
|
||||
# close launch dialog after app widgets were created
|
||||
self.launch_dialog.close()
|
||||
|
||||
|
||||
|
|
|
@ -84,7 +84,12 @@ QLineEdit {
|
|||
|
||||
QCheckBox {
|
||||
color: #F0F0F0;
|
||||
background-color: none;
|
||||
}
|
||||
QCheckBox::indicator{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#list_widget {
|
||||
|
|
|
@ -4,13 +4,14 @@ import os
|
|||
class InstallOptions:
|
||||
def __init__(self, app_name: str, path: str = os.path.expanduser("~/legendary"),
|
||||
max_workers: int = os.cpu_count() * 2, repair: bool = False,
|
||||
download_only: bool = False, ignore_free_space: bool = False):
|
||||
download_only: bool = False, ignore_free_space: bool = False, force: bool = False):
|
||||
self.app_name = app_name
|
||||
self.path = path
|
||||
self.max_workers = max_workers
|
||||
self.repair = repair
|
||||
self.download_only = download_only
|
||||
self.ignore_free_space = ignore_free_space
|
||||
self.force = force
|
||||
|
||||
|
||||
class KillDownloadException(Exception):
|
||||
|
|
Loading…
Reference in a new issue