1
0
Fork 0
mirror of synced 2024-06-17 10:04:43 +12:00

Downloads: Remove UNINSTALLING state on cancel

This commit is contained in:
loathingKernel 2023-05-29 15:12:13 +03:00
parent eaed611c5f
commit 497bdc08cc
No known key found for this signature in database
GPG key ID: CE0C72D0B53821FD
2 changed files with 8 additions and 3 deletions

View file

@ -182,7 +182,10 @@ class DownloadsTab(QWidget):
def __start_download(self, item: InstallQueueItemModel):
rgame = self.rcore.get_game(item.options.app_name)
if not rgame.state == RareGame.State.DOWNLOADING:
logger.error(f"Can't start download {item.options.app_name} due to non-idle state {rgame.state}")
logger.error(
f"Can't start download {item.options.app_name}"
f"due to incompatible state {RareGame.State(rgame.state).name}"
)
# lk: invalidate the queue item in case the game was uninstalled
self.__requeue_download(InstallQueueItemModel(options=item.options))
return
@ -331,12 +334,14 @@ class DownloadsTab(QWidget):
@pyqtSlot(UninstallOptionsModel)
def __on_uninstall_dialog_closed(self, options: UninstallOptionsModel):
rgame = self.rcore.get_game(options.app_name)
if options and options.accepted:
rgame = self.rcore.get_game(options.app_name)
rgame.set_installed(False)
worker = UninstallWorker(self.core, rgame, options)
worker.signals.result.connect(self.__on_uninstall_worker_result)
QThreadPool.globalInstance().start(worker)
else:
rgame.state = RareGame.State.IDLE
@pyqtSlot(RareGame, bool, str)
def __on_uninstall_worker_result(self, rgame: RareGame, success: bool, message: str):

View file

@ -120,4 +120,4 @@ class UninstallOptionsModel:
"""
self.accepted = values[0]
self.keep_files = values[1]
self.keep_config = values[2]
self.keep_config = values[2]