Update profile names on menu open. Fixes #18

This commit is contained in:
Manu 2018-11-20 09:04:11 +08:00
parent efeac8fad1
commit 99d8fa2d1e
2 changed files with 9 additions and 3 deletions

View File

@ -36,10 +36,10 @@ class VortaScheduler(QtScheduler):
changed = True changed = True
elif self.get_job(job_id) is not None and trigger is None: elif self.get_job(job_id) is not None and trigger is None:
self.remove_job(job_id) self.remove_job(job_id)
changed = True
notifier = VortaNotifications.pick()() if changed:
notifier.deliver('Vorta Scheduler', 'New schedule was successfully applied.') notifier = VortaNotifications.pick()()
notifier.deliver('Vorta Scheduler', 'New schedule was successfully applied.')
@property @property
def next_job(self): def next_job(self):

View File

@ -50,3 +50,9 @@ class TrayMenu(QSystemTrayIcon):
self.status.setText(f'Next Task: {self.app.scheduler.next_job}') self.status.setText(f'Next Task: {self.app.scheduler.next_job}')
self.profile_menu.setEnabled(True) self.profile_menu.setEnabled(True)
self.cancel_action.setVisible(False) 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))