This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from objc_util import * | |
| import ctypes | |
| import numpy as np | |
| import matplotlib.image | |
| import io,ui | |
| AVAudioEngine=ObjCClass('AVAudioEngine') | |
| AVAudioSession=ObjCClass('AVAudioSession') | |
| def setup(): | |
| error=ctypes.c_void_p(0) | |
| session=AVAudioSession.sharedInstance() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ui | |
| class Screen(ui.View): | |
| def __init__(self,view): | |
| scale=(min(ui.get_screen_size())-64)/1024. | |
| self.view=view | |
| self.add_subview(view) | |
| self.transform=ui.Transform.scale(scale,scale) | |
| rb=[] | |
| for b in ['ipad','ipad_land','iphone','iphone_land']: | |
| btn=ui.ButtonItem() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python2 | |
| """ | |
| A pure python ping implementation using raw socket. | |
| Note that ICMP messages can only be sent from processes running as root. | |
| Derived from ping.c distributed in Linux's netkit. That code is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ui | |
| #necessary if we want to fool acustomTableViewCell into thinking it is a TableViewCell, mainly for allowing cls.method() type callbacks. | |
| class MockTableCellType(type): | |
| def __instancecheck__(self, other): | |
| if other==ui.TableViewCell: | |
| return True | |
| class CustomTableViewCell(object): | |
| __metaclass__=MockTableCellType |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ui | |
| class CustomTableViewCell(ui.View): | |
| def as_cell(self): | |
| c=ui.TableViewCell() | |
| self.frame=c.content_view.bounds | |
| self.flex='wh' | |
| c.content_view.add_subview(self) | |
| c.set_needs_display() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def getattribstrings_fast(o): | |
| A=[] | |
| itstype=type(o) | |
| for a in dir(o): | |
| if hasattr(itstype,a): | |
| if callable(getattr(itstype,a)): | |
| A.append(a+'()') | |
| else: | |
| A.append(a) | |
| else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ui | |
| view_str=''' | |
| [ { "class" : "View", "attributes" : { | |
| "custom_class" : "moo", | |
| "tint_color" : "RGBA(0.0,0.5,1.0,1.0)", | |
| "border_color" : "RGBA(0.0,0.0,0.0,1.0)", | |
| "flex" : "" }, | |
| "frame" : "{{0, 0}, {240, 240}}", "selected" : false, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| print('ran it') | |
| i=1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #coding: utf-8 | |
| import requests | |
| import appex,console,time,os | |
| unquote=requests.utils.unquote | |
| urlparse=requests.utils.urlparse | |
| url=appex.get_url() | |
| p=urlparse(url) | |
| urlfilename=unquote(unquote(urlparse(appex.get_url()).path.split('/')[-1])) | |
| console.hud_alert('downloading '+urlfilename) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ui | |
| from math import pi | |
| v=ui.View(frame=(0,0,576,576)) | |
| v.bg_color=(1,1,1) | |
| N=12 | |
| for i in range(0,N): | |
| a=ui.Button(image=ui.Image.named('iob:arrow_up_a_256')) | |
| a.height=a.width=64 | |
| a.center=v.bounds.center() | |
| a.transform=ui.Transform.translation(0,-(v.height/2-a.height/2)).concat( |