def room_paste(sender):
    url = clipboard.get()
    if url.find('https://') == -1:
        console.hud_alert("TwitterURLをコピーしてから実行してください", 'error')
        return None
    userid = url2id(url)

    add_api(1, userid)
    for i in range(2, 6):
        tt = threading.Thread(target=add_api, args=(i, userid))
        tt.start()
        time.sleep(0.15)
    tt.join()

    api = OAuth1Session(CK, CS, AT, AS)
    auth = tweepy.OAuthHandler(CK, CS)
    auth.set_access_token(AT, AS)
    TweetName = tweet_get(tw_api[0], userid)
    try:
        roomid = guess_room(TweetName[1], TweetName[0])
    except:
        roomid = ""
    if roomid == "":
        console.hud_alert("ルーム番号がみつかりませんでした。")
    else:
        keyboard.backspace(20)
        keyboard.insert_text(roomid)
        keyboard.insert_text('\n')
        keyboard.set_view(None)
        sys.exit()
예제 #2
0
def main():
	if not keyboard.is_keyboard():
		return

	text = keyboard.get_selected_text()

	clipboard.set(text)
	if text:
		# clear selection
		keyboard.insert_text(' ')
		keyboard.backspace(1)
예제 #3
0
def main():
    if not keyboard.is_keyboard():
        return

    selected_text = keyboard.get_selected_text()
    if selected_text:
        keyboard.backspace(1)

    tpl = keyboard.get_input_context()
    left = tpl[0]
    delete_count = len(left)

    keyboard.backspace(delete_count)
예제 #4
0
def main():
    if not keyboard.is_keyboard():
        return

    selected_text = keyboard.get_selected_text()
    if selected_text:
        keyboard.backspace(1)

    tpl = keyboard.get_input_context()
    right = tpl[1]
    delete_count = len(right)
    keyboard.move_cursor(delete_count)
    keyboard.backspace(delete_count)
예제 #5
0
def delete_word():
    left, right = keyboard.get_input_context()
    if not right:
        return

    m = re.match(r'^(.+?\b *)', right)
    if not m:
        return

    right_word = m.groups()[0]
    count = len(right_word)

    keyboard.move_cursor(count)
    keyboard.backspace(count)
    return
 def delete_button_action(self, sender):
     if self['hirganas']['hirgana'].width > 0:
         # temporary hirgana in progress
         self['hirganas']['hirgana'].width = 0
         self.touch_n = 0
         self.touch_actives = {}
         self['dots'].hidden = True
         self['prefix_dots'].hidden = True
         self['b_decision'].hidden = True
         self.draw_hirganas()
     elif len(self.hirganas) > 0:
         # Hirhanas in progress
         # process to delete last hirgana
         # one hirganas uses a variable number of characters, thus not easy to remove it at right of a text
         del self.hirganas[-1]
         t = ''
         for ch in self.hirganas:
             t += ch
         self['hirganas'].text = t
         self.draw_hirganas()
         # if Kanji selection was in progress, cancel it
         if not self['kanjis'].hidden:
             self.hide_buttons(True)
             #self['kanjis'].hidden = True
             #self['kanjis_up'].hidden = True
             #self['kanjis_ok'].hidden = True
             #self['kanjis_down'].hidden = True
             #self['kanjis_other'].hidden = True				# add 1.6
     else:
         # process to delete in textfield
         if self.custom_keyboard:
             keyboard.backspace(times=1)
         else:
             cursor = self.tfo.offsetFromPosition_toPosition_(
                 self.tfo.beginningOfDocument(),
                 self.tfo.selectedTextRange().start())
             if cursor > 0:
                 self.tf.text = self.tf.text[:cursor -
                                             1] + self.tf.text[cursor:]
                 cursor = cursor - 1
             # set cursor
             cursor_position = self.tfo.positionFromPosition_offset_(
                 self.tfo.beginningOfDocument(), cursor)
             self.tfo.selectedTextRange = self.tfo.textRangeFromPosition_toPosition_(
                 cursor_position, cursor_position)
예제 #7
0
def main():
    if not keyboard.is_keyboard():
        return

    keyboard.move_cursor(1)
    keyboard.backspace(1)
예제 #8
0
def delete_line():
	left, right = keyboard.get_input_context()
	count = len(right + '\n')
	keyboard.move_cursor(count)
	keyboard.backspace(count)
	return
예제 #9
0
def delete_selection():
	selected_text = keyboard.get_selected_text()
	if selected_text:
		keyboard.insert_text(' ')
		keyboard.backspace(1)
	return
 def b_delete_action(sender):
     keyboard.backspace(times=1)
def run_pass_auto():
    global oldimg_url
    global oldtweet_id
    global oldtweet_name
    global oldtweet_text
    global exrep
    global switch
    global new
    global error_script
    
    global alpha_mode,img_mode,speed
    try:
        with open('./.option.csv', 'r', encoding='utf8') as (f):
            reader = csv.reader(f)
            for i in reader:
                alpha_mode = i[0]
                img_mode = i[1]
                sleep_time = 0.21-float(i[2])*0.2
        print("***設定読み込み完了***")
        print("****オート起動****")

    except:
        console.alert('Pythonistaで先に設定して下さい。')
        sys.exit(3)
    
    try:
        f = open('.tw.txt', 'r')
        for row in f:
            settingtxt = row.strip()
        f.close()
        codes = re.split('#', settingtxt)
        au = convert_from_hash(codes[4])
    except:
        print('Twitter連携が無効です\n')
        sys.exit()
    if not au==str(send_code*33):
        print('購入者コードが無効です\n')
        sys.exit()
    
    userid = url2id(url)
    
    add_api(1,userid)
    for i in range(2,6):
        tt = threading.Thread(target=add_api, args=(i,userid))
        tt.start()
        time.sleep(0.15)
    tt.join()
    #print("****連携済み"+str(len(tw_api))+"個****")
    
    start_time = time.time()
    stpcount = 0
    
    if len(tw_api) == 0:
        print("連携不足エラー")
        sys.exit()

    old = tweet_get(tw_api[0], userid, True)
    while old[1] == 'err':
        old = tweet_get(tw_api[0], userid, True)
        stpcount += 1
        if stpcount == 5:
            print("ツイート取得できませんでした。")
            sys.exit()
    oldtweet_id = old[0]
    oldtweet_text = old[1]
    oldtweet_name = old[2]
    oldimg_url = old[3]
    print(oldtweet_name + 'のパスツイ待機中•••')
    new = tweet_get(tw_api[0], userid)
    mtweet_id = new[0]
    mtweet_text = new[1]
    mtweet_name = new[2]
    mimg_url = new[3]
    elapsed_time = 0
    api_switch = 0
    loop_count = 0
    list_get = False
    while switch == 0:
        api_switch = api_switch%len(tw_api)
        if list_switch:
            list_get = not list_get
        t = threading.Thread(target=t_tweet_get, args=(tw_api[api_switch], userid, list_get))
        t.start()
        mtweet_id = new[0]
        mtweet_text = new[1]
        mtweet_name = new[2]
        mimg_url = new[3]
        if not keyboard.is_keyboard():
            print(mtweet_text)
        flag = check_passtweet(mtweet_text)
        if flag:
            ps = pass_auto(mtweet_id, mtweet_text, mimg_url)
            if keyboard.is_keyboard():
                keyboard.backspace(10)
                keyboard.insert_text(ps)
                keyboard.insert_text('\n')
            print('****取得成功****\n' + ps)
            sound.play_effect('arcade:Coin_2', 0.10)
            switch = 1
            try:
                mememe=tw_api[0].me()
                nowt = str(datetime.datetime.now())
                error_script =  "atweet_id x"+str(error_script.count('atweet_id'))+"   ltweet_id x"+str(error_script.count('ltweet_id'))+error_script
                error_script = re.sub("local variable 'atweet_id' referenced before assignment","",error_script)
                error_script = re.sub("local variable 'ltweet_id' referenced before assignment","",error_script)
                stext = nowt[:nowt.find(".")]+'\nリストスイッチ:'+str(list_switch)+"\nエラー文\n"+error_script+"\nuser:@"+mememe.screen_name+"\nsleeptime:"+str(sleep_time)+"\ntweet:"+oldtweet_name+"\n"+oldtweet_text+"\n処理前テキスト\n"+mtweet_text+"\n処理後テキスト\n"+ps
                stext = urllib.parse.quote(stext)
                requests.get()
            except Exception as e:
                #print(e)
                pass
        api_switch+=1
        time.sleep(sleep_time)