1
0
Fork 0
mirror of synced 2024-06-26 10:11:19 +12:00

Option to disable notification after download

This commit is contained in:
Dummerle 2021-04-13 10:31:26 +02:00
parent 36fb3bf687
commit cbb2ba0ab8
2 changed files with 17 additions and 16 deletions

View file

@ -2,7 +2,7 @@ import datetime
from logging import getLogger
from multiprocessing import Queue as MPQueue
from PyQt5.QtCore import QThread, pyqtSignal, Qt
from PyQt5.QtCore import QThread, pyqtSignal, Qt, QSettings
from PyQt5.QtWidgets import QWidget, QMessageBox, QVBoxLayout, QLabel, QGridLayout, QProgressBar, QPushButton, QDialog, \
QListWidget, QHBoxLayout, QGroupBox
@ -193,16 +193,16 @@ class DownloadTab(QWidget):
pass
elif text == "finish":
self.installing_game.setText(self.tr("Download finished. Reload library"))
try:
from notifypy import Notify
except ModuleNotFoundError:
logger.warning("No Notification Module found")
else:
notification = Notify()
notification.title = self.tr("Installation finished")
notification.message = self.tr("Finished Download of game {}").format(self.active_game.app_title)
notification.send()
if QSettings().value("notification", True, bool):
try:
from notifypy import Notify
except ModuleNotFoundError:
logger.warning("No Notification Module found")
else:
notification = Notify()
notification.title = self.tr("Installation finished")
notification.message = self.tr("Finished Download of game {}").format(self.active_game.app_title)
notification.send()
# QMessageBox.information(self, "Info", "Download finished")
logger.info("Download finished: " + self.active_game.app_title)

View file

@ -71,11 +71,12 @@ class RareSettings(QScrollArea):
self.cloud_sync.stateChanged.connect(
lambda: self.settings.setValue(f"auto_sync_cloud", self.cloud_sync.isChecked()))
self.save_size = QCheckBox(self.tr("Save size"))
self.save_size.setChecked(self.settings.value("save_size", False, bool))
self.save_size_widget = SettingsWidget(self.tr("Save size of window after restart"), self.save_size)
self.layout.addWidget(self.save_size_widget)
self.save_size.stateChanged.connect(self.save_window_size)
self.show_notification = QCheckBox(self.tr("Show Notifications after Downloads"))
self.show_notification.setChecked(self.settings.value("notification", True, bool))
self.show_notification_widget = SettingsWidget(self.tr("Show notification"), self.show_notification)
self.layout.addWidget(self.show_notification_widget)
self.show_notification.stateChanged.connect(
lambda: self.settings.setValue("notification", self.show_notification.isChecked()))
self.save_size = QCheckBox(self.tr("Save size"))
self.save_size.setChecked(self.settings.value("save_size", False, bool))