예제 #1
0
            def results():
                global download
                global upload
                global ping
                global message
                global result
                result.destroy()

                final = Tk()
                final.title('SpeedTest-Connected-Results')
                final.wm_iconbitmap('speedtest_icon.ico')
                final.geometry("400x400")

                L1 = Label(final, text="Download Speed:")
                L1.grid(row=0, column=0, padx=10, pady=10)

                L2 = Label(final, text="Upload Speed:")
                L2.grid(row=1, column=0, padx=10, pady=10)

                L3 = Label(final, text="Ping:")
                L3.grid(row=2, column=0, padx=10, pady=10)

                download_label = Label(final, text=download).grid(row=0,
                                                                  column=1,
                                                                  padx=10,
                                                                  pady=10)

                upload_label = Label(final, text=upload).grid(row=1,
                                                              column=1,
                                                              padx=10,
                                                              pady=10)

                ping_label = Label(final, text=ping).grid(row=2,
                                                          column=1,
                                                          padx=10,
                                                          pady=10)

                if network():
                    toaster = win10toast.ToastNotifier()
                    toaster.show_toast('Wifi Speedtest Successfull!',
                                       message,
                                       icon_path='speedtest_icon.ico',
                                       duration=60)
                else:
                    toaster = win10toast.ToastNotifier()
                    toaster.show_toast(
                        'Wifi Speedtest Failed!',
                        'Cannot connect to the internet\nPlease check your Internet Connection!!!',
                        icon_2path='speedtest_icon.ico',
                        duration=60)
예제 #2
0
async def __main__(currency_pair, notification_threshold):
    notifier = win10toast.ToastNotifier()
    conn = await KrakenConnection.connect()

    # too lazy to handle None, use dummy value
    last_notified_ask = 0.1
    currency_str = "/".join(currency_pair)

    print("")

    def ticker_cb(msg):
        nonlocal last_notified_ask
        bid = float(msg[1]["b"][0])
        ask = float(msg[1]["a"][0])

        # added spaces to `end` to overwrite any leftover chars in case of longer price string
        print(f"   {currency_str}: bid({bid}), ask({ask})",
              end="              \r",
              flush=True)

        if abs(ask - last_notified_ask) > notification_threshold:
            last_notified_ask = ask
            notifier.show_toast(
                currency_str + " ticker",
                f"BID: {bid} {currency_pair[1]}\nASK: {ask} {currency_pair[1]}",
                None, 3, True)

    await conn.subscribe_ticker(currency_pair, ticker_cb)
    async for unhandled_msg in conn.start_listening():
        raise Exception("unhandled server message: " + str(unhandled_msg))
예제 #3
0
 def show(self, notification, image_file):
     import win10toast
     win10toast.ToastNotifier().show_toast(threaded=True,
                                           title=notification.title(),
                                           msg=notification.message(),
                                           duration=5,
                                           icon_path=None)
예제 #4
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)
예제 #5
0
def NOTIFICATION():
    try:
        toaster = win10toast.ToastNotifier()
        toaster.show_toast("AutoClicker", "V5.0", duration=5, threaded=True, icon_path ="favicon.ico")
        messagebox.showinfo('AutoClicker', 'V5.0')
    except:
        pass
예제 #6
0
    def times_up(self):

        self.back_to_default()
        self.fun()
        playsound("Sounds/alarm2.mp3", False)
        toaster = win10toast.ToastNotifier()
        toaster.show_toast("Timer", "Times's up!", icon_path="Graphic/timer_icon.ico", duration=5)
예제 #7
0
def checkInternet():
    PING = subprocess.Popen('ping ' + IP, stdout=subprocess.PIPE)
    PING.wait()

    if PING.poll() != 0:
        toaster = win10toast.ToastNotifier()
        toaster.show_toast('Internet Check', 'Internet is down', duration=10)
예제 #8
0
 def toast(self, text):
     toaster = win10toast.ToastNotifier()
     toaster.show_toast(
         self.title,
         text,
         duration=2,
     )
예제 #9
0
def notification(title: str, message: str, duration: float = 5.0) -> None:
    """
    Displays notifications in the taskbar

    :param title: the headline of the message
    :param message: message text
    :param duration: duration of notification
    :return: None
    """
    if config.OS_TYPE == config.OSType.Windows:
        import win10toast
        # https://stackoverflow.com/questions/12575708/notification-using-python
        win10toast.ToastNotifier().show_toast(
            title=title,
            msg=message,
            icon_path=config.ICON_NOTIFICATION_PATH,
            duration=duration)
    elif config.OS_TYPE == config.OSType.Mac:
        # http://osxh.ru/terminal/command/osascript
        command = f'''osascript -s h -e \'display notification "{message}" with title "{title}"\''''
        os.system(command)
        time.sleep(duration)
    elif config.OS_TYPE == config.OSType.Linux:
        # http://manpages.ubuntu.com/manpages/bionic/man1/notify-send.1.html
        command = f'''
            notify-send
                --urgency=critical
                --expire-time={duration}
                --icon={config.ICON_NOTIFICATION_PATH}
                "{title}"
                "{message}"
        '''
        command = " ".join(command.split())  # must be in one line
        os.system(command)
    return
예제 #10
0
def push_notification(score_difference_list: List[Dict[str, str]]) -> None:
    """推送通知

    :param score_difference_list: 差异分数列表
    """
    # Windows 10 桌面推送
    if config.win10_toast_enable:
        toast = win10toast.ToastNotifier()
        toast.show_toast(title='出新成绩了',
                         msg='快来看看你有没有挂科吧',
                         duration=5,
                         threaded=True)
    # Server 酱推送
    if config.server_chan_enable:
        detail_message = get_server_chan_push_content(score_difference_list)
        logger.debug(detail_message)
        try:
            response = requests.post(
                f'https://sc.ftqq.com/{config.server_chan_sckey}.send',
                data={
                    'text': f'有 {len(score_difference_list)} 门课出新成绩了,快看看你挂科了吗',
                    'desp': detail_message
                })
            response_json = response.json()
            logger.debug(response_json)
        except Exception as err:
            raise PushNotificationError(f'Server酱推送错误:{err}')
        else:
            if response_json['errno'] != 0:
                raise PushNotificationError(
                    f"Server酱推送错误,服务器返回错误代码:{response_json['errno']},"
                    f"错误信息:{response_json['errmsg']}")
예제 #11
0
def notify(task):
    day, hour, minute = map(int, task.getRemainTime())
    title = f"{day}일 {hour}시간 {minute}분 후"
    msg = f"{task.label}의 마감입니다"
    win10toast.ToastNotifier().show_toast(title=title, msg=msg)

    return schedule.CancelJob
예제 #12
0
 def notify_score(score):
     toaster = win10toast.ToastNotifier()
     toaster.show_toast(
         "Cricket!",
         score,
         threaded=True,
         icon_path=r'C:\Users\BatMan\Desktop\Codes\PostLearn\logo.ico',
         duration=10)  # 10 seconds
예제 #13
0
def Spam():
    running = True
    while running:
        update()
        toaster = win10toast.ToastNotifier()
        toaster.show_toast("Spam", "Spam", duration=1, threaded=True)
        if keyboard.is_pressed('ctrl + c'):
            break
예제 #14
0
def notify(mmin, msubj):
    # from win10toast import ToastNotifier  # Install Win10Toast module

    toaster = win10toast.ToastNotifier()
    toaster.show_toast("Time to Wrapup ",
                       str(mmin) + " Mins are left in Meeting : " + str(msubj),
                       icon_path=resource_path('lalarm.ico'),
                       duration=15)
예제 #15
0
    def input_fpath(self):
        file_path, flag = QInputDialog.getText(self, "User Input",
                                               "Enter File Path:")

        if file_path != '':
            msg = QMessageBox()
            msg.setWindowTitle("System Alert")
            msg.setText("Press OK and Please Wait!        ")
            msg.setIcon(QMessageBox.Information)
            msg.setStandardButtons(QMessageBox.Ok)
            msg.exec_()

            clf = joblib.load("classifier.pkl")
            features = pickle.loads(open("features.pkl", 'rb').read())

            try:
                data = extract_infos(file_path)
                pe_features = list(map(lambda x: data[x], features))
                res = clf.predict([pe_features])[0]
                ans = (
                    '%s - %s' %
                    (os.path.basename(file_path), ['MALICIOUS!', 'SAFE'][res]))
                print(ans)

                toaster = win10toast.ToastNotifier()
                if (res == 1):
                    toaster.show_toast(
                        'Malware Detector Tool',
                        ans,
                        duration=10,
                        icon_path="Hopstarter-Malware-Patched.ico")
                else:
                    toaster.show_toast(
                        'Malware Detector Tool',
                        ans,
                        duration=10,
                        icon_path="Hopstarter-Malware-Delete.ico")
            except:
                toas_error = win10toast.ToastNotifier()
                toas_error.show_toast(
                    'Malware Detector',
                    'Invalid FILE FORMAT',
                    duration=10,
                    icon_path="Oxygen-Icons.org-Oxygen-Actions-window-close.ico"
                )
예제 #16
0
    def Callback(self, message):
        # TO DO
        # Convert the payload in a dict
        messageDict = ''
        try:
            messageDict = eval(message.payload.decode('utf-8'))
        except:
            pass  # No message or title in the payload

        # Priority for configuration content and title. If not set there, will try to find them in the payload

        # Look for notification content
        if self.GetOption(
            [self.consts.CONTENTS_OPTION_KEY,
             CONTENTS_MESSAGE_OPTION_KEY]):  # In config ?
            content = self.GetOption(
                [self.consts.CONTENTS_OPTION_KEY, CONTENTS_MESSAGE_OPTION_KEY])
        elif CONTENTS_MESSAGE_OPTION_KEY in messageDict:  # In the payload ?
            content = messageDict[CONTENTS_MESSAGE_OPTION_KEY]
        else:  # Nothing found: use default
            content = DEFAULT_MESSAGE
            self.Log(
                Logger.LOG_WARNING,
                'No message for the notification set in configuration or in the received payload'
            )

        # Look for notification title
        if self.GetOption(
            [self.consts.CONTENTS_OPTION_KEY,
             CONTENTS_TITLE_OPTION_KEY]):  # In config ?
            title = self.GetOption(
                [self.consts.CONTENTS_OPTION_KEY, CONTENTS_TITLE_OPTION_KEY])
        elif CONTENTS_TITLE_OPTION_KEY in messageDict:  # In the payload ?
            title = messageDict[CONTENTS_TITLE_OPTION_KEY]
        else:  # Nothing found: use default
            title = DEFAULT_TITLE

        # Check only the os (if it's that os, it's supported because if it wasn't supported,
        # an exception would be thrown in post-inits)
        if self.os == self.consts.FIXED_VALUE_OS_WINDOWS:
            toaster = win10toast.ToastNotifier()
            toaster.show_toast(title,
                               content,
                               duration=DEFAULT_DURATION,
                               threaded=False)
        elif self.os == self.consts.FIXED_VALUE_OS_LINUX:
            notification = notify2.Notification(title, content)
            notification.show()
        elif self.os == self.consts.FIXED_VALUE_OS_MACOS:
            command = 'osascript -e \'display notification "{}" with title "{}"\''.format(
                content, title)
            os.system(command)
        else:
            self.Log(
                self.Logger.LOG_WARNING,
                "No notify command available for this operating system (" +
                str(self.os) + ")... Aborting")
예제 #17
0
def bond(PB, goal, minimumPrice):
    while (1):
        toaster = win10toast.ToastNotifier()
        #http://services.runescape.com/m=itemdb_oldschool/viewitem?obj=554 <--- can just change the object ID and it will iterate through the items :POGCHAMP: so just have a database that scrapes the name and price
        URL = 'http://services.runescape.com/m=itemdb_oldschool/Old+school+bond/viewitem?obj=13190'
        page = requests.get(URL)
        soup = BeautifulSoup(page.content, 'html.parser')
        results = soup.find(id='grandexchange')
        job_elems = results.find('div', class_='stats')
        price = job_elems.find('h3')
        price2 = price.find(
            'span')  #have to clean up the price scrapping situation going on
        final = str(price2)
        final = re.findall(r'"(.*?)"', final)
        elem = final[0]
        elem = elem.replace(',', "")
        price = int(elem)
        # End web scrapping for Item
        #Start comparison
        buyPrice = float(PB)  #FILL HERE, amount you bought the item for
        profitGoal = float(
            goal
        )  #FILL HERE for bonds it fluctuates between +/- 5% so ill do 2.5
        minimumPriceToBuy = int(
            minimumPrice
        )  #FILL HERE , minimum price you want to buy the item for
        breakEvenPoint = buyPrice * 1.1  #because 10% tax, essentially this is the buy price because you have to make it tradable
        notifyPrice = breakEvenPoint * (1 + (profitGoal / 100))

        if (price <= minimumPriceToBuy):
            toaster.show_toast(
                'OSRS_BOND',
                'Item has reached the price you are willing to buy for. BUY NOW',
                duration=3,
                icon_path=
                "D:\\Users\\sheeh\Desktop\\Projects\\OSRS Tools\\OSRS_Bond\\camera_test.ico"
            )

        if (price >= notifyPrice):
            toaster.show_toast(
                'OSRS_BOND',
                'Profit Margin Reached, SELL NOW',
                duration=3,
                icon_path=
                "D:\\Users\\sheeh\Desktop\\Projects\\OSRS Tools\\OSRS_Bond\\coin.ico"
            )
            exit(0)
        else:
            toaster.show_toast(
                'OSRS_BOND',
                'Profit Margin Not Reached',
                duration=3,
                icon_path=
                "D:\\Users\\sheeh\Desktop\\Projects\\OSRS Tools\\OSRS_Bond\\coin.ico"
            )
            time.sleep(3600)  #check every hour
예제 #18
0
def makeVariables():
    global message
    message = val1.get()
    global deadline
    deadline = val2.get()
    print(message,deadline)
    deadline = int(deadline) * 60
    time.sleep(deadline)
    notify = win10toast.ToastNotifier()
    notify.show_toast("Reminder",message)
예제 #19
0
def notify():
    notifier = win10toast.ToastNotifier()
    title = 'twitter'
    message = 'updated profile pic'

    notifier.show_toast(title=title,
                        msg=message,
                        icon_path='..\\resources\\icon\\icon.ico',
                        duration=10,
                        threaded=True)
예제 #20
0
def notify(title,message):
    try:
        toaster = win10toast.ToastNotifier()
        toaster.show_toast(
        title,
        message,
        duration=21600,
        threaded=True)
        print("NOTIFICATION SENT")
    except Exception:
        print("EXCEPTION OCCURED WHILE SENDING NOTIFICATION")
예제 #21
0
 def got_time(self,picker_widget,the_time):
     self.dialog.dismiss()
     alarmhour=the_time.hour
     alarmmin=the_time.minute
     while True:
         if(alarmhour==datetime.datetime.now().hour and alarmmin==datetime.datetime.now().minute):
             for obj in self.dialog.content_cls.children:
                 if isinstance(obj, MDTextField):
                     toaster=win10toast.ToastNotifier()
                     toaster.show_toast(obj.text, duration=10)
             break
예제 #22
0
def sendNotification(platform, title, text):
    if platform[:3] == 'win':
        toaster = win10toast.ToastNotifier()
        toaster.show_toast(title, text, duration=15)
    elif platform == 'darwin':
        os.system("""
                osascript -e 'display notification "{}" with title "{}"'
                """.format(text, title))
    else:
        pass
    return
예제 #23
0
파일: winTools.py 프로젝트: RyanD524/rshell
def notification(args=None):
    title = "Default"
    message = "Default"
    toaster = win10toast.ToastNotifier()
    args = args[0].split(" ", 1)
    if args != None:
        title = args[0]
        if len(args) > 1:
            message = args[1]

    toaster.show_toast(title, message)
예제 #24
0
 def __send_windows(self):
     try:
         import win10toast
         win10toast.ToastNotifier().show_toast(threaded=True,
                                               title=self.__title,
                                               msg=self.__description,
                                               duration=self.__duration,
                                               icon_path=self.__icon_path)
     except ImportError:
         raise ImportError(
             'notifications are not supported, can\'t import necessary library'
         )
예제 #25
0
def setReminder():
    tt, title, message = get_reminder_details()
    while (True):
        curr_time = time.strftime("%H:%M:%S")
        if curr_time == tt:
            print(curr_time)
            break
        else:
            pass

    toaster = win10toast.ToastNotifier()
    toaster.show_toast(title, message, duration=15)
예제 #26
0
 def send_windows(self):
     """Notify on windows with win10toast"""
     try:
         import win10toast
         win10toast.ToastNotifier().show_toast(threaded=True,
                                               title=self.__title,
                                               msg=self.__description,
                                               duration=self.__duration,
                                               icon_path=self.__icon_path)
     except ImportError:
         raise ImportError(
             'notifications are not supported, can\'t import win10toast')
예제 #27
0
def start():
    battery = psutil.sensors_battery()
    plugged = battery.power_plugged
    percent = str(battery.percent)
    if plugged == False:
        plugged = "Not Plugged In"
    else:
        plugged = "Plugged In"
    if (psutil.sensors_battery().power_plugged == True) and (battery.percent
                                                             == 100):
        print(percent + '% | ' + plugged)
        print('Unplug the Charger Please!')
        win10toast.ToastNotifier().show_toast(
            'Battery Statues',
            'Battery Full.\nUnplug the Charger Please!',
            icon_path='bat.ico',
            duration=10,
            threaded=True)
        gui.after(full_timer, start)
    elif (psutil.sensors_battery().power_plugged
          == False) and (battery.percent != 100):
        print(percent + '% | ' + plugged)
        print('Not Charging...')
        win10toast.ToastNotifier().show_toast('Battery Statues',
                                              'Charger Not Plugged',
                                              icon_path='bat.ico',
                                              duration=10,
                                              threaded=True)
        gui.after(chrg_timer, start)
    else:
        print(percent + '% | ' + plugged)
        print('Charging...')
        win10toast.ToastNotifier().show_toast('Battery Statues',
                                              'Charging...',
                                              icon_path='bat.ico',
                                              duration=10,
                                              threaded=True)
        gui.after(nchrg_timer, start)
예제 #28
0
파일: Notification.py 프로젝트: madkne/kdfs
	def __send_windows(self):
		try:
			import win10toast
			win10toast.ToastNotifier().show_toast(
				threaded=True,
				title=self.__title,
				msg=self.__description,
				duration=self.__duration,
				icon_path=self.__icon_path
			)
			return True
		except ImportError:
			KDFSProtocol.echo('notifications are not supported, can\'t import necessary library','notification',is_err=True)
			return False
예제 #29
0
 def issuenotification(self, message):
     if not self.perma["notifications_enabled"]:
         return
     if (os.name == "nt"):  # Windows
         toaster = win10toast.ToastNotifier()
         toaster.show_toast("Rina",
                            message,
                            threaded=True,
                            icon_path="assets/favicon.png",
                            duration=10)
     elif (os.name == "posix"):
         os.system("""
           osascript -e 'display notification "{}" with title "{}"'
           """.format(message, "Rina"))
예제 #30
0
def init_notifier_win():
    try:
        import win10toast
        toaster = win10toast.ToastNotifier()
        toaster.show_toast(shexter.config.APP_NAME,
                           'Notifications enabled',
                           duration=3,
                           threaded=True)
        return toaster
    except ImportError as e:
        print(e)
        print('***** To use the ' + shexter.config.APP_NAME +
              ' daemon on Windows you must install win10toast'
              ' with "[pip | pip3] install win10toast"')