1
0
Fork 0
mirror of synced 2024-06-29 11:40:37 +12:00

More fixes:

- remove widgets in dl tab after uninstalling
- fix verification error: worker was not started
This commit is contained in:
Dummerle 2021-11-22 20:09:05 +01:00
parent 72d05f6e53
commit 0c5bd642e3
No known key found for this signature in database
GPG key ID: AB68CC59CA39F2F1
6 changed files with 13 additions and 12 deletions

View file

@ -107,6 +107,8 @@ class DownloadTab(QWidget):
self.setLayout(self.layout) self.setLayout(self.layout)
self.signals.install_game.connect(self.get_install_options) self.signals.install_game.connect(self.get_install_options)
self.signals.game_uninstalled.connect(self.queue_item_removed)
self.signals.game_uninstalled.connect(self.remove_update)
def queue_item_removed(self, app_name): def queue_item_removed(self, app_name):
if w := self.update_widgets.get(app_name): if w := self.update_widgets.get(app_name):
@ -122,6 +124,10 @@ class DownloadTab(QWidget):
self.get_install_options(InstallOptionsModel(app_name=igame.app_name, update=True, silent=True)) self.get_install_options(InstallOptionsModel(app_name=igame.app_name, update=True, silent=True))
widget.update_button.setDisabled(True) widget.update_button.setDisabled(True)
def remove_update(self, app_name):
if w := self.update_widgets.get(app_name):
w.delete_later()
def update_dl_queue(self, dl_queue): def update_dl_queue(self, dl_queue):
self.dl_queue = dl_queue self.dl_queue = dl_queue

View file

@ -5,10 +5,8 @@ from PyQt5.QtGui import QImage, QPixmap
from PyQt5.QtWidgets import QStackedWidget, QVBoxLayout, QWidget from PyQt5.QtWidgets import QStackedWidget, QVBoxLayout, QWidget
import rare.shared as shared import rare.shared as shared
from legendary.models.game import Game, InstalledGame from legendary.models.game import InstalledGame
from rare.components.dialogs.uninstall_dialog import UninstallDialog
from rare.ui.components.tabs.games.games_tab import Ui_GamesTab from rare.ui.components.tabs.games.games_tab import Ui_GamesTab
from rare.utils import legendary_utils
from rare.utils.extra_widgets import FlowLayout from rare.utils.extra_widgets import FlowLayout
from rare.utils.utils import get_pixmap, download_image from rare.utils.utils import get_pixmap, download_image
from .cloud_save_utils import CloudSaveUtils from .cloud_save_utils import CloudSaveUtils
@ -123,14 +121,6 @@ class GamesTab(QStackedWidget, Ui_GamesTab):
i_widget.leaveEvent(None) i_widget.leaveEvent(None)
l_widget.update_text() l_widget.update_text()
def uninstall_game(self, game: Game):
infos = UninstallDialog(game).get_information()
if infos == 0:
return
legendary_utils.uninstall(game.app_name, self.core, infos)
self.setCurrentIndex(0)
self.update_list([game.app_name])
def show_import(self): def show_import(self):
self.setCurrentIndex(2) self.setCurrentIndex(2)
self.import_sync_tabs.show_import() self.import_sync_tabs.show_import()

View file

@ -76,6 +76,7 @@ class GameInfo(QWidget, Ui_GameInfo):
verify_worker.signals.summary.connect(self.finish_verify) verify_worker.signals.summary.connect(self.finish_verify)
self.verify_progress.setValue(0) self.verify_progress.setValue(0)
self.verify_threads[self.game.app_name] = verify_worker self.verify_threads[self.game.app_name] = verify_worker
self.verify_pool.start(verify_worker)
def verify_staistics(self, progress): def verify_staistics(self, progress):
# checked, max, app_name # checked, max, app_name

View file

@ -67,6 +67,7 @@ class GameUtils(QObject):
if infos == 0: if infos == 0:
return False return False
legendary_utils.uninstall(game.app_name, self.core, infos) legendary_utils.uninstall(game.app_name, self.core, infos)
shared.signals.game_uninstalled.emit(app_name)
return True return True
def prepare_launch(self, app_name, offline: bool = False, skip_update_check: bool = False): def prepare_launch(self, app_name, offline: bool = False, skip_update_check: bool = False):

View file

@ -79,6 +79,9 @@ class VerifySignals(QObject):
class VerifyWorker(QRunnable): class VerifyWorker(QRunnable):
num: int = 0
total: int = 1 # set default to 1 to avoid DivisionByZero before it is initialized
def __init__(self, core, app_name): def __init__(self, core, app_name):
super(VerifyWorker, self).__init__() super(VerifyWorker, self).__init__()
self.core, self.app_name = core, app_name self.core, self.app_name = core, app_name

View file

@ -127,6 +127,6 @@ class Signals(QObject):
installation_finished = pyqtSignal(bool, str) installation_finished = pyqtSignal(bool, str)
update_gamelist = pyqtSignal(list) update_gamelist = pyqtSignal(list)
uninstall_game = pyqtSignal(Game) # deprecated game_uninstalled = pyqtSignal(str)
set_discord_rpc = pyqtSignal(str) # app_name of running game set_discord_rpc = pyqtSignal(str) # app_name of running game