def tableview_cell_for_row(self, tableview, section, row): if row is 0: cell = ui.TableViewCell('subtitle') cell.text_label.text = str(self.items[0]) #cell.detail_text_label.text = ('Time to service: ' + str(self.items[4]) + ' minutes') cell.detail_text_label.text = (str(self.items[1])) cell.text_label.alignment = ui.ALIGN_LEFT cell.text_label.number_of_lines = 0 cell.text_label.font = ('<system-bold>', 20) cell.accessory_type = 'disclosure_indicator' cell.selectable = True else: cell = ui.TableViewCell('subtitle') cell.text_label.text = (str(self.items[4] + ' Minutes to service')) cell.text_label.alignment = ui.ALIGN_CENTER cell.text_label.font = ('<system-bold>', 14) cell.detail_text_label.text = ('Drive Time: ' + str(self.items[3]) + ' minute | Wait Time: ' + str(self.items[2]) + ' minutes') cell.detail_text_label.alignment = ui.ALIGN_CENTER cell.detail_text_label.font = ('<system>', 10) cell.selectable = False cell.text_label.number_of_lines = 0 return cell
def tableview_cell_for_row(self, tableview, section, row): param = self.params[row] name = param.displayName cell = None if name == None or name == '': name = param.name if param.type == 'bool': cell = ui.TableViewCell() cell.selectable = False switch = ui.Switch() switch.name = param.name switch.value = param.value switch.y = cell.center.y - switch.height/2 switch.x = cell.width + switch.width/2 switch.action = self.switch_change cell.add_subview(switch) else: cell = ui.TableViewCell('value1') if not param.value == None: cell.detail_text_label.text = str(param.value) cell.detail_text_label.text_color = self.thememanager.main_text_colour cell.text_label.text = name cell.background_color = self.thememanager.main_background_colour cell.text_label.text_color = self.thememanager.main_text_colour return cell
def tableview_cell_for_row(self, tableview, section, row): # Create and return a cell for the given section/row if section == 0: cell = ui.TableViewCell("subtitle") cell.image_view.image = ui.Image.named(self.lists[section][1][row][3]) else: cell = ui.TableViewCell("value2") cell.text_label.text = self.lists[section][1][row][1] cell.detail_text_label.text = self.lists[section][1][row][2] return cell
def tableview_cell_for_row(self, tableview, section, row): if row >= self.extraRows: element = self.elements[row - self.extraRows] cell = ui.TableViewCell('subtitle') cell.selectable = False cell.text_label.text = element.get_title() cell.detail_text_label.text = element.get_description() cell.background_color = self.thememanager.main_background_colour cell.image_view.image = ui.Image.named(element.get_icon()) params = element.get_params() or [] selectable = False for p in params: if p.display: selectable = True cell.accessory_type = 'disclosure_indicator' cell.selectable = selectable if self.currentElementNumber >= self.extraRows: cell.selectable = False if self.currentElementNumber + 1 == row: cell.background_color = self.thememanager.running_cell_background_colour cell.text_label.text_color = self.thememanager.running_cell_text_colour cell.detail_text_label.text_color = self.thememanager.running_cell_text_colour else: cell.background_color = self.thememanager.main_background_colour cell.text_label.text_color = self.thememanager.main_text_colour cell.detail_text_label.text_color = self.thememanager.main_text_colour return cell elif row == self.adminRow: cell = ui.TableViewCell() cell.background_color = self.thememanager.main_background_colour cell.selectable = False editButton = ui.Button( title='Done' if tableview.editing else 'Edit') editButton.width *= 1.4 editButton.action = swap_edit editButton.y = cell.height / 2 - editButton.height / 2 editButton.x = cell.width cell.add_subview(editButton) self.titleButton.y = cell.height / 2 - editButton.height / 2 self.titleButton.x = self.titleButton.width / 2 self.titleButton.action = self.change_title cell.add_subview(self.titleButton) return cell elif row == self.typeRow: cell = ui.TableViewCell('value1') cell.background_color = self.thememanager.main_background_colour cell.selectable = True cell.text_label.text_color = self.thememanager.main_text_colour cell.detail_text_label.text_color = self.thememanager.main_text_colour cell.text_label.text = 'Type of Flow' cell.detail_text_label.text = self.flowType return cell
def tableview_cell_for_row(self, tableview, section, row): if tableview.name == 'Bookmarks': cell = ui.TableViewCell() cell.text_label.text = sorted(self.bookmarks.keys())[row] cell.image_view.image = ui.Image.named( 'ionicons-ios7-bookmarks-outline-32') cell.image_view.tint_color = '#66CCFF' return cell elif tableview.name == 'More': cell = ui.TableViewCell() cell.text_label.text = 'Settings' cell.image_view.image = ui.Image.named('ionicons-wrench-32') return cell
def tableview_cell_for_row(self, tableview, section, row): cell = ui.TableViewCell() cell.text_label.text = self.data[row]['name'] cell.accessory_type = 'disclosure_indicator' if not self.data[row]['type'].icon == None: cell.image_view.image = self.data[row]['type'].icon return cell
def tableview_cell_for_row(self, tv, section, row): cell = ui.TableViewCell() entry = self.flat_entries[row] level = entry.level - 1 image_view = ui.ImageView(frame=(44 + 20 * level, 5, 34, 34)) label_x = 44 + 34 + 8 + 20 * level label_w = cell.content_view.bounds.w - label_x - 8 label_frame = (label_x, 0, label_w, 44) label = ui.Label(frame=label_frame) label.font = ('<System>', 18) label.text = entry.title label.flex = 'W' cell.content_view.add_subview(label) if entry.leaf and not entry.enabled: label.text_color = '#999' cell.content_view.add_subview(image_view) if not entry.leaf: has_children = entry.expanded btn = ui.Button(image=ui.Image.named( 'CollapseFolder' if has_children else 'ExpandFolder')) btn.frame = (20 * level, 0, 44, 44) btn.action = self.expand_dir_action cell.content_view.add_subview(btn) if entry.icon_name: image_view.image = ui.Image.named(entry.icon_name) else: image_view.image = None cell.selectable = entry.enabled return cell
def tableview_cell_for_row(self, tableview, section, row): cell = ui.TableViewCell() cell.text_label.text = self.flows[row] cell.background_color = self.thememanager.main_background_colour cell.text_label.text_color = self.thememanager.main_text_colour cell.selectable = True return cell
def tableView_cellForRowAtIndexPath_(sel,cmd,tableView,indexPath): ip = ObjCInstance(indexPath) ds = ObjCInstance(sel) data = ds.data[ip.row()] tv = ObjCInstance(sel) cell = ui.TableViewCell('subtitle') cell.text_label.text = data['name'] cell.detail_text_label.text = data['docsetname'] cell.image_view.image = data['icon'] cell.border_color = Theme_manager.currentTheme.borderColour cell.background_color = Theme_manager.currentTheme.backgroundColour cell.bg_color = Theme_manager.currentTheme.backgroundColour cell.tint_color = Theme_manager.currentTheme.tintColour cell.text_label.text_color = Theme_manager.currentTheme.textColour cell.detail_text_label.text_color = Theme_manager.currentTheme.subTextColour selectedBackgroundView = ui.View() selectedBackgroundView.background_color = Theme_manager.currentTheme.cellSelectionColour if not Theme_manager.currentTheme.showCellSelection: selectedBackgroundView.alpha = 0 cell.selected_background_view = selectedBackgroundView iv = ui.ImageView() cell.content_view.add_subview(iv) iv.image = data['type'].icon iv.width = 15 iv.height = 15 iv.x = cell.content_view.width - (iv.width * 2) iv.y = (cell.content_view.height) / 2 - (iv.height) iv.flex = 'L' return ObjCInstance(cell).ptr
def tableview_cell_for_row(self, tableview, section, row): style = style_list[row] cell = ui.TableViewCell() cell.bg_color = style_data[style] cell.border_width = 0.3 cell.border_color = 'white' cell_selected_icon = ui.ImageView() cell_selected_icon.image = ui.Image.named('iow:checkmark_round_24') cell_selected_icon.frame = (30,15,20,20) cell_bg = ui.View() cell_bg.frame = (0,0,200,50) cell_bg.bg_color = style_data[style] cell_bg.corner_radius = 6 cell_title = ui.Label() cell_title.frame = (0,0,200,50) cell_title.alignment = ui.ALIGN_CENTER cell_title.number_of_lines = 3 cell_title.font = ('<System-Bold>',20) cell_title.text_color = 'white' if style_mode == 'system_theme' else 'black' cell_title.text = style cell.content_view.add_subview(cell_bg) cell.content_view.add_subview(cell_title) if style_data[style] == SYSTEM_STYLE or style_data[style] == READER_STYLE: cell.content_view.add_subview(cell_selected_icon) return cell
def tableview_cell_for_row(self, tableview, section, row): # Create and return a cell for the given section/row import ui cell = ui.TableViewCell() cell.text_label.text = self.items[row]['title'] cell.accessory_type = self.items[row]['accessory_type'] return cell
def tableview_cell_for_row(self, tableview, section, row): # Create and return a cell for the given section/row cell = ui.TableViewCell() cell.text_label.text = subjects[row] # style cell, then fix style_ui's inconistent background colors style_ui(cell) if theme_is_dark(): cell.text_label.text_color = '#cccccc' bg_view = ui.View() select_tint = [0, 0, 0, 1] tinting_factor = 0.1 for idx in range(len(cell.background_color)): if idx < len(cell.background_color) - 1: if theme_is_dark(): select_tint[ idx] = cell.background_color[idx] + tinting_factor else: select_tint[ idx] = cell.background_color[idx] - tinting_factor bg_view.background_color = tuple(select_tint) cell.selected_background_view = bg_view return cell
def tableview_cell_for_row(self, tableview, section, row): self.width, height = ui.get_screen_size() cell = ui.TableViewCell() cell.bounds = (0, 0, self.width, self.row_height) for i in range(3): self.make_labels(cell, tableview.data_source.items[row][i], i) return cell
def __new__(cls, color): c = ui.TableViewCell() #you can put WHATEVER YOU WANT inside content_view. c.content_view.add_subview( ui.View(bg_color=color, frame=c.content_view.bounds)) c.hello = lambda: cls.hello(c) return c
def make_cell(): cell = ui.TableViewCell() h = randint(44, 90) cell.height = h cell.text_label.text = 'cell height - ' + str(h) return cell
def tableview_cell_for_row(self, tableview, section, row): cell = ui.TableViewCell() cell.background_color = self.main.background_color cell.text_label.text_color = self.main.text_color cell.text_label.text = str(row + 1) cell.text_label.alignment = ui.ALIGN_RIGHT return cell
def tableview_cell_for_row(self, tableview, section, row): source = sources_list[row] cell = ui.TableViewCell() cell.text_label.text = source cell.text_label.font = ('<System-Bold>',14) cell.text_label.text_color = '#006f82' cell_selected = ui.View() cell_selected.bg_color = '#f7ffc4' cell_selected.corner_radius = 15 cell_selected.border_width = 3 cell_selected.border_color = '#00c4a8' cell_logo = ui.View() cell_logo.frame = (5,8,5,cell.height-16) cell_logo.bg_color = 'red' cell_detail = ui.Label() cell_detail.frame = (100,0,140,50) cell_detail.number_of_lines = 3 cell_detail.bg_color = 'white' cell_detail.font = ('<System>',12) cell_detail.text_color = '#c400a7' cell_detail.text = sources_data[source]['lastChapter'] cell.selected_background_view = cell_selected cell.content_view.add_subview(cell_detail) if source == chapterview.source_name: cell.content_view.add_subview(cell_logo) return cell
def tableview_cell_for_row(self, tableview, section, row): self.book_id = bookcase_list[row] self.book_info = bookcase_data[self.book_id] cell = ui.TableViewCell('subtitle') cell.bg_color = INFO_STYLE cell.tint_color = SYSTEM_STYLE cell.detail_text_label.text_color = '#008923' cell.accessory_type = 'detail_button' cover = ui.ImageView() cover.frame = (15,10,45,60) img_path = path.join(BOOK_DATA_DIR,'.cache/{}.jpg'.format(self.book_id)) cover.image = ui.Image.named(img_path) title = ui.Label() title.frame = (70,5,255,40) title.font = ('<System-Bold>',18) title.text = self.book_info['title'] status = ui.Label() status.frame = (70,35,255,40) status.number_of_lines = 0 status.font = ('<System>',16) status.text_color = '#44a179' status.number_of_lines = 2 if 'update_data' in globals() and self.book_id in update_data: title.text_color = status.text_color = '#ff00d9' status.text = update_data[self.book_id] else: status.text = self.book_info['lastChapter'] cell.content_view.add_subview(cover) cell.content_view.add_subview(title) cell.content_view.add_subview(status) return cell
def tableview_cell_for_row(self, tableview, section, row): data = tableview.data_source.items[row] cell = ui.TableViewCell() cell.text_label.text = data cell.bg_color = 'white' tableview.bring_to_front() return cell
def tableview_cell_for_row(self, tableview, section, row): # Create and return a cell for the given section/row cell = ui.TableViewCell() cell.image_view.image = self.placeholder_img cell.image_view.load_from_url(self.imgUrls[row]) cell.text_label.text = self.imgUrls[row] return cell
def tableview_cell_for_row(self, tableview, section, row): entry = self.sections[self.section_indices[section]][row] cell = ui.TableViewCell('subtitle') cell.text_label.text = entry['title'] if len(entry['item_author']) > 1: author = ' • by ' + entry['item_author'] else: author = '' dt = parse_date(entry['dt']).strftime("%H:%M") cell.detail_text_label.text = entry['feed_title'] + \ author + ' • ' + dt favicon = ui.ImageView(frame=(2, 10, 16, 16)) favicon.image = ui.Image.from_data( base64.decodebytes( entry['feed_favicon'].partition('base64,')[2].encode('utf-8')), 2) cell.content_view.add_subview(favicon) cell.text_label.number_of_lines = 0 return cell
def tableview_cell_for_row(self, tableview, section, row): cell = ui.TableViewCell() cell.selectable = False cell.background_color = 'black' symbol_name = self.data_list[row] tint_color = 'white' if symbol_name.startswith('R '): symbol_name = symbol_name[2:] tint_color = 'orange' symbol_image = SymbolImage(symbol_name, point_size=14, weight=self.weight, scale=SMALL) button = ui.Button( tint_color=tint_color, title=' ' + symbol_name, font=('Fira Mono', 14), image=symbol_image, frame=cell.content_view.bounds, flex='WH', action=self.copy_to_clipboard, #enabled=False, ) cell.content_view.add_subview(button) return cell
def tableview_cell_for_row(self, tableview, section, row): cell = ui.TableViewCell() cell.selectable = False opt_name = self.menuList[row] label = ui.Label() label.alignment = ui.ALIGN_CENTER label.frame = (0, 0, tableview.width, cell.height) label.text = opt_name if (opt_name == self.MENU_WISHLIST): cell.image_view.image = ui.Image.named('typb:Star') cell.accessory_type = 'disclosure_indicator' elif (opt_name == self.MENU_FAVORITE): cell.image_view.image = ui.Image.named('typb:List') cell.accessory_type = 'disclosure_indicator' elif (opt_name == self.MENU_UPDATE): cell.image_view.image = ui.Image.named('typb:Refresh') elif (opt_name == self.MENU_SETTING): cell.image_view.image = ui.Image.named('typb:Cog') cell.accessory_type = 'disclosure_indicator' elif (opt_name == self.MENU_ABOUT): cell.image_view.image = ui.Image.named('typb:Info') cell.content_view.add_subview(label) return cell
def tableview_cell_for_row(self, tableview, section, row): id = book_lists_list[row] item = book_lists_data[id] cell = ui.TableViewCell() cell.bg_color = INFO_STYLE cover = ui.ImageView() cover.frame = (10,20,40,60) cover.load_from_url(cover_url_encode(item['cover'])) title = ui.Label() title.frame = (60,8,305,18) title.font = ('<System-Bold>',16) title.text_color = SYSTEM_STYLE title.text = item['title'] desc = ui.Label() desc.frame = (60,24,305,56) desc.number_of_lines = 0 desc.font = ('<System>',12) desc.text_color = '#6e6e6e' desc.text = '作者:{author}\n简介:{desc}'.format(**item) info = ui.Label() info.frame = (60,80,305,12) info.font = ('<System>',12) info.text_color = 'red' info.text = '共{bookCount}本书 | {collectorCount}人收藏'.format(**item) cell.content_view.add_subview(cover) cell.content_view.add_subview(title) cell.content_view.add_subview(desc) cell.content_view.add_subview(info) return cell
def tableview_cell_for_row(self, tableview, section, row): status = self.data[row]['status'] cell = ui.TableViewCell('subtitle') cell.text_label.text = self.data[row]['name'] cell.border_color = self.theme_manager.currentTheme.tintColour cell.background_color = self.theme_manager.currentTheme.backgroundColour cell.bar_tint_color = self.theme_manager.currentTheme.tintColour cell.bg_color = self.theme_manager.currentTheme.backgroundColour cell.tint_color = self.theme_manager.currentTheme.tintColour cell.text_label.text_color = self.theme_manager.currentTheme.textColour cell.detail_text_label.text_color = self.theme_manager.currentTheme.subTextColour if not status == 'downloading': cell.detail_text_label.text = status else: cell.detail_text_label.text = self.data[row]['stats'] if not self.data[row]['image'] == None: cell.image_view.image = self.data[row]['image'] iv = self.__getDetailButtonForStatus(status, cell.height, self.action, self.data[row]) iv.x = cell.content_view.width - (iv.width * 1.5) iv.y = (cell.content_view.height) - (iv.height * 1.05) iv.flex = 'L' cell.content_view.add_subview(iv) cell.selectable = False return cell
def tableview_cell_for_row(self, tableview, section, row): # Create and return a cell for the given section/row cell = ui.TableViewCell() cell.text_label.text = self.items[row] cell.text_label.number_of_lines = 0 cell.text_label.line_break_mode = ui.LB_WORD_WRAP return cell
def tableview_cell_for_row(self, tableview, section, row): status = self.data[row].status cell = ui.TableViewCell('subtitle') cell.text_label.text = self.data[row].name cell.border_color = self.theme_manager.currentTheme.tintColour cell.background_color = self.theme_manager.currentTheme.backgroundColour cell.bar_tint_color = self.theme_manager.currentTheme.tintColour cell.bg_color = self.theme_manager.currentTheme.backgroundColour cell.tint_color = self.theme_manager.currentTheme.tintColour cell.text_label.text_color = self.theme_manager.currentTheme.textColour cell.detail_text_label.text_color = self.theme_manager.currentTheme.subTextColour cell.selectable = False if not self.data[row].hasVersions: if not status == 'downloading': cell.detail_text_label.text = status else: cell.detail_text_label.text = self.data[row].stats if not self.data[row].authorName == None: cell.detail_text_label.text = cell.detail_text_label.text + ' - Contributed by ' + self.data[row].authorName iv = self.__getDetailButtonForStatus(status, cell.height, self.action, self.data[row]) iv.x = cell.content_view.width - (iv.width * 1.5) iv.y = (cell.content_view.height) - (iv.height * 1.05) iv.flex = 'L' cell.content_view.add_subview(iv) else: cell.accessory_type = 'disclosure_indicator' if not self.data[row].image == None: cell.image_view.image = self.data[row].image return cell
def cell3(self, tableview, section, row): cell = ui.TableViewCell('value2') cell.bg_color = 'deeppink' cell.text_label.font = ('Avenir Next Condensed', 22) cell.text_label.text = 'TableViewCell(value2)' cell.detail_text_label.text = 'the subtitle line' return cell
def tableview_cell_for_row(self, tv, s, r): cell = ui.TableViewCell() if self.state == "bs": ks = sorted(self.bsData.keys()) else: ks = sorted(self.bpData.keys()) ks.reverse() date = ks[r] if self.state == "bs": val = self.bsData[date] else: val = self.bpData[date] z = ui.Label() z.text = re.sub('T', ' ', date) z.center = (70, 20) z.width = 200 z.alignment = ui.ALIGN_LEFT cell.content_view.add_subview(z) label = ui.Label() label.text = val label.center = (310, 20) label.width = 50 label.alignment = ui.ALIGN_RIGHT cell.content_view.add_subview(label) return cell
def as_cell(self): c = ui.TableViewCell() self.frame = c.content_view.bounds self.flex = 'wh' c.content_view.add_subview(self) c.set_needs_display() return c