コード例 #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 send(process=None, subject_format='{executable} process {pid} ended',
         timeout=notify2.EXPIRES_NEVER):
    """Display a Desktop Notification via DBUS (notify2)

    :param process: information about process. (.info() inserted into body)
    :param subject_format: subject format string. (uses process.__dict__)
    :param timeout: how long to display notification (milliseconds) default 0 (never expires)
    """
    notif = Notification(subject_format.format(**process.__dict__),
                         process.info())
    notif.timeout = timeout
    notif.show()