Add menu icon.

This commit is contained in:
Manu 2018-10-28 01:40:08 +08:00
parent 5906a4b0c2
commit 9866c27039
3 changed files with 19 additions and 1 deletions

View File

@ -51,3 +51,4 @@ $ pyinstaller --clean --noconfirm vorta.spec
- Licensed under GPLv3. See LICENSE.txt for details.
- Uses the excellent [BorgBackup](https://www.borgbackup.org)
- Based on PyQt and Qt.
- Icons by [FontAwesome](https://fontawesome.com)

BIN
vorta/UI/icons/hdd-o.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -1,8 +1,25 @@
import sys
from PyQt5.QtWidgets import QApplication
import os
from PyQt5.QtWidgets import QApplication, QSystemTrayIcon, QMenu, QAction
from PyQt5.QtGui import QIcon
from vorta.main import MainWindow
app = QApplication(sys.argv)
app.setQuitOnLastWindowClosed(False)
# Create the tray
tray = QSystemTrayIcon()
icon = QIcon(os.path.join(os.path.dirname(__file__), 'UI/icons/hdd-o.png'))
tray.setIcon(icon)
tray.setVisible(True)
# Create the menu
menu = QMenu()
action = QAction("A menu item")
menu.addAction(action)
# Add the menu to the tray
tray.setContextMenu(menu)
ex = MainWindow()
ex.show()
sys.exit(app.exec_())