def watch_maildir(maildir): logger.info('watching "{}"'.format(maildir)) notify.init('mail notifier') watch_manager = pyinotify.WatchManager() handler = MailEventHandler(maildir=maildir) notifier = pyinotify.Notifier(watch_manager, handler) watch_manager.add_watch(maildir, pyinotify.IN_CREATE | pyinotify.IN_CLOSE_WRITE, rec=True) notifier.loop() logger.info('exit')
def __init__(self, server, port): self.user_name = raw_input("user name?") self.client = ReliableChatClient(self.user_name, (server, port)) self.ui = RallyCursesUI() # bind methods: self.ui.user_message = self.user_message self.client.data_changed = self.ui.render_chats self.client.new_content_message = self.ui.new_content_message # start-er-up: try: self.client.try_connect() notify.init("Rally") self.ui.start() self.ui.read_msgs() except KeyboardInterrupt: pass finally: self.ui.close()
def handle_new_comment(comment): comment_by_author = 'Comment created by {}'.format(comment.author.name) comment_url = 'https://old.reddit.com{}'.format(comment.permalink) print('# COMMENT #') print('Title: {}'.format(comment.submission.title)) print('Author: {}'.format(comment.author.name)) print('URL: {}'.format(comment_url)) print('Body: {}'.format(comment.body)) print() def open_subreddit_comment_cb(): return webbrowser.open_new_tab(comment_url) notify.init(icon='reddit.ico', callback=open_subreddit_comment_cb) notify.notify(body=comment_by_author, title=comment.submission.title, icon='reddit.ico', realtime=True, timeout=5, flags=notify.dwInfoFlags.NIIF_USER | notify.dwInfoFlags.NIIF_LARGE_ICON | notify.dwInfoFlags.NIIF_NOSOUND)
def __init__(self, server, port): self.user_name = raw_input('user name?') self.client = ReliableChatClient(self.user_name, (server, port)) self.ui = RallyCursesUI() #bind methods: self.ui.user_message = self.user_message self.client.data_changed = self.ui.render_chats self.client.new_content_message = self.ui.new_content_message #start-er-up: try: self.client.try_connect() notify.init('Rally') self.ui.start() self.ui.read_msgs() except KeyboardInterrupt: pass finally: self.ui.close()
def handle_new_submission(submission): submission_by_author = 'Submission created by {}'.format( submission.author.name) # There's no comments_url in Submission, so we manually create it through the ID. submission_url = 'https://old.reddit.com/r/Euroleague/comments/{}/'.format( submission.id) print('# SUBMISSION #') print('Title: {}'.format(submission.title)) print('Author: {}'.format(submission.author.name)) print('URL: {}'.format(submission_url)) print() def open_subreddit_submission_cb(): return webbrowser.open_new_tab(submission_url) notify.init(icon='reddit.ico', callback=open_subreddit_submission_cb) notify.notify(body=submission_by_author, title=submission.title, icon='reddit.ico', realtime=True, timeout=5, flags=notify.dwInfoFlags.NIIF_USER | notify.dwInfoFlags.NIIF_LARGE_ICON)
def __init__(self): self.ready = threading.Semaphore(0) self.ui_lock = threading.RLock() self.last_state = ([], {}) self.logger = get_logger(self) notify.init('Rally')
def sendmessage(title, message): notify.init("Test") notice = notify.Notification(title, message) notice.show() return
#test_notify.py #Copyright (C) 2011 Russell Cohen <*****@*****.**> # # This file is part of Rally. # # Rally is free software: you can redistribute it # and/or modify it under the terms of the GNU General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # Rally is distributed in the hope that it will be # useful, but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Rally. If not, see # <http://www.gnu.org/licenses/>. import notify notify.init('test') notify.send('test title', 'test message')
def set_default(index): for ident in config.config['user'][index]['sensor_controls']: config.sensors_control[ident].Control.SetDefault() def close(systray): config.terminate = True config.stop() os._exit(0) # Needed, so flask exits -.- def open_browser(systray): b = webbrowser.get('windows-default') b.open('http://localhost:9876') if config_moved: notify.init(str(Path.joinpath(folder, 'favicon.ico')), open_browser(None)) notify.notify( 'Your config file was broken. I renamed it to config.jsoncorrupt.json!', 'SuckControl', str(Path.joinpath(folder, 'favicon.ico')), False, 10, notify.dwInfoFlags.NIIF_USER | notify.dwInfoFlags.NIIF_LARGE_ICON) notify.uninit() menu_options = (('Open', None, open_browser), ) systray = SysTrayIcon(str(Path.joinpath(folder, 'favicon.ico')), 'SuckControl', menu_options, on_quit=close) systray.start() serve(app, port=9876)
def __init__(self, title=''): logging.Handler.__init__(self) self.title = title notify.init(self.title)
importlib.import_module(package) except ImportError: import subprocess subprocess.check_call([sys.executable, '-m', 'pip', 'install', package_pip]) finally: globals()[package] = importlib.import_module(package) def callback_from_icon(): pass install_and_import("notify","winnotify") import notify ICO='install_icon_155236.ico' notify.init(ICO, callback_from_icon) from utils import * from pathlib import Path import shutil from shutil import copyfileobj import traceback import distutils.dir_util import time import win32gui import subprocess import win32event import win32api from winerror import ERROR_ALREADY_EXISTS
import notify notify.init('test') notify.send('test title', 'test message')
def callback_from_icon(): print('Notification from icon clicked!') def callback_from_resource(): print('Notification from resource clicked!') def callback_from_buffer(): print('Notification from buffer clicked!') print('Initializing from icon: ', notify.init('python.ico', callback_from_icon)) time.sleep(3) print( 'Notifying from icon: ', notify.notify( 'This is a test notification from icon file.', 'Test #1', 'python.ico', False, 3, notify.dwInfoFlags.NIIF_USER | notify.dwInfoFlags.NIIF_LARGE_ICON)) time.sleep(5) print('Cleaning up: ', notify.uninit()) print('Initializing from resource: ', notify.init(('wmploc.dll', 29518), callback_from_resource)) time.sleep(3) print( 'Notifying from resource: ',
def build(self): notify.init("Posture Tracker") return sm
def _notify(self, msg): if self.notice: notify.init("SQRL") n = notify.Notification("pySQRL", msg) n.show()