예제 #1
0
 def notify(self, title, message, timeout=10):
     n = Notification(
         "{app} - {title}".format(app=self._app_name, title=title), message,
         pyinstaller_resource_path("icon.png"))
     n.timeout = timeout * 1000
     n.add_action("open", "Open App", self.open)
     n.show()
     self._notifications.append(n)
예제 #2
0
 def on_start(self):
     if self._should_run():
         self._run_command()
         self.finish_async()
     else:
         n = Notification(
             summary=str(self.command),
             message="Run now?",  # TODO include command name
             icon='dialog-question',
         )
         n.set_timeout(EXPIRES_NEVER)
         n.add_action("error", "<b>Run</b>",
                      lambda n, action: self._run_command(n))
         n.add_action("close", "Close", lambda n, action: n.close())
         n.connect('closed', lambda n: self.finish_async())
         n.show()