def __init__(self, pyui_rec): if not pyui_rec: # silent fail is ok return if not isinstance(pyui_rec, dict) or \ 'type' not in pyui_rec or \ 'data' not in pyui_rec or \ 'raw' not in pyui_rec : raise TypeError('''Expected a dict with keys, key, data and raw defined''') if not pyui_rec.get('type') or \ not pyui_rec.get('data'): raise TypeError('Both type and data values need to be present') class selfwrapper(ui.View): def __new__(cls): return self if pyui_rec.get('type') == 'pyui_file': ui.load_view( pyui_rec.get('data') , bindings={'selfwrapper':selfwrapper, 'self':self}) elif pyui_rec.get('type') == 'pyui_str' : if pyui_rec.get('raw', False): pyui_rec['data'] = json.dumps(pyui_rec.get('data','')) ui.load_view_str(pyui_rec.get('data',''), bindings={'selfwrapper':selfwrapper, 'self':self}) self.loaded_type = pyui_rec.get('type')
def __init__(self,*args,**kwargs): print("]]]> showDetailedEntryView INSTANTIATED!!!!") self.arguments = kwargs self.posArgs = args #self.view = ui.load_view("../../Documents/aaaFiveStarsProduction/destinyListDetailView.pyui") #self.view = ui.load_view("/private/var/mobile/Containers/Shared/AppGroup/"+os.path.abspath(__file__)[47:83]+"/Documents/aaaFiveStarsProduction/destinyListDetailView.pyui") #self.view = ui.load_view(groupIDPath+"/Documents/aaaFiveStarsProduction/destinyListDetailView.pyui") self.view = ui.load_view_str(pyui.decode('utf-8')) self.tableView = self.view["tableViewDetail"] self.tableView.row_height = 70 self.view.present('fullscreen')#,hide_title_bar=True) self.view.name = 'DetailedView' #'ShowTableView' #self.data = self.getDataSource() self.tableView.data_source = self.tableView.delegate = self.getDataSource() self.dataList.number_of_lines = 10 self.tableView.action = self.evenMoreDetailAction self.heightSetup() self.tableView.reload_data() self.setup_tableview_swizzle(1) self.tableView.reload_data()
def __init__(self, pyui_str, theme, *args, **kwargs): #ui.load_view(_pyui_file_name, #bindings={'MyClass': WrapInstance(self), 'self': self}) ui.load_view_str(pyui_str, bindings={ 'MyClass': WrapInstance(self), 'self': self }) super().__init__(*args, **kwargs) self.tc = None self.set_tint_color_cheat(theme) self.theme = theme self.border_width = .5 self.corner_radius = 6 self.border_color = 'darkgray' self.update_view()
def get_saved_view(filename, key): ''' return a ui.View given a key that has been previously saved to the database. ''' db = TinyDB(filename) el = db.get(Query()['key'] == key) if el: return ui.load_view_str(el['data'])
class selfwrapper(ui.View): def __new__(cls): return self if raw: pyui_str = json.dumps(pyui_str) ui.load_view_str(pyui_str, bindings={'selfwrapper':selfwrapper, 'self':self})
def __init__(self): self.animate_demo = True self.flex = 'WH' self.name = 'AWS Image Export' self.background_color = '#fff' w, h = ui.get_window_size() self.frame = (0, 0, w, h) buffer = 20 # Setup Exporter self.exporter = AWSImageExporter() # Setup images self.image_list = {} self.all_images = [] # Setup Categories self.categories = [] # Grab Images into above vars self.load_images() # Remove duplicates in categories, and sort self.categories = sorted(list(set(self.categories))) pyui = bz2.decompress(b64decode(self._load_ui())) self.content_view = ui.load_view_str(pyui.decode('utf-8')) self.content_view.background_color = '#333' self.content_view.frame = self.frame self.content_view.flex = 'WH' self.add_subview(self.content_view) # Setup the various connections self.main = self.content_view['main'] self.label_image_num = self.main['image_num'] self.preview_image = self.main['preview_image'] self.preview_category = self.main['preview_category'] self.list_set = self.main['list_set'] self.list_view = self.main['list_view'] self.label_category_preview = self.main['label_category_preview'] self.label_image_preview = self.main['label_image_preview'] # Default View self.preview_category.image = ui.Image( 'images/Database_AmazonElasticCache_Memcached.png') self.preview_image.image = ui.Image( 'images/Database_AmazonElasticCache_Redis.png') self.label_image_num.text = str(len(self.all_images))
def __init__(self, pyui_rec): if not pyui_rec: # silent fail is ok return if not isinstance(pyui_rec, dict) or \ 'type' not in pyui_rec or \ 'data' not in pyui_rec or \ 'raw' not in pyui_rec : raise TypeError('''Expected a dict with keys, key and data defined''') if not pyui_rec.get('type') or \ not pyui_rec.get('data'): raise TypeError('Both type and data values need to be present') class selfwrapper(ui.View): def __new__(cls): return self if pyui_rec.get('type') == 'pyui_file': ui.load_view( pyui_rec.get('data') , bindings={'selfwrapper':selfwrapper, 'self':self}) elif pyui_rec.get('type') == 'pyui_str' : if pyui_rec.get('raw', False): pyui_rec['data'] = json.dumps(pyui_rec.get('data','')) ui.load_view_str(pyui_rec.get('data',''), bindings={'selfwrapper':selfwrapper, 'self':self}) self.loaded_type = pyui_rec.get('type') return
def __init__(self,timelimit=60*60): compressedui = '''\ QlpoOTFBWSZTWUc9NZEAAyzfgFUQUGd/9T+E3Qq/r976QAL8wYDa1TCSQIZMptTU9U9T1A A0xGTQAA9IESJSm9KYyjI0B6gHqfqmmg0ZAbSaBzTEwAJgAmAAEwABMEUo1MU2INIaeoAA AABoBpXQDYpCgnMlgf2mycngJQSSASdLEzlBE5ICGEGigpRUClAG9AcCEJCOSCFKfaGiDh SsfT89nQ2zcEg7mdbgkZNxVIFjoWDp1dnjaTI1uRycNb7nnbm6zJ2+GcDwENYpsTVsTYQs jG7KAq2mEMMSkuwJSUW4hREinC29Pg1yR0haUlpFTbJAfX57Ye3OtskxEvGlTtjiG/o5O1 y81U2oR68XN1cHU6FvutEzMm/AyR01Pa1mGUPZ0Mw5JEJpFNMKIa138TPQzFWCJsSK2OyA 4HOW09a8cJT3yMr5jxDYXpkIyiSpoz7PudZRMPhnrQdFRcUkjIzUeFoBjuxhhVt5Pg/HcO wNGq04b69+xCsnEVEmieM6Y4ak91LUOZ2kIQ0fqgQPX8ULqlLasbsYz1tKzYU5pRn2rDO9 Q2rXbPdptKEJ0aD4VxleN50jnWw+ON2hltb5LIXqDxDl707pG9cQj4Bejn50dsursYDwHp 0VkiHnSQFKlqkhgSNCx9DNMp8OUbMJS729xDWYaYSI/5IXHo/sCVoMEHUkRDjGgCdxUOkS 5ZDiqmYM6UgmNxH6UvdcWiOU1yRmLRHdtUTOSOR/gJFiQtrri8yVzCTMKFw52QyvaUu/gr ZxwNVIH2GoNpoojgqBqtzzagE1RIwSHRFmxqkRBZIwAyJlUvcb+NjMhYZBrcw4W+JEFx7G QJyBwFAWjcTJhzD1BUma8ICoTS2pWfKQmhiQCDkpfsTbjcpgP3zM+tE+ZcE/4u5IpwoSCO emsiA= ''' pyui = bz2.decompress(b64decode(compressedui)) v = ui.load_view_str(pyui.decode('utf-8')) self.v = v self.v.present('sheet') self.timelimit=timelimit self.startTime = time.time() self.gameBegun = False self.playerOne = self.v["playerOne"] self.playerTwo = self.v["playerTwo"] self.playerOne.tint_color='green' self.playerTwo.tint_color='green' self.playerOne.sound='casino:ChipsStack3' self.playerTwo.sound='casino:ChipsStack6' self.playerOne.border_width=1 self.playerTwo.border_width=1 self.playerOne.height=44 self.playerTwo.height=44 self.playerOne.opponentTimeElapsed = 0 self.playerTwo.opponentTimeElapsed = 0 self.playerOne.latestTurnElapsed = 0 self.playerTwo.latestTurnElapsed = 0 self.playerOne.currentOppTime=0 self.playerTwo.currentOppTime=0 self.lastPlayerToTap = "NOBODY" self.lastTimeToggled=self.startTime sound.load_effect(self.playerOne.sound) sound.load_effect(self.playerTwo.sound) self.mainLoop()
#super().__init__(*args, **kwargs) self.bg_color = 'purple' self.xxxxxxxx = 'dynamic Attr' def h(self): print('hello from Panel class') def pyui_bindings(obj): # JonB def WrapInstance(obj): class Wrapper(obj.__class__): def __new__(cls): return obj return Wrapper bindings = globals().copy() bindings[obj.__class__.__name__] = WrapInstance(obj) return bindings j_str = json.dumps(d) v = ui.load_view_str(j_str, pyui_bindings(Panel)) v.present('sheet') # dir(v) shows the xxxxxxxx attr print(dir(v)) # v links to Panel.h method v.h() # --------------------
GX2thmkQGQW4YSRLXzUnTwCG3HC69+ZH2mwOOtRScRBSp0REOS+K9OLBvzvrGt3diWpOXG BlhLjQrbrn1jTBO4BLoFkgqIB5VxNGOddTE3tfMJkDWiNqcxIylUPUX5iUTxV60IVgCidF rM41qUUVo4gPEBrAw+iTI5/EC9XPvSOzo4ebw3e+jcOMagHlFyAFh7jkNgfyJmk/Cmj644 W4vk4qFVSAxCwjUHQxCTweJ+gBMJ/gDliNiuxiA2WPYTFlhZSaMgtQNGoNsa+zjUk7LSPI IEDzA8HGYRKCIUwxPWSB0Oiko94JL2VuFgdCq4htouR0hHAGyZ8TTyDtImL2DNUIWWRZd6 /8BrvqDCnf6g7HtI6AU905HJ8aDJ40Arzg5vRXPqkxGRrQMmAfcqvfZeM6neHLAXMIaLSv dEUFTuXALVNIJTqvIGxIyO6p8K1BxWdlcjMHQJNC6uoauDLz+C/eEw3N7hDzC/W6pg5GxQ wBp0gkdc0GMgGJRTmLYHfICRoIzndccHr3HCw7LmEgnxCtyo8AyXIHJe0ULyvi5YluhygG xQ1FsG3N3NKqUqG0srxXnzBxPUUFxC8r7htEFX/hsHo0hhdQGR1KRTpkIsYQYxJIsSG6qY 9anBf4VLE5jo4kqpRy0QOfHLV4+z9es0JH/i7kinChIRFbxBI= ''' import ui import bz2 from base64 import b64decode pyui = bz2.decompress(b64decode(data)) v = ui.load_view_str(pyui.decode('utf-8')) v['bt_make'].action = make_action v.present('sheet') pyui_path = file_picker('Select pyui file', multiple=False, select_dirs=False, file_pattern=r'^.+.pyui$') if pyui_path: class_name = os.path.splitext(os.path.basename(pyui_path))[0] with open(pyui_path) as in_file: r = json.load(in_file) attrib = r[0] main_view_name = attrib['attributes'].get('name', 'view') v['tf_class_name'].text = class_name
import appex import photos import lay_ui import ui body = ui.load_view() #root = lay_ui.RootView(body=body) root = lay_ui.root lay_ui.present(body, ui.load_view_str((ui.dump_view(body))))
web = ui.load_view_str( """ [ { "class" : "View", "attributes" : { "background_color" : "RGBA(1.000000,1.000000,1.000000,1.000000)", "tint_color" : "RGBA(0.000000,0.478000,1.000000,1.000000)", "enabled" : true, "border_color" : "RGBA(0.000000,0.000000,0.000000,1.000000)", "flex" : "" }, "frame" : "{{0, 0}, {540, 540}}", "selected" : false, "nodes" : [ { "class" : "WebView", "attributes" : { "class" : "WebView", "name" : "webview", "frame" : "{{170, 170}, {200, 200}}", "uuid" : "C40643E2-3779-4B0D-ADBE-6CB8BC5350B1", "scales_to_fit" : true, "flex" : "WH" }, "frame" : "{{0, 0}, {540, 540}}", "selected" : false, "nodes" : [ ] } ] } ] """ )
def __init__(self, str, *args, **kwargs): ui.load_view_str(str, bindings={'MyClass': WrapInstance(self), 'self': self}) super().__init__(*args, **kwargs)
def __init__(self): class selfy(ui.View): def __new__(cls): return self ui.load_view_str(pyuistr, bindings={'self': selfy})
def __new__(self): v = ui.load_view_str(pyuistr) return v
class MyViewWrapper(ui.View): def __new__(self): v = ui.load_view_str(pyuistr) return v def check_load(v): if v['button1']: return True else: return False v = ui.load_view_str(pyuistr) print 'loadviewstr loaded pyui :', check_load(v) v2 = MyView() print 'MyView() loaded pyui:', check_load(v2) v3 = MyViewWrapper() #i.e use this in editor print 'MyViewWrapper() loaded pyui:', check_load(v3) #v.present('sheet') v4 = ui.load_view_str(pyuistr2) print 'Custom View subview inside pyui using MyView() loaded pyui', check_load( v4['view1']) v5 = ui.load_view_str(pyuistr2.replace('MyView', 'MyViewWrapper')) print 'Custom View subview inside pyui using MyViewWrapper() loaded pyui', check_load(
web = ui.load_view_str(""" [ { "class" : "View", "attributes" : { "background_color" : "RGBA(1.000000,1.000000,1.000000,1.000000)", "tint_color" : "RGBA(0.000000,0.478000,1.000000,1.000000)", "enabled" : true, "border_color" : "RGBA(0.000000,0.000000,0.000000,1.000000)", "flex" : "" }, "frame" : "{{0, 0}, {540, 540}}", "selected" : false, "nodes" : [ { "class" : "WebView", "attributes" : { "class" : "WebView", "name" : "webview", "frame" : "{{170, 170}, {200, 200}}", "uuid" : "C40643E2-3779-4B0D-ADBE-6CB8BC5350B1", "scales_to_fit" : true, "flex" : "WH" }, "frame" : "{{0, 0}, {540, 540}}", "selected" : false, "nodes" : [ ] } ] } ] """)
"enabled" : true, "background_color" : "RGBA(1.000000,1.000000,1.000000,1.000000)", "tint_color" : "RGBA(0.000000,0.478000,1.000000,1.000000)", "border_color" : "RGBA(0.000000,0.000000,0.000000,1.000000)", "flex" : "" }, "selected" : false } ] ''' if __name__ == '__main__': v = ui.load_view_str(uipage()) v.name=f'MASK UI V{VERSION}' v.present('uipage') if location.is_authorized(): location.start_updates() v['btmGPS'].alpha=1.0 sleep(1) btmGetGPS(v['btmGPS']) else: v['btmGPS'].alpha=0.2 v['txtResult'].text=TITLE