def show_notif(word, alert): #display notif Notify.init('Dictionary') notif = Notify.Notification.new(word, alert, 'dialog-information') notif.set_urgency(2) notif.show() #clean up Notify.uninit()
def notify2(name: str, var1: str, var2: str, action: str): summary = gActions.get(action) body = "\n{} {}".format(var1, var2) Notify.init('dev_notify') Notify.Notification.new( # summary summary.format(name), # message body "\n{} {}".format(var1, var2), # icon path "stuff", ).show() print("** NOTIFY2: {} - {}".format(summary, body))
def main(): indicator = Indicator() notify.init(indicator.app) ## keybinding keystr = "<Ctrl>bracketleft" ## keystr = "<Ctrl>l" kbd.init() kbd.bind(keystr, indicator.switch_state) ## dynamic indicator GObject.threads_init() signal.signal(signal.SIGINT, signal.SIG_DFL) subprocess.call(["xbindkeys", "-p"]) gtk.main() ## start an endless loop till quit
def __init__(self): self.notify_initialized = None if Notify: self.notify_initialized = Notify.init('SickChill')
import pgi import datetime import time import math import gh_contributions import threading from pgi.repository import Notify Notify.init('Github Streak Reminder') checked_hours = [] commited_today = False def send_reminder(title, message, urgency): n = Notify.Notification.new(title, message, 'dialog-information') n.set_urgency(urgency) n.show() def min_until_midnight(): now = datetime.datetime.now() tomorrow = datetime.datetime(now.year, now.month, now.day) + \ datetime.timedelta(1) return math.floor(abs(tomorrow - now).seconds / 60) def CheckContibutions(): global checked_hours global commited_today
from pgi.repository import Notify import requests from time import sleep import zmq from . import settings Notify.init("linknotify") context = zmq.Context() consumer_receiver = context.socket(zmq.PULL) consumer_receiver.connect(settings.SERVER) def main(): while True: data = consumer_receiver.recv_json() n = Notify.Notification.new("Link", data['url'], "notification-message-im") n.show() if __name__ == "__main__": main()
def __init__(self, app_name): self.app_name = app_name Notify.init(app_name)
# all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. import os from pypui import Application from pgi.repository import Gtk, GLib, Notify Notify.init("foobar") cur_dir = os.path.dirname(os.path.realpath(__file__)) index = os.path.join(cur_dir, "index.html") app = Application("myapp", index) app.set_title("Some Title") @app.register("fun") def fun(): notif = Notify.Notification.new("foo", "bar", "applications-games") notif.show() app.js.event1()
# coding: utf-8 # Requires pydbus and pgi to be installed via pip. # I think requires some stuff linux side that should already be installed, such # as python-gobject and libnotify-bin from pgi.repository import Notify Notify.init('Hello World') n = Notify.Notification.new("Hello, world!", "This is an example notification.", "dialog-information") n.show()
def __init__(self): super(Notifier, self).__init__() Notify.init("VOEvent Notifications")
def get_notifier(self): Notify.init('not') return Notify.Notification.new('', '', '')
import pgi pgi.require_version('Notify', '0.7') from pgi.repository import Notify Notify.init('Test') __notification_map = {} def create_or_update_notification(key, title, message, icon="", timeout=3000, urgency=0): if __notification_map.get(key, None) is None: __notification_map[key] = Notify.Notification.new(title, message, icon) notif = __notification_map[key] notif.update(title, message, icon) notif.set_timeout(timeout) notif.set_urgency(urgency) notif.show()
import asyncio import logging.config from asyncio import StreamReader, StreamWriter from time import sleep once = True linux, windows = (None, ) * 2 try: import pgi as linux linux.install_as_gi() linux.require_version('Notify', '0.7') from pgi.repository import Notify Notify.init('Client Notifier') except ImportError: linux, Notify = (None, ) * 2 if not linux: try: import win10toast as windows except ImportError: windows = None if linux: def get_icon(state): _state = state.lower() if _state == 'error': return 'dialog-error'
# setup app settings from db BROKER = get_setting("default-broker") PORT = str(get_setting("port")) SIZE = (get_setting("window-width"), get_setting("window-height")) print(SIZE) # notify function for linux if current_os.lower() == "linux": import pgi pgi.require_version('Notify', '0.7') from pgi.repository import Notify Notify.init("MQTT-Client") @eel.expose def notify(msg, head, ul=1, icon_file=jarvis_icon): notification = Notify.Notification.new(head, f"<i>{msg}</i>", icon_file) notification.set_urgency(ul) notification.show() # notify function for windows elif current_os.lower() == "windows": import win10toast as wtt toaster = wtt.ToastNotifier() @eel.expose
import pgi pgi.require_version('Notify', '0.7') from pgi.repository import Notify Notify.init("Test Notifier") class DisplayNotification(object): def __init__(self, reputation): self.rep = reputation notification = Notify.Notification.new( "Your Reputation \n", self.rep + "\n", "Bronze", ) notification.show()
from bs4 import BeautifulSoup from datetime import datetime import urllib.request import os import time import pgi pgi.require_version('Notify', '0.7') from pgi.repository import Notify Notify.init('pdl') def get_current_url(): with urllib.request.urlopen( 'http://www.poorlydrawnlines.com/') as pdl_site: data = pdl_site.read() soup = BeautifulSoup(data, features='html.parser') image = soup.find('figure', attrs={'class': 'wp-block-image'}).find('img') image_url = (image.attrs['src']) title = image_url.split('/')[-1].replace('.png', '') new_url = 'http://www.poorlydrawnlines.com/comic/' + title return new_url def notify_comic(url): notification = Notify.Notification.new('New comic!', url, 'emblem-OK') notification.show()