From 99d8fa2d1e463a0824ef53a56bd39ba8b57c2402 Mon Sep 17 00:00:00 2001 From: Manu Date: Tue, 20 Nov 2018 09:04:11 +0800 Subject: [PATCH] Update profile names on menu open. Fixes #18 --- src/vorta/scheduler.py | 6 +++--- src/vorta/tray_menu.py | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/vorta/scheduler.py b/src/vorta/scheduler.py index 5b375d21..f85cea61 100644 --- a/src/vorta/scheduler.py +++ b/src/vorta/scheduler.py @@ -36,10 +36,10 @@ class VortaScheduler(QtScheduler): changed = True elif self.get_job(job_id) is not None and trigger is None: self.remove_job(job_id) - changed = True - notifier = VortaNotifications.pick()() - notifier.deliver('Vorta Scheduler', 'New schedule was successfully applied.') + if changed: + notifier = VortaNotifications.pick()() + notifier.deliver('Vorta Scheduler', 'New schedule was successfully applied.') @property def next_job(self): diff --git a/src/vorta/tray_menu.py b/src/vorta/tray_menu.py index 718844e8..96e8b25f 100644 --- a/src/vorta/tray_menu.py +++ b/src/vorta/tray_menu.py @@ -50,3 +50,9 @@ class TrayMenu(QSystemTrayIcon): self.status.setText(f'Next Task: {self.app.scheduler.next_job}') self.profile_menu.setEnabled(True) self.cancel_action.setVisible(False) + + self.profile_menu.clear() + 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))