当前位置: 首页>>代码示例>>Python>>正文


Python Column.top方法代码示例

本文整理汇总了Python中albow.Column.top方法的典型用法代码示例。如果您正苦于以下问题:Python Column.top方法的具体用法?Python Column.top怎么用?Python Column.top使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在albow.Column的用法示例。


在下文中一共展示了Column.top方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: update_side_panel

# 需要导入模块: from albow import Column [as 别名]
# 或者: from albow.Column import top [as 别名]
 def update_side_panel(self, item):
     if item == self.displayed_item:
         return
     self.displayed_item = item
     if self.side_panel:
         self.side_panel.set_parent(None)
     items = [a for a in item[1]]
     rows = []
     if config.nbtTreeSettings.showAllTags.get():
         meth = None
     else:
         meth = getattr(self, "build_%s" % item[3].lower(), None)
     col = True
     if meth and len(items) == 1:
         rows = meth(items)
     else:
         height = 0
         for itm in items:
             t = itm.__class__.__name__
             rows.append(Row([Label("Data Type:"), Label(t)], margin=1))
             fields = self.build_field(itm)
             for field in fields:
                 if type(field) == TextFieldWrapped:
                     field.set_size_for_text(self.side_panel_width)
                 row = Row([field], margin=1)
                 rows.append(row)
                 height += row.height
         if height > self.displayRow.height:
             col = False
     if rows:
         if col:
             col = Column(rows, align="l", spacing=0, height=self.displayRow.height)
         else:
             col = ScrollPanel(
                 rows=rows,
                 align="l",
                 spacing=0,
                 height=self.displayRow.height,
                 draw_zebra=False,
                 inner_width=self.side_panel_width - scroll_button_size,
             )
         col.set_parent(self.displayRow)
         col.top = self.displayRow.top
         col.left = self.displayRow.subwidgets[0].right
         col.bottom = self.displayRow.subwidgets[0].bottom
         col.shrink_wrap()
         self.side_panel = col
开发者ID:Crayder,项目名称:MCEdit-Unified,代码行数:49,代码来源:nbtexplorer.py

示例2: __init__

# 需要导入模块: from albow import Column [as 别名]
# 或者: from albow.Column import top [as 别名]

#.........这里部分代码省略.........
        def formatBlockName(x):
            block = self.matchingBlocks[x]
            #&#
            #r = "{name}".format(name=block.name)
            r = u"{name}".format(name=mclangres.translate(block.name))
            #&#
            if block.aka:
                #&#
                #r += " [{0}]".format(block.aka)
                r += u" [{0}]".format(mclangres.translate(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
        spacing = max(tableview.font.get_linesize() - 16, 2)
        icons = Column(tableicons, spacing=spacing)

        # 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"
        but.height = 30

        if self.allowWildcards:
            # self.add(but)
            anyRow = CheckBoxLabel("Any Subtype", ref=AttrRef(self, 'anySubtype'),
                                   tooltipText="Replace blocks with any data value. Only useful for Replace operations.")
            col = Column((searchRow, tableWidget, anyRow, blockView, but))
        else:
            col = Column((searchRow, tableWidget, blockView, but))
        col.anchor = "wh"
        self.anchor = "wh"

        panel = GLBackground()
        panel.bg_color = [i / 255. for i in self.bg_color]
        panel.anchor = "tlbr"
        self.add(panel)

        self.add(col)
        self.add(icons)

        icons.left += tableview.margin + tableWidget.margin + col.margin
        icons.top = tableWidget.top + tableview.top + tableview.header_height + tableview.header_spacing + tableWidget.margin + tableview.margin + tableview.subwidgets[1].margin + (spacing / 2)

        self.shrink_wrap()
        panel.size = self.size

        try:
            self.tableview.rows.scroll_to_item(self.selectedBlockIndex)
        except:
            pass
开发者ID:violine1101,项目名称:MCEdit-Unified,代码行数:104,代码来源:blockpicker.py


注:本文中的albow.Column.top方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。