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()
def main(): v = CharsView(frame=(0, 0, 320, 40)) if keyboard.is_keyboard(): keyboard.set_view(v, 'current') else: v.name = 'Keyboard Preview' v.present('sheet')
def quinted(sender): alltime_switch(sender) qtime = qtime_make(sender) q = '(クイン OR クインテットゲリラ OR クインテッドゲリラ OR #クインテットゲリラ OR #クインテット大会 OR #ゲリラクインテット OR #クインテットルーム) ' + search_fix q = quote(qtime + q) webbrowser.open_new('twitter://search?query=' + q) keyboard.set_view(None) keyboard.insert_text("\n") sys.exit()
def squad(sender): alltime_switch(sender) qtime = qtime_make(sender) q = '(スクゲリ OR スクワット OR スクワッド OR #スクワットゲリラ OR #スクワット大会 OR #ゲリラスクワット OR #スクワットルーム) ' + search_fix q = quote(qtime + q) webbrowser.open_new('twitter://search?query=' + q) keyboard.set_view(None) keyboard.insert_text("\n") sys.exit()
def duo(sender): alltime_switch(sender) qtime = qtime_make(sender) q = '(デュオゲリ OR #デュオゲリラ OR #デュオ大会 OR #ゲリラデュオ OR #デュオルーム) ' + search_fix q = quote(qtime + q) webbrowser.open_new('twitter://search?query=' + q) keyboard.set_view(None) keyboard.insert_text("\n") sys.exit()
def single(sender): alltime_switch(sender) qtime = qtime_make(sender) q = '(シングルゲリラ OR #シングルゲリラ OR #シングル大会 OR #ゲリラシングル OR #シングルルーム) ' + search_fix q = quote(qtime + q) webbrowser.open_new('twitter://search?query=' + q) keyboard.set_view(None) keyboard.insert_text("\n") sys.exit()
def main(): content = get_selected_text() if content == '': content = get_input_context()[0] if content == '': return img = Function(content).plot() v = Plot_View(img) set_view(v)
def main(): if PythonistaVersion >= 3.3: if keyboard.is_keyboard(): v = BrailleKeyboardInputAccessoryViewForTextField() v.custom_keyboard = True keyboard.set_view(v, 'expanded') return # Before Pythonista supporting keyboard or run in Pythonista app w, h = ui.get_screen_size() mv = ui.View() mv.name = 'Test keyboard in Pythonista' mv.background_color = 'white' tf = ui.TextField() tf.text = '' tf.frame = (2, 2, w - 4, 32) mv.add_subview(tf) tfo = ObjCInstance( tf).textField() # UITextField is subview of ui.TextField kv = ui.View() kv.frame = (0, 0, w, min(363, h * (3 / 5))) unused = ' unused, only to simulate height of custom keyboard with Pythonista 3.3' kv.add_subview(ui.Label(frame=(0, 0, w, kv.height / 7), text=unused)) kv.background_color = 'lightgray' frame = (0, kv.height / 7, w, kv.height * 5 / 7) v = BrailleKeyboardInputAccessoryViewForTextField(frame=frame) v.custom_keyboard = False kv.add_subview(v) kv.add_subview( ui.Label(frame=(0, v.y + v.height, w, kv.height / 7), text=unused)) tfo.setInputView_(ObjCInstance(kv)) v.tf = tf v.tfo = ObjCInstance( tf).textField() # UITextField is subview of ui.TextField # view of keyboard retain_global( v ) # see https://forum.omz-software.com/topic/4653/button-action-not-called-when-view-is-added-to-native-view # remove undo/redo/paste BarButtons above standard keyboard tfo.inputAssistantItem().setLeadingBarButtonGroups(None) tfo.inputAssistantItem().setTrailingBarButtonGroups(None) mv.present('full_screen') tf.begin_editing() mv.wait_modal()
def run_search(): v['imageview1'].image = ui.Image('./src/logo.png') now = datetime.datetime.now() strnow = now.strftime('%H:%M:%S') v['nowtime'].text = strnow uitime = v['datepicker'].date minutes = uitime.strftime('%M') iminutes = int(minutes) if 0 < iminutes < 30: v['datepicker'].date = v['datepicker'].date + datetime.timedelta( minutes=30 - iminutes) elif 30 < iminutes < 60: v['datepicker'].date = v['datepicker'].date + datetime.timedelta( minutes=60 - iminutes) if keyboard.is_keyboard() == True: keyboard.set_view(v) else: v.present('sheet')
def __init__(self, server, localIP, port): self.server = server self.name = 'Keyboard Preview' # 仅在调试窗口中才看到窗口名 self.flex = 'WHTBLF' # 尺寸边距都设为自动,以便填充满整个键盘 # 创建iplabel以显示当前服务器运行的ip及端口 iplabel = ui.Label() iplabel.flex = 'WHTBLF' iplabel.text = "请在浏览器打开:" + localIP + ":" + str(port) iplabel.background_color = "#ffffff" iplabel.alignment = ui.ALIGN_CENTER # 之后还可以继续开发更多组件件加入主窗口 self.add_subview(iplabel) # 判断是否是在键盘中运行 if keyboard.is_keyboard(): keyboard.set_view(self, 'expanded') else: # 当在pythonista主应用中调试时启动: self.frame = (0, 0, 500, 200) self.present('sheet')
def main(): if not keyboard.is_keyboard(): return v = MyView() keyboard.set_view(v, 'expanded')
def main(): # Se view add's the created view to the panel of PyKeys keyboard set_view(Out_View())