mirror of
https://github.com/borgbase/vorta
synced 2025-01-20 06:28:49 +00:00
Add menu icon.
This commit is contained in:
parent
5906a4b0c2
commit
9866c27039
3 changed files with 19 additions and 1 deletions
|
@ -51,3 +51,4 @@ $ pyinstaller --clean --noconfirm vorta.spec
|
||||||
- Licensed under GPLv3. See LICENSE.txt for details.
|
- Licensed under GPLv3. See LICENSE.txt for details.
|
||||||
- Uses the excellent [BorgBackup](https://www.borgbackup.org)
|
- Uses the excellent [BorgBackup](https://www.borgbackup.org)
|
||||||
- Based on PyQt and Qt.
|
- Based on PyQt and Qt.
|
||||||
|
- Icons by [FontAwesome](https://fontawesome.com)
|
||||||
|
|
BIN
vorta/UI/icons/hdd-o.png
Normal file
BIN
vorta/UI/icons/hdd-o.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
|
@ -1,8 +1,25 @@
|
||||||
import sys
|
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
|
from vorta.main import MainWindow
|
||||||
|
|
||||||
app = QApplication(sys.argv)
|
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 = MainWindow()
|
||||||
ex.show()
|
ex.show()
|
||||||
sys.exit(app.exec_())
|
sys.exit(app.exec_())
|
||||||
|
|
Loading…
Reference in a new issue