Downloads: Remove UNINSTALLING state on cancel
This commit is contained in:
parent
eaed611c5f
commit
497bdc08cc
2 changed files with 8 additions and 3 deletions
|
@ -182,7 +182,10 @@ class DownloadsTab(QWidget):
|
||||||
def __start_download(self, item: InstallQueueItemModel):
|
def __start_download(self, item: InstallQueueItemModel):
|
||||||
rgame = self.rcore.get_game(item.options.app_name)
|
rgame = self.rcore.get_game(item.options.app_name)
|
||||||
if not rgame.state == RareGame.State.DOWNLOADING:
|
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
|
# lk: invalidate the queue item in case the game was uninstalled
|
||||||
self.__requeue_download(InstallQueueItemModel(options=item.options))
|
self.__requeue_download(InstallQueueItemModel(options=item.options))
|
||||||
return
|
return
|
||||||
|
@ -331,12 +334,14 @@ class DownloadsTab(QWidget):
|
||||||
|
|
||||||
@pyqtSlot(UninstallOptionsModel)
|
@pyqtSlot(UninstallOptionsModel)
|
||||||
def __on_uninstall_dialog_closed(self, options: UninstallOptionsModel):
|
def __on_uninstall_dialog_closed(self, options: UninstallOptionsModel):
|
||||||
if options and options.accepted:
|
|
||||||
rgame = self.rcore.get_game(options.app_name)
|
rgame = self.rcore.get_game(options.app_name)
|
||||||
|
if options and options.accepted:
|
||||||
rgame.set_installed(False)
|
rgame.set_installed(False)
|
||||||
worker = UninstallWorker(self.core, rgame, options)
|
worker = UninstallWorker(self.core, rgame, options)
|
||||||
worker.signals.result.connect(self.__on_uninstall_worker_result)
|
worker.signals.result.connect(self.__on_uninstall_worker_result)
|
||||||
QThreadPool.globalInstance().start(worker)
|
QThreadPool.globalInstance().start(worker)
|
||||||
|
else:
|
||||||
|
rgame.state = RareGame.State.IDLE
|
||||||
|
|
||||||
@pyqtSlot(RareGame, bool, str)
|
@pyqtSlot(RareGame, bool, str)
|
||||||
def __on_uninstall_worker_result(self, rgame: RareGame, success: bool, message: str):
|
def __on_uninstall_worker_result(self, rgame: RareGame, success: bool, message: str):
|
||||||
|
|
Loading…
Reference in a new issue