コード例 #1
0
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()
コード例 #2
0
 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()
コード例 #3
0
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)
コード例 #4
0
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()
コード例 #5
0
    def notify(self, block=True, **kwargs):
        from notifypy import Notify
        notification = Notify()
        for key, value in kwargs.items():
            setattr(notification, key, value)

        notification.send(block=block)
コード例 #6
0
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"
                )
コード例 #7
0
ファイル: helper.py プロジェクト: sebwinte/cc2
 def __init__(self):
     Helper.valid_arguments_compression = ["low", "medium", "high"]
     Helper.valid_arguments_type = ["mp4", "webm", "ogv"]
     Helper.marker = "--"
     Helper.os = os.name
     self.notification = Notify(
         default_notification_icon=Path("./doc/logo.png"))
コード例 #8
0
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)
コード例 #9
0
def standard_message(lecture, time_left, logo):

    notification = Notify()
    notification.title = lecture
    notification.message = f'ლექციამდე დარჩენილია {time_left} საათი, არ დაგავიწყდეს BTU-სა და Google ქლასრუმებზე დავალების ნახვა.'
    notification.icon = logo
    notification.send()
コード例 #10
0
ファイル: shutdown_notify.py プロジェクト: danihodovic/dht
def shutdown_notify(minutes):
    """
    Sends a notification if there is a pending shutdown in N minutes
    from now.
    """
    systemd_shutdown_file = "/run/systemd/shutdown/scheduled"
    if not os.path.exists(systemd_shutdown_file):
        click.secho("No shutdown scheduled ✔️", fg="green")
        return

    with open(systemd_shutdown_file, "r") as f:
        content = f.read()
        usec_str = re.search(
            r"USEC=(\d+)",
            content,
        ).group(1)
        now_seconds = time.time()
        time_left_seconds = int(usec_str) / 10**6 - now_seconds
        time_left = timedelta(seconds=int(time_left_seconds))

        if timedelta(minutes=minutes) >= time_left:
            notification = Notify(
                default_notification_title="Pending shutdown",
                default_notification_message=(
                    "The system is scheduled for "
                    f"automatic shutdown in {time_left}.\n"
                    "Use shutdown -c to cancel."),
            )
            notification.send()
コード例 #11
0
	def __init__(self, db: DB, notification_title: str):
		self._db = db
		self._cancel_event = Event()
		self._thread = Thread(target=self._notification_loop)
		self._filter = TaskFilter(self.SLEEP_TIME)
		self._notification = Notify()
		self._notification.title = notification_title
コード例 #12
0
    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)
コード例 #13
0
 def __init__(self, my_dir, allow_renaming=False):
     self.dir = my_dir
     self.allow_renaming = allow_renaming
     self._db = Database(my_dir, observer=self)
     self._allowed_renames = []
     self._allowed_modifications = []
     self._notify = Notify(default_notification_application_name="RefMan")
コード例 #14
0
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)
コード例 #15
0
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()
コード例 #16
0
ファイル: send_notify.py プロジェクト: c0dejump/HawkScan
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()
コード例 #17
0
 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()
コード例 #18
0
ファイル: opm_notify.py プロジェクト: OPMUSER/opm-utilities
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)
コード例 #19
0
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
コード例 #20
0
 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)
コード例 #21
0
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()
コード例 #22
0
ファイル: helpers.py プロジェクト: tys-hiroshi/toggl-cli
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()
コード例 #23
0
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()
コード例 #24
0
 def __init__(self, api, crypto_coin):
     self.coingecko = api
     self.notification = Notify()
     self.crypto_coin = crypto_coin
     self.currency = 'usd'
     self.crypto = self.coingecko.get_price(ids=self.crypto_coin,
                                            vs_currencies=self.currency)
     self.title = f"{self.crypto_coin.title()} Current Price"
     self.message = f"The Current Price of {self.crypto_coin.title()} is {self.Price()}"
     self.notification.icon = icon
     self.notification.audio = sound
コード例 #25
0
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()
コード例 #26
0
ファイル: Main.py プロジェクト: Wakeel03/Robert-Assistant
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])
コード例 #27
0
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()
コード例 #28
0
ファイル: Timer.py プロジェクト: Ravi-2723/Timer
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()
コード例 #29
0
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")
コード例 #30
0
ファイル: loops.py プロジェクト: huantianad/LevelSync
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)