From 162f6bf7a598fc01f77164be98ae667bafbacaae Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sat, 24 Nov 2018 03:41:09 +0100 Subject: [PATCH] refactor tray menu: deduplicate --- src/vorta/tray_menu.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/vorta/tray_menu.py b/src/vorta/tray_menu.py index 96e8b25f..66a22eaf 100644 --- a/src/vorta/tray_menu.py +++ b/src/vorta/tray_menu.py @@ -17,14 +17,9 @@ class TrayMenu(QSystemTrayIcon): 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,6 +29,7 @@ class TrayMenu(QSystemTrayIcon): exit_action = menu.addAction("Exit") exit_action.triggered.connect(self.app.quit) + self.on_user_click() self.activated.connect(self.on_user_click) self.setContextMenu(menu)