Python ui 模块,TableViewCell() 实例源码

我们从Python开源项目中,提取了以下41个代码示例,用于说明如何使用ui.TableViewCell()

项目:PyDoc    作者:shaun-h    | 项目源码 | 文件源码
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
        cell.detail_text_label.text = cell.detail_text_label.text + ' - Contributed by ' + self.data[row].authorName
        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
项目:PyDoc    作者:shaun-h    | 项目源码 | 文件源码
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' or not 'stats' in self.data[row].keys():
            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
项目:PyDoc    作者:shaun-h    | 项目源码 | 文件源码
def tableview_cell_for_row(self, tableview, section, row):
        cell = ui.TableViewCell()
        cell.border_color = self.theme_manager.currentTheme.tintColour
        cell.background_color = self.theme_manager.currentTheme.backgroundColour
        cell.bar_tint_color = self.theme_manager.currentTheme.toolbarBackgroundColour
        cell.bg_color = self.theme_manager.currentTheme.backgroundColour
        cell.tint_color = self.theme_manager.currentTheme.tintColour
        cell.title_color = self.theme_manager.currentTheme.tintColour
        cell.text_label.text_color = self.theme_manager.currentTheme.textColour
        cell.text_label.text = self.data[row].plural
        cell.accessory_type = 'disclosure_indicator'
        selectedBackgroundView = ui.View()
        selectedBackgroundView.background_color = self.theme_manager.currentTheme.cellSelectionColour
        if not self.theme_manager.currentTheme.showCellSelection:
            selectedBackgroundView.alpha = 0
        cell.selected_background_view = selectedBackgroundView
        if not self.data[row].icon == None:
            cell.image_view.image = self.data[row].icon
        return cell
项目:PyDoc    作者:shaun-h    | 项目源码 | 文件源码
def tableview_cell_for_row(self, tableview, section, row):
        cell = ui.TableViewCell()       
        cell.border_color = self.theme_manager.currentTheme.borderColour
        cell.background_color = self.theme_manager.currentTheme.backgroundColour
        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
        selectedBackgroundView = ui.View()
        selectedBackgroundView.background_color = self.theme_manager.currentTheme.settingsCellSelectionColour
        if not self.theme_manager.currentTheme.showSettingsCellSelection:
            selectedBackgroundView.alpha = 0
        cell.selected_background_view = selectedBackgroundView
        if section == self.docset_section_number:
            cell.text_label.text = self.data[row]
            cell.accessory_type = 'disclosure_indicator'
        elif section == self.ack_section_number:
            cell.text_label.text = self.ack_data[row]['text']
        elif section == self.pydoc_updates_section_number:
            cell.text_label.text = self.updates_data[row]
        elif section == self.theme_section_number:
            cell.text_label.text = self.theme_data[row]
        elif section == self.websearch_section_number:
            cell.text_label.text = self.webSearch_data[row]
        return cell
项目:PyDoc    作者:shaun-h    | 项目源码 | 文件源码
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 + ' (' + self.data[row].type + ')'
        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
项目:PyDoc    作者:shaun-h    | 项目源码 | 文件源码
def tableview_cell_for_row(self, tableview, section, row):
        k = list(self.data.keys())[section]
        cell = ui.TableViewCell('subtitle')
        cell.text_label.text = self.data[k][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 self.data[k][row].status == 'Installing':
            cell.detail_text_label.text = self.data[k][row].status
        else:
            cell.detail_text_label.text = self.data[k][row].stats
        if not self.data[k][row].image == None:
            cell.image_view.image = self.data[k][row].image
        iv = self.__getDetailButtonForStatus(self.data[k][row].status, cell.height, self.action, self.data[k][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
项目:PyDoc    作者:shaun-h    | 项目源码 | 文件源码
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
项目:PyDoc    作者:shaun-h    | 项目源码 | 文件源码
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'
        cell.border_color = self.theme_manager.currentTheme.tintColour
        cell.background_color = self.theme_manager.currentTheme.backgroundColour
        cell.bar_tint_color = self.theme_manager.currentTheme.toolbarBackgroundColour
        cell.bg_color = self.theme_manager.currentTheme.backgroundColour
        cell.tint_color = self.theme_manager.currentTheme.tintColour
        cell.title_color = self.theme_manager.currentTheme.tintColour
        cell.text_label.text_color = self.theme_manager.currentTheme.textColour
        selectedBackgroundView = ui.View()
        selectedBackgroundView.background_color = self.theme_manager.currentTheme.cellSelectionColour
        if not self.theme_manager.currentTheme.showCellSelection:
            selectedBackgroundView.alpha = 0
        cell.selected_background_view = selectedBackgroundView      
        if not self.data[row]['type'].icon == None:
            cell.image_view.image = self.data[row]['type'].icon
        return cell
项目:pythonista-scripts    作者:khilnani    | 项目源码 | 文件源码
def tableview_cell_for_row(self, tableview, section, row):
        section_key = self.elements.keys()[section]
        try:
            cell = ui.TableViewCell('subtitle')
            cell.background_color = self.thememanager.main_background_colour
            cell.text_label.text_color = self.thememanager.main_text_colour
            cell.text_label.text = self.elements[section_key][row].get_title()
            cell.detail_text_label.text = self.elements[section_key][row].get_description()
            cell.detail_text_label.text_color = self.thememanager.main_text_colour
            cell.image_view.image = ui.Image.named(self.elements[section_key][row].get_icon())
            cell.selectable = True
            return cell
        except:
            cell = ui.TableViewCell('subtitle')
            cell.text_label.text = self.elements[section_key][row].get_title()
            cell.detail_text_label.text = 'Is invalid please check file in elements folder'
            cell.selectable = False
            return cell
项目:pythonista-scripts    作者:khilnani    | 项目源码 | 文件源码
def tableview_cell_for_row(self, tableview, section, row):
        section_key = self.elements.keys()[section]
        try:
            cell = ui.TableViewCell('subtitle')
            cell.text_label.text = self.elements[section_key][row].get_title()
            cell.detail_text_label.text = self.elements[section_key][row].get_description()
            cell.image_view.image = ui.Image.named(self.elements[section_key][row].get_icon())
            cell.selectable = False
            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
        except:
            cell = ui.TableViewCell('subtitle')
            cell.text_label.text = self.elements[section_key][row].get_title()
            cell.detail_text_label.text = 'Is invalid please check file in elements folder'
            cell.selectable = False
            return cell
项目:py-search    作者:vieira-rafael    | 项目源码 | 文件源码
def init_size(self): # initialize with correct size when landscape      orientation = ui.WebView(frame=(0,0,100,200)).eval_js('window.orientation') if orientation in (-90, 90): self.frame = (0, 0, self.height, self.width)
 def did_load(self): self.init_buttons() self.init_webbrowser() self.init_addressbar() self.init_size() self.flex = 'WH' self.bookmarks = self.load_bookmarks() self.history = self.load_history() self.addressbar_is_editing = False self.webpage_has_loaded = False self.favourite_images = {True :ui.Image.named('ionicons-ios7-star-32'), False:ui.Image.named('ionicons-ios7-star-outline-32')}
 def save_history(self, filename=filename_history): with open(filename, 'w') as f:          url = self.get_url() if url in self.history: self.history.remove(url) self.history.append(url)          f.seek(0)           pickle.dump(self.history, f)  def clear_history(self, sender, filename=filename_history): with open(filename, 'w') as f: self.history = []          f.seek(0)           pickle.dump(self.history, f)            sender.superview.superview['history'].data_source.items = self.history          sender.superview.superview['history'].reload()
 def save_bookmark(self, filename=filename_bookmarks): with open(filename, 'w') as f:           url = self.get_url()            title = self.get_title() or self.parse_url(url) self.bookmarks[title] = url         f.seek(0)           json.dump(self.bookmarks, f, indent=4) self['controlpanel']['favourite'].image = self.favourite_images[True]
 def remove_bookmark(self, title=None, filename=filename_bookmarks): with open(filename, 'w') as f:         title = title or self.get_title() del self.bookmarks[title]         f.seek(0)           json.dump(self.bookmarks, f, indent=4) self['controlpanel']['favourite'].image = self.favourite_images[False]
 def popup_menu(self):      popup = ui.View(name='menu', frame=(0, 0, 320, 500))        toolbar = ui.View(frame=(-5, 0, 330, 100), name='toolbar')      toolbar.border_width = 0.5      toolbar.border_color = '#B2B2B2'        label = ui.Label()      label.text = 'Bookmarks'        label.alignment = ui.ALIGN_CENTER       label.frame = (0, 0, 320, 50)       label.name = 'title'        segment_ctrl = ui.SegmentedControl(name='segctrl')      segment_ctrl.segments = ['Bookmarks', 'History']        segment_ctrl.width = 170        segment_ctrl.center = popup.center      segment_ctrl.y = label.height       segment_ctrl.selected_index = 0     segment_ctrl.action = self.bookmarks_or_history         button = ui.Button()        button.frame = (segment_ctrl.x*3.5, segment_ctrl.y, 60, 30)     button.font = ('<system>', 15)      button.title= 'Clear'       button.name = 'clear'       button.action = self.clear_history      button.hidden = True        toolbar.add_subview(label)      toolbar.add_subview(segment_ctrl)       toolbar.add_subview(button)         popup.add_subview(toolbar)      data_source = ui.ListDataSource(sorted(self.bookmarks.keys()))      popup.add_subview(self.list_bookmarks_and_history(data_source, width=320,height=toolbar.superview.height-toolbar.height, y=toolbar.height, name='bookmarks'))       x, y = self['controlpanel']['bookmarks'].center     popup.present('popover', popover_location=(x, y), hide_title_bar=True)
 def bookmarks_or_history(self, sender):        toolbar = sender.superview if sender.selected_index == 0:           toolbar['clear'].hidden = True          toolbar['title'].text = 'Bookmarks'         data_source = ui.ListDataSource(sorted(self.bookmarks.keys()))          tv = self.list_bookmarks_and_history(data_source, width=320, height=toolbar.superview.height-toolbar.height, y=toolbar.height, name='bookmarks')            toolbar.superview.remove_subview(toolbar.superview['history']) else:            toolbar['clear'].hidden = False             toolbar['title'].text = 'History'           data_source = ui.ListDataSource(self.history[::-1])         tv = self.list_bookmarks_and_history(data_source, width=320, height=toolbar.superview.height-toolbar.height, y=toolbar.height, name='history')          toolbar.superview['bookmarks'].hidden=True          toolbar.superview.remove_subview(toolbar.superview['bookmarks'])        sender.superview.superview.add_subview(tv)
 def list_bookmarks_and_history(self, data_source, **kwargs):       tv = ui.TableView()     tv.data_source = data_source        tv.delegate = self for k, v in kwargs.items(): setattr(tv, k, v) return tv
 def show_more_menu(self):      popup = ui.TableView()      popup.width = 250       popup.height = 500      popup.name = 'More'     popup.data_source = popup.delegate = self       button = self['controlpanel']['more']       popup.present('popover', popover_location=(button.x, button.y+button.height))
 def button_tapped(self, sender): if sender.name == 'favourite': if self.get_url() in self.bookmarks.values(): self.remove_bookmark() else: self.save_bookmark() elif sender.name == 'bookmarks': self.popup_menu() elif sender.name == 'more': self.show_more_menu() else: eval("self['webview'].{}()".format(sender.name))
 def tableview_number_of_rows(self, tableview, section): if tableview.name == 'Bookmarks': return len(self.bookmarks) elif tableview.name == 'More': return 1
 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
 @ui.in_background def tableview_did_select(self, tableview, section, row): if tableview.name == 'bookmarks':           url = self.bookmarks[sorted(self.bookmarks.keys())[row]] self.load_url(url)         tableview.superview.close() elif tableview.name == 'history':           url = tableview.data_source.items[row]          tableview.superview.close() self.load_url(url) elif tableview.name == 'More':           tableview.close()           console.hud_alert('No settings yet...', 'error', 1)
 def tableview_can_delete(self, tableview, section, row): return True
 def tableview_delete(self, tableview, section, row):       item = sorted(self.bookmarks.keys())[row] self.remove_bookmark(item)        tableview.reload()
 def textfield_did_begin_editing(self, textfield): self.addressbar_is_editing = True self.set_url() self['controlpanel']['reload'].hidden = True
 def textfield_did_end_editing(self, textfield): self.addressbar_is_editing = False self['controlpanel']['reload'].hidden = False self.set_url()
 def textfield_should_return(self, textfield):      url = self['controlpanel']['addressbar'].text self.load_url(url)        textfield.end_editing() return True
 def webview_did_start_load(self, webview): self.webpage_has_loaded = False
 def webview_did_finish_load(self, webview): if not self.addressbar_is_editing: self.set_url() self.webpage_has_loaded = True       page_is_bookmarked = unicode(self.get_url()) in self.bookmarks.values() self['controlpanel']['favourite'].image = self.favourite_images[page_is_bookmarked] self.save_history()
项目:PyDoc    作者:shaun-h    | 项目源码 | 文件源码
def tableview_cell_for_row(self, tableview, section, row):
        cell = ui.TableViewCell()
        cell.text_label.text = self.filteredData[row]
        return cell
项目:PyDoc    作者:shaun-h    | 项目源码 | 文件源码
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
项目:mediawiki_ui    作者:allanburleson    | 项目源码 | 文件源码
def tableview_cell_for_row(self, tableview, section, row):
        cell = ui.TableViewCell()
        cell.text_label.text = self.items[row]['title']
        cell.accessory_type = self.items[row]['accessory_type']
        return cell
项目:ui2    作者:controversial    | 项目源码 | 文件源码
def __init__(self):
        self._cell = ui.TableViewCell()
项目:ccMVC    作者:polymerchm    | 项目源码 | 文件源码
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
项目:ccMVC    作者:polymerchm    | 项目源码 | 文件源码
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]['title']
        cell.accessory_type = self.items[row]['accessory_type']
        return cell
项目:ccMVC    作者:polymerchm    | 项目源码 | 文件源码
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]['title']
        cell.accessory_type = self.items[row]['accessory_type']
        return cell



#--- ###################################################
# root tone
项目:ccMVC    作者:polymerchm    | 项目源码 | 文件源码
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]['title']
        cell.accessory_type = self.items[row]['accessory_type']
        return cell
项目:ccMVC    作者:polymerchm    | 项目源码 | 文件源码
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]['title']
        cell.accessory_type = self.items[row]['accessory_type']
        return cell
项目:ccMVC    作者:polymerchm    | 项目源码 | 文件源码
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']
        return cell
项目:ccMVC    作者:polymerchm    | 项目源码 | 文件源码
def tableview_cell_for_row(self, tableview, section, row):
        # Create and return a cell for the given section/row
        import ui
        cell = ui.TableViewCell()
        try:
            cell.text_label.text = self.items[row]['title']
        except IndexError:
            return
        cell.text_label.text_color = 'red' if self.items[row]['accessory_type'] == 'checkmark' else 'black'
        return cell
项目:ccMVC    作者:polymerchm    | 项目源码 | 文件源码
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]['title']
        cell.accessory_type = self.items[row]['accessory_type']
        return cell
项目:ccMVC    作者:polymerchm    | 项目源码 | 文件源码
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]['title']
        return cell
项目:pythonista-toys    作者:Wildog    | 项目源码 | 文件源码
def tableview_cell_for_row(self, tableview, section, row):
        cell = ui.TableViewCell()
        cell.selectable = True
        cell.text_label.text = self.comments[section]['comment']
        return cell
项目:pythonista-scripts    作者:khilnani    | 项目源码 | 文件源码
def tableview_cell_for_row(self, tableview, section, row):
        cell = ui.TableViewCell('subtitle')
        tool_name = self.tool_names[row]
        tool_url = self.tools_dict[tool_name]['url']
        cell.text_label.text = tool_name
        cell.detail_text_label.text = self.tools_dict[tool_name]['description']
        # TODO: Cell does not increase its height when label has multi lines of text
        # cell.detail_text_label.line_break_mode = ui.LB_WORD_WRAP
        # cell.detail_text_label.number_of_lines = 0

        InstallButton(self.app, cell, self.category_name, tool_name, tool_url)

        return cell
项目:pythonista-scripts    作者:khilnani    | 项目源码 | 文件源码
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
        if entry.subtitle:
            label_frame = (label_x, 0, label_w, 26)
            sub_label = ui.Label(frame=(label_x, 26, label_w, 14))
            sub_label.font = ('<System>', 12)
            sub_label.text = entry.subtitle
            sub_label.text_color = '#999'
            cell.content_view.add_subview(sub_label)
        else:
            label_frame = (label_x, 0, label_w, 44)
        label = ui.Label(frame=label_frame)
        if entry.subtitle:
            label.font = ('<System>', 15)
        else:
            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
项目:pythonista-scripts    作者:khilnani    | 项目源码 | 文件源码
def tableview_cell_for_row(self, tableview, section, row):
        cell = ui.TableViewCell()
        cell.text_label.text = str(self.items[row])
        cell.text_label.alignment = ui.ALIGN_CENTER
        return cell
项目:pythonista-scripts    作者:khilnani    | 项目源码 | 文件源码
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
项目:pythonista-scripts    作者:khilnani    | 项目源码 | 文件源码
def tableview_cell_for_row(self, tableview, section, row):

        cell = ui.TableViewCell()
        cell.accessory_type = ('disclosure_indicator', 'detail_button')[section]
        cell.text_label.text = self.data[section][row]
        if section==0:
            cell.background_color='#eeffee'

        return cell
项目:pythonista-scripts    作者:khilnani    | 项目源码 | 文件源码
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
项目:pythonista-scripts    作者:khilnani    | 项目源码 | 文件源码
def tableview_cell_for_row(self, tableview, section, row):
        cell = ui.TableViewCell('subtitle')
        cell.accessory_type = 'disclosure_indicator'
        if self.is_main():
            text = self.source[row]['title']
            cell.text_label.text = text
            if 'copyright' in self.source[row]:
                cell.detail_text_label.text = self.source[row]['copyright']
        else:
            cell.text_label.text = self.source[row]
            tableview.row_height = 48
            cell.image_view.image = ui.Image.named(self.source[row])
            if self.dark_cells:
                cell.image_view.background_color = 'black'
        return cell
项目:pythonista-scripts    作者:khilnani    | 项目源码 | 文件源码
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
项目:pythonista-scripts    作者:khilnani    | 项目源码 | 文件源码
def tableview_cell_for_row(self, tableview, section, row):
        cell = ui.TableViewCell()
        if section == 0:
            cell.text_label.text = self.tables[row]
        elif section == 1:
            cell.text_label.text = self.views[row]
        else:
            cell.text_label.text = self.systemtables[row]

        cell.selectable = True
        return cell
项目:pythonista-scripts    作者:khilnani    | 项目源码 | 文件源码
def tableview_cell_for_row(self, tableview, section, row):
        cell = ui.TableViewCell('subtitle')
        if section == 0:
            nullable = self.tinfo[row][3] == 1
            cell.text_label.text = self.tinfo[row][1]
            fmt = 'Type: {} Nullable: {} Default: {}'
            cell.detail_text_label.text = fmt.format(self.tinfo[row][2], nullable, self.tinfo[row][4])
        elif section == 1:
            cell.text_label.text = self.iinfo[row][1]
        cell.selectable = False
        return cell
项目:pythonista-scripts    作者:khilnani    | 项目源码 | 文件源码
def tableview_cell_for_row(self, tableview, section, row):
        cell = ui.TableViewCell('value1')
        if section == 0:
            if row == 0:
                cell.text_label.text = 'Record'
                cell.detail_text_label.text = self.return_count_label()
            else:
                cell.text_label.text = str(self.tkeys[row-1])
                cell.detail_text_label.text = str(self.tdata[self.currentid-1][row-1])
        cell.selectable = False
        return cell
项目:pythonista-scripts    作者:khilnani    | 项目源码 | 文件源码
def tableview_cell_for_row(self, tableview, section, row):
        cell = ui.TableViewCell()
        cell.text_label.text = self.files[row]
        return cell
项目:blackmamba    作者:zrzka    | 项目源码 | 文件源码
def tableview_cell_for_row(self, tv, section, row):
        item = self._filtered_items[row]
        cell = ui.TableViewCell(UITableViewCellStyle.subtitle.value)
        cell.text_label.number_of_lines = 1
        cell.text_label.text = item.title
        cell.detail_text_label.text = item.subtitle
        cell.detail_text_label.text_color = (0, 0, 0, 0.5)
        if item.image:
            cell.image_view.image = item.image
        return cell
项目:blackmamba    作者:zrzka    | 项目源码 | 文件源码
def tableview_cell_for_row(self, tv, section, row):
        item = self.filtered_items[row]
        cell = TableViewCell(UITableViewCellStyle.subtitle.value)
        cell.text_label.number_of_lines = 1
        cell.text_label.text = item.title
        cell.detail_text_label.text = item.subtitle
        cell.detail_text_label.text_color = (0, 0, 0, 0.5)
        return cell
项目:pythonista-scripts    作者:khilnani    | 项目源码 | 文件源码
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
项目:blackmamba    作者:zrzka    | 项目源码 | 文件源码
def tableview_cell_for_row(self, tv, section, row):
        if section == self._folder_section:
            item = self.items[row]
            node = item['node']
        else:
            item = self._files[row]
            node = None

        cell = ui.TableViewCell()

        cvb = cell.content_view.bounds

        x = 15 + cvb.x + item['level'] * 15

        if node and node.children_exists:
            image_view = ui.ImageView()
            image_view.frame = (x, 10, 24, 24)
            image_view.image = ui.Image.named(
                'iob:arrow_down_b_24' if node.path in self._expanded_node_paths else 'iob:arrow_right_b_24'
            )
            cell.content_view.add_subview(image_view)

        x += 24 + 8

        image_view = ui.ImageView()
        image_view.frame = (x, 10, 24, 24)
        image_view.image = ui.Image.named('iob:folder_24' if node else 'iob:document_24')
        cell.content_view.add_subview(image_view)

        x += 24 + 8

        title_label = ui.Label(flex='W')
        title_label.text = item['title']
        title_label.size_to_fit()
        title_label.frame = (
            x, cvb.y + (cvb.height - title_label.height) / 2.0,
            cvb.width - (x - cvb.x) - 8, title_label.height
        )
        cell.content_view.add_subview(title_label)

        separator = ui.View(flex='W')
        separator.background_color = (0, 0, 0, 0.05)
        x = title_label.frame.x - 12 - 8
        separator.frame = (
            x, cvb.y + cvb.height - 1,
            cvb.width - (x - cvb.x), 1
        )
        cell.content_view.add_subview(separator)

        cell_objc = ObjCInstance(cell)
        cell_objc.setSelectionStyle(0)

        return cell