本文整理汇总了Python中ui.TableViewCell方法的典型用法代码示例。如果您正苦于以下问题:Python ui.TableViewCell方法的具体用法?Python ui.TableViewCell怎么用?Python ui.TableViewCell使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ui
的用法示例。
在下文中一共展示了ui.TableViewCell方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tableview_cell_for_row
# 需要导入模块: import ui [as 别名]
# 或者: from ui import TableViewCell [as 别名]
def tableview_cell_for_row(self, tableview, section, row):
departure = self.departures[row]
product = departure['product']
destination = departure['destination']
label = departure['label']
time_remaining = (datetime.fromtimestamp(departure['departureTime']/1000.0) - datetime.now()).total_seconds()
if time_remaining > 60:
time_remaining = f'{int(time_remaining / 60)} min'
else:
time_remaining = f'{int(time_remaining)} sec'
cell = ui.TableViewCell('value1')
cell.text_label.text = f'{label} - {destination}'
cell.text_label.text_color = departure['lineBackgroundColor']
cell.detail_text_label.text = time_remaining
return cell
示例2: tableview_cell_for_row
# 需要导入模块: import ui [as 别名]
# 或者: from ui import TableViewCell [as 别名]
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
示例3: tableview_cell_for_row
# 需要导入模块: import ui [as 别名]
# 或者: from ui import TableViewCell [as 别名]
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
示例4: tableview_cell_for_row
# 需要导入模块: import ui [as 别名]
# 或者: from ui import TableViewCell [as 别名]
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
示例5: tableview_cell_for_row
# 需要导入模块: import ui [as 别名]
# 或者: from ui import TableViewCell [as 别名]
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
示例6: tableview_cell_for_row
# 需要导入模块: import ui [as 别名]
# 或者: from ui import TableViewCell [as 别名]
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
示例7: tableview_cell_for_row
# 需要导入模块: import ui [as 别名]
# 或者: from ui import TableViewCell [as 别名]
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
示例8: tableview_cell_for_row
# 需要导入模块: import ui [as 别名]
# 或者: from ui import TableViewCell [as 别名]
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
示例9: tableview_cell_for_row
# 需要导入模块: import ui [as 别名]
# 或者: from ui import TableViewCell [as 别名]
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
示例10: tableview_cell_for_row
# 需要导入模块: import ui [as 别名]
# 或者: from ui import TableViewCell [as 别名]
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
示例11: tableview_cell_for_row
# 需要导入模块: import ui [as 别名]
# 或者: from ui import TableViewCell [as 别名]
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
示例12: tableview_cell_for_row
# 需要导入模块: import ui [as 别名]
# 或者: from ui import TableViewCell [as 别名]
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
示例13: tableview_cell_for_row
# 需要导入模块: import ui [as 别名]
# 或者: from ui import TableViewCell [as 别名]
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
示例14: tableview_cell_for_row
# 需要导入模块: import ui [as 别名]
# 或者: from ui import TableViewCell [as 别名]
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
示例15: tableview_cell_for_row
# 需要导入模块: import ui [as 别名]
# 或者: from ui import TableViewCell [as 别名]
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