예제 #1
0
 def notify_failed(self, timer):
     """Notify the desktop environment that a system backup has failed."""
     if self.notifications_enabled:
         body = "Backup failed after %s! Review the system logs for details." % timer
         notify_desktop(summary="System backups",
                        body=body,
                        urgency='critical')
예제 #2
0
 def test_notify_desktop(self):
     """Test that :func:`proc.notify.notify_desktop()` works."""
     env = dict((name, 'value') for name in REQUIRED_VARIABLES)
     with ExternalCommand('sleep 60', environment=env):
         with MockProgram('notify-send'):
             notify_desktop(
                 summary="Headless notifications",
                 body=
                 "They actually work! (this message brought to you by the 'proc' test suite :-)",
                 urgency='low',
             )
예제 #3
0
 def notify_finished(self, timer):
     """Notify the desktop environment that a system backup has finished."""
     if self.notifications_enabled:
         body = "Finished backup in %s." % timer
         notify_desktop(summary="System backups", body=body)
예제 #4
0
 def notify_starting(self):
     """Notify the desktop environment that a system backup is starting."""
     if self.notifications_enabled:
         body = "Starting dry-run" if self.dry_run else "Starting backup"
         notify_desktop(summary="System backups", body=body)