1
0
Fork 0
mirror of https://github.com/borgbase/vorta synced 2025-01-03 13:45:49 +00:00

Merge pull request #52 from ThomasWaldmann/menu-profiles

tray menu: refactor and fix non-refresh issue
This commit is contained in:
Manuel Riel 2018-11-26 13:07:07 +08:00 committed by GitHub
commit 1075fcce3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,14 +17,9 @@ def __init__(self, parent=None):
self.status.setEnabled(False)
self.profile_menu = menu.addMenu('Backup Now')
for profile in BackupProfileModel.select():
new_item = self.profile_menu.addAction(profile.name)
new_item.setData(profile.id)
new_item.triggered.connect(lambda profile_id=profile.id: self.app.create_backup_action(profile_id))
self.cancel_action = menu.addAction("Cancel Backup")
self.cancel_action.triggered.connect(self.app.backup_cancelled_event.emit)
self.cancel_action.setVisible(False)
settings_action = menu.addAction("Settings")
settings_action.triggered.connect(self.app.open_main_window_action)
@ -34,7 +29,9 @@ def __init__(self, parent=None):
exit_action = menu.addAction("Exit")
exit_action.triggered.connect(self.app.quit)
self.activated.connect(self.on_user_click)
self.on_user_click()
# https://stackoverflow.com/questions/43657890/pyqt5-qsystemtrayicon-activated-signal-not-working
menu.aboutToShow.connect(self.on_user_click)
self.setContextMenu(menu)
self.setVisible(True)