def notify(self):
     try:
         #this notification will pop up on ubuntu as well!'
         notification.notify(title="Kivy Notification",message="Plyer Up and Running!",
     app_name="kivy_test",app_icon="icon.png",timeout=10)
     except:
         print 'error notifiying'
Beispiel #2
0
    def build(self):
        if platform ==  "android":
            from android import AndroidService
            service = AndroidService('desire sensors service', 'running')
            service.start('service started')
            self.service = service

        status_page = StatusPage()
        accelerometer.enable()
        compass.enable()
        self.gps = gps
        self.gps.configure(on_location=self.on_gps_location,
                           on_status=self.on_gps_status)
        self.gps.start()

        notification.notify(title="Hello",message="Just Checking")
        #vibrator.vibrate(0.2)  # vibrate for 0.2 seconds
        print("Hello World")
        status_page.gps_data = self.gps_data

#        Clock.schedule_interval(status_page.update, 1.0 / 10.0) # 10H
        Clock.schedule_interval(status_page.update, 1.0) # 1Hz


        button=Button(text='Service',size_hint=(0.12,0.12))
        button.bind(on_press=self.callback)
        status_page.add_widget(button)

        switch = Switch()
        switch.bind(active=self.callback)
        status_page.add_widget(switch)
        return status_page
Beispiel #3
0
    def do_notify(self, repo):
        """
        Handles notifications.
        :param repo: Repo to generate a notification from
        """
        last_status = None
        current_status = None
        for i in self.last_info.values():
            last_status = i['result']

        for i in self.current_info.values():
            current_status = i['result']

        if all(a is not None for a in [last_status, current_status]):
            if last_status != current_status:
                message = str("Build for %s %s." % (repo, current_status))
                notification_dict = {'title': "Sempy",
                                     'message': message,
                                     'app_name': "Sempy",
                                     'timeout': 3}
                if platform == "win":
                    notification_dict['app_icon'] = join(dirname(realpath(__file__)), "res/" + current_status + ".ico")
                else:
                    notification_dict['app_icon'] = join(dirname(realpath(__file__)), "res/" + current_status + ".png")
                notification.notify(**notification_dict)
Beispiel #4
0
    def build(self):
        try:
            # Find home dir
            if platform == "android":
                _home = "/storage/emulated/0/Android/data/"
            else:
                _home = os.path.expanduser("~")
            # Check if there is a settings file there
            _config_path = os.path.join(_home, "se.optimalbpm.optimal_file_sync/config.txt")
            # Raise error if non existing config
            if not os.path.exists(_config_path):
                if not os.path.exists(os.path.join(_home, "se.optimalbpm.optimal_file_sync")):
                    os.mkdir(os.path.join(_home, "se.optimalbpm.optimal_file_sync"))
                if platform == "android":
                    copy("default_config_android.txt", _config_path)
                else:
                    copy("default_config_linux.txt", _config_path)

                notification.notify("Optimal File Sync Service", "First time, using default config.")

            self.settingsframe = SettingsFrame()
            self.settingsframe.init(_cfg_file=_config_path)
            return self.settingsframe
        except Exception as e:
            notification.notify("Optimal File Sync Service", "Error finding config :" + str(e))
Beispiel #5
0
 def notify(self, message):
     try:
         global notification, os
         if not notification:
             from plyer import notification
         icon = os.path.dirname(os.path.realpath(__file__)) + "/../../" + self.icon
         notification.notify("Electrum", message, app_icon=icon, app_name="Electrum")
     except ImportError:
         Logger.Error("Notification: needs plyer; `sudo pip install plyer`")
Beispiel #6
0
 def _finish_timer(self):
     self.timer_is_running = False
     try:
         notification.notify("Immersion Coffee Timer", "Coffee is ready.")
     except NotImplementedError:
         pass
     self.timer_display.text = "Done"
     alert(double_ding=True)
     self.start_pause_resume_button.text = "Start Timer"
Beispiel #7
0
 def notify(self, message):
     try:
         global notification, os
         if not notification:
             from plyer import notification
         icon = (os.path.dirname(os.path.realpath(__file__))
                 + '/../../' + self.icon)
         notification.notify('Electrum', message,
                         app_icon=icon, app_name='Electrum')
     except ImportError:
         Logger.Error('Notification: needs plyer; `sudo pip install plyer`')
Beispiel #8
0
 def do_notify(self, mode='normal'):
     kwargs = {'title': self.ids.notification_title.text,
               'message': self.ids.notification_text.text}
     if mode == 'fancy':
         kwargs['app_name'] = "Plyer Notification Example"
         if platform == "win":
             kwargs['app_icon'] = join(dirname(realpath(__file__)),
                                       'plyer-icon.ico')
             kwargs['timeout'] = 4
         else:
             kwargs['app_icon'] = join(dirname(realpath(__file__)),
                                       'plyer-icon.png')
     notification.notify(**kwargs)
Beispiel #9
0
def do_notify(message="",title="Notification"):

    """
    Notify a message with title and message
    """

    if PY2:
        title = title.decode('utf8')
        message = message.decode('utf8')
    kwargs = {'title': title, 'message': message}

    try:
        notification.notify(**kwargs)
    except:
        print "error on notify message:",title, message
Beispiel #10
0
    def do_notify(self, mode='normal'):
        if PY2:
            self.title = self.title.decode('utf8')
            self.message = self.message.decode('utf8')

        kwargs = {'title': self.title, 'message': self.message}
        if mode == 'fancy':
            kwargs['app_name'] = "Doviz App"
            if platform == "win":
                kwargs['app_icon'] = join(dirname(realpath(__file__)),
                                          'notfy.ico')
                kwargs['timeout'] = 4
            else:
                kwargs['app_icon'] = join(dirname(realpath(__file__)),
                                          'notfy.png')
        notification.notify(**kwargs)
Beispiel #11
0
def notify(title, message, bring_up=False):
    print title, message
    try:
        notification.notify(title, message)
        if system == 'Darwin':
            from AppKit import NSApp, NSApplication
            NSApplication.sharedApplication()
            app = NSApp()
            app.requestUserAttention_(0)  # this should bounce the icon
            # the 0 should be replaced by the NSRequestUserAttentionType.NSCriticalRequest
            # imported from NSApplication? TODO
            # https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSApplication_Class/Reference/Reference.html#//apple_ref/doc/c_ref/NSRequestUserAttentionType
            if bring_up:
                app.activateIgnoringOtherApps_(True)  # this should bring the app to the foreground
    except Exception as e:
        print e
        Logger.exception('Notification error:\n%s' % e)
Beispiel #12
0
 def emit(self, record):
     level = record.levelno
     message = self.format(record)
     if message.endswith('\n'):
         message = message[:-1]
     if level <= log.INFO:
         timeout = 10
     elif level <= log.WARNING:
         timeout = 15
     else:
         timeout = 60
     notification.notify(
         app_name=APPNAME,
         app_icon=APPICON,
         title=APPNAME,
         message=message,
         timeout=timeout,
     )
Beispiel #13
0
    def do_notify(self, mode='normal'):
        title = 'Goshen Notify'
        message = 'You Have A New Message'
        # ticker = self.ids.ticker_text.text
        if PY2:
            title = title.decode('utf8')
            message = message.decode('utf8')
        kwargs = {'title': title, 'message': message,}

        if mode == 'fancy':
            kwargs['app_name'] = "Plyer Notification Example"
            if platform == "win":
                kwargs['app_icon'] = join(dirname(realpath(__file__)),
                                          'tower.ico')
                kwargs['timeout'] = 4
            else:
                kwargs['app_icon'] = join(dirname(realpath(__file__)),
                                          'tower.png')
        notification.notify(**kwargs)
Beispiel #14
0
def notify(title, message, use_regex):
    bNotify = False
    if use_regex:
        for regex in guard_words:
            if regex.search(message):
                bNotify = True
                break
    else:
        bNotify = True

    if bNotify:
        app = App.get_running_app()
        icon = os.path.join(app.directory, app.icon)
        notification.notify(title=title, message=message,
                            timeout=timeout,
                            app_name=app.get_application_name(),
                            app_icon=icon)
        if sound is not None:
            sound.play()
Beispiel #15
0
def notify(title, message, bring_up=False):
    try:
        kwargs = {'title': title, 'message': message}
        if system == "Windows" or system == "Linux":
            kwargs['app_icon'] = os.path.abspath(get_icon_path())
            kwargs['timeout'] = 4
        notification.notify(**kwargs)
        if system == 'Darwin':
            from AppKit import NSApp, NSApplication
            NSApplication.sharedApplication()
            app = NSApp()
            app.requestUserAttention_(0)  # this should bounce the icon
            # the 0 should be replaced by the NSRequestUserAttentionType.NSCriticalRequest
            # imported from NSApplication? TODO
            # https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSApplication_Class/Reference/Reference.html#//apple_ref/doc/c_ref/NSRequestUserAttentionType
            if bring_up:
                app.activateIgnoringOtherApps_(True)  # this should bring the app to the foreground
    except Exception as e:
        print e
        Logger.exception('Notification error:\n%s' % e)
Beispiel #16
0
    def do_notify(self, mode='normal'):
        title = self.ids.notification_title.text
        message = self.ids.notification_text.text
        ticker = self.ids.ticker_text.text
        if PY2:
            title = title.decode('utf8')
            message = message.decode('utf8')
        kwargs = {'title': title, 'message': message, 'ticker': ticker}

        if mode == 'fancy':
            kwargs['app_name'] = "Plyer Notification Example"
            if platform == "win":
                kwargs['app_icon'] = join(dirname(realpath(__file__)),
                                          'plyer-icon.ico')
                kwargs['timeout'] = 4
            else:
                kwargs['app_icon'] = join(dirname(realpath(__file__)),
                                          'plyer-icon.png')
        elif mode == 'toast':
            kwargs['toast'] = True
        notification.notify(**kwargs)
Beispiel #17
0
def fill(l):
    global oldn
    n = ""
    #notification.notify(title="hallo",message="end of parsing fill")
    for item in l:
        n+= item[2]+". "+item[5] + ", "
    if len(l) > 4:
        n = str(len(l))+ "Vertretungen"
    if n != oldn:
        vibrator.vibrate(1)
        time.sleep(1.2)
        oldn = n
        vibrator.vibrate(0.2)
        time.sleep(0.4)
        vibrator.vibrate(0.2)
        time.sleep(0.4)
        vibrator.vibrate(0.2)
        time.sleep(0.4)
        vibrator.vibrate(1)
    #notification.notify(title="hallo",message="end of parsing end")
    if n != "" :
        notification.notify(title="Neue Vertretung(en)",message=n)
Beispiel #18
0
 def notify(self, title, message):
     if self.wait > 0:
         reactor.callLater(self.wait + 1,  # @UndefinedVariable
                           self.notify,
                           *(title, message))
         return
     else:
         self.wait += 1
         reactor.callLater(1, self.notified)  # @UndefinedVariable
     if platform == 'win':
         icon = 'logo.ico'
         timeout = 10
     else:
         icon = 'logo.png'
         timeout = 10000
     kwargs = {'app_icon': os.path.join(
         os.path.dirname(os.path.realpath(__file__)), icon),
         'app_name': 'onDemand',
         'title': title,
         'message': message,
         'timeout': timeout}
     notification.notify(**kwargs)
Beispiel #19
0
    def pars(self,data):
        global Tfile
        if '|&*' not in data and "*?!" not in data and data!='':
            Tfile.part(data)
        data = data.split('|&*')
        if len(data) == 1:
            data = data[0].split('*?!')
            if data[0]=='l' or data[0]=='d':
                self.build(data[len(data)-1])
            if data[0]=='s':
                data1 = data[1].replace('"','')
                data2 = data[2].replace('nt.stat_result',"").replace('=',':')
                for w in self.ids.Grid.children:
                    if os.path.join(w.path,w.name)== data1:
                        data2 = data2.replace('st_mode:',"").replace('st_ino:',"").replace('st_dev:',"").replace('st_nlink:',"").replace('st_uid:',"").replace('st_gid:',"").replace('st_atime:',"").replace('st_size:',"").replace('st_mtime:',"").replace('st_ctime:',"")
                        Logger.info('title: '+ data2)
                        w.build(eval(data2))

            if data[0]=='SfH':
                Tfile = tfile(data[1],int(data[2]))
                self.downloading = True

            if '@eND$' in data[0]:
                data[0] = data[0].replace('@eND$','')
                Tfile.part(data[0])
                Tfile.close()
                notification.notify(message="Download completed:"+Tfile.n ,title="Catomap")
                Tfile = None




                #print TFILES['9.png'].value

        else:
            for d in data:
                self.pars(d)
Beispiel #20
0
def tip(title, msg):
    notification.notify(title=title, message=msg, app_name='Pushhh', timeout=1)
import pyttsx3 
trans = Translator(from_lang="english",to_lang="hindi") 
engine = pyttsx3.init()
engine.setProperty('rate',150)
engine.setProperty('volume',10)
def speak_it_out():                       
    x = Tk().clipboard_get()
    engine.say(x)
    engine.runAndWait()
def translate_it():                            
    x = Tk().clipboard_get()
    print("Copied word : ",x)
    translation = trans.translate(x)
    notification.notify(
        title = x,
        message = translation
        )
while True:
    try:
        if keyboard.is_pressed('*'):  
            speak_it_out()
            continue;
        if keyboard.is_pressed('/'):   
            translate_it()
            continue;
    except:
        notification.notify(
            title = "We encountered some error",
            message = "Kindly give it a re-try"
            )
Beispiel #22
0
 def notification_app():
     notification.notify(title='%s: 現在データ取得' % svs,
                         message='エラーが発生しました、確認してください。')
     return None
import time
from plyer import notification

if __name__ == "__main__":
    while True:
        notification.notify(
            title="**Please drink Water!!",
            message=
            "The adult human body is 60% water and your blood is 90% water. Drinking water benefits the whole body in a million ways. From flushing out toxins to preventing acne and giving you glowing skin, water is a miracle drink!",
            app_icon="E:\WaterAppPython\waterglass.ico",
            timeout=2)
        time.sleep(60 * 60)
Beispiel #24
0
def notify_2150(timeout=60):
    notification.notify(
        title = "<<!!! PC終了予告 !!!>>",
        message = "生活リズムを安定化させるために、22:00にはPC作業を終了しましょう",
        timeout = timeout
    )
Beispiel #25
0
def notify_msg(title="", msg="", timeout=60):
    notification.notify(
        title = title,
        message = msg,
        timeout = timeout
    )
Beispiel #26
0
def message():
    title = "Alarm"
    text = "Your alarm has occurred."
    notification.notify(title=title, message=text)
Beispiel #27
0
import time
from plyer import notification

if __name__ == "__main__":
    while True:
        notification.notify(
            title="**Please Drink Water",
            message=
            "The adequate daily fluid intake is: About 15.5 cups (3.7 liters) of fluids for men. About 11.5 cups (2.7 liters) of fluids a day for women.",
            app_icon=
            "C:\\Users\\Vighnesh\\Desktop\\Python Projects\\waterNotification\\icon.ico.ico",
            timeout=10)
        time.sleep(3)
                exists = False
                for activity in activeList.activities:
                    if activity.name == activity_name:
                        exists = True
                        activity.time_entries.append(time_entry)

                if not exists:
                    activity = Activity(active_id, activity_name, [time_entry])
                    activeList.activities.append(activity)

                time_delta = (end_time - start_time)
                total_seconds = time_delta.total_seconds()
                minutes = total_seconds / 60
                if minutes > 10:
                    notification.notify(title='Hey there!',
                                        message='You spent too much time on ' +
                                        activity_name)

                with open('activities.json', 'w') as json_file:
                    app = firebase.FirebaseApplication(
                        'https://apptrack-b28fe.firebaseio.com/', None)

                    data = json.dump(activeList.serialize(),
                                     json_file,
                                     indent=4,
                                     sort_keys=True)

                    # app.post('/Activites/',activeList.serialize())
                    app.put('/Activites/-MAI3y9hAq5XloWo-dVQ', 'activities',
                            activeList.serialize())
Beispiel #29
0
 def build(self):
     notification.notify(title=u'Issue 175', message=MyApp.hello_world)
     return Label(text=MyApp.hello_world)
Beispiel #30
0
def notify_via_Notification(content):  # fix needed
    notification.notify(title="Reminder...",
                        message=content,
                        app_name="PyNotifier by Ronik",
                        timeout=10)
import time
from plyer import notification

if __name__ == '__main__':
    while True:
        notification.notify(
            title="**please Drink a Water..!!!!",
            message="Water is good for health so please do drink it...!",
            app_icon="/home/husenbeg/notifier/glass.ico",
            timeout=10)
        time.sleep(6)
Beispiel #32
0
import time
from plyer import notification
#The following application sends a reminder every hour to take a break, and after 5 mins of that to end the break.
work_time = 55  #Enter total time you want to work before a break, in mins
break_time = 5  #Enter total time you want to take a break for, in mins

work_time = work_time * 60
break_time = break_time * 60

if __name__ == "__main__":
    while True:
        time.sleep(work_time)

        notification.notify(title="REMINDER!!!",
                            message="It has been an hour! Time for a break",
                            timeout=10,
                            app_icon='logo_m.ico')
        time.sleep(break_time)
        notification.notify(title="REMINDER!!!",
                            message="Let's get back to work! Break is Over",
                            timeout=10,
                            app_icon='logo_m.ico')
# this application will reminds you tu drink water,do some eye exersise and some physical activity, in certain time interval
import time
from plyer import notification

if __name__ == '__main__':
    while True:

        notification.notify(
            title="Drink 437ml of water now!!",
            message="Since an avarage person needs 3.7 liter of water in a day."
            "This program will make you drink 3.7 liters of water in between your office hours.",
            app_icon=r"C:\Users\SRINATH\Desktop\c program\glass_icon.ico",
            timeout=7)
        time.sleep(60 * 60)
Beispiel #34
0
 def notify():
     notification.notify(
         title="Wait!",
         message="Make the pledge to stay safe!",
     )
Beispiel #35
0
def notifyMe(title, message):
    notification.notify(title=title,
                        message=message,
                        app_icon="Image\corona.ico",
                        timeout=10)
def notifyme(title, message):
    notification.notify(title=title,
                        message=message,
                        app_icon='icon.ico',
                        timeout=15)
Beispiel #37
0
def sendNotification(title, msg):
	notification.notify(
	title = title,
	message = msg,
	timeout = 3   #how much seconds the notification should be dispalyed
	)
Beispiel #38
0
 def AzWyczysc(self):
     tabIdent=['AzX1','AzY1','AzX2','AzY2']
     for i in tabIdent:
         lab=self.ids[i]
         lab.text=''
     notification.notify('Czyszczenie', 'Wyczyszczono')
Beispiel #39
0
def notify_2200(timeout=60):
    notification.notify(
        title = "<<!!! PC終了勧告 !!!>>",
        message = "22:00です。10分後にPCは強制終了します。\n作業を終了してください。",
        timeout = timeout
    )
Beispiel #40
0
 def wyczysc(self):
     ident=['X1WL','Y1WL','X2WL','Y2WL','D1WL','D2WL']
     for i in ident:
         lab=self.ids[i]
         lab.text=''
     notification.notify('Czyszczenie', 'Wyczyszczono')
def sys_notification(title, commentary, current_score):
    """ To display the notification on system """
    notification.notify(
        title=title, message=commentary + " " + current_score, timeout=30
    )
Beispiel #42
0
 def do_notify(self, *args):
     print "Notification received"
     notification.notify(self.devicename, self.newstatus, timeout=50000)
Beispiel #43
0
import time
from plyer import notification

if __name__ == '__main__':
    notification.notify(
        title="This is my first custom notification!!",
        message="I will learn everything.",
        #app_icon="C:\\Users\\lenovo\\PycharmProjects\\pythonProject\\pythonProject\\NotificationSystem\\pasye.ico",
        timeout=500
    )
    time.sleep(60*60)
Beispiel #44
0
 def build(self):
     notify('Some title', 'Some message text')
Beispiel #45
0
import time
from plyer import notification
if __name__ == '__main__':
    while (True):
        notification.notify(
            title=" Please drink water Now",
            message=
            " The National Academies of Sciences, Engineering, and Medicine determined that an adequate daily fluid intake is: About 15.5 cups (3.7 liters) of fluids for men. About 11.5 cups (2.7 liters) of fluids a day for women",
            app_icon=r"C:\Users\honey\PycharmProjects\prgm\ppgg.ico.ico",
            timeout=10)
        time.sleep(60 * 30)
Beispiel #46
0
 def _stir_notification(self, dt):
     try:
         notification.notify("Immersion Coffee Timer", "Time to stir the coffee.")
     except NotImplementedError:
         pass
     alert()
from plyer import notification
from time import sleep

print("\n\tDO NOT CLOSE THE COMMAND PROMPT")
while True:
    notification.notify(
        title='IMPORTANT',
        message='PLEASE DRINK A GLASS OF WATER',
        timeout=9
    )
    sleep(3600) # 60 (seconds) = 1 minute
Beispiel #48
0
def is_render_complete(scene):

    #WINDOWS

    if os.name == 'nt' and locx == "es_":  #Español
        notification.notify(
            message='Render Finalizado',
            app_name='Blender',
            #app_icon = cd + 'blender_icon_32x32.ico'
        )
    elif os.name == 'nt' and locx == "ca_":  #Catalán
        notification.notify(
            message='S´ha finalitzat la prestació!',
            app_name='Blender',
        )

    elif os.name == 'nt' and locx == "fr_":  #Frances
        notification.notify(
            message='Rendu terminé',
            app_name='Blender',
        )

    elif os.name == 'nt' and locx == "it_":  #Italiano
        notification.notify(
            message='Rendering finito',
            app_name='Blender',
        )

    elif os.name == 'nt' and locx == "pt_":  #Protugues
        notification.notify(
            message='Renderizado concluído!',
            app_name='Blender',
        )

    elif os.name == 'nt' and locx == "de_":  #Alemán
        notification.notify(
            message='Fertig machen!',
            app_name='Blender',
        )

    else:
        notification.notify(
            message='Render Finished!',
            app_name='Blender',
            #app_icon = 'blender_icon_32x32.ico'
        )
# from psutil we will import the
# sensors_battery class and with
# that we have the battery remaining
while (True):
    now = datetime.now()
    current_time = now.strftime("%H:%M:%S")
    battery = psutil.sensors_battery()
    percent = battery.percent
    if (battery.power_plugged):
        isPlugged = "Plugged!!"
    else:
        isPlugged = "Not Plugged"

    print(percent, ' ', isPlugged, ' ', current_time)

    if (percent >= 80 and battery.power_plugged):
        notification.notify(title="High Charging",
                            message=str(percent) + "% Battery remaining",
                            timeout=10)
    elif (percent <= 15 and not battery.power_plugged):
        notification.notify(title="Low Charging",
                            message=str(percent) + "% Battery remaining",
                            timeout=10)

# after every 60 mins it will show the
# battery percentage
    time.sleep(60)

    continue
    port = 22
    username = '******'
    password = '******'

    forward = 'cat f.txt > /dev/input/event0'
    backward = 'cat b.txt > /dev/input/event0'
    home = 'cat h.txt > /dev/input/event0'
    option = 'cat o.txt > /dev/input/event0'

    ssh = paramiko.SSHClient()
    ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    ssh.connect(host, port, username, password)

    print('Connected to PocketBook')
    print('\007')
    notification.notify(title='Connected To PocketBook', timeout=2)

except Exception:
    print('Lack of connection, session aborted')
    print('\007')
    notification.notify(title='Lack of connection, session aborted', timeout=2)
    exit()

keyboard.wait()

running = True

while running:
    time.sleep(0.1)
    if (ssh.get_transport().is_active() == False):
        print('Lack of connection, session aborted')
Beispiel #51
0
 def PoleWyczysc(self):
     lab=self.ids['PoleX']
     lab.text=''
     lab=self.ids['PoleY']
     lab.text=''
     notification.notify('Czyszczenie', 'Wyczyszczono')
Beispiel #52
0
def notifyMe(title, message):
    notification.notify(
        title=title,
        message=message,
        app_icon="C:\\Users\\dhira\\Desktop\\notification\\corona.ico",
        timeout=10)
Beispiel #53
0
 def wyczysc(self):
     ident=['X1','Y1','X2','Y2','D','K']
     for i in ident:
         lab=self.ids[i]
         lab.text=i
     notification.notify('Czyszczenie', 'Wyczyszczono')
import time
from plyer import notification
if __name__ == "__main__":
    while True:
        notification.notify(
            title="Please Drink Water Now",
            message=
            "Drinking Water Helps Maintain the Balance of Body Fluids. Your body is composed of about 60% water. The functions of these bodily fluids include digestion, absorption, circulation, creation of saliva, transportation of nutrients, and maintenance",
            app_icon=("icon.ico"),
            timeout=2)
        time.sleep(60 * 60)
Beispiel #55
0
def sendNotification():
    notification.notify(title='Current Task', message="No Tasks being worked on!!", app_name="TimeTracker9000", app_icon=join(dirname(realpath(__file__)),"Haro-icon.gif")) 
Beispiel #56
0
def mask_image():
	# construct the argument parser and parse the arguments
	ap = argparse.ArgumentParser()
	ap.add_argument("-i", "--image", required=True,
		help="path to input image")
	ap.add_argument("-f", "--face", type=str,
		default="face_detector",
		help="path to face detector model directory")
	ap.add_argument("-m", "--model", type=str,
		default="mask_detector.model",
		help="path to trained face mask detector model")
	ap.add_argument("-c", "--confidence", type=float, default=0.5,
		help="minimum probability to filter weak detections")
	args = vars(ap.parse_args())

	# load our serialized face detector model from disk
	print("[INFO] loading face detector model...")
	prototxtPath = os.path.sep.join([args["face"], "deploy.prototxt"])
	weightsPath = os.path.sep.join([args["face"],
		"res10_300x300_ssd_iter_140000.caffemodel"])
	net = cv2.dnn.readNet(prototxtPath, weightsPath)

	# load the face mask detector model from disk
	print("[INFO] loading face mask detector model...")
	model = load_model(args["model"])

	# load the input image from disk, clone it, and grab the image spatial
	# dimensions
	image = cv2.imread(args["image"])
	orig = image.copy()
	(h, w) = image.shape[:2]

	# construct a blob from the image
	blob = cv2.dnn.blobFromImage(image, 1.0, (300, 300),
		(104.0, 177.0, 123.0))

	# pass the blob through the network and obtain the face detections
	print("[INFO] computing face detections...")
	net.setInput(blob)
	detections = net.forward()

	# loop over the detections
	for i in range(0, detections.shape[2]):
		# extract the confidence (i.e., probability) associated with
		# the detection
		confidence = detections[0, 0, i, 2]

		# filter out weak detections by ensuring the confidence is
		# greater than the minimum confidence
		if confidence > args["confidence"]:
			# compute the (x, y)-coordinates of the bounding box for
			# the object
			box = detections[0, 0, i, 3:7] * np.array([w, h, w, h])
			(startX, startY, endX, endY) = box.astype("int")

			# ensure the bounding boxes fall within the dimensions of
			# the frame
			(startX, startY) = (max(0, startX), max(0, startY))
			(endX, endY) = (min(w - 1, endX), min(h - 1, endY))

			# extract the face ROI, convert it from BGR to RGB channel
			# ordering, resize it to 224x224, and preprocess it
			face = image[startY:endY, startX:endX]
			face = cv2.cvtColor(face, cv2.COLOR_BGR2RGB)
			face = cv2.resize(face, (224, 224))
			face = img_to_array(face)
			face = preprocess_input(face)
			face = np.expand_dims(face, axis=0)

			# pass the face through the model to determine if the face
			# has a mask or not
			(mask, withoutMask) = model.predict(face)[0]

			# determine the class label and color we'll use to draw
			# the bounding box and text
			label = "Mask" if mask > withoutMask else "No Mask"
			color = (0, 255, 0) if label == "Mask" else (0, 0, 255)
			if label == "No Mask":
			notification.notify(
				title = "***No Mask Detected***",
				message = "Wear Mask to stay safe! ",
				app_icon = "images/1.ico",    #ico file should be downloaded
				timeout = 1
            			)

			# include the probability in the label
			label = "{}: {:.2f}%".format(label, max(mask, withoutMask) * 100)

			# display the label and bounding box rectangle on the output
			# frame
			cv2.putText(image, label, (startX, startY - 10),
				cv2.FONT_HERSHEY_SIMPLEX, 0.45, color, 2)
			cv2.rectangle(image, (startX, startY), (endX, endY), color, 2)

	# show the output image
	cv2.imshow("Output", image)
	cv2.waitKey(0)
	
if __name__ == "__main__":
	mask_image()
Beispiel #57
0
    def gen_contract(self, index):
        try:
            notification.notify(
                app_name = 'GERENCIADOR DE VOLUNTÁRIOS',
                title = 'GERANDO CONTRATO',
                message = 'Aguarde enquanto o contrato está sendo gerado, uma mensagem aparecerá na tela ao término da operação.',
                timeout = 5
            )

            database_fields = [
                'ID',
                'SERIAL',
                'REGISTRADO EM',
                'NOME',
                'NOME DO PAI',
                'NOME DA MAE',
                'ENDERECO',
                'NUMERO',
                'COMPLEMENTO',
                'BAIRRO',
                'CIDADE',
                'ESTADO',
                'CEP',
                'TELEFONE (RESIDENCIAL)',
                'TELEFONE (CELULAR)',
                'CPF',
                'RG',
                'ORGAO EMISSOR',
                'CIDADE NATAL',
                'ESTADO NATAL',
                'DATA DE NASCIMENTO',
                'ESTADO CIVIL',
                'GENERO',
                'ESCOLARIDADE',
                'EMAIL',
                'CURSO DOUTRINARIO',
                'EMPRESA',
                'OCUPACAO',
                'TEMPO DE EMPRESA',
                'ENDERECO DA EMPRESA',
                'BAIRRO DA EMPRESA',
                'NUMERO DA EMPRESA',
                'CIDADE DA EMPRESA',
                'ESTADO DA EMPRESA',
                'CEP DA EMPRESA',
                'TELEFONE DA EMPRESA'
            ]

            conn = db.create_connection()
            cursor = conn.cursor()
            result = cursor.execute(f'SELECT * FROM voluntaries WHERE id = {index}').fetchone()
            
            emitter = result[17].split('/')

            pdf = fpdf.FPDF(format = 'A4')
            pdf.add_page()
            pdf.set_font('times', 'B', size = 20)
            pdf.set_fill_color(200,200,200)
            pdf.write(18,'DADOS DO VOLUNTÁRIO')
            pdf.ln()

            i = 1
            while i < len(database_fields):
                if result[i] != '' and not result[i].endswith('-') and database_fields[i] != 'ESTADO DA EMPRESA':
                    pdf.set_font('helvetica', 'B',size = 12)
                    pdf.cell(55, 9, database_fields[i], 1, 0, '', 1, '')
                    pdf.set_font('helvetica', size = 12)
                    pdf.multi_cell(0, 9, result[i], 1, 'J', 0)
                
                i += 1

            pdf.add_page()
            pdf.image('./assets/contract/contract_header.png', w=190, h=45)
            pdf.ln()
            
            string_contract = f'''
            Eu, {result[3]}, portador da cédula de identidade no Registro Geral nº {result[16]} emitida 
            no estado da UF {emitter[1].strip()} pelo Órgão Emissor {emitter[0].strip()} e CPF {result[15]}, 
            disponho-me a prestar serviços voluntários nos moldes da lei 9608/98, a qual tenho pleno conhecimento, 
            firmo por essa melhor forma de direito, MINHA DISPOSIÇÃO DE SERVIR COMO VOLUNTÁRIO(A) POR TEMPO 
            INDETERMINADO nas tarefas beneficentes da ASSOCIAÇÃO ESPÍRITA LAURO MACHADO, com sede à Avendida Ulisses 
            Guimarães, nº 1901, Bairro Vila Guilherme na cidade de Francisco Morato no Estado de São Paulo, doando 
            minhas horas disponíveis, bem como minhas atividades, em favor dos menos favorecidos como e quando me for 
            possível, segundo o melhor critério adotado pela entidade, por dispor de renda própria para minha 
            subsistência, submeto-me às cláusulas abaixo:
            '''

            string_clause = f'''
            * Cláusula 1ª - Ao teor do que dispõe o Parágrafo Único do Artigo 1 da Lei 9608/98,
                                    a prestação do serviço voluntário em questão não gera vínculo empregatício,
                                    nem obrigação de natureza trabalhista, previdenciária ou afim.

            * Cláusula 2ª - A prestação do serviço voluntário não será remunerada, sendo que eventuais
                                    despesas realizadas no desempenho das atividades não serão reembolsadas
                                    pela instituição.
            
            * Cláusula 3ª - Como voluntário(a) disponho-me a realizar as atividades relacionadas acima,
                                    comprometendo-me a observar o Regulamento Interno da Instituição.
            
            * Cláusula 4ª - A prestação de serviço voluntário poderá ser encerrada a qualquer tempo
                                    por uma das partes.
            '''

            string_days = f'''
            Dias disponíveis: de Segunda-feira à Sexta-feira das 08:00 hs. às 17:00 hs., Sábados das 08:00 hs. 
            às 19:00 hs., Domingos das 08:00 hs. às 13:00 hs., e Quartas-feiras além do horário normal, das 19:00 
            hs. às 20:30 hs., podendo alterar estes horários em eventos, com prévio aviso e concordância.
            '''

            string_agreement = f'''
            Desta forma, lido e achado conforme assinam o presente Termo de Adesão de Serviço Voluntário, 
            na presença de duas testemunhas que também o subscreve.
            '''

            contract = string_contract.replace('\n', '').replace('    ', '') + '\n'
            contract += string_clause + '\n'
            contract += string_days.replace('\n', '').replace('    ', '') + '\n\n'
            contract += string_agreement.replace('\n', '').replace('    ', '') + '\n'

            pdf.set_font('times', size = 12)
            pdf.multi_cell(0, 6.5, contract, 0, 'J', 0)
            pdf.set_font('times', 'B', size = 14)
            # pdf.write(6,'FRANCISCO MORATO, SP - ' + datetime.datetime.now().strftime('%d/%m/%Y'))
            # pdf.ln()
            pdf.ln()
            pdf.ln()
            pdf.image('./assets/contract/contract_footer.png', w=190, h=4)


            if platform.system() == 'Linux':
                if not os.path.exists(os.path.expanduser("~") + '/Documentos/CONTRATOS_DE_VOLUNTARIOS'):
                    os.mkdir(os.path.expanduser("~") + '/Documentos/CONTRATOS_DE_VOLUNTARIOS')
                
                pdf.output(os.path.expanduser("~") + '/Documentos/CONTRATOS_DE_VOLUNTARIOS/Contrato_de_' + result[3] + '.pdf')

            else:
                if not os.path.exists(os.path.expanduser("~") + '\\Documents\\CONTRATOS_DE_VOLUNTARIOS'):
                    os.mkdir(os.path.expanduser("~") + '\\Documents\\CONTRATOS_DE_VOLUNTARIOS')
                
                pdf.output(os.path.expanduser("~") + '\\Documents\\CONTRATOS_DE_VOLUNTARIOS\\Contrato_de_' + result[3] + '.pdf')

            root = tkinter.Tk()
            root.withdraw()
            messagebox.showinfo('SUCESSO', 'Contrato de voluntariado gerado com sucesso!')
            tkinter.Tk().destroy()

        except Exception as e:
            root = tkinter.Tk()
            root.withdraw()
            messagebox.showerror('ERRO', e)
            tkinter.Tk().destroy()

        finally:
            pdf.close()
            db.close_connection()
Beispiel #58
0
__author__ = 'Nicklas Boerjesson'
from plyer import notification
import os
from kivy.utils import platform

platform = platform()

if __name__ == '__main__':
    """Initialize the service"""

    try:
        # Import the service main class
        from syncservice import SyncService
    except Exception as e:
        notification.notify("Optimal File Sync Service", "Error in init :" + str(e))


    try:
        # Find home dir
        if platform == "android":
            _home = "/storage/emulated/0/Android/data/"
        else:
            _home = os.path.expanduser("~")
        # Check if there is a settings file there
        _config_path = os.path.join(_home, "se.optimalbpm.optimal_file_sync/config.txt")
        # Raise error if non existing config
        if not os.path.exists(_config_path):
            notification.notify("Optimal File Sync Service", "Could not find config: " + _config_path + ", quitting.")
        else:
            # Pass to service
Beispiel #59
0
def notifyMe(title, message):
    notification.notify(title=title,
                        message=message,
                        app_icon="C://Users//hp//Desktop//notify//virus.ico",
                        timeout=10)
Beispiel #60
-1
 def notify_cb(self, title='', message='', timeout=1):
     
     try:
         notification.notify(
             title=title, 
             message=message, 
             app_name=constants.APP_NAME, 
             app_icon=os.path.join(constants.KIVY_RESOURCE_PATH_1, 'icon.png'),
             timeout=timeout
         )
     except (NotImplementedError, ImportError):
         Logger.warn(
             "DEVICE: No vibrate function defined for {} platform.".format(
                 constants.PLATFORM))     
     else:
         Logger.info("DEVICE: Fired Notification!")