Notification settings.

        :title: notification title
        :msg: notification message
        :icon_path: path to the .ico file to custom notification
        :duration: delay in seconds before notification self-destruction
975024
def show_toast(self, title="Notification", msg="Here comes the message",
                    icon_path=None, duration=5, threaded=False):
        
        if not threaded:
            self._show_toast(title, msg, icon_path, duration)
        else:
            if self.notification_active():
                # We have an active notification, let is finish so we don't spam them
                return False

            self._thread = threading.Thread(target=self._show_toast, args=(title, msg, icon_path, duration))
            self._thread.start()
        return True
759952
def alert(msg,body="",icon=None):
    
    if type(body) == str:
        body = body[:200]
    if call(["which","notify-send"]) == 0:
        if icon is not None:
            call(["notify-send",msg,"-i",icon,body])
        else:
            call(["notify-send",msg,body])
    else:
        print(("ALERT: ", msg))
787146
def notify(notification, value=None, unset_environment=False):
    

    if not isinstance(notification, Notification):
        raise TypeError("state must be an instance of Notification")

    state = notification.value

    if state.constant is not None and value:
        raise ValueError(
            "State %s should contain only constant value %r" % (state.name, state.constant),
            state.name, state.constant
        )

    line = "%s=%s" % (
        state.name,
        state.constant if state.constant is not None else state.type(value)
    )

    log.debug("Send %r into systemd", line)

    try:
        return sd_notify(line, unset_environment)
    except Exception as e:
        log.error("%s", e)
635179
def do_notification_update(mc, args):
    ''''''
    fields = {}
    fields['notification_id'] = args.id
    fields['name'] = args.name

    fields['type'] = args.type
    fields['address'] = args.address
    if not _validate_notification_period(args.period, args.type.upper()):
        return
    fields['period'] = args.period
    try:
        notification = mc.notifications.update(**fields)
    except (osc_exc.ClientException, k_exc.HttpError) as he:
        raise osc_exc.CommandError('%s\n%s' % (he.message, he.details))
    else:
        print(jsonutils.dumps(notification, indent=2))
1323137
def notify(self, instance=None, **kwargs):
        
        notified = {}
        for notification_cls in self.registry.values():
            notification = notification_cls()
            if notification.notify(instance=instance, **kwargs):
                notified.update({notification_cls.name: instance._meta.label_lower})
        return notified
1152171
def notify(title,
           message,
           auth_token,
           source=None,
           url=None,
           url_title=None,
           image=None,
           ttl=None,
           important=False,
           silent=False,
           retcode=None):
    

    data = {
        'Title': title,
        'Body': message,
        'AuthorizationToken': auth_token,
    }

    if source:
        data['Source'] = source
    if url:
        data['Link'] = url
    if url and url_title:
        data['LinkTitle'] = url_title
    if image:
        data['Image'] = image
    if ttl:
        data['TimeToLive'] = int(ttl)
    if important:
        data['IsImportant'] = 'True'
    if silent:
        data['IsSilent'] = 'True'

    headers = {'User-Agent': USER_AGENT}
    response = requests.post(PUSHALOT_API_URL, data=data, headers=headers)
    response.raise_for_status()
648074
def notify(self, msg='', title=None, delay=5000, image=''):
        '''
        '''
        if not msg:
            log.warning('Empty message for notification dialog')
        if title is None:
            title = self.addon.getAddonInfo('name')
        xbmc.executebuiltin('XBMC.Notification("%s", "%s", "%s", "%s")' %
                            (msg, title, delay, image))
286519
def notify_user(
        self,
        msg,
        level="error",
        rate_limit=None,
        module_name="",
        icon=None,
        title="py3status",
    ):
        
        dbus = self.config.get("dbus_notify")
        if dbus:
            # force msg, icon, title to be a string
            title = u"{}".format(title)
            msg = u"{}".format(msg)
            if icon:
                icon = u"{}".format(icon)
        else:
            msg = u"py3status: {}".format(msg)
        if level != "info" and module_name == "":
            fix_msg = u"{} Please try to fix this and reload i3wm (Mod+Shift+R)"
            msg = fix_msg.format(msg)
        # Rate limiting. If rate limiting then we need to calculate the time
        # period for which the message should not be repeated.  We just use
        # A simple chunked time model where a message cannot be repeated in a
        # given time period. Messages can be repeated more frequently but must
        # be in different time periods.

        limit_key = ""
        if rate_limit:
            try:
                limit_key = time.time() // rate_limit
            except TypeError:
                pass
        # We use a hash to see if the message is being repeated.  This is crude
        # and imperfect but should work for our needs.
        msg_hash = hash(u"{}#{}#{}#{}".format(module_name, limit_key, msg, title))
        if msg_hash in self.notified_messages:
            return
        elif module_name:
            log_msg = 'Module `%s` sent a notification. "%s: %s"' % (
                module_name,
                title,
                msg,
            )
            self.log(log_msg, level)
        else:
            self.log(msg, level)
        self.notified_messages.add(msg_hash)

        try:
            if dbus:
                # fix any html entities
                msg = msg.replace("&", "&amp;")
                msg = msg.replace("<", "&lt;")
                msg = msg.replace(">", "&gt;")
                cmd = ["notify-send"]
                if icon:
                    cmd += ["-i", icon]
                cmd += ["-u", DBUS_LEVELS.get(level, "normal"), "-t", "10000"]
                cmd += [title, msg]
            else:
                py3_config = self.config.get("py3_config", {})
                nagbar_font = py3_config.get("py3status", {}).get("nagbar_font")
                wm_nag = self.config["wm"]["nag"]
                cmd = [wm_nag, "-m", msg, "-t", level]
                if nagbar_font:
                    cmd += ["-f", nagbar_font]
            Popen(cmd, stdout=open("/dev/null", "w"), stderr=open("/dev/null", "w"))
        except Exception as err:
            self.log("notify_user error: %s" % err)
298540
function saveNotifications(options) {
            const defaults = {
                    dismissible: true,
                    location: 'bottom',
                    status: 'alert',
                    id: ObjectId.generate()
                },
                overrides = {
                    seen: false,
                    addedAt: moment().toDate()
                },
                notificationsToCheck = options.data.notifications;
            let addedNotifications = [];

            return _private.fetchAllNotifications()
                .then((allNotifications) => {
                    notificationsToCheck.forEach((notification) => {
                        const isDuplicate = allNotifications.find((n) => {
                            return n.id === notification.id;
                        });

                        if (!isDuplicate) {
                            addedNotifications.push(merge({}, defaults, notification, overrides));
                        }
                    });

                    const hasReleaseNotification = notificationsToCheck.find((notification) => {
                        return !notification.custom;
                    });

                    // CASE: remove any existing release notifications if a new release notification comes in
                    if (hasReleaseNotification) {
                        remove(allNotifications, (el) => {
                            return !el.custom;
                        });
                    }

                    // CASE: nothing to add, skip
                    if (!addedNotifications.length) {
                        return Promise.resolve();
                    }

                    const addedReleaseNotifications = addedNotifications.filter((notification) => {
                        return !notification.custom;
                    });

                    // CASE: only latest release notification
                    if (addedReleaseNotifications.length > 1) {
                        addedNotifications = addedNotifications.filter((notification) => {
                            return notification.custom;
                        });
                        addedNotifications.push(orderBy(addedReleaseNotifications, 'created_at', 'desc')[0]);
                    }

                    return SettingsAPI.edit({
                        settings: [{
                            key: 'notifications',
                            value: allNotifications.concat(addedNotifications)
                        }]
                    }, internalContext);
                })
                .then(() => {
                    return _private.publicResponse(addedNotifications);
                });
        }
426559
function () {
        var self = this, prefix = self.classPrefix, icon = '', closeButton = '', progressBar = '', notificationStyle = '';

        if (self.icon) {
          icon = '<i class="' + prefix + 'ico' + ' ' + prefix + 'i-' + self.icon + '"></i>';
        }

        if (self.color) {
          notificationStyle = ' style="background-color: ' + self.color + '"';
        }

        if (self.closeButton) {
          closeButton = '<button type="button" class="' + prefix + 'close" aria-hidden="true">\u00d7</button>';
        }

        if (self.progressBar) {
          progressBar = self.progressBar.renderHtml();
        }

        return (
          '<div id="' + self._id + '" class="' + self.classes + '"' + notificationStyle + ' role="presentation">' +
          icon +
          '<div class="' + prefix + 'notification-inner">' + self.state.get('text') + '</div>' +
          progressBar +
          closeButton +
          '</div>'
        );
      }
231019
def info(self, message):
        
        if Settings.InfoLogs:
            self._write_log("info", Settings.LogTime, message)
1155058
def notify_message(self, message, level="info", clear_if_dupl=True,
                       clear_in=CLEAR_NOTIF_BAR_MESSAGE_IN):
        
        with self.notifications_lock:
            if clear_if_dupl and message in self.message_widget_dict.keys():
                logger.debug("notification %r is already displayed", message)
                return
            logger.debug("display notification %r", message)
            widget = urwid.AttrMap(urwid.Text(message), "notif_{}".format(level))
        return self.notify_widget(widget, message=message, clear_in=clear_in)
661110
public void onNotificationsResumed() {
        isNotificationsPaused = false;

        // If there are notifications during pause
        if (notificationsDuringPause.size() > 0) {

            if (isAppVisible) {
                if (visiblePeer != null && notificationsDuringPause.containsKey(visiblePeer)) {

                    // If there was message from visible chat
                    if (isMobilePlatform) {

                        // Playing sound effects for mobile platforms
                        playEffectIfEnabled();
                    } else {

                        // Don't play sounds in chat on non-mobile platforms
                    }
                } else {

                    // If there are no messages from visible peer
                    if (isMobilePlatform) {

                        // Don't play sounds not from current chat on mobile platforms
                    } else {

                        // Find any suitable peer and if found play sound effect
                        for (Peer p : notificationsDuringPause.keySet()) {

                            if (isNotificationsEnabled(p, notificationsDuringPause.get(p))) {
                                playEffectIfEnabled();
                                break; // Can't do return because we need to make more work later
                            }
                        }
                    }
                }
            } else {

                // Just show out-app notification
                for (Peer p : notificationsDuringPause.keySet()) {

                    if (isNotificationsEnabled(p, notificationsDuringPause.get(p))) {
                        showNotification();
                        break;
                    }
                }
            }

            // Clearing of notifications
            notificationsDuringPause.clear();
        }
    }
1051469
function Notification({ avatarURL, message, time, unread }: Props): React.Node {
  return (
    <React.Fragment>
      {avatarURL && (
        <Avatar className="mr-3 align-self-center" imageURL={avatarURL} />
      )}
      <div>
        {message}
        {time && (
          <Text color="muted" size="small">
            {time}
          </Text>
        )}
      </div>
    </React.Fragment>
  );
}
543259
public void notifyEnd(String projectName, String projectVersion, String category, long duration) {
		try {
			if (isStarted()) {
				JSONObject endNotification = new JSONObject().
					put("project", new JSONObject().
						put("name", projectName).
						put("version", projectVersion)
					).
					put("category", category).
					put("duration", duration);
				
				socket.emit("run:end", endNotification);
			}
			else {
				LOGGER.warn("Minirox is not available to send the end notification");
			}
		}
		catch (Exception e) {
			LOGGER.info("Unable to send the end notification to MINI ROX. Cause: {}", e.getMessage());
			
			if (LOGGER.isDebugEnabled()) {
				LOGGER.debug("Exception: ", e);
			}
		}
	}
662459
def notification(
        self,
        topic_name,
        topic_project=None,
        custom_attributes=None,
        event_types=None,
        blob_name_prefix=None,
        payload_format=NONE_PAYLOAD_FORMAT,
    ):
        
        return BucketNotification(
            self,
            topic_name,
            topic_project=topic_project,
            custom_attributes=custom_attributes,
            event_types=event_types,
            blob_name_prefix=blob_name_prefix,
            payload_format=payload_format,
        )
1329067
def _show_toast(self, title, msg,
                    icon_path, duration):
        
        message_map = {WM_DESTROY: self.on_destroy, }

        # Register the window class.
        self.wc = WNDCLASS()
        self.hinst = self.wc.hInstance = GetModuleHandle(None)
        self.wc.lpszClassName = str("PythonTaskbar")  # must be a string
        self.wc.lpfnWndProc = message_map  # could also specify a wndproc.
        try:
            self.classAtom = RegisterClass(self.wc)
        except:
            pass #not sure of this
        style = WS_OVERLAPPED | WS_SYSMENU
        self.hwnd = CreateWindow(self.classAtom, "Taskbar", style,
                                 0, 0, CW_USEDEFAULT,
                                 CW_USEDEFAULT,
                                 0, 0, self.hinst, None)
        UpdateWindow(self.hwnd)

        # icon
        if icon_path is not None:
            icon_path = path.realpath(icon_path)
        else:
            icon_path =  resource_filename(Requirement.parse("win10toast"), "win10toast/data/python.ico")
        icon_flags = LR_LOADFROMFILE | LR_DEFAULTSIZE
        try:
            hicon = LoadImage(self.hinst, icon_path,
                              IMAGE_ICON, 0, 0, icon_flags)
        except Exception as e:
            logging.error("Some trouble with the icon ({}): {}"
                          .format(icon_path, e))
            hicon = LoadIcon(0, IDI_APPLICATION)

        # Taskbar icon
        flags = NIF_ICON | NIF_MESSAGE | NIF_TIP
        nid = (self.hwnd, 0, flags, WM_USER + 20, hicon, "Tooltip")
        Shell_NotifyIcon(NIM_ADD, nid)
        Shell_NotifyIcon(NIM_MODIFY, (self.hwnd, 0, NIF_INFO,
                                      WM_USER + 20,
                                      hicon, "Balloon Tooltip", msg, 200,
                                      title))
        # take a rest then destroy
        sleep(duration)
        DestroyWindow(self.hwnd)
        UnregisterClass(self.wc.lpszClassName, None)
        return None