def moveFiles(sender): rows = table.selected_rows if "../" in rows: return error("Can't move current folder") elif not rows: return error("Select items to move") mview = ui.View() mview.name = "Choose location" mtable = ui.TableView() mtable.flex = "WH" mtable.delegate = MDelegate() mtable.data_source = mtable.delegate.getDirListing(mtable.delegate.curpath) def ask_rename(name): answer = console.alert("File named %s already exists." % name, "Do you want to replace it?", "Yes", "No", "Rename", True) return answer @ui.in_background def choose_location(sender): root = mtable.delegate.curpath fns = [table.data_source.items[i[1]] for i in rows] cpaths = [os.path.join(table.delegate.curpath, i) for i in fns] npaths = [os.path.join(root, i) for i in fns] for path, cpath in zip(npaths, cpaths): if os.path.exists(path): rename = ask_rename(os.path.split(path)[-1]) if rename == 2: while os.path.exists(path): root, fn = os.path.split(path) path = os.path.join(root, "-" + fn) elif rename == 1: continue if os.path.exists(path): if os.path.isfile(path): os.remove(path) else: shutil.rmtree(path) shutil.move(cpath, path) ui.delay(mview.close, 0.1) table.delegate.update(table, table.delegate.curpath) toggleEditMode(table)(view.right_button_items[0]) mview.add_subview(mtable) mview.right_button_items = [ ui.ButtonItem("Select", action=choose_location) ] mview.present("sheet")
def __init__(self): self.file = "app.dat" self.loadData() self.v = ui.View(name="bloodApp") self.v.background_color = 'white' self.v.left_button_items = ui.ButtonItem( title='sugar', action=self.switchBs), ui.ButtonItem(title='BP', action=self.switchBp) self.v.right_button_items = ui.ButtonItem(title='save', action=self.save), self.timePick = ui.DatePicker(name="timePick") self.timePick.mode = ui.DATE_PICKER_MODE_DATE_AND_TIME self.table = ui.TableView(name="Table") self.table.data_source = self self.table.background_color = (1, 1, 1, 1) self.table.border_color = (0, 0, 0, 1) self.table.row_height = 30 self.table.flex = "WH" self.table.border_width = 1 self.table.corner_radius = 1 self.table.frame = (0, 200, 320, 272) self.value = ui.TextField(name="value") self.value.keyboard_type = ui.KEYBOARD_PHONE_PAD self.value.clear_button_mode = 'always' self.value.x = 0 self.value.y = 0 self.value.width = 120 self.value.height = 38.5 self.value.background_color = (1, 1, 1, 1) self.value.border_color = (0, 0, 0, 1) self.value.border_width = 1 self.value.corner_radius = 2 self.value.alignment = ui.ALIGN_LEFT self.value.enabled = 1 self.value.placeholder = 'blood sugar' self.v.add_subview(self.timePick) self.v.add_subview(self.table) self.v.add_subview(self.value) self.state = "bs" self.switch() self.table.reload() self.v.present("fullscreen")
def demo(): main_view = ui.View() w, h = ui.get_screen_size() main_view.frame = (0, 0, w, h) main_view.name = 'textDemo' scene_view = scn.View(main_view.frame, superView=main_view) scene_view.autoresizingMask = scn.ViewAutoresizing.FlexibleHeight | scn.ViewAutoresizing.FlexibleRightMargin scene_view.antialiasingMode = scn.AntialiasingMode.Multisampling16X scene_view.allowsCameraControl = True scene_view.backgroundColor = 'white' scene_view.scene = scn.Scene() root_node = scene_view.scene.rootNode text_mesh = scn.Text.textWithString('Pythonista', 6.0) text_mesh.flatness = 0.2 text_mesh.chamferRadius = 0.4 text_mesh.font = ('HelveticaNeue-Bold', 18) bbox_min, bbox_max = text_mesh.boundingBox text_width = bbox_max.x - bbox_min.x text_node = scn.Node.nodeWithGeometry(text_mesh) text_node.castsShadow = True text_container = scn.Node.node() text_container.addChildNode(text_node) text_container.position = (0, 40, 0) text_node.position = (-text_width / 2, 0, 0) box = scn.Box(width=150, height=4, length=150, chamferRadius=1) box_node = scn.Node.nodeWithGeometry(box) root_node.addChildNode(box_node) rotate_action = scn.Action.repeatActionForever( scn.Action.rotateBy(0, math.pi * 2, math.pi * 2, 10)) text_container.runAction(rotate_action) root_node.addChildNode(text_container) light_node = scn.Node.node() light_node.position = (0, 105, 5) light_node.rotation = (1, 0, 0, -math.pi / 2) light = scn.Light.light() light.type = 'spot' light.spotOuterAngle = 65 light.castsShadow = True light.shadowSampleCount = 16 light.color = 'cyan' light_node.light = light root_node.addChildNode(light_node) main_view.present(hide_title_bar=False)
def init(size, numBombs, name): global v global bombs global isFlag bombs = [] v = ui.View(name=name) v.background_color = '#D3D3D3' x, y = ui.get_screen_size() v.frame = (0, 0, x, y - 60) p = creategrid(size, numBombs, x, y) flag_button.action = flag v.right_button_items = [flag_button] v.present('fullscreen') return v
def __init__(self): """ Initialize a BusyView instance. """ self.flex = 'WH' self.background_color = (0, 0, 0, 0.35) backdrop = ui.View(frame=(self.center.x - 50, self.center.y - 50, 100, 100)) backdrop.background_color = (0, 0, 0, 0.7) backdrop.corner_radius = 8.0 backdrop.flex = 'TLRB' self.spinner = spinner = ui.ActivityIndicator() spinner.style = ui.ACTIVITY_INDICATOR_STYLE_WHITE_LARGE spinner.center = (50, 50) backdrop.add_subview(spinner) self.add_subview(backdrop) self.hidden = True
def __init__(self, master_view, detail_view): #need to instantiate with master and detail subviews as args. self.touch_enabled=False # using gestures instead self.g=Gestures() self.prev_location=None self.g.add_pan(self,self.did_pan) self.small_screen_size = False self.menu_is_visible = False #used for redrawing with small_screen_size and for slide events self.master = ui.View(frame=(-60,0,320,200), flex='H', touch_enabled=True) #-60 for effect if ui.get_screen_size()[0] < 768 or ui.get_screen_size()[1] < 768: #adjust for smaller screen self.master.width = ui.get_screen_size()[0] - 45 #leave some space to swipe back (..need to test on iphone!) self.small_screen_size = True master_view.width = self.master.width #otherwise it's at the default 100. self.master.add_subview(master_view) self.detail = ui.View(frame=(0,0,100,100), flex='WH', touch_enabled=True) self.detail.add_subview(detail_view) self.add_subview(self.master) self.add_subview(self.detail) self.background_color = 0.4 self.present()
def main (): # Create the UI and view global view view = ui.View() view.name = 'Study Aid' view.background_color = '#f6f6f6' # Create buttons and views and add to view view.add_subview(makeSearchButtonObj()) view.add_subview(makeLabelObj()) view.add_subview(makeViewProgressButtonObj()) view.add_subview(makeHistoryToggleButtonObj()) # Present view view.present(hide_title_bar = False, animated = True, style= 'full_screen')
def choose_color(self, sender): if sender.name in self.color: self.color[sender.name] = sender.value self.set_color() elif sender in self['palette'].subviews: self.set_color(sender.background_color) elif sender.name == 'color_input': try: c = sender.text if sender.text.startswith('#') else eval( sender.text) v = ui.View(background_color=c) self['color_input'].text = str(v.background_color) self.set_color(v.background_color) except Exception as e: console.hud_alert('Invalid Color', 'error')
def createView(): main=ui.View(frame=(0,0,576,576)) subpanel=ui.View(frame=(0,330,576,246)) subpanel2=ui.View(frame=(0,0,576,246)) slider=ui.Slider(frame=(10,10,150,44),name='slider1') slider.stored=True switch1=ui.Switch(frame=(10,66,70,44),name='switch1') switch1.stored=True switch2=ui.Switch(frame=(90,66,70,44)) #no name switch2.stored=True switch3=ui.Switch(frame=(10,120,70,44),name='switch3') #not stored tf1=ui.TextField(frame=(10,180,250,50),name='textfield') tf1.stored=True main.add_subview(subpanel) subpanel.add_subview(slider) subpanel.add_subview(switch1) subpanel.add_subview(switch2) subpanel.add_subview(switch3) subpanel.add_subview(tf1) slider2=ui.Slider(frame=(10,10,150,44),name='slider1') slider2.stored=True subpanel2.add_subview(slider2) main.add_subview(subpanel2) return main
def create_tool_bar(self): v = ui.View(name='tool_bar') v.bg_color = 'pink' btn = ui.Button(name='style', title='Styles') btn.frame = (0, 0, 90, 32) btn.image = ui.Image.named('iob:arrow_down_b_32') btn.action = self._show_style_menu v.add_subview(btn) lb = ui.Label(name='style_label') lb.frame = (10, 2, 200, 32) lb.text_color = btn.tint_color v.add_subview(lb) return v
def classify_asset(asset): mv = ui.View(bg_color="white") im = ui.ImageView() pil_image = asset.get_image() print(pil_image.size) ui_image = asset.get_ui_image() n_squares = 9 d_grid = 15 # % around the digit wim, him = pil_image.size ws, hs = ui.get_screen_size() if (ws / hs) < (wim / him): h = ws * him / wim im.frame = (0, (hs - h) / 2, ws, h) else: w = hs * wim / him im.frame = ((ws - w) / 2, 0, w, hs) print(wim, him, ws, hs) mv.add_subview(im) wi = im.width hi = im.height im.image = ui_image im.content_mode = 1 # 1 mv.frame = (0, 0, ws, hs) mv.present("fullscreen") dx = wim / n_squares dy = him / n_squares d = dx * d_grid / 100 dl = int((wi / n_squares) * d_grid / 100) for ix in range(n_squares): x = ix * dx for iy in range(n_squares): y = iy * dy pil_char = pil_image.crop( (int(x + d), int(y + d), int(x + dx - d), int(y + dy - d))) l = ui.Button() l.frame = ( int(ix * wi / n_squares) + dl, int(iy * hi / n_squares) + dl, int(wi / n_squares) - 2 * dl, int(hi / n_squares) - 2 * dl, ) l.border_width = 1 l.border_color = "red" l.tint_color = "red" ObjCInstance(l).button().contentHorizontalAlignment = 1 # left l.background_image = pil2ui(pil_char) im.add_subview(l) l.title = classify_image(pil_char)["label"]
def create_or_reuse_cell(self, item_index): # @Phuket2 # trying to change the buffering system # assuming that resuable_cells is # calculated well # using a sledge hammer here! i can see when # scrolling around fast some intresting results. not sure its good ir right through # maybe rather than deleting the first entries in the list, # i could iterate over the list # and delete elements that are furthest away # from the currently visible row, fwd and backwards. just a thought. # its very difficult for me to predict the correct approach. # size of buffer, speed of alogorithm to # etc... # cap the buffered items buf_size = _reusable_cells_cap # hmmm, i am not really sure all the clean # up of objects are being handled correctly # here num_buf_items = len(self.reusable_cells) if num_buf_items > buf_size: del self.reusable_cells[:num_buf_items - buf_size] self.name = str(len(self.reusable_cells)) for cell in self.reusable_cells: if cell.index == item_index: cell.set_info_label('reused') return cell # @Phuket2 # i commented out the below code ''' if self.reusable_cells: cell = self.reusable_cells[0] del self.reusable_cells[0] return cell ''' if self.data_source: return self.data_source.gridview_create_cell(self, item_index) else: return ui.View(bg_color='gray')
def _mktab(self, tab, width, tab_x=None, tab_close_action=None, bypass_close_action=False): assert isinstance(tab, TabPageItem), 'Invalid tab provided' t = ui.View( height=self.tab_height+2, width=width, x=0, y=-1, border_width=0.5, border_color='#ccc', ) if tab.id == 1: t.background_color='white' if tab_x: t.x = tab_x tab_label = ui.Label( font=self.tab_font, text=tab.title, #frame=t.frame, x=5, height=self.tab_height, alignment=ui.ALIGN_CENTER, flex='RTB', ) close_image=ui.Image.named('iob:close_24') close_button = ui.Button( background_image=close_image, frame=((t.width-18), ((t.height-16)/2), 16, 16), flex='LTB', action=self.close_tab, # tab specific tab_id=tab.id, # Used for closing tab_close_action=tab_close_action, # Run when closing bypass_close_action=bypass_close_action, ) #tab_label.present() t.add_subview(tab_label), t.add_subview(close_button) return t
def main(self): main_view = ui.View() w, h = ui.get_screen_size() main_view.frame = (0,0,w,h) main_view.name = 'MDL import demo' scene_view = scn.View(main_view.frame, superView=main_view) scene_view.autoresizingMask = scn.ViewAutoresizing.FlexibleHeight | scn.ViewAutoresizing.FlexibleWidth scene_view.allowsCameraControl = True scene_view.backgroundColor = 'white' scene_view.rendersContinuously = True scene_view.scene = scn.Scene() root_node = scene_view.scene.rootNode floor_geometry = scn.Floor() floor_node = scn.Node.nodeWithGeometry(floor_geometry) root_node.addChildNode(floor_node) asset = MDLAsset.alloc().initWithURL_(nsurl('Lucy.obj')) mesh = asset.objectAtIndex_(0) lucy_geometry = scn.Geometry.geometryWithMDLMesh(mesh) lucy_node_1 = scn.Node.nodeWithGeometry(lucy_geometry) root_node.addChildNode(lucy_node_1) lucy_node_2 = scn.Node.nodeWithMDLObject(mesh) lucy_node_2.position = (10., 0., 0.) root_node.addChildNode(lucy_node_2) camera_node = scn.Node() camera_node.camera = scn.Camera() camera_node.position = (10., 10., 10.) camera_node.lookAt(root_node.position) root_node.addChildNode(camera_node) light_node = scn.Node() light_node.position = (-20., 20., 20) light = scn.Light() light.type = scn.LightTypeDirectional light.castsShadow = True light.shadowSampleCount = 32 light.color = (.99, 1.0, .86) light_node.light = light light_node.lookAt(root_node.position) root_node.addChildNode(light_node) main_view.present(hide_title_bar=False)
def btn_HTMLview(self, sender): sel_rows = len(self.view['tableview1'].selected_rows) if sel_rows == 1: row = self.view['tableview1'].selected_row[1] self.view_po = ui.View() self.view_po.name = self.view['tableview1'].data_source.items[row]['title'] wv = ui.WebView() wv.width = self.view_po.width wv.height = self.view_po.height wv.flex = 'WH' self.view_po.add_subview(wv) self.view_po.present('full_screen') wv.load_url(self.path + '/' + self.filename) wv.scales_page_to_fit = True else: self.btn_Help(None,message='Please select one file.',name='Error')
def main(): main_view = ui.View(frame=(0, 0, 400, 400)) main_view.name = 'Key Commands Demo' v = KeyCommandsView.alloc().initWithFrame_(((0, 0), (400, 400))) v.setBackgroundColor_(UIColor.lightGrayColor()) v.becomeFirstResponder() ObjCInstance(main_view).addSubview_(v) label = ui.Label(frame=(0, 0, 400, 400)) label.alignment = ui.ALIGN_CENTER label.text = 'Press Cmd+R on an external keyboard to change the background color.' label.number_of_lines = 0 main_view.add_subview(label) main_view.present('sheet')
def __init__(self, root_node): self.selected_entries = None self.table_view = ui.TableView() self.table_view.frame = (0, 0, 500, 500) self.table_view.data_source = self self.table_view.delegate = self self.table_view.flex = 'WH' self.table_view.allows_multiple_selection = False self.table_view.tint_color = 'gray' self.view = ui.View(frame=self.table_view.frame) self.view.add_subview(self.table_view) self.view.name = root_node.title self.root_node = root_node self.entries = [] self.flat_entries = [] self.expand_root()
def __init__(self): #self.flex = 'TBLR' self.width = 180 self.height = 34 background_view = ui.ImageView( flex='WH', frame=(0, 0, self.width, self.height), image=ui.Image.named('gui/fivestars_grey.png') ) self.add_subview(background_view) upper_view = ui.View( flex='WH', frame=(0, 0, self.width, self.height), name='upper_view' ) self.add_subview(upper_view)
def demo(): main_view = ui.View() main_view_objc = ObjCInstance(main_view) scene_view = SCNView.alloc().initWithFrame_options_(((0, 0), (400, 400)), None).autorelease() scene_view.setAutoresizingMask_(18) scene_view.setAllowsCameraControl_(True) scene = SCNScene.scene() root_node = scene.rootNode() text_mesh = SCNText.textWithString_extrusionDepth_('Pythonista', 6.0) text_mesh.setFlatness_(0.2) text_mesh.setChamferRadius_(0.4) text_mesh.setFont_(UIFont.fontWithName_size_('HelveticaNeue-Bold', 18)) bbox_min, bbox_max = SCNVector3(), SCNVector3() text_mesh.getBoundingBoxMin_max_( byref(bbox_min), byref(bbox_max), restype=None, argtypes=[POINTER(SCNVector3), POINTER(SCNVector3)]) text_width = bbox_max.x - bbox_min.x text_node = SCNNode.nodeWithGeometry_(text_mesh) text_node.setCastsShadow_(True) text_container = SCNNode.node() text_container.addChildNode_(text_node) text_container.setPosition_((0, 40, 0)) text_node.setPosition_((-text_width / 2, 0, 0)) box = SCNBox.boxWithWidth_height_length_chamferRadius_(100, 4, 100, 1) box_node = SCNNode.nodeWithGeometry_(box) root_node.addChildNode_(box_node) rotate_action = SCNAction.repeatActionForever_( SCNAction.rotateByX_y_z_duration_(0, math.pi * 2, math.pi * 2, 10)) text_container.runAction_(rotate_action) root_node.addChildNode_(text_container) light_node = SCNNode.node() light_node.setPosition_((0, 100, 10)) light_node.setRotation_((1, 0, 0, -math.pi / 2)) light = SCNLight.light() light.setType_('spot') light.setCastsShadow_(True) light.setColor_(UIColor.cyanColor().CGColor()) light_node.setLight_(light) root_node.addChildNode_(light_node) scene_view.setScene_(scene) main_view_objc.addSubview_(scene_view) main_view.name = 'SceneKit Demo' main_view.present()
def get_username(): textfield = ui.TextView(name='namefield') textfield.text = read_username() button = ui.Button(title='Save name') button.action = write_username root_view = ui.View(name='get_username()') root_view.add_subview(textfield) root_view.add_subview(button) root_view.hidden = True root_view.present('sheet') textfield.center = button.center = root_view.center textfield.height = 25 root_view.hidden = False return root_view
def get_all_attrs_set(): # return a set of unique attrs across all ui_elements # sets doing all the hard work with the union operator '|' s = set() for ctl in _ui_controls: try: s = s | set(get_full_dict(ctl())) except: # handle differently for ui.NavigationView, it needs a # ui.View as a param if ctl is ui.NavigationView: s = s | set(get_full_dict(ctl(ui.View()))) else: # print out a control type if an error produced we # do not handle print(ctl) return s
def __init__(self, mode=ui.DATE_PICKER_MODE_DATE, title='', done_button_title='Done'): self.was_canceled = True self.container_view = ui.View(background_color='white') self.view = ui.DatePicker() self.view.name = title self.view.mode = mode self.view.background_color = 'white' self.view.frame = (0, 0, 500, 500) self.view.flex = 'WH' self.container_view.frame = self.view.frame self.container_view.add_subview(self.view) done_button = ui.ButtonItem(title=done_button_title) done_button.action = self.done_action self.container_view.right_button_items = [done_button]
def buttonTapped(sender3): # Working! def bHome(sender5): # Working! web_view.load_url('http://www.google.se') n_view = ui.View() n_view.name = 'Option' n_view.background_color = .47, .47, .47 n_view.frame = (0, 40, 400, 360) sender3.superview.navigation_view.push_view(n_view) b4 = ui.Button(title='Home', frame=(360, 80, 70, 70)) b4.tint_color = 'black' b4.action = bHome n_view.add_subview(b4) b5 = ui.Button(frame=(330, 180, 100, 70)) b5.title = 'bookmarks' b5.tint_color = 'black' n_view.add_subview(b5)
def __init__(self, _body=ui.View()): self.name = 'main' self.mode = 0 self.frame = (0, 0, 240, 240) body = self.setup_body(_body) title_bar = self.TitleBar(name='title_bar', frame=(0, 0, self.width, 30)) controller = self.Controller(name='controller', frame=(0, self.height - 17, self.width, 17)) self.add_subview(body) self.add_subview(title_bar) self.add_subview(controller) self.permissions = {'controller': {'x-move': True}}
def __init__(self, width=1024, height=1024): self.bg_color = 'white' iv = ui.ImageView(frame=(0, 0, width, height)) pv = PathView(frame=self.bounds) ui.View(alpha=0.5) pv.action = self.path_action self.add_subview(iv) self.add_subview(pv) save_button = ui.ButtonItem() save_button.title = 'RTL' save_button.action = self.rtl_action clear_button = ui.ButtonItem() clear_button.title = 'Clear' clear_button.tint_color = 'red' clear_button.action = self.clear_action self.right_button_items = [save_button, clear_button] self.image_view = iv
def test(): icon_names = ['iob:beaker_32', 'iob:beer_32', 'iob:bag_32'] button_item_list = map( lambda name: ui.ButtonItem(image=ui.Image.named(name), action=handle_action), icon_names) condenser = ButtonItemCondenser(button_item_list) v = ui.View(frame=(0, 0, 400, 400), name='Demo') v.background_color = 'white' condensed_list = condenser.get_condensed_list() normal_item = ui.ButtonItem(image=ui.Image.named('iob:checkmark_32'), action=handle_action) condensed_list.append(normal_item) v.right_button_items = condensed_list v.present('sheet')
def newItem(sender): pview = ui.View() ptable = ui.TableView() ptable.flex = "WH" ptable.data_source = ui.ListDataSource([ "New folder", "New file", "Script with ui", "Scene with layers", "Basic scene" ]) ptable.delegate = NDelegate(table) sx, sy = ui.get_screen_size() x, y, w, h = view["nbutton"].frame pos = (x + (sx / 2 - view.width / 2) + w / 2, y + (sy / 2 - view.height / 2) + h) pview.add_subview(ptable) pview.width, pview.height = 300, 150 pview.present("popover", True, pos, True)
def main(text): v = ui.View(frame=(0, 0, 320, 120)) label = ui.Label(frame=(20, 0, 320 - 44 - 30, 120), flex='wh') label.name = 'text_label' label.font = ('Menlo', 13) label.number_of_lines = 0 v.add_subview(label) clear_btn = ui.Button(frame=(320 - 44 - 10, 0, 44, 120), flex='hl') clear_btn.name = "clear_button" clear_btn.image = ui.Image.named('iow:clipboard_32') clear_btn.tint_color = "#000000" clear_btn.action = toClipButton v.add_subview(clear_btn) appex.set_widget_view(v) label.text = "正在生成分享链接…" label.text = 'Base 62: ' + text + "\n数字 ID: " + str( index(text)) + "\n微博国际版 URL: " + clearURL
def make_time_view(): v = ui.View(frame=(0, 0, sz[0], sz[1] - banner)) v.name = 'time' v.background_color = 'white' done = ui.ButtonItem('Schedule') v.right_button_items = [done] tab = ui.TableView() tab.frame = (0, 0, sz[0], 150) lst = ui.ListDataSource(['time 1', 'time 2']) tab.data_source = lst tab.delegate = lst v.add_subview(tab) wid = 120 custip = ui.TextField() custip.frame = (20 + wid, 160, sz[0] - wid - 30, 36) custip.clear_button_mode = 'while_editing' custip.text = '1' custip.keyboard_type = ui.KEYBOARD_NUMBER_PAD custip.delegate = MyTextFieldDelegate(done) v.add_subview(custip) label = ui.Label() label.text = 'Number of runs' label.frame = (10, 160, wid + 10, 36) v.add_subview(label) custip = ui.TextField() custip.frame = (20 + wid, 206, sz[0] - wid - 30, 36) custip.clear_button_mode = 'while_editing' custip.text = '24' custip.keyboard_type = ui.KEYBOARD_DECIMAL_PAD custip.delegate = MyTextFieldDelegate(done) v.add_subview(custip) label = ui.Label() label.text = 'Length (hours)' label.frame = (10, 206, wid + 10, 36) v.add_subview(label) dt = ui.DatePicker() dt.frame = (0, 240, sz[0], sz[1] - 240) v.add_subview(dt) return v
def __init__(self, container, state): self._container = container self._touch_began_location = None self._initial_container_frame = None self._container_superview = ObjCInstance(container).superview() label = LayoutProxy(ui.Label()) label.font = ('<system>', 13.0) label.alignment = ui.ALIGN_CENTER label.text_color = get_theme_value('bar_title_color') label.touch_enabled = False self.add_subview(label) label.layout.align_left_with_superview.equal = 0 label.layout.align_right_with_superview.equal = 0 label.layout.align_center_y_with_superview.equal = 0 self.title_label = label button = LayoutProxy( ui.Button(title='x', tint_color=get_theme_value('tint_color'))) self.add_subview(button) button.layout.align_left_with_superview.equal = 0 button.layout.align_top_with_superview.equal = 0 button.layout.align_bottom_with_superview.equal = 0 button.layout.width.equal = _OVERLAY_BAR_HEIGHT self.close_button = button button = LayoutProxy( ui.Button(title='-', tint_color=get_theme_value('tint_color'))) self.add_subview(button) button.layout.align_right_with_superview.equal = 0 button.layout.align_top_with_superview.equal = 0 button.layout.align_bottom_with_superview.equal = 0 button.layout.width.equal = _OVERLAY_BAR_HEIGHT self.collapse_button = button separator = LayoutProxy( ui.View(background_color=get_theme_value('separator_color'))) self.add_subview(separator) separator.layout.height.equal = 1 separator.layout.align_left_with_superview.equal = 0 separator.layout.align_bottom_with_superview.equal = 0 separator.layout.align_right_with_superview.equal = 0 self.separator = separator self.update_appearance(state)