Exemplo n.º 1
0
def main():
	try:
		img.save("pymgur_tmp.png", 'PNG')
	except AttributeError:
		print "There is no image on the clipboard'"
		sys.exit()
	f = open("pymgur_tmp.png", "rb")
	binary_data = f.read()
	b64image = base64.b64encode(binary_data)
	f.close()
	os.remove("pymgur_tmp.png")
	payload = {'key': API_KEY,
	           'image': b64image,
	           'type': 'base64',
	           'title': 'Pymgur Upload {}'.format(datetime.datetime.today().strftime("%c"))
	           }
	print "Uploading..."
	try:
		r = requests.post(url, headers = headers, data = payload)
	except requests.ConnectionError:
		hud_alert('No internet connection', icon = 'error')
		sys.exit()
	j = json.loads(r.text)
	link = j["data"]["link"]
	clipboard.set(link)
	hud_alert('Link Copied!')
	notification.schedule("Pymgur Upload Complete!", delay=0, action_url=link)
	print "The image link ({}) has been copied to the clipboard!".format(link)
Exemplo n.º 2
0
def cancel_removed_reminders_workaround(initial, final):
    """Zrusi vsechny pripominky z `initial` pokud nejsou ve `final`.

    Arguments:
        initial: Puvodni pripominky (pred zobrazenim / editaci).
        final: Pripominky, ktere maji zustat.
    """

    if len(initial) == len(final):
        # Nic nechceme odstranit, koncime
        return

    # Musime zrusit vsechny notifikace
    notification.cancel_all()

    # Zjistime si aktualni cas
    now = time.time()

    def calculate_delay(note):
        # Funkce vypocita hodnotu delay a vlozi ji do notifikace.
        # fire_date je totiz cas kdy se ma notifikace zobrazit, ale my ji musime
        # znovu nastavit a tam se vyuziva delay, tj. za jak dlouho se ma zobrazit.
        note['delay'] = note.pop('fire_date') - now
        return note

    # Vypocitame delay pro vsechny notifikace
    notes = [calculate_delay(x['note']) for x in final]

    # Znovu je nastavime
    for note in notes:
        notification.schedule(**note)

    count = len(initial) - len(final)
    console.hud_alert(f'Odstraněno {count} připomínek')
Exemplo n.º 3
0
def main():
    try:
        img.save("pymgur_tmp.png", 'PNG')
    except AttributeError:
        print("There is no image on the clipboard'")
        sys.exit()
    f = open("pymgur_tmp.png", "rb")
    binary_data = f.read()
    b64image = base64.b64encode(binary_data)
    f.close()
    os.remove("pymgur_tmp.png")
    payload = {
        'key':
        API_KEY,
        'image':
        b64image,
        'type':
        'base64',
        'title':
        'Pymgur Upload {}'.format(datetime.datetime.today().strftime("%c"))
    }
    print("Uploading...")
    try:
        r = requests.post(url, headers=headers, data=payload)
    except requests.ConnectionError:
        hud_alert('No internet connection', icon='error')
        sys.exit()
    j = json.loads(r.text)
    link = j["data"]["link"]
    clipboard.set(link)
    hud_alert('Link Copied!')
    notification.schedule("Pymgur Upload Complete!", delay=0, action_url=link)
    print("The image link ({}) has been copied to the clipboard!".format(link))
Exemplo n.º 4
0
def schedule_notfications():
    nots = notification.get_scheduled()
    #print(nots)
    dayrange = list(range(7))

    #print('dayrange before: {}'.format(dayrange))
    today = datetime.datetime.now()
    '''
	for n in nots:
		d1 = datetime.datetime.fromtimestamp( n['fire_date'] )
		diff = d1 - today
		#print('diff: {}'.format(diff.days ))
		if diff.days in dayrange:
			dayrange.remove(diff.days)
	print('dayrange after: {}'.format(dayrange))
	'''

    notification.cancel_all()

    for i in dayrange:
        day = today + datetime.timedelta(days=i)
        h = 21
        m = 30

        desired_time = day.replace(hour=h, minute=m, second=0, microsecond=0)
        #print(desired_time)

        if desired_time > today:
            delta = desired_time - today
            delay_seconds = delta.total_seconds()

            notification.schedule(
                'Complete Triggers', delay_seconds, 'default',
                'pythonista3://triggers/enter-triggers.py?action=run&root=iCloud'
            )
Exemplo n.º 5
0
def countup_timer(time):
    for past in range(0, time):
        if ((time - past) % 600 == 0):
            notification.schedule('todo:残り{}分'.format((time - past) // 60),
                                  past, 'arcade:Coin_2')
    notification.schedule('todo:終了です', time, 'arcade:Coin_1')
    print()
Exemplo n.º 6
0
def run_server(config):
  ConfigProfileHandler.config = config
  server_address = ('', 0)
  httpd = BaseHTTPServer.HTTPServer(server_address, ConfigProfileHandler)
  sa = httpd.socket.getsockname()
  webbrowser.open('safari-http://localhost:' + str(sa[1]))
  httpd.handle_request()
  notification.schedule('Tap "Install" to add the shortcut to your homescreen.', 1.0)
Exemplo n.º 7
0
 def _save_to_db(self, new_dict):
     self.conn = ConnSqlite()
     account = new_dict['account']
     key = new_dict['key']
     if account and key:
         self.conn.insert_value(account, key)
         notification.schedule('Add success!', 1)
     self.conn.close_conn()
Exemplo n.º 8
0
def run_server(config):
    ConfigProfileHandler.config = config
    server_address = ('', 0)
    httpd = http.server.HTTPServer(server_address, ConfigProfileHandler)
    sa = httpd.socket.getsockname()
    webbrowser.open('safari-http://localhost:' + str(sa[1]))
    httpd.handle_request()
    notification.schedule(
        'Tap "Install" to add the shortcut to your homescreen.', 1.0)
Exemplo n.º 9
0
 def update(self, value):
     self.value = value
     #Notify the user if notifications are enabled and the task is finished
     if value == self.topValue and self.notify:
         if self.title is None:
             message = 'Your progressbar has finished!'
         else:
             message = 'Your progressbar "{}" has finished!'.format(
                 self.title)
         notification.schedule(message)
Exemplo n.º 10
0
 def ok_tapped(self, sender):
     """
     内容保存到sqlite
     :param sender:
     :return: True
     """
     self.conn = ConnSqlite()
     name_text = self.name_textfield.text
     secret_text = self.secret_textfield.text
     if name_text and secret_text:
         self.conn.insert_value(name_text, secret_text)
         notification.schedule('Add success!', 1)
     self.conn.close_conn()
Exemplo n.º 11
0
def _save_to_db(new_dict):
    global countdown
    con = ConnSqlite()
    account = new_dict['account']
    key = new_dict['key']
    if account and key:
        if check_key(key):
            con.insert_value(account, key)
            notification.schedule('Add success!', 0)
            con.close_conn()
            countdown = 1
        else:
            notification.schedule('Key wrong!', 0)
            con.close_conn()
            return add_button_tapped(None)
Exemplo n.º 12
0
def notify(external_ip):
    return notification.schedule(
        "Your external IP address has changed. Your current IP address is: %s"
        % external_ip,
        5,
        'digital:PhaserUp7',
    )
Exemplo n.º 13
0
def save_config(sender):
    ally = alliance_control.selected_index
    pos = position_control.selected_index

    # print(str(pos) + '\n' + str(ally)) [Use this as a debug!]

    if ally == 0:
        ally_select = 'red'
        print('Selected target is: RED')
    elif ally == 1:
        ally_select = 'blue'
        print('Selected target is: BLUE')
    else:
        print('No selected target')
        return

    if pos == 0:
        pos_select = 'left'
        print('Selected target is: LEFT')
    elif pos == 1:
        pos_select = 'middle'
        print('Selected target is: MIDDLE')
    elif pos == 2:
        pos_select = 'right'
        print('Selected target is: RIGHT')
    else:
        print('No selected target')
        return

    file.writelines(ally_select + "\n" + pos_select)
    file.close()
    toast = notification.schedule('The file has been successfully saved.', 0)
Exemplo n.º 14
0
def reincarnate(argv):  # relaunch self with state in args
    (theMessage, theSound) = ('', '')  # Silent notification
    theDelay = 1  # Just one second of downtime
    thisScript = sys.argv[0].rpartition('/')[2].partition('.')[0]
    actionURL = 'pythonista://{}?action=run{}'
    actionURL = actionURL.format(thisScript, argsString(argv))
    returnCode = notification.schedule(theMessage, theDelay,
                                       theSound, actionURL)
Exemplo n.º 15
0
def reminder(message, delay=3600*24, uid=None, 
             sound_name='default', 
             action=None, action_args=(), 
             interval=3600, 
             num_reminders=5):
    ''' call a script after a delay, and keep reminding until the notification is acknowledged.
    uses a uid to access all instances of this reminder, for deleting or finding when the next instance is scheduled.
    
    adding a new reminder with the same uid wipes out existing reminders with that uid.
    
    parameters:
    
    message  string message
    delay    seconds
    uid      string, or None to use random uuid
    sound_name string name of a sound, or '' for no sound
    action    string name of a script
    action_args tuple of args to pass to action.  should be escaped if needed
    interval  time in seconds between reminders
    num_reminders number of reminders to issue
    
    '''
    
    if uid is None:
        #create random uid
        uid=uuid.uuid4()
        
    #delete any existing reminders with this uid
    delete_reminder(uid)
    
    for i in range(num_reminders):
        url='pythonista://reminder?action=run&argv={}&argv={}'.format(uid,action)
        argstr=''
        for a in action_args:
            argstr+='&argv={}'.format(a)
        notification.schedule(message, delay+i*interval, sound_name, url+argstr)
Exemplo n.º 16
0
def timer2(sender):
    global time4
    global time5
    global time6
    global tap1
    global tap2

    if tap2 == False:
        if time6 == 0 & (time5 > 0 | time4 > 0):
            time6 = 9
            if time5 == 0:
                time4 -= 1
                time5 = 5
            else:
                time5 -= 1
        else:
            time6 -= 1
            time.sleep(1)
            player1button.title = str(time4) + ':' + str(time5) + str(time6)
            timer2(sender)
        if time4 == time5 == time6 == 0:
            notification.schedule('Flag Down! Player 1 Wins!')
            view.remove_subview(player1button)
            view.remove_subview(player2button)
Exemplo n.º 17
0
 def init_and_schedule(cls, message, delay=None, sound_name=None, action_url=None):
     notification.schedule(message=message, delay=delay, sound_name=sound_name, action_url=action_url)
     return cls(notification.get_scheduled()[-1])
Exemplo n.º 18
0
def main():
    # Ziskame vstup od uzivatele
    result = get_user_input()
    if result:
        # Pokud neco zadal, nastavime novou notifikaci
        notification.schedule(**result)
Exemplo n.º 19
0
text = sys.argv[1]
action = sys.argv[2]
delay = sys.argv[3]

# Convert delay time into hours.
hours = float(delay) * 3600

# Encode action and text so they can bed used in URL action.
encoded_action = action.encode('utf-8')
encoded_action = urllib.quote(encoded_action, safe='')

encoded_text = text.encode('utf-8')
encoded_text = urllib.quote(encoded_text, safe='')

# Create URL. You can change this from a Drafts action to be something else if it better fits your needs.
url = 'drafts4://x-callback-url/create?text=' + encoded_text + '&action=' + encoded_action

# Schedule notification.
scheduled = notification.schedule('Run ' + action + ' on "' + text + '"',
                                  hours, 'default', url)

# Append text for action and what action was run on it to a file called "Scheduled Actions" in Pythonista.
scheduled_actions = open('Scheduled Actions', 'a')
scheduled_actions.write(action + ' on "' + text + '"\n')
scheduled_actions.close()

# Return you to source app after action is scheduled. (Delete these last lines to just stay in Pythonista.)
#webbrowser.open('launchpro://')
webbrowser.open('drafts://')
# Uncomment line 35 and comment line 34 to open Drafts after success instead of Launch Center Pro.
Exemplo n.º 20
0
import notification

n = notification.schedule(
    "Hello, World",
    delay=5,
    action_url="pythonista://Sandbox%2Fnotificationtest.py?action=run")
print n
Exemplo n.º 21
0
import  notification

n = notification.schedule("Hello, World", delay=5, action_url="pythonista://Sandbox%2Fnotificationtest.py?action=run")
print n
Exemplo n.º 22
0
                if touch.location.x > key.frame.center().x and len(
                        key.names) > 1:
                    webbrowser.open(key.names[1][1])
                else:
                    webbrowser.open(key.names[0][1])
        return

    def touch_began(self, touch):
        self.any_touch(touch)
        return

    def touch_moved(self, touch):
        self.any_touch(touch)
        return

    def touch_ended(self, touch):
        self.any_touch(touch)
        return


notification.cancel_all()
notification.schedule('####### Call-Someone', 7, '', 'tel://12345678')
notification.schedule('####### Whatsapp-Someone', 7, '',
                      'whatsapp://send?abid=123&text=hello')
notification.schedule('####### Skype-Someone', 7, '', 'skype://12345678')
notification.schedule('======= Whatsapp', 7, '', 'whatsapp:')
notification.schedule('======= Reeder', 7, '', 'reeder:')
notification.schedule('======= Map', 7, '', 'comgooglemaps:')
notification.schedule('launch-todolist,calendar,rss', 7, '',
                      'pythonista://Launcher')
run(Launcher(), PORTRAIT, 7)
Exemplo n.º 23
0
def notifyKaspu():
    now = datetime.datetime.now()
    if now < kaspu_01:
        k1Str = 'Kaspu 01 Rabbit: ' + str(kaspu_01.time())
        notification.schedule(k1Str,
                              delay=secsFromNow(kaspu_01),
                              sound_name='Media/Sounds/piano/G4#')
    if now < kaspu_02:
        k2Str = 'Kaspu 02 Dragon: ' + str(kaspu_02.time())
        notification.schedule(k2Str,
                              delay=secsFromNow(kaspu_02),
                              sound_name='Media/Sounds/piano/G4')
    if now < kaspu_03:
        k3Str = 'Kaspu 03 Snake: ' + str(kaspu_03.time())
        notification.schedule(k3Str,
                              delay=secsFromNow(kaspu_03),
                              sound_name='Media/Sounds/piano/F4#')
    if now < kaspu_04:
        k4Str = 'Kaspu 04 Horse: ' + str(kaspu_04.time())
        notification.schedule(k4Str,
                              delay=secsFromNow(kaspu_04),
                              sound_name='Media/Sounds/piano/F4')
    if now < kaspu_05:
        k5Str = 'Kaspu 05 Goat: ' + str(kaspu_05.time())
        notification.schedule(k5Str,
                              delay=secsFromNow(kaspu_05),
                              sound_name='Media/Sounds/piano/E4')
    if now < kaspu_06:
        k6Str = 'Kaspu 06 Monkey: ' + str(kaspu_06.time())
        notification.schedule(k6Str,
                              delay=secsFromNow(kaspu_06),
                              sound_name='Media/Sounds/piano/D4#')
    if now < kaspu_07:
        k7Str = 'Kaspu 07 Rooster: ' + str(kaspu_07.time())
        notification.schedule(k7Str,
                              delay=secsFromNow(kaspu_07),
                              sound_name='Media/Sounds/piano/D4')
    if now < kaspu_08:
        k8Str = 'Kaspu 08 Dog: ' + str(kaspu_08.time())
        notification.schedule(k8Str,
                              delay=secsFromNow(kaspu_08),
                              sound_name='Media/Sounds/piano/C4#')
    if now < kaspu_09:
        k9Str = 'Kaspu 09 Pig: ' + str(kaspu_09.time())
        notification.schedule(k9Str,
                              delay=secsFromNow(kaspu_09),
                              sound_name='Media/Sounds/piano/C4')
    if now < kaspu_10:
        k10Str = 'Kaspu 10 Rat: ' + str(kaspu_10.time())
        notification.schedule(k10Str,
                              delay=secsFromNow(kaspu_10),
                              sound_name='Media/Sounds/piano/B3')
    if now < kaspu_11:
        k11Str = 'Kaspu 11 Ox: ' + str(kaspu_11.time())
        notification.schedule(k11Str,
                              delay=secsFromNow(kaspu_11),
                              sound_name='Media/Sounds/piano/A3#')
    if now < kaspu_12:
        k12Str = 'Kaspu 12 Tiger: ' + str(kaspu_12.time())
        notification.schedule(k12Str,
                              delay=secsFromNow(kaspu_12),
                              sound_name='Media/Sounds/piano/A3')
Exemplo n.º 24
0
def schedule_15min_notifications(start_of_day, end_of_day):
    duration_start_to_end = end_of_day - start_of_day
    num_15min_Ste = int(duration_start_to_end.total_seconds() / 60 / 15)
    hour_floor_durSte = int(
        math.floor(duration_start_to_end.total_seconds() / 60 / 60))
    minute_floor_durSte = int(
        math.floor((duration_start_to_end.total_seconds() -
                    hour_floor_durSte * 60 * 60) / 60))
    # Calcuating first 15minute notification from now
    now_after_colon_in_seconds = now.microsecond * 1e-6 + now.second + now.minute * 60
    now_after_colon_in_minutes = now_after_colon_in_seconds / 60
    now_minute_to_15_ceil = int(
        15 * (math.floor(now_after_colon_in_minutes / 15) + math.ceil(
            (now_after_colon_in_minutes % 15) / 15)))
    dur_minutes_from_now_to_15ceil = now_minute_to_15_ceil - now.minute
    first_notification = now + timedelta(
        minutes=dur_minutes_from_now_to_15ceil) - timedelta(
            seconds=now.second, microseconds=now.microsecond)

    # Duration first_notification to end of day
    dur_first_notif_to_end = end_of_day - first_notification
    num_15min_notifications = int(1 + dur_first_notif_to_end.total_seconds() /
                                  60 / 15)

    for i in range(num_15min_notifications):

        #calculate notification delay_seconds
        i_notification = first_notification + timedelta(minutes=(15 * i))
        delay_timedelta = i_notification - now
        delay_seconds = int(delay_timedelta.total_seconds())

        # Calculate notifcation message
        duration_iNotif_to_end = end_of_day - i_notification
        hour_floor_durInte = int(
            math.floor(duration_iNotif_to_end.total_seconds() / 60 / 60))
        minute_floor_durInte = int(
            math.floor((duration_iNotif_to_end.total_seconds() -
                        hour_floor_durInte * 60 * 60) / 60))
        percentage_used = 100 * round(
            (duration_iNotif_to_end.total_seconds() /
             duration_start_to_end.total_seconds()), 3)
        num_15min_notifications_left = int(
            duration_iNotif_to_end.total_seconds() / 60 / 15)

        message = "{:.2f}".format(percentage_used) + "per. " + str(
            num_15min_notifications_left
        ) + "/" + str(num_15min_Ste) + " " + str(
            hour_floor_durInte
        ) + "h" + "{:01d}".format(minute_floor_durInte) + "m" + "/" + str(
            hour_floor_durSte) + "h" + "{:01d}".format(
                minute_floor_durSte) + "m " + str(
                    i_notification.hour) + ":" + "{:02d}".format(
                        i_notification.minute) + " " + str(
                            start_of_day.hour) + ":" + "{:02d}".format(
                                start_of_day.minute) + " - " + str(
                                    end_of_day.hour) + ":" + "{:02d}".format(
                                        end_of_day.minute)

        print(delay_seconds)
        print(message)

        notification.schedule(message, delay_seconds, "Input")
Exemplo n.º 25
0
import requests
import notification
import console
# my numbers + powerball as last
myNums = [1, 2, 3, 4, 5]
myPowerBall = 0

drawings = eval(
    requests.get(
        "https://www.powerball.com/api/v1/numbers/powerball/recent?_format=json"
    ).content)

lastDrawing = list(
    map(int, drawings[0].get('field_winning_numbers').split(',')))
winningPowerball = lastDrawing.pop(-1)

numMatched = numMatched = len(set(myNums).intersection(lastDrawing))
matchedPowerball = winningPowerball == myPowerBall

body = """
Date: %s
Winning Numbers: %s, %i
My Numbers: %s
# Matched: %i
Matched Powerball: %r
    """ % (drawings[0].get('field_draw_date'), lastDrawing, winningPowerball,
           myNums, numMatched, matchedPowerball)

notification.schedule(body)
console.alert(body, button1="ok", hide_cancel_button=True)
Exemplo n.º 26
0
	def addNotice(self,info):
		notification.schedule(message=info,delay=0,sound_name='default',action_url=self.url,title=self.title)
Exemplo n.º 27
0
# https://forum.omz-software.com/topic/2646/notification-sounds/5

import notification
notification.schedule('Test', delay=5, sound_name='Media/Sounds/drums/Drums_15')

# The same pattern ('Media/Sounds/<collection>/<name>') should work with any of the bundled sounds, not just the 'digital' and 'game' collections.
Exemplo n.º 28
0
        def any_touch(self, touch):
                for key in self.keys:
                        if key.hit_test(touch):
                                if touch.location.x > key.frame.center().x and len(key.names) > 1:
                                        webbrowser.open(key.names[1][1])
                                else:
                                        webbrowser.open(key.names[0][1])
                return

        def touch_began(self, touch):
                self.any_touch(touch)
                return

        def touch_moved(self, touch):
                self.any_touch(touch)
                return

        def touch_ended(self, touch):
                self.any_touch(touch)
                return

notification.cancel_all()
notification.schedule('####### Call-Someone',7,'','tel://12345678')
notification.schedule('####### Whatsapp-Someone',7,'','whatsapp://send?abid=123&text=hello')
notification.schedule('####### Skype-Someone',7,'','skype://12345678')
notification.schedule('======= Whatsapp',7,'','whatsapp:')
notification.schedule('======= Reeder',7,'','reeder:')
notification.schedule('======= Map',7,'','comgooglemaps:')
notification.schedule('launch-todolist,calendar,rss',7,'','pythonista://Launcher')
run(Launcher(), PORTRAIT,7)
Exemplo n.º 29
0
import urllib
import notification
import console
import sound
import webbrowser

numArgs = len(sys.argv)

if numArgs == 1:
	console.alert('This script is meant to be run from Drafts.app. See' +
		' the docs for more info.')
elif numArgs > 1 and (sys.argv[2]) == '':
	url = 'drafts4://x-callback-url/create?text=' + urllib.quote_plus(sys.argv[1])
	console.alert('Please enter a time interval, in minutes, in the body of'
		' your draft.', 'Go back to Drafts?', 'Yes')
	webbrowser.open(url)
elif numArgs == 3:
	digit = sys.argv[2].replace(",", "")
	interval = int(digit) * 60
	text = sys.argv[1]
	notes = 'C3', 'D3', 'A3', 'B3'
	url = 'drafts4://x-callback-url/create?text=' + ''
	for note in notes:
		sound.play_effect('Piano_' + note)
		time.sleep(0.2)
	console.alert('Schedule?', 'Alert in' + ' ' + digit + ' ' + 
		'minutes?', 'Schedule')
	notification.schedule(text, interval, 'default')
	webbrowser.open(url)
else:
	console.alert('Failed.')
Exemplo n.º 30
0
# https://gist.github.com/hiilppp/9936000

# Pythonista script that randomly selects a reminder (out of a given list) and schedules a (quiet) notification for that reminder at a random point of time in the future (within a given range). Opening the notification will then schedule a new reminder notification (and, if provided, follow a link).

import notification
from random import randint
import sys
import urllib
import webbrowser

reminders = ["Reminder A", ["Reminder B", "url://"], "Reminder C"]

n = randint(0, len(reminders) - 1)
URL = "pythonista://random_reminders.py?action=run"

if type(reminders[n]) == list:
    random_reminder = reminders[n][0]
    URL = URL + "&argv=" + urllib.quote(reminders[n][1], safe="")
else:
    random_reminder = reminders[n]

d = 60 * 60 * 24
random_delay = randint(d, 7 * d)

notification.schedule(random_reminder, random_delay, "", URL)

try:
    webbrowser.open(sys.argv[1])
except:
    pass
Exemplo n.º 31
0
# coding: utf-8
# coding: utf-8 (notifyme.py)

# https://forum.omz-software.com/topic/2565/notifications-and-callback-to-myself

import notification

notification.schedule('test', 5, 'default', 'pythonista://test.py?action=run')

#==============================

# coding: utf-8
import notification
print 'hi'
notification.schedule('hello',5,action_url='pythonista://test.py?action=run')
Exemplo n.º 32
0
player.stop()

# --------------------

# coding: utf-8

import editor
import notification
import sound
import os
import urllib

# download a silent mp3 if it's not there yet:
if not os.path.exists('silence.mp3'):
	urllib.urlretrieve('http://www.xamuel.com/blank-mp3-files/1sec.mp3', 'silence.mp3')
player = sound.Player('silence.mp3')
player.number_of_loops = -1 # repeat forever
player.play()

# run the currently open file. I know execfile isnt ideal, but the other option I found is os.system, which didn't work, I think because it uses subprocessing.'
execfile(editor.get_path())

# notify the user when the script is done.
notification.schedule('Your script is done running', delay=0)

# --------------------

time.sleep()

# --------------------
Exemplo n.º 33
0
		k09 = True
		print ('Kaspu 09 has begun')
	elif now > kaspu_10 and k10 == False:
		k10 = True
		print ('Kaspu 10 has begun')
	elif now > kaspu_11 and k11 == False:
		k11 = True
		print ('Kaspu 11 has begun')
	elif now > kaspu_12 and k12 == False:
		k12 = True
		print ('Kaspu 12 has begun')
	time.sleep(10)


'''
'''
1.0, .82, .17
1.0, 1.0, 1.0

import notification

notification.schedule('Test', delay=5, sound_name='Media/Sounds/drums/Drums_15')
The same pattern ('Media/Sounds/<collection>/<name>') should work with any of the bundled sounds, not just the 'digital' and 'game' collections.

import sound
# Play the result:
player = sound.MIDIPlayer('output.mid')
sound.Player(file_path)
player.play()

'''
Exemplo n.º 34
0
	def hook(d):
		if d['status'] == 'finished':
			title = d['filename'].split('/')[-1].split(' - ', 1)[-1].rsplit(' - ', 1)[0]

			notification.schedule(f'Download of "{title}" completed', 1, 'default', '')
			console.clear()
Exemplo n.º 35
0
"""

stocks = [['CIEL3', 600, 10.91], ['MGLU3', 200, 25.27], ['PETR4', 100, 22.05],
          ['LAME4', 100, 34.78], ['PETR4', 200, 27.30]]

stocksf, stocksd = [], []
stocksd.append("Variação Diaria:\n")
stocksf.append("Valores Finais:\n")

for stock in stocks:
    r = requests.get(
        'https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=' +
        stock[0] + '.SA&apikey=YourApiKeyHere')
    data = r.json()
    r1 = data['Global Quote']
    diaria = r1['01. symbol'] + " " + r1['05. price'] + " " + r1[
        '10. change percent']
    stocksd.append(diaria)
    vlrfinal = (float(r1['05. price']) - stock[2])
    final = r1['01. symbol'] + " " + str(round(
        stock[2] * stock[1], 0)) + " " + str(round(stock[1] * vlrfinal, 2))
    stocksf.append(final)

listaf = '\n'.join(stocksd) + '\n\n' + '\n'.join(stocksf)

noti = notification.schedule(message=listaf, title="Lista de Ações \U0001F428")
alerta = dialogs.alert("Lista de Ações \U0001F428",
                       listaf,
                       "\U0001F428 OK \U0001F428",
                       hide_cancel_button=True)
Exemplo n.º 36
0
import console
import sound
import webbrowser

numArgs = len(sys.argv)

if numArgs == 1:
    console.alert('This script is meant to be run from Drafts.app. See' +
                  ' the docs for more info.')
elif numArgs > 1 and (sys.argv[2]) == '':
    url = 'drafts4://x-callback-url/create?text=' + urllib.quote_plus(
        sys.argv[1])
    console.alert(
        'Please enter a time interval, in minutes, in the body of'
        ' your draft.', 'Go back to Drafts?', 'Yes')
    webbrowser.open(url)
elif numArgs == 3:
    digit = sys.argv[2].replace(",", "")
    interval = int(digit) * 60
    text = sys.argv[1]
    notes = 'C3', 'D3', 'A3', 'B3'
    url = 'drafts4://x-callback-url/create?text=' + ''
    for note in notes:
        sound.play_effect('Piano_' + note)
        time.sleep(0.2)
    console.alert('Schedule?', 'Alert in' + ' ' + digit + ' ' + 'minutes?',
                  'Schedule')
    notification.schedule(text, interval, 'default')
    webbrowser.open(url)
else:
    console.alert('Failed.')
Exemplo n.º 37
0
import random
import notification


minute = 60
hour = minute*60
day = hour*24
week = day*7

def get_provocations(file_name):
	try:
		fo = open(file_name, "r")
		provocations = fo.read().split('\n')

	except:
		logging.info('no provocation file found')
		provocations = ['None found']

	else:
		fo.close()

	return provocations
	
provocations = get_provocations('oblique_strategies.txt')

for i in range(4):
	delay = (10 * minute) + (i * (10 * minute))
	provocation = 'Eno: ' + random.choice(provocations)
	print(str(delay) + ' ' + provocation)
	notification.schedule(provocation,delay)