About window

This commit is contained in:
Vinicius Moreira
2019-06-27 12:13:18 -03:00
parent 713e97b93b
commit b2176cadda
9 changed files with 125 additions and 8 deletions

View File

@@ -7,6 +7,7 @@ from PyQt5.QtWidgets import QSystemTrayIcon, QMenu
from fpakman.core.controller import FlatpakManager
from fpakman.core import resource
from fpakman.view.qt.about import AboutDialog
from fpakman.view.qt.window import ManageWindow
@@ -44,10 +45,16 @@ class TrayIcon(QSystemTrayIcon):
self.setIcon(self.icon_default)
self.menu = QMenu()
self.action_manage = self.menu.addAction(self.locale_keys['tray.action.manage'])
self.action_manage.triggered.connect(self.show_manage_window)
self.action_about = self.menu.addAction(self.locale_keys['tray.action.about'])
self.action_about.triggered.connect(self.show_about)
self.action_exit = self.menu.addAction(self.locale_keys['tray.action.exit'])
self.action_exit.triggered.connect(lambda: QCoreApplication.exit())
self.setContextMenu(self.menu)
self.manage_window = ManageWindow(locale_keys=self.locale_keys, manager=self.manager, tray_icon=self)
@@ -55,6 +62,8 @@ class TrayIcon(QSystemTrayIcon):
self.check_thread.signal.connect(self.notify_updates)
self.check_thread.start()
self.dialog_about = AboutDialog(self.locale_keys)
def notify_updates(self, updates: int):
if updates > 0:
if self.icon().cacheKey() != self.icon_update.cacheKey():
@@ -82,3 +91,8 @@ class TrayIcon(QSystemTrayIcon):
self.manage_window.refresh()
self.manage_window.show()
def show_about(self):
if self.dialog_about.isHidden():
self.dialog_about.show()