Пример #1
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)
Пример #2
0
from notifypy import Notify

notification = Notify()
notification.title = "Moshi Moshi"
notification.message = "This is a message."
notification.icon = "../logo-rass.png"
notification.application_name = "Nofication from Rass"
notification._notification_icon = "../logo-rass.png"
notification.send()