def cellTapped(sender): global page global resultsV global hospIdx global HospView global _hospView global homeV if HospView is not None: HospView.wait_modal() currView = None if hospIdx is -1: _hospView = ui.load_view('hospital-details.pyui') hospIdx = getIdxOfName(sender.items[0]) initHospResults() updateHospResults() else: #resultsV.navigation_view.pop_view() #hospView.wait_modal() #print('sheet already being presented') _controller = ui.NavigationView(HospView, navigation_bar_hidden=False) _controller.objc_instance.navigationController().dismis() ehospView.close() #resultsV.navigation_view.push_view(hospView) currView = ui.NavigationView(HospView, navigation_bar_hidden=False) currView.objc_instance.navigationController().navigationBar().hidden = True HospView.present('sheet', hide_title_bar=True) print(HospView.wait_modal()) page = 2 #presentResultsPage(hospIdx) print(HospNamesL[hospIdx] + ' Tapped')
def __init__(self, rootpath, test_mod=0): self.name = 'IstaTranslator' self.rootpath = rootpath self.configService = ConfigService(rootpath + "config.ini") self.logger = logging.getLogger(self.__class__.__name__) self.orientation = self.LANDSCAPE self.test_mod = test_mod self.trans_history = [] self.viewKind = self.TRANSLATE self.translateDeep = 0 self.recordDeep = 0 self.settingDeep = 0 self.isLestenningClipbord = self.configService.GetIsLestenningClipbord( ) if self.isLestenningClipbord: self.lesteningStatus = self.LESTENNING else: self.lesteningStatus = self.STOP # 状态指示器 self.activity_indicator = ui.ActivityIndicator(flex='LTRB') self.activity_indicator.center = self.center self.activity_indicator.style = ui.ACTIVITY_INDICATOR_STYLE_GRAY # 中心导航视图 self.translateView = TranslateView(self) self.recordView = RecordView(self) self.settingView = SettingView(self) self.translateNavi = ui.NavigationView(self.translateView) self.recordNavi = ui.NavigationView(self.recordView) self.settingNavi = ui.NavigationView(self.settingView) # 底部栏 self.bottomView = ui.View() self.translateBtn = ui.Button() self.recordBtn = ui.Button() self.settingBtn = ui.Button() # 将按钮加入底部栏 self.bottomView.add_subview(self.translateBtn) self.bottomView.add_subview(self.recordBtn) self.bottomView.add_subview(self.settingBtn) # 将所有视图加入主窗口 self.add_subview(self.translateNavi) self.add_subview(self.recordNavi) self.add_subview(self.settingNavi) self.add_subview(self.bottomView) self.add_subview(self.activity_indicator) self.LoadUI() self.activity_indicator.bring_to_front()
def __init__(self, rootpath, test_mod=0): self.name = 'AppWishList' self.rootpath = rootpath self.appService = AppService(rootpath) self.configService = ConfigService(rootpath) self.orientation = self.LANDSCAPE self.divice = self.IPAD self.test_mod = test_mod self.isUpdating = False self.viewKind = self.STAR self.starDeep = 0 self.favoriteDeep = 0 self.moreDeep = 0 if self.test_mod == self.NORMAL: self.width, self.height = ui.get_window_size() elif self.test_mod == self.TEST_IPHOE_P: # iPhone test self.width, self.height = 414, 736 else: self.width, self.height = 736, 414 if (self.width + self.height < 1024 + 768): self.divice = self.IPHONE self.activity_indicator = ui.ActivityIndicator(flex='LTRB') self.activity_indicator.center = self.center self.activity_indicator.style = ui.ACTIVITY_INDICATOR_STYLE_GRAY self.starView = WishListView(self) self.favoriteView = CategoryView(self) self.moreView = SettingView(self) self.starNavi = ui.NavigationView(self.starView) self.favoriteNavi = ui.NavigationView(self.favoriteView) self.moreNavi = ui.NavigationView(self.moreView) self.bottomView = ui.View() self.starBtn = ui.Button() self.favoriteBtn = ui.Button() self.moreBtn = ui.Button() self.bottomView.add_subview(self.starBtn) self.bottomView.add_subview(self.favoriteBtn) self.bottomView.add_subview(self.moreBtn) self.add_subview(self.starNavi) self.add_subview(self.favoriteNavi) self.add_subview(self.moreNavi) self.add_subview(self.bottomView) self.add_subview(self.activity_indicator) self.loadUI() self.activity_indicator.bring_to_front()
def __init__(self, nav_column, content_column): """Initialize the view with the two view columns.""" # Putting content_column inside a NavigationView is a hack to make its # title bar visible. We never invoke the NavigationView methods. nav_column = ui.NavigationView(nav_column) self.add_subview(nav_column) self.add_subview(ui.NavigationView(content_column)) self.content_column = content_column self.nav_column = nav_column # open_words will probably always just have one item, but it's # technically possible to have more than one open. self.open_words = [] self.last_layout = None # background color is used as a border between the columns. self.background_color = 'lightgrey'
def __init__(self, app: AppSingleLaunch): self.app = app self.tint_color = '#494949' self.name = "MetreAce Nav" self.flex = 'WH' self.mainscript = MainView() self.nav = ui.NavigationView(self.mainscript)
def __init__(self, rootpath): self.rootpath = rootpath self.appService = AppService(rootpath) self.configService = ConfigService(rootpath) self.isUpdating = False self.orientation = self.LANDSCAPE self.activity_indicator = ui.ActivityIndicator(flex='LTRB') self.activity_indicator.style = 10 self.width, self.height = ui.get_window_size() self.mainTable = MainTable(self) self.nav_view = ui.NavigationView(self.mainTable) self.nav_view.name = 'AppWishList' self.nav_view.flex = "WHLRTB" self.nav_view.add_subview(self.activity_indicator) self.add_subview(self.nav_view) self.loadUI() self.activity_indicator.bring_to_front()
def push_view(self, view): view.left_button_items = ui.ButtonItem( image=ui.Image.named("ionicons-close-24"), action=(lambda sender: self.pop_view()), ), # Needs to be a tuple self.view_stack.append(view) nav = ui.NavigationView(view) nav.width = view.width nav.height = self.scroll.height if len(self.nav_stack) > 0: nav.x = self.nav_stack[-1].x + self.nav_stack[-1].width else: nav.x = 0 self.scroll.content_size = nav.x + nav.width, self.scroll.height # Automatically scroll to the newly pushed view if appropriate if (self.scroll.content_size[0] > self.scroll.width and self.scroll.content_offset[0] >= nav.x - self.scroll.width - 1): self.scroll.content_offset = nav.x + nav.width - self.scroll.width, 0 self.scroll.add_subview(nav) self.nav_stack.append(nav)
def __init__(self, master_width=300, child_min=300, mv=ui.View()): ''' :master_width: the width of the master view :child_min: the minimum size of the child before going to a nav view ''' self.width = 800 self.height = 800 self.master_width = master_width self.mv = mv self.child = ui.View() self.mv.name = 'mv' self.child.name = 'child' self.mv.background_color = (.67, .96, 1.0) self.child.background_color = (.81, 1.0, .38) self.mv.x = 0 self.mv.y = 0 self.mv.flex = 'H' self.mv.height = self.height self.mv.width = self.master_width self.mv.height = self.height self.mv.background_color = 'blue' self.child.flex = 'WHL' self.child.x = mv.width self.child.height = self.height self.add_subview(self.mv) self.add_subview(self.child) self.nav = ui.NavigationView(self.mv) self.nav.hidden = True self.nav.width = self.width self.nav.height = self.height self.nav.flex = 'WH' self.add_subview(self.nav) self.child_min = child_min
def __init__(self): self.navi = ui.NavigationView() self.add_subview(self.navi) self.addNavi('123') self.addNavi('234') self.addNavi('567') self.present('full_screen')
def __init__(self, fileManager, *args, **kwargs): ui.View.__init__(self, *args, **kwargs) self.name = "FileViewer<%r>" % self self.fileManager = fileManager self.file_load_callback = dummy_file_callback self.listview = ui.TableView() self.listview.flex = "WH" self.listview.frame = self.frame self.listview.name = "root" self.listview.delegate = self self.navview = ui.NavigationView(self.listview) self.navview.flex = "WH" self.navview.frame = self.frame self.navview.name = "NAME" self.add_subview(self.navview) self.listview.set_needs_display() self.navview.set_needs_display() self.set_needs_display() self.init_list() self.selected_items = [] self.current_list = None c = Config() self.style = c.get_value("editor.style")
def __init__(self, rootpath, test_mod=0): self.name = 'AppWishList' self.rootpath = rootpath self.appService = AppService(rootpath) self.configService = ConfigService(rootpath) self.isUpdating = False self.orientation = self.LANDSCAPE self.divice = self.IPAD self.test_mod = test_mod self.activity_indicator = ui.ActivityIndicator(flex='LTRB') self.activity_indicator.style = 10 if self.test_mod == self.NORMAL: self.width, self.height = ui.get_window_size() elif self.test_mod == self.TEST_IPHOE_P: # iPhone test self.width, self.height = 414, 736 else: self.width, self.height = 736, 414 if (self.width + self.height < 1024 + 768): self.divice = self.IPHONE self.mainTable = MainTable(self) self.nav_view = ui.NavigationView(self.mainTable) self.nav_view.flex = "WHLRTB" self.nav_view.add_subview(self.activity_indicator) self.add_subview(self.nav_view) self.loadUI() self.activity_indicator.bring_to_front()
def __init__(self): # デッキコード取得 code = clipboard.get() # デッキデータ取得 self.deck = pokeLoadDeckCode.pokeLoadDeckCode(code) # たねポケモンリスト self.seedList = [] for id in self.deck.keys(): if self.deck[id].get('evol') == 'たね': self.seedList.append( { 'title':self.deck[id].get('nameAlt') , 'id':id } ) # データセット作成 self.ds = ui.ListDataSource('') self.ds.items = self.seedList self.ds.move_enabled = True self.ds.delete_enabled = False # テーブル作成 self.tv = ui.TableView() self.tv.name = 'Seed List' self.tv.delegate = self self.tv.data_source = self.ds self.tv.editing = True # ボタン作成 self.bi = ui.ButtonItem(title='Check!') self.bi.action = self.checkStartPokemon # 画面作成 self.nv = ui.NavigationView(self.tv) self.nv.name = 'Pokemon Start Card Check' self.nv.right_button_items = [self.bi]
def main(args): global fnapp # Technically not necessary, but useful for testing ap = argparse.ArgumentParser(description=__doc__) ap.add_argument(u"dir", type=unicode, nargs="?", help=u"initial directory, defaults to favorites list") ns = ap.parse_args(args) fnapp = SlimFilenavApp() lst = fnapp.make_favs_list(common.full_path("./favorites.json")) lst.left_button_items = (ui.ButtonItem( image=ui.Image.named("ionicons-close-24"), action=(lambda sender: fnapp.close()), ), ) fnapp.root = ui.NavigationView(lst) fnapp.root.navigation_bar_hidden = False fnapp.root.flex = "WH" if MODE == "popover": fnapp.root.height = 1000 if ns.dir: fnapp.push_view(fnapp.make_file_list(common.FileItem(ns.dir))) fnapp.root.present(MODE, hide_title_bar=True) sys.exit(0)
def __init__(self, cal: TiTra.Calender): self.view = ui.load_view('Tasks.pyui') self.view.name = "Tasks" self.__cal = cal self._allTasks = TiTra.Task.GetAllTasksList() self._allProjects = TiTra.Project.GetAllProjectsList() self._index = 0 self.nav_view = ui.NavigationView(self.view) self.nav_view.navigation_bar_hidden = True self.__len = len(self._allTasks) root, ext = os.path.splitext(sys.argv[0]) # script path without .py # script_name = os.path.basename(root) # script name without the path listOfDirs = root.split('/') l = len(listOfDirs) - 1 version_button = ui.ButtonItem() pre = self.__cal.GetPrefix() version_button.title = f"{listOfDirs[l-1]}/{listOfDirs[l]} V {version} : {pre}" version_button.tint_color = 'red' # no title bar in this GUI -> other solution needed self.view.right_button_items = [version_button] self.view[ 'l_version'].text = f"{listOfDirs[l-1]}/{listOfDirs[l]} V {version} : {pre}" # self.nav_view.present('sheet') self.nav_view.present() self.slider = SliderWithLabel(frame=(61, 18, 337, 60), value=0, max_val=len(self._allTasks) - 1) value_change = SliderValueChangeDelegate(self) self.slider.delegate = value_change self.view.add_subview(self.slider) self.view['tf_project'].enabled = False self.populate()
def getFile(setter=None, base_dir='.'): fv = FileViewer(setter, base_dir) fv.height = 700 nv = ui.NavigationView(fv) def openDocuments(sender, path): def setme(fv, value): # set and bubble up setters fv.src.sel[0] = value if fv.src.setter is not None: fv.src.setter(value) newfv = FileViewer(setter=lambda value: setme(fv, value), base_dir=path) nv.push_view(newfv) nv.right_button_items = [ ui.ButtonItem(title='Documents', action=lambda sender: openDocuments( sender, os.path.expanduser('~/Documents'))), ui.ButtonItem( title='Library', action=lambda sender: openDocuments(sender, os.path.split(os.__file__)[0])) ] nv.height = 800 nv.width = 500 nv.name = 'File Selector' nv.present('popover') ui.in_background(nv.wait_modal) nv.wait_modal() return fv.src.sel[0]
def __init__(self): self.activity_indicator = ui.ActivityIndicator(flex='LTRB') self.activity_indicator.style = 10 self.display_mode = 'pad' if min( ui.get_screen_size()) >= 768 else 'phone' self.icon_size = '24' if self.display_mode == 'phone' else '32' self.index = {} if os.path.isfile(TITLES_FILE): self.index = self.get_contents_from_file(TITLES_FILE) else: self.update_cache(self.index) categories_table = CategoriesTable(self) self.nav_view = ui.NavigationView(categories_table.view) self.nav_view.name = 'Anime Spider' self.nav_view.add_subview(self.activity_indicator) self.activity_indicator.frame = (0, 0, self.nav_view.width, self.nav_view.height) self.activity_indicator.bring_to_front() self.favorite_dict = MainApp.get_favorites() hist_list = self.get_history() self.old_hist_list, self.hist_list = hist_list[::-1], hist_list[::-1] hiddens = self.get_hiddens() self.old_hide_list, self.hide_list = hiddens.copy(), hiddens.copy()
def __init__(self): switches = ui.SegmentedControl(frame=(50, 700, 300, 29)) switches.segments = ['Starred', 'Unread', 'All Items'] switches.selected_index = 1 switches.action = segment_action self.list = getGroups() self.tv = ui.TableView() self.tv.name = view_type + ' Groups' self.tv.delegate = self self.tv.data_source = self nv = ui.NavigationView(self.tv) nv.name = app_name sync_button = ui.ButtonItem() sync_button.title = '🔄' sync_button.tint_color = 'red' sync_button.action = sync_action nv.left_button_items = [sync_button] feed_button = ui.ButtonItem() feed_button.title = 'Feed' feed_button.tint_color = 'green' feed_button.action = feed_action group_button = ui.ButtonItem() group_button.title = 'Group' group_button.tint_color = 'blue' group_button.action = group_action nv.right_button_items = [feed_button, group_button] nv.add_subview(switches) nv.present('fullscreen')
def __init__(self): self.name = 'Chamonix Bars' self.bars_dict = get_bars_dict() for bar_name in sorted(self.bars_dict): self.add_subview(self.make_bar_button(bar_name)) ui.NavigationView(self).present(orientations=['landscape']) self.navigation_view.name = 'Chamonix Hackathon 2015'
def setup(self): """ This extracts saved (persistence) data from pickle files. Then it creates all the different Views ready to be called. And then it creates the initial user interface. """ # IMPLEMENT PERSISTANCE # Open saved file and extract Group objects. # THIS MUST BE CALLED BEFORE THE TABLE ITEMS ARE EXTRACTED!! # File path is hard coded for iOS version). # This creates a 'generator'. saved_items = self.open_file('ios_persistance.pkl') # Iterate through saved_items generator and add the contents to the # groups_list. for item in saved_items: self.groups_list.append(item) # Do the same for Settings # This is a slight duplicate of code but self.open_file didn't quite work. if os.path.isfile('settings.pkl'): with open('settings.pkl', 'rb') as output: self.settings = pickle.load(output) # SETUP ROOT VIEW (Groups) self.root_view = ui.View() self.root_view.name = 'Groups' self.root_view.background_color = 'white' self.root_table = ui.TableView() self.root_table.flex = 'WH' # Define content items list table_items = [] # Extract items from groups_list for group in self.groups_list: group_name = group.get_name() table_items.append({ 'title': group_name, 'accessory_type': 'disclosure_indicator' }) self.groups_listsource = ui.ListDataSource(table_items) self.root_table.data_source = self.groups_listsource self.root_table.delegate = self.groups_listsource self.groups_listsource.action = self.group_list_action self.groups_listsource.edit_action = self.groups_edit_action self.root_view.add_subview(self.root_table) # SETUP PEOPLE VIEW self.people_pushed_view = ui.load_view('people_view') self.people_table = self.people_pushed_view['tableview1'] # IMPLEMENT UI # Create button objects with the format edit_group_btn = ui.ButtonItem('Settings', None, self.groups_btn_action) add_group_btn = ui.ButtonItem('Add', None, self.groups_btn_action) # Apply buttons to view self.root_view.left_button_items = [edit_group_btn] self.root_view.right_button_items = [add_group_btn] # Create and present NavigationView nav_view = ui.NavigationView(self.root_view) nav_view.present()
def setup_navigationview(self, initview): initview.right_button_items = [ui.ButtonItem(title='Add Flow', action=self.show_flow_choice_menu)] initview.left_button_items = [ui.ButtonItem(title='Elements', action=self.show_elementmanagementview),ui.ButtonItem(title='Settings',action=self.show_settingmanager)] self.navigation_view = ui.NavigationView(initview) self.navigation_view.bar_tint_color=self.theme_manager.main_bar_colour self.navigation_view.tint_color = self.theme_manager.main_tint_colour self.navigation_view.background_color = self.theme_manager.main_background_colour self.navigation_view.title_color = self.theme_manager.main_title_text_colour
def setup_navigation_view(self): nav_view = ui.NavigationView(self.main_view) nav_view.border_color = self.theme_manager.currentTheme.borderColour nav_view.background_color = self.theme_manager.currentTheme.backgroundColour nav_view.bar_tint_color = self.theme_manager.currentTheme.toolbarBackgroundColour nav_view.bg_color = self.theme_manager.currentTheme.backgroundColour nav_view.tint_color = self.theme_manager.currentTheme.tintColour nav_view.title_color = self.theme_manager.currentTheme.textColour return nav_view
def __init__(self): self.seg_control = self.make_segmented_control( ('with available bikes', 'with no bikes available')) self.add_subview(self.seg_control) self.table_view = self.make_table_view() self.add_subview(self.table_view) ui.NavigationView(self).present() self.map_view = make_web_view_from_url( map_url_fmt.format(**station_dict))
def getFile(setter=None, base_dir='.'): fv = FileViewer(setter, base_dir) fv.height = 700 nv = ui.NavigationView(fv) nv.height = 800 nv.name = 'File Selector' nv.present('popover') ui.in_background(nv.wait_modal) #nv.wait_modal() return fv.selection
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 __init__(self): self.activity_indicator = ui.ActivityIndicator(flex='LTRB') self.activity_indicator.style = 10 article_table = ArticleListTable(self) self.nav_view = ui.NavigationView(article_table.view) self.nav_view.name = '知乎日报' self.nav_view.add_subview(self.activity_indicator) self.activity_indicator.frame = (0, 0, self.nav_view.width, self.nav_view.height) self.activity_indicator.bring_to_front()
def __init__(self): self.list = list(data) self.tv = ui.TableView() self.tv.name = "Locatie" self.tv.delegate = self self.tv.data_source = self nv = ui.NavigationView(self.tv) nv.present("sheet")
def __init__(self): # Specify the visible buttons in the navigation view titlebar when the root view is visible. root.right_button_items = [ui.ButtonItem(action=self.openSubView, image=ui.Image.named('ionicons-close-24'))] # Set the titlebar text of the Navigation View when the root view is loaded root.name = 'Root View' # Create the Navigation View with the root view preloaded self.v = ui.NavigationView(root) self.v.name = 'navview' self.v.width = 320 self.v.height = 480 self.v.present('sheet')
def __init__(self): # Load the default view that's placed inside the Navigation View. # This root view has its own pyui file (here: RootView.pyui). # That makes it easier to design the root view. root = ui.load_view('RootView.pyui') # Set the titlebar text of the Navigation View when the root view is loaded root.name = 'Root View' # Specify the visible buttons in the navigation view titlebar when the root view is visible. root.right_button_items = [ui.ButtonItem(action=self.openSubView, image=ui.Image.named('ionicons-close-24'))] # Create the Navigation View with the root view preloaded self.v = ui.NavigationView(root) self.v.present('sheet')
def run(path="~", mode="popover"): # Run the main UI application global nav lst = make_file_list(CWD_FILE_ITEM if full_path(path) == "~" else FileItem(path)) lst.left_button_items = ui.ButtonItem(image=ui.Image.named("ionicons-close-24"), action=close_proxy()), nav = ui.NavigationView(lst) nav.navigation_bar_hidden = False nav.flex = "WH" if mode == "popover": nav.height = 1000 nav.present(mode, hide_title_bar=True)
def prepare_view(self, detail_view=None, navigation=True): self.detail_view[detail_view.unique_id] = detail_view if navigation: self.nav = ui.NavigationView(detail_view) self.nav.navigation_bar_hidden = False self.nav.frame = self.bounds self.nav.flex = "WH" self.nav.name = "Master Detail" self.add_subview(self.nav) else: detail_view.frame = self.bounds detail_view.flex = "WH" self.add_subview(detail_view)