本文整理汇总了Python中albow.TableView.draw_table_cell方法的典型用法代码示例。如果您正苦于以下问题:Python TableView.draw_table_cell方法的具体用法?Python TableView.draw_table_cell怎么用?Python TableView.draw_table_cell使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类albow.TableView
的用法示例。
在下文中一共展示了TableView.draw_table_cell方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__old
# 需要导入模块: from albow import TableView [as 别名]
# 或者: from albow.TableView import draw_table_cell [as 别名]
def __init__old(self, blockInfo, materials, *a, **kw):
self.root = get_root()
self.allowWildcards = False
Dialog.__init__(self, *a, **kw)
panelWidth = 518
self.click_outside_response = 0
self.materials = materials
self.anySubtype = blockInfo.wildcard
self.matchingBlocks = materials.allBlocks
try:
self.selectedBlockIndex = self.matchingBlocks.index(blockInfo)
except ValueError:
self.selectedBlockIndex = 0
for i, b in enumerate(self.matchingBlocks):
if blockInfo.ID == b.ID and blockInfo.blockData == b.blockData:
self.selectedBlockIndex = i
break
lbl = Label("Search")
# lbl.rect.topleft = (0,0)
fld = TextFieldWrapped(300)
# fld.rect.topleft = (100, 10)
# fld.centery = lbl.centery
# fld.left = lbl.right
fld.change_action = self.textEntered
fld.enter_action = self.ok
fld.escape_action = self.cancel
self.awesomeField = fld
searchRow = Row((lbl, fld))
def formatBlockName(x):
block = self.matchingBlocks[x]
r = "{name}".format(name=block.name)
if block.aka:
r += " [{0}]".format(block.aka)
return r
def formatBlockID(x):
block = self.matchingBlocks[x]
ident = "({id}:{data})".format(id=block.ID, data=block.blockData)
return ident
tableview = TableView(columns=[TableColumn(" ", 24, "l", lambda x: ""),
TableColumn("Name", 415, "l", formatBlockName),
TableColumn("ID", 45, "l", formatBlockID)
])
tableicons = [blockview.BlockView(materials) for i in range(tableview.rows.num_rows())]
for t in tableicons:
t.size = (16, 16)
t.margin = 0
icons = Column(tableicons, spacing=2)
# tableview.margin = 5
tableview.num_rows = lambda: len(self.matchingBlocks)
tableview.row_data = lambda x: (self.matchingBlocks[x], x, x)
tableview.row_is_selected = lambda x: x == self.selectedBlockIndex
tableview.click_row = self.selectTableRow
draw_table_cell = tableview.draw_table_cell
def draw_block_table_cell(surf, i, data, cell_rect, column):
if isinstance(data, Block):
tableicons[i - tableview.rows.scroll].blockInfo = data
else:
draw_table_cell(surf, i, data, cell_rect, column)
tableview.draw_table_cell = draw_block_table_cell
tableview.width = panelWidth
tableview.anchor = "lrbt"
# self.add(tableview)
self.tableview = tableview
tableWidget = Widget()
tableWidget.add(tableview)
tableWidget.shrink_wrap()
def wdraw(*args):
for t in tableicons:
t.blockInfo = materials.Air
tableWidget.draw = wdraw
self.blockButton = blockView = thumbview.BlockThumbView(materials, self.blockInfo)
blockView.centerx = self.centerx
blockView.top = tableview.bottom
# self.add(blockview)
but = Button("OK")
but.action = self.ok
but.top = blockView.bottom
but.centerx = self.centerx
but.align = "c"
#.........这里部分代码省略.........