1
0
Fork 0
mirror of synced 2024-06-29 03:31:06 +12:00
Rare/rare/components/dialogs/uninstall_dialog.py
loathingKernel ee5adce18b Implement LgndrIndirectLogger to return the last logged message from LegendaryAPI
The indirect return is stored in a `LgndrIndirectStatus` object that provides checking and unpacking features

Lgndr: `LgndrInstallGameArgs.install_tag` default to None
Lgndr: add default `move` method.
Lgndr: monkeypatch `dlm.status_queue` after preparing a download to reduce `InstallQueueItemModel`
InstallOptionsModel: implement `as_install_kwargs` to pass only relevant arguments to `LgndrInstallGameArgs` in InstallDialog
InstallOptionsModel: rename `sdl_list` to `install_tag` as they were the same thing
LegendaryUtils: Update to use `LgndrIndirectStatus`
UninstallDialog: Add option to keep configuration decoupled from keeping game data
GameUtils: Add messagebox to show error messages from legendary after uninstalling a game
InstallDialog: Update to use `LgndrIndirectStatus`
InstallDialog: Update selectable download handling to match legendary's
DownloadThread: Remove multiple instance variables, instead reference them directly from `InstallQueueItemModel` instance
ImportGroup: Replace `info_label` with an `ElideLabel` for displaying long messages
ImportGroup: Don't translate message strings in the `ImportWorker`
GameInfo: Call `repair()` if needed after verification instead of handling it locally
GamesTab: Fix string matching for capitalized strings and scroll to top on when searching
2022-08-02 10:42:38 +03:00

63 lines
1.9 KiB
Python

from typing import Tuple
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import (
QDialog,
QLabel,
QVBoxLayout,
QCheckBox,
QHBoxLayout,
QPushButton,
)
from legendary.models.game import Game
from rare.utils.utils import icon
class UninstallDialog(QDialog):
def __init__(self, game: Game):
super(UninstallDialog, self).__init__()
self.setAttribute(Qt.WA_DeleteOnClose, True)
self.setWindowTitle("Uninstall Game")
layout = QVBoxLayout()
self.info_text = QLabel(
self.tr("Do you really want to uninstall <b>{}</b> ?").format(game.app_title)
)
layout.addWidget(self.info_text)
self.keep_files = QCheckBox(self.tr("Keep game files?"))
self.keep_config = QCheckBox(self.tr("Keep game configuation?"))
form_layout = QVBoxLayout()
form_layout.setContentsMargins(6, 6, 0, 6)
form_layout.addWidget(self.keep_files)
form_layout.addWidget(self.keep_config)
layout.addLayout(form_layout)
button_layout = QHBoxLayout()
self.ok_button = QPushButton(
icon("ei.remove-circle", color="red"), self.tr("Uninstall")
)
self.ok_button.clicked.connect(self.ok)
self.cancel_button = QPushButton(self.tr("Cancel"))
self.cancel_button.clicked.connect(self.cancel)
button_layout.addWidget(self.ok_button)
button_layout.addStretch(1)
button_layout.addWidget(self.cancel_button)
layout.addLayout(button_layout)
self.setLayout(layout)
self.options: Tuple[bool, bool, bool] = (False, False, False)
def get_options(self) -> Tuple[bool, bool, bool]:
self.exec_()
return self.options
def ok(self):
self.options = (True, self.keep_files.isChecked(), self.keep_config.isChecked())
self.close()
def cancel(self):
self.options = (False, False, False)
self.close()