def __init__(self): tv = ui.TableView(name='root_table') self.name = 'My Lists' #things = self.get_items() #ds = ui.ListDataSource(items=things) tv.data_source = MyTableViewDataSource() tv.delegate = MyTableViewDelegate() self.add_subview(tv) tv.editing = False self.list_choices = [ 'Projects', 'Someday Maybe', 'Waiting For', '!nbox' ] for l in self.list_choices: name = 'b' + l.replace(' ', '') self.add_subview(ui.Button(name=name)) self[name].title = l self[name].background_color = 'white' self[name].font = ('<system-bold>', 18) rb = ui.ButtonItem(title='Edit') rb.action = self.edit_button self.right_button_items = [rb] self.a = ui.ActivityIndicator() self.add_subview(self.a)
def add_feed(sender): url = console.input_alert('', "Enter RSS feed URL:", '') result = urlparse.urlparse(url) if result.netloc == '': url = 'http://www.macstories.net/feed/' indicator = ui.ActivityIndicator() indicator.center = navigation_view.center navigation_view.add_subview(indicator) indicator.bring_to_front() indicator.start() feed = feedparser.parse(url) title = feed['feed']['title'] conn = sqlite3.connect('feeds.db') conn.execute('INSERT INTO feeds VALUES (?, ?)', (title, url)) conn.commit() feeds = [] for title, url in conn.execute('SELECT * FROM feeds ORDER BY title'): feeds.append({'title': title, 'url': url}) conn.close() feed_list_controller.feeds = feeds table_view.reload() indicator.stop() navigation_view.remove_subview(indicator)
def __init__(self): ui.View.__init__(self) self.background_color = "#ffffff" self.table = ui.TableView() self.table.delegate = self.table.data_source = self self.table.flex = "WH" self.add_subview(self.table) self.ai = ui.ActivityIndicator() self.ai.style = ui.ACTIVITY_INDICATOR_STYLE_WHITE_LARGE self.ai.hides_when_stopped = True self.ai.x = self.width / 2.0 - (self.ai.width / 2.0) self.ai.y = self.height / 2.0 - (self.ai.height / 2.0) self.ai.flex = "LRTB" self.ai.background_color = "#000000" self.ai.alpha = 0.7 self.ai.corner_radius = 5 self.add_subview(self.ai) self.subview_open = False self.cur_tf = None self.hide_kb_button = ui.ButtonItem( "Hide Keyboard", action=self.hide_keyboard, enabled=False, ) self.right_button_items = (self.hide_kb_button, )
def __init__(self): self.activity = ui.ActivityIndicator(name='activity', hides_when_stopped=True, style=ui.ACTIVITY_INDICATOR_STYLE_WHITE_LARGE, touch_enabled=False) self.activity.center = self.center self.add_subview(self.activity) self.touch_enabled = False self._objc = ObjCInstance(self.activity) self._objc.setColor_(UIColor.grayColor())
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 start_action(sender): v1 = sender.superview['view1'] a = ui.ActivityIndicator(name='activity') a.center = v1.bounds.center() a.start_animating() v1.add_subview(a) ui.delay(partial(delay_action, sender), 3)
def load_song(new_song_id): global current_song_id, scores, current_state, midi_socket if new_song_id < 0 or new_song_id >= len( scores) or new_song_id == current_song_id: return spinner = ui.ActivityIndicator() spinner.style = ui.ACTIVITY_INDICATOR_STYLE_GRAY spinner.center = mbuddy.center spinner.start() mbuddy.add_subview(spinner) path = preset_path(new_song_id) if os.path.isfile(path): state = State.SongState.from_file(filepath=path) else: state = State.SongState.from_default() current_song_id = new_song_id midi_socket.send_song_change(current_song_id) current_state = State.MidiSongState.from_song_state(song_state=state, midi=midi_socket) mbuddy['score_image'].image = ui.Image.named('scores/' + scores[current_song_id]) mbuddy['info_label'].text = ' ' + scores[current_song_id][:-4] spinner.stop() mbuddy.remove_subview(spinner)
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, 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 xdid_load(self, info, dl_path): self.dl_path = dl_path self.info = info x, y, w, h = self['thumbnail_location_view'].frame self.add_subview( ui.ActivityIndicator(name='indicator', center=(w / 2 + x, h / 2 + y))) self.refresh()
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 load(): ai = ui.ActivityIndicator(background_color='black') ai.style = ui.ACTIVITY_INDICATOR_STYLE_WHITE_LARGE ai.present('sheet', hide_title_bar=True, animated=False) ai.start() myfeeddata.load(callback=tabview.reload_data) ai.stop() ai.close() tabview.unset_editing(None)
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, 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, root_node, allow_multi=False, async_mode=False): self.async_mode = async_mode self.allow_multi = allow_multi 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 = True 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.busy_view = ui.View(frame=self.view.bounds, flex='WH', background_color=(0, 0, 0, 0.35)) hud = ui.View(frame=(self.view.center.x - 50, self.view.center.y - 50, 100, 100)) hud.background_color = (0, 0, 0, 0.7) hud.corner_radius = 8.0 hud.flex = 'TLRB' spinner = ui.ActivityIndicator() spinner.style = ui.ACTIVITY_INDICATOR_STYLE_WHITE_LARGE spinner.center = (50, 50) spinner.start_animating() hud.add_subview(spinner) self.busy_view.add_subview(hud) self.busy_view.alpha = 0.0 self.view.add_subview(self.busy_view) self.done_btn = ui.ButtonItem(title='Done', action=self.done_action) self.root_btn = ui.ButtonItem(title='Root', action=self.root_btn_action) self.mobile_btn = ui.ButtonItem(title='Mobile', action=self.mobile_btn_action) self.view.right_button_items = [self.mobile_btn, self.root_btn] if self.allow_multi: self.view.right_button_items = [ self.done_btn, self.mobile_btn, self.root_btn ] self.done_btn.enabled = False self.root_node = root_node self.entries = [] self.flat_entries = [] if self.async_mode: self.set_busy(True) t = threading.Thread(target=self.expand_root) t.start() else: self.expand_root()
def xdid_load(self, item): self.border_color = '#c3c3c3' self.border_width = 1 self.url = item['url'] self['label_category'].text, self[ 'label_category'].background_color = get_color( item["category"].lower()) self['label_length'].text = str(item["length"]) + '页' self['label_posted'].text = item["posted"] if item["visible"] == 'Yes': self['delete_line_view'].hidden = True else: self['delete_line_view'].hidden = False self['label_uploader'].text = item["uploader"] self['label_title'].text = item.get("title") or item.get( 'japanese_title') or item.get('english_title') x, y, w, h = self['rating_location_view'].frame if item['is_personal_rating']: rating = item['display_rating'] personal = True else: rating = item['rating'] personal = False rating_stars_view = render_rating_stars_view(rating, personal=personal, width=w, height=h, name='rating_stars_view') rating_stars_view.x = x rating_stars_view.y = y self.add_subview(rating_stars_view) favcat = item.get('favcat') if favcat: self['label_posted'].border_color = get_color_from_favcat(favcat) if type(item['taglist']) == str: taglist = json.loads(item['taglist']) else: taglist = item['taglist'] self['textview_taglist'].text = render_taglist_to_text( translate_taglist(taglist)) self['button_open_gallery'].action = self.open_gallery self.add_subview( ui.ActivityIndicator(name='indicator', center=(56, 80))) thumbnail_url = item['thumbnail_url'] self.img_path = os.path.join( CACHEPATH, os.path.split(urllib.parse.urlparse(thumbnail_url).path)[1]) glv.PARSER.start_download_pic_normal([(self.img_path, thumbnail_url)], CACHEPATH) self.refresh()
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): self.repo = PythonistaToolsRepo() self.github_installer = GitHubRepoInstaller() self.gist_installer = GistInstaller() self.activity_indicator = ui.ActivityIndicator(flex='LTRB') self.activity_indicator.style = 10 categories_table = CategoriesTable(self) self.nav_view = ui.NavigationView(categories_table.view) self.nav_view.name = 'Pythonista Tools Installer' 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 did_load(self): self.background_color = 'white' # 按钮:显示信息,对应load_info self['button_info'].action = self.load_info # 按钮:刷新,对应refresh_slide self['button_refresh'].action = self.refresh_slide # 按钮:关闭,对应close_view self['button_close'].action = self.close_view # 按钮:自动翻页,对应auto_load_next self['button_autoload'].action = self.auto_load_next # 按钮:设置,对应load_setting self['button_setting'].action = self.load_settingview # 滑块:翻页 self['slider1'].action = self.load_specified_slide_for_slider max_width, max_height = get_max_wh() self.add_subview(ui.ActivityIndicator(name='indicator', center=(max_width/2, max_height/2+18), flex='LRTB'))
def __init__(self, img_id, img_path, url): self.update_interval = 0.1 self.img_path = img_path self.url = url self.page = int(img_id) - 1 self.add_subview(ui.ImageView(name='imageview')) self.add_subview( ui.Label(name='label', frame=(0, 195, 158, 18), font=('<system>', 12), alignment=ui.ALIGN_CENTER, text=img_id)) self.add_subview( ui.ActivityIndicator(name='indicator', center=(69, 97))) self.add_subview( ui.Button(frame=(0, 0, 139, 195), action=self.start_mpv)) self.loading_flag = True self.refresh()
def __init__(self): #Setup the view self.name = 'File Downloader' self.background_color = 'white' #Setup the ui elements self.url_input = ui.TextField(frame = (0, 0, self.width, 50), flex='W', background_color='white') self.url_input.placeholder = 'URL' self.start_button = ui.Button(flex='LR', title='Download') self.start_button.center = (self.width * 0.5, 70) self.start_button.action = self.start_download self.loading_bar = ui.Label(frame=(0,0,0,50), flex='', background_color=(0.00, 0.50, 1.00, 0.5)) self.activity_indicator = ui.ActivityIndicator(frame=(50,25,0,0), flex='W', alignment=ui.ALIGN_CENTER) #Add subviews to main view and 'present' ui self.add_subview(self.url_input) self.add_subview(self.start_button) self.add_subview(self.loading_bar) self.add_subview(self.activity_indicator) self.present('sheet')
def set_act(self, img, explic): self.act = ui.ActivityIndicator() self.act.x = img.width / 2 self.act.y = img.height / 2 self.act.background_color = (0.0, 0.0, 1.0, 0.5) self.act.name = 'Activity_Indicator' self.act.style = ui.ACTIVITY_INDICATOR_STYLE_WHITE_LARGE img.add_subview(self.act) self.expl = ui.Label() self.expl.text = explic self.expl.background_color = (0.0, 0.0, 1.0, 0.5) self.expl.text_color = 'white' self.expl.width = 142 self.expl.height = 30 self.expl.x = self.act.x + self.act.width / 2 - self.expl.width / 2 self.expl.y = self.act.y - self.expl.height img.add_subview(self.expl) self.act.start()
def __setupUi(view,model): vdel=MyTableViewDelegate(model) print('delegate') print(model) datasource=MyTableViewDataSource(model) view['tableview1'].data_source=datasource view['tableview1'].delegate=vdel imgView=view['imageview1'] label=view['label1'] #userName=model['user'].name label.text='Aquiring user...' #webview #segment sc1=view['segmentedcontrol1'] sc1.enabled=False cv=view['view1'] cv.background_color='#ff916a' #project button b4=view['button4'] b4.enabled=False #activity indicator ai=ui.ActivityIndicator() ai.style=ui.ACTIVITY_INDICATOR_STYLE_WHITE rect=(12.5,5,20,20) ai.frame=rect cv.add_subview(ai) ai.start() view.present('sheet') return view
def __init__ (self): self.bg_color = SYSTEM_STYLE self.bookcase = ui.TableView() self.bookcase.bg_color = INFO_STYLE self.bookcase.name = '追书神器' self.bookcase.row_height = 80 self.bookcase.height = h-50 self.bookcase.data_source = BookCaseDataSource('local') self.bookcase.delegate = TableViewDelegate('local') self.refresh = ui.Label() self.refresh.name = 'refresh' self.refresh.frame = (w/2-30,80,60,12) self.refresh.font = ('<System-Bold>',12) self.refresh.text_color = 'red' self.refresh.text = '检查更新...' self.menubar = ui.View() self.menubar.frame = (0,h-50,w,50) self.button1 = ui.Button() self.button1.frame = (0,5,75,40) self.button1.tint_color = 'white' self.button1.image = ui.Image.named('typw:Search') self.button1.action = button1_tapped self.button2 = ui.Button() self.button2.frame = (75,5,75,40) self.button2.tint_color = 'white' self.button2.image = ui.Image.named('iow:ios7_bookmarks_32') self.button2.action = button2_tapped self.button3 = ui.Button() self.button3.frame = (150,5,75,40) self.button3.image = ui.Image.named('typw:Home') self.button3.tint_color = 'white' self.button3.action = button3_tapped self.button4 = ui.Button() self.button4.frame = (225,5,75,40) self.button4.image = ui.Image.named('iow:gear_b_32') self.button4.tint_color = 'white' self.button4.action = button4_tapped self.button5 = ui.Button() self.button5.frame = (300,5,75,40) self.button5.image = ui.Image.named('iow:ios7_close_32') self.button5.tint_color = 'white' self.button5.action = button5_tapped self.view = ui.NavigationView(self.bookcase) self.view.frame = (0,0,w,h-50) self.view.tint_color = 'white' self.view.title_color = 'white' self.network_status = ui.ActivityIndicator() self.network_status.center = (w/2,h/2) self.menubar.add_subview(self.button1) self.menubar.add_subview(self.button2) self.menubar.add_subview(self.button3) self.menubar.add_subview(self.button4) self.menubar.add_subview(self.button5) self.add_subview(self.menubar) self.add_subview(self.view) self.add_subview(self.network_status)
def tableview_move_row(self, tableview, from_section, from_row, to_section, to_row): pass v = ui.load_view('Garfield') views = v['scrollview1'].subviews image_view = views[0] prev_button = views[1] next_button = views[2] share_button = views[3] date_label = views[4] table_view = views[5] image_view.content_mode = ui.CONTENT_SCALE_ASPECT_FIT table_view.delegate = TableViewDelegate() indicator = ui.ActivityIndicator() indicator.style = ui.ACTIVITY_INDICATOR_STYLE_WHITE_LARGE indicator.background_color = (0.0, 0.0, 0.0, 0.5) indicator.x = (ui.get_screen_size()[0] - 60) / 2 indicator.y = (image_view.height - 60) / 2 indicator.width = 60 indicator.height = 60 indicator.corner_radius = 10 v.add_subview(indicator) v.present('sheet') indicator.start() retrieve(default_url)
def __init__(self, root_node, icloud_node=None, import_file_path=None, allow_multi=False, async_mode=False): self.async_mode = async_mode self.allow_multi = allow_multi self.import_file_path = import_file_path self.multi_input = False self.filename = None 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 = allow_multi self.table_view.tint_color = 'gray' self.view = ui.View(frame=self.table_view.frame) self.view.add_subview(self.table_view) if self.import_file_path[1:]: self.multi_input = True else: self.filename = os.path.basename(import_file_path[0]) self.view.name = self.filename if self.filename else 'Choose Location' self.busy_view = ui.View(frame=self.view.bounds, flex='WH', background_color=(0, 0, 0, 0.35)) hud = ui.View(frame=(self.view.center.x - 50, self.view.center.y - 50, 100, 100)) hud.background_color = (0, 0, 0, 0.7) hud.corner_radius = 8.0 hud.flex = 'TLRB' spinner = ui.ActivityIndicator() spinner.style = ui.ACTIVITY_INDICATOR_STYLE_WHITE_LARGE spinner.center = (50, 50) spinner.start_animating() hud.add_subview(spinner) self.busy_view.add_subview(hud) self.busy_view.alpha = 0.0 self.view.add_subview(self.busy_view) self.done_btn = ui.ButtonItem(title='Done', action=self.done_action) self.Rename_btn = ui.ButtonItem( title='Rename', image=ui.Image.named('iob:ios7_compose_outline_32'), action=self.rename_action) if self.multi_input: self.view.right_button_items = [self.done_btn] else: self.view.right_button_items = [self.done_btn, self.Rename_btn] self.done_btn.enabled = False self.root_node = root_node self.icloud_node = icloud_node self.entries = [] self.flat_entries = [] if self.async_mode: self.set_busy(True) t = threading.Thread(target=self.expand_root) t.start() else: self.expand_root()
def __init__(self): # ui setup ui.View.__init__(self) self.connected = False self.proto = None self.background_color = "#000000" self.cmb = ui.Button() self.conb = ui.Button() self.sceneholder = scene.SceneView() self.AI = ui.ActivityIndicator() self.controller = ControllScene(self) self.sceneholder.background_color = self.background_color self.cmb.image = ui.Image('iob:game_controller_b_256') self.conb.image = ui.Image('iob:wifi_256') self.add_subview(self.cmb) self.add_subview(self.conb) self.add_subview(self.sceneholder) self.add_subview(self.AI) self.cmb.border_width = self.conb.border_width = 2 self.cmb.border_color = self.conb.border_color = '#ff0000' self.cmb.tint_color = self.conb.tint_color = "#ff0000" self.cmb.corner_radius = self.conb.corner_radius = 15 self.cmb.flex = self.conb.flex = "TBHLRW" self.sceneholder.flex = "TBHLRW" y = self.height / 2.0 midx = self.width / 2.0 width = (5.0 / 16.0) * self.width offset = (1.0 / 6.0) / 2.0 * self.width height = (1.0 / 2.0) * self.height y = (self.height - height) / 2.0 cmbx = midx - offset - width conbx = midx + offset self.cmb.frame = (cmbx, y, width, height) self.conb.frame = (conbx, y, width, height) self.sceneholder.frame = (0, self.height - y, self.width, y) self.sceneholder.frame_interval = 4 self.sceneholder.anti_alias = True self.sceneholder.shows_fps = False self.sceneholder.scene = self.controller self.AI.style = ui.ACTIVITY_INDICATOR_STYLE_WHITE_LARGE self.AI.hides_when_stopped = True self.AI.frame = (midx - offset, self.height / 2.0 - offset, offset * 2, offset * 2) self.AI.flex = "TBHLRW" self.controller.show_nconn = True self.controller.update_label() # conn setup self.manager = com.ConnectionManager(debug=DEBUG) # other setup self.proxy = CCProxy() self.proxy.default_receiver = self self.cmb.action = self.show_cmb_setup self.conb.action = self.show_connection_setup self.bthr = threading.Thread(name="Background jobs", target=self.background_thread) self.bthr.daemon = True self.bthr.start() if not os.path.exists(KEYMAPPATH): os.mkdir(KEYMAPPATH) try: self.keymap = Keymap.load("default") except IOError: self.keymap = Keymap("default", {}) self.keymap.save()
def show_activity_indicator(v): a = ui.ActivityIndicator(name='activity') a.center = v.bounds.center() a.start_animating() v.add_subview(a)