我们从Python开源项目中,提取了以下14个代码示例,用于说明如何使用ui.load_view()。
def tableView_accessoryButtonTappedForRowWithIndexPath_(_self, _cmd, _tv, _ip): view = ObjCInstance(_self) row = ObjCInstance(_ip).row() cell = ObjCInstance(tableView_cellForRowAtIndexPath_(_self, None, _tv, _ip)) accessory_view = ObjCInstance(cell.valueForKey_('_accessoryView')) song = songs[row] song_info_view = ui.load_view('SongInfo') ObjCInstance(song_info_view['artworkImageView']).setImage_(song.artwork) song_info_view['song_title_label'].text = str(song.title) song_info_view['song_album_label'].text = str(song.albumTitle) song_info_view['song_playcount_label'].text = str(song.playCount) song_info_view.present('popover')
def showfindbar(): v = ui.load_view('Find_and_replace') find = v['find'] find.autocapitalization_type = ui.AUTOCAPITALIZE_NONE find.delegate = FindField() replace = v['replace'] replace.autocapitalization_type = ui.AUTOCAPITALIZE_NONE replace.delegate = ReplaceField() back = v['back'] forward = v['forward'] once_and_for_all = v['once_and_for_all'] once_and_for_all.action = seg replace_button = v['replace_button'] editor._set_toolbar(v)
def dump_view(view, path): """ The reverse of `ui.load_view()` """ with open(path, "w") as f: json.dump(_view_to_dict(view), f)
def loadoptionscreen(self): '''Load the option screen ui and queue the state to show it.''' self.optionscreen = ui.load_view('mazecraze') #Create the options screen. self.wantstate = self.showoptionscreen
def __init__(self): root_view = ui.load_view() root_view.left_button_items = [make_button_item(self.bt_close, 'ionicons-close-24')] root_view.right_button_items = [make_button_item(self.bt_subview, 'ionicons-arrow-right-b-24')] self.nav_view = ui.NavigationView(root_view) self.nav_view.present(hide_title_bar=True)
def bt_subview(self, sender): sub_view = ui.load_view('switchview1.pyui') sub_view.name = 'subview' sub_view['btn_Okay'].action = self.bt_action sub_view['btn_Cancel'].action = self.bt_action self.nav_view.push_view(sub_view)
def __init__(self): PopOverView.view_main = ui.load_view('pop-over') PopOverView.view_main.present('fullscreen')
def quit(self, sender): def ask_user(sender): #action method for both buttons (yes and no) PopOverView.view_po.close() if sender.name == 'yes': PopOverView.view_main.close() PopOverView.view_po = ui.load_view('po') PopOverView.view_po.present('popover',popover_location=(400,400))
def __init__(self): self.view = ui.load_view('ShowTableView') self.view.present('fullscreen') self.view.name = 'ShowTableView' self.bt_empty_action(None)
def __init__(self): self.view = ui.load_view('SpecialButton') self.view.present('fullscreen') self.label = ui.Label(frame=(120,100,100,100)) self.btn = MyButtonClass(self.label) self.view.add_subview(self.btn) #watch the order, first button and then the label self.view.add_subview(self.label)
def __init__(self): #self.view = ui.load_view('SpecialButton') self.view = ui.View() self.view.background_color = 'white' self.view.present('fullscreen') img = ui.Image.named('Girl') width,height = img.size img = None self.btn = MyButtonClass(100,100,width,height,'red') self.view.add_subview(self.btn)
def __init__(self): self.view = ui.load_view('SpecialButton') self.view.present('fullscreen') self.btn = MyButtonClass() self.view.add_subview(self.btn)
def load(cls): import os, inspect pyui= os.path.abspath(inspect.getfile(inspect.currentframe()))+'ui' if cls._lastinstance is None: cls._lastinstance = ui.load_view(pyui) return cls._lastinstance
def run(): global root global ctrl global out root = ui.load_view() ctrl = root["ctrl"] out = root["out"] ctrl.delegate = KBControlDelegate() root.present("sheet")