1
0
Fork 0
mirror of synced 2024-06-28 11:11:15 +12:00

Download tab issues; Cleanup: use get_size from utils

This commit is contained in:
Dummerle 2021-04-17 10:50:25 +02:00
parent b71fe88eec
commit 20663f4992
4 changed files with 7 additions and 5 deletions

View file

@ -82,9 +82,9 @@ class App(QApplication):
self.tray_icon.exit_action.triggered.connect(lambda: exit(0))
self.tray_icon.start_rare.triggered.connect(self.mainwindow.show)
self.tray_icon.activated.connect(self.tray)
self.mainwindow.tab_widget.downloadTab.finished.connect(lambda: self.tray_icon.showMessage(
self.mainwindow.tab_widget.downloadTab.finished.connect(lambda update: self.tray_icon.showMessage(
self.tr("Download finished"), self.tr("Download finished. Game is playable now"),
QSystemTrayIcon.Information, 4000))
QSystemTrayIcon.Information, 4000) if update else None)
self.launch_dialog.close()
def tray(self, reason):

View file

@ -96,9 +96,9 @@ class TabWidget(QTabWidget):
self.setTabText(1, "Downloads" + ((" (" + str(downloads) + ")") if downloads != 0 else ""))
def start_download(self, options):
self.downloadTab.install_game(options)
downloads = len(self.downloadTab.dl_queue) + len(self.downloadTab.update_widgets.keys()) + 1
self.setTabText(1, "Downloads" + ((" (" + str(downloads) + ")") if downloads != 0 else ""))
self.downloadTab.install_game(options)
def resizeEvent(self, event):
self.tabBar().setMinimumWidth(self.width())

View file

@ -133,6 +133,7 @@ class DownloadTab(QWidget):
# Information
if not from_update:
if not InstallInfoDialog(dl_size=analysis.dl_size, install_size=analysis.install_size).get_accept():
self.finished.emit(False)
return
if self.active_game is None:

View file

@ -8,6 +8,7 @@ from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QFileDialog, QPushButt
from rare.components.tabs.settings.settings_widget import SettingsWidget
from rare.utils.extra_widgets import PathEdit
from custom_legendary.core import LegendaryCore
from rare.utils.utils import get_size
logger = getLogger("LegendarySettings")
@ -96,7 +97,7 @@ class LegendarySettings(QScrollArea):
after = self.core.lgd.get_dir_size()
logger.info(f'Cleanup complete! Removed {(before - after) / 1024 / 1024:.02f} MiB.')
if cleaned := (before-after) > 0:
QMessageBox.information(self, "Cleanup", self.tr("Cleanup complete! Successfully removed {} MB").format(round(cleaned / 1024 / 1024, 3)))
if (before-after) > 0:
QMessageBox.information(self, "Cleanup", self.tr("Cleanup complete! Successfully removed {}").format(get_size(before-after)))
else:
QMessageBox.information(self, "Cleanup", "Nothing to clean")