def notify(self, title, description, duration=5): notification = Notify() notification.title = title notification.message = description notification.icon = "./assets/image/icon.png" notification.audio = "./assets/audio/notification.wav" notification.send()
def bildirim(self, baslik=None, icerik=None, gorsel=None) -> None: if platform.machine( ) == "aarch64" or self.kullanici_adi == "gitpod" or self.bellenim_surumu.split( '-')[-1] == 'aws': return dizin = os.getcwd() konum = dizin.split( "\\") if self.isletim_sistemi == "Windows" else dizin.split("/") dosya_adi = f"~/../{konum[-2]}/{konum[-1]}/{sys.argv[0]}" ayrac = "/" if self.isletim_sistemi != "Windows" else "\\" kutuphane_dizin = Path(__file__).parent.resolve() _bildirim = Notify() _bildirim._notification_audio = f"{kutuphane_dizin}{ayrac}bildirim.wav" _bildirim._notification_application_name = dosya_adi if gorsel: if not gorsel.startswith("http"): _bildirim._notification_icon = f"{dizin}{ayrac}{gorsel}" else: foto_istek = requests.get(gorsel, stream=True) foto_istek.raw.decode_content = True with open(f"{kutuphane_dizin}{ayrac}gorsel.png", "wb") as dosya: copyfileobj(foto_istek.raw, dosya) _bildirim._notification_icon = f"{kutuphane_dizin}{ayrac}gorsel.png" _bildirim.title = baslik or self.pencere_basligi _bildirim.message = icerik or self.bildirim_metni _bildirim.send(block=False)
def Notificacion(opciones): """ Muestra una notificacion de Escritorio texto -> str Texto de la notificacion titulo -> str Titulo de la notificacion icono -> str direcion del icono icono_relativo -> bool direcion del icono dentro de folder config """ if "texto" in opciones: Texto = opciones["texto"] Noti = Notify() Noti.message = Texto Noti.application_name = "ElGatoALSW" if "titulo" in opciones: Noti.title = opciones["titulo"] else: Noti.title = "ElGatoALSW" # TODO: Iconos relativo if "icono" in opciones: DirecionIcono = opciones["icono"] if "icono_relativo" in opciones: if opciones["icono_relativo"]: DirecionIcono = UnirPath(ObtenerFolderConfig, DirecionIcono) Noti.icon = DirecionIcono Noti.send()
def errorNotify(title, body): if thePlatform == "Linux" or thePlatform == "Darwin": from notifypy import Notify notif = Notify() notif.title = title notif.message = body notif.icon = "./icons/png/robloxnotif.png" notif.audio = path.realpath("./sounds/error.wav") notif.application_name = "robloxnotif" notif.send(block=True) elif thePlatform == "Windows": import win10toast from playsound import playsound toast = win10toast.ToastNotifier() toast.show_toast( title, body, duration=5, icon_path="./icons/robloxnotif.ico", threaded=True, sound=False, ) try: playsound(path.realpath("./sounds/error.wav")) except UnicodeDecodeError: pass while toast.notification_active(): sleep(0.1)
def upload_logic(filepath: PathLike, notify: bool, password: str, clipboard: bool): obj = MirrorAceConnection(getenv("MirAce_K"), getenv("MirAce_T")) if password is not None: req = trio.run(obj, filepath, password) else: req = trio.run(obj, filepath) if isinstance(req, Response): typer.echo(req.json()["result"]["url"]) if notify: notification = Notify() notification.title = f'{req.json()["result"]["name"]} has been uploaded.' notification.message = f"The link has been copied to your clipboard" notification.send() if clipboard: pyperclip.copy(req.json()["result"]["url"]) if isinstance(req, list): typer.echo( "File was too large for direct upload; it as been split into multiple files." ) with open("results.txt", "a+") as f: for line in req: typer.echo( f"{line.json()['result']['name']} : {line.json()['result']['url']}" ) f.write( f"{line.json()['result']['name']} : {line.json()['result']['url']}\n" )
def EnviarNotificacion(mensaje, audio): NotigicacionBase = Notify() NotigicacionBase.title = "Titulo" NotigicacionBase.message = mensaje if audio is not None: NotigicacionBase.audio = path.join(direcion, audio) NotigicacionBase.send()
def notify_popout(title=None, message=None, icon=sg.DEFAULT_BASE64_ICON, app_name=None): """ Show a notification popout window :param title: Title shown in the notification :param message: Message shown in the notification :param icon: Icon shown in the notification - defaults to PySimpleGUI icon. Should be a PNG file :param app_name: Application name shown in the notification """ if not hasattr(notify_popout, 'temp_files'): notify_popout.temp_files = [] notification = Notify() notification.title = title notification.message = message tmp = None if isinstance(icon, bytes): with tempfile.TemporaryFile(suffix='.png', delete=False) as tmp: tmp.write(base64.b64decode(icon)) tmp.close() notification.icon = tmp.name elif icon is not None: notification.icon = icon if app_name is not None: notification.application_name = app_name notification.send(block=False) if tmp is not None: notify_popout.temp_files.append(tmp.name)
def standard_message(lecture, time_left, logo): notification = Notify() notification.title = lecture notification.message = f'ლექციამდე დარჩენილია {time_left} საათი, არ დაგავიწყდეს BTU-სა და Google ქლასრუმებზე დავალების ნახვა.' notification.icon = logo notification.send()
def _notify(title: str, body: str, image: str = None) -> None: notification = Notify() notification.title = title notification.message = body notification.icon = image if image and os.path.exists(image) else app_icon notification.application_name = APP_NAME notification.send(block=False)
def Birthday_Today_Notification(First, Last, Age): notification = Notify() notification.title = f"{First} {Last}'s Birthday!!!" notification.message = f"{First} is turning {Age} today! Make sure to wish them a happy birthday!" notification.icon = "Images\BirthdayCakeIcon.png" notification.application_name = "Birthday Tracker" notification.audio = r"Images\NotificationSound.wav" notification.send()
def notification_send(title, message, config_dict, b_sound): notification = Notify() notification.title = title notification.message = message notification.icon = config_dict['PATH_NOTIF_ICON'] if b_sound: notification.audio = config_dict['PATH_NOTIF_SOUND'] notification.send()
def notify_scan_completed(): """ notify_scan_completed: Send a notification when the scan if finish (only works on Linux) """ notification = Notify() notification.title = "Hawkscan" notification.message = "Scan completed" notification.send()
def send_notification(self, title, message): if self.config.ENABLE_NOTIFICATIONS and sys.platform == 'win32': from notifypy import Notify notification = Notify() notification.title = title notification.message = message notification.application_name = "AzurLaneAutoScript" notification.icon = "assets/gooey/icon.ico" notification.send(block=False)
def opm_notify_main(): """Main function for Sending Notification Message to the Host Desktop The function is used in OPMRUN background scripts to send a status notification message to the host desktop, based on the augments supplied to the function, there are no parameters for this function. The function is used on a standalone basis and thus does not use the OPMRUN system variable directory. Augments -------- --title= : str The title to be used in the notification. If default with '' then 'OPMRUN Background Processing", will be used. --message= : dict The message to be displayed in the notification, should normally the job number and job name. --status= : int Status code used to display the icon in the notification set to one of the following: '' : for the default icon opmrun.png "0" : for pass and the opm_notify_pass.png icon "0" : for fail and the opm_notify_fail.png icon. Parameters ---------- None Returns ------- Issues notification message to the desktop. """ # # Read Arguments # title = '' message = '' pathdir = os.path.dirname(os.path.abspath(__file__)) icon = Path(pathdir) / 'opmrun.png' iconpass = Path(pathdir) / 'opmrun-pass.png' iconfail = Path(pathdir) / 'opmrun-fail.png' for cmd in sys.argv: if '--title=' in cmd: title = cmd.replace('--title=', '') if title is None: title = 'OPMRUN Background Processing' elif '--message=' in cmd: message = cmd.replace('--message=', '') elif '--status=' in cmd: status = cmd.replace('--status=', '') if status == '0': icon = iconpass elif status == '1': icon = iconfail notification = Notify() notification.application_name = 'OPMRUN Background Processing', notification.title = str(title) notification.message = str(message) notification.icon = icon notification.send(block=False)
def notification_send(title="Empty", message="No message", icon=""): notify = Notify() notify.title = title notify.message = message try: notify.icon = icon notify.send(block=False) except (exceptions.InvalidIconPath): pass
def notify(title="Event", message=None, location=None): """Send a system notification""" notification = Notify() notification.title = title notification.message = message if location: message += f"\nLocation: {location}" notification.icon = "./schedule.png" notification.audio = "./Polite.wav" notification.send()
def notify(title, text): """ this function will only work on OSX and needs to be extended for other OS @title string for notification title @text string for notification content """ notification = Notify() notification.title = title notification.message = text notification.icon = os.path.join(os.path.dirname(__file__), '..', 'assets', 'icon.png') notification.send()
def notify(message: str): """Notify with a given message.""" notification = Notify( default_notification_title="Remember", default_application_name="name", default_notification_icon=s.config.http_path, # default_notification_audio="" ) notification.message = message notification.send()
def send_notification(pub): """Sends notification to OS level notification server based on selected publication""" message = pub.bib['title'] + '\n' message += 'Read at -\n' message += pub.bib['url'] notification = Notify() notification.title = 'Your research paper pick for the day' notification.message = message notification.send()
def sendnofy(): #print(os.path.split(os.path.realpath(sys.argv[0]))) #print(os.getcwd()) # 运行路径在调用函数的 buffer 文件目录下 with open( 'E:\\spacemacs\\emacs26-3\\.emacs.d\\site-lisp\\notify\\Record.txt', 'r', encoding='utf-8') as f: notification = Notify() notification.title = f.readline() notification.message = f.readline() notification.icon = "E:\\spacemacs\\emacs26-3\\.emacs.d\\site-lisp\\notify\\logo.png" # notification.audio = "" notification.send()
def prompt_for_touch(): try: click.echo('Touch your YubiKey...', err=True) notification = Notify() notification.title = "Touch your yubikey" notification.message = "Touch your yubikey" notification.audio = os.path.join(os.path.dirname(__file__), "notification_sound.wav") notification.icon = os.path.join(os.path.dirname(__file__), "yubikey.png") notification.send() except Exception: sys.stderr.write("Touch your YubiKey...\n")
def notifier(): global timer_started, timer_running, clock_values timer_started = False timer_running = -1 clock_values = ['00','00','00'] n = Notify() n.title = "Timer" n.message = "Timer is over" n.audio = 'notification.wav' n.icon = 'timer.png' n.send()
def this_will_run_when_alarm_rings(alarm): if alarm[2] == 0: pass else: alarm_ = Alarms() time = alarm_.convert_to_12_hour_clock(minutes_from_minight=alarm[4]) notification = Notify() notification.title = alarm[1] notification.message = f"The time is {time[0]}:{time[1]} {time[2]}" notification.icon = "./Assets/Robert Logo.png" notification.audio = "./Assets/beep.wav" notification.send() alarm_.delete_alarm(alarm[0])
def error(message: str) -> None: """ Sends an error notification as well as log into the log file. """ logging.error(message) if enable_notifications is False: return notification = Notify() notification.title = "LevelSync Error!!!!" notification.message = message notification.icon = initial.bundled_path(os.path.join('res', 'icon.ico')) notification.send(block=True)
def notify_msg(self): notification = Notify() notification.title = self.currency message = str(self.rate) + "@ \n" + self.time notification.message = message try: notification.audio = self.tone notification.icon = self.indicator notification.send(block=False) except ( exceptions.InvalidAudioFormat, exceptions.InvalidIconPath, exceptions.InvalidAudioPath, ): pass
def input_handler(self): notPaused = True notif = Notify() notif.title = "Lavish's Keystrokes Thingy" while True: msg = self.s.recv(5024).decode() keystrokes = msg.split(" ") key = keystrokes[-2].split("(")[-1] if key == "esc" and keystrokes[-1][:-1] == 'up': if notPaused: notPaused = False notif.message = "Paused" notif.send() else: notPaused = True notif.message = "Unpaused" notif.send() if notPaused: if keystrokes[-1][:-1] == 'up': keyboard.release(key) elif keystrokes[-1][:-1] == 'down': keyboard.press(key) else: pass
def send_notification(title, text, icon_path): """Send notification out Args: title (str): Notification title text (str): Notification text icon_path (str): Path to icon shown in the notification """ notification = Notify() notification.title = title notification.message = text notification.application_name = 'NormCap ' + __version__ if icon_path: notification.icon = icon_path notification.send(block=False)
def find_product_match(self, wishlist_file=None): """If a match is found with the wishlist, a notification is created""" wish_list = WishList(wishlist_file).items notification = None product = self.get_product() for item in wish_list: if item.lower() in product['productName'].lower() or item.lower() in product['offerName'].lower(): notification = Notify() timeend = re.search("(\d\d:\d\d:\d\d)", product['dealEndDateTime']).group(1) message = f"Price: {product['price']} EUR \nDiscount: {product.get('discount','-')}% \nEnds: {timeend}" notification.title = product['productName'] notification.message = message return product, notification
def notification(message: str) -> None: """ Sends a normal notification. Args: message (set): Message to send. """ if message is None or enable_notifications is False: return notification = Notify() notification.title = "LevelSync" notification.message = message notification.icon = initial.bundled_path(os.path.join('res', 'samuraisword.ico')) notification.send(block=True)
def notifcation(title="test", message="test"): notification = Notify() notification.title = title notification.message = message sound = random_sound() setting = read_config() if setting[2] == "True": # True False - SOUND ON OFF if setting[3] == "default": # default random notification.audio = "sounds/" + "default.wav" if setting[3] == "random": # default random notification.audio = "sounds/" + sound if setting[4] == "True": # True False - Norifcarion ON OFF notification.icon = "images/icon.png" notification.send()