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


Python Widget.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from albow import Widget [as 别名]
# 或者: from albow.Widget import __init__ [as 别名]
    def __init__(self, items, keysColumn=None, buttonsColumn=None):
        if keysColumn is None:
            keysColumn = []
        if buttonsColumn is None:
            buttonsColumn = []

        Widget.__init__(self)
        for (hotkey, title, action) in items:
            if isinstance(title, (str, unicode)):
                button = Button(title, action=action)
            else:
                button = ValueButton(ref=title, action=action, width=200)
            button.anchor = self.anchor

            label = Label(hotkey, width=75, margin=button.margin)
            label.anchor = "wh"

            label.height = button.height

            keysColumn.append(label)
            buttonsColumn.append(button)

        self.buttons = list(buttonsColumn)

        buttonsColumn = Column(buttonsColumn)
        buttonsColumn.anchor = self.anchor
        keysColumn = Column(keysColumn)

        commandRow = Row((keysColumn, buttonsColumn))
        self.add(commandRow)
        self.shrink_wrap()
开发者ID:TrazLander,项目名称:Traz-Fork-MCEdit-Unified,代码行数:33,代码来源:mceutils.py

示例2: __init__

# 需要导入模块: from albow import Widget [as 别名]
# 或者: from albow.Widget import __init__ [as 别名]
    def __init__(self, tool, module, *args, **kw):
        Widget.__init__(self, *args, **kw)
        self.tool = tool
        pages = TabPanel()
        pages.is_gl_container = True
        self.pages = pages
        self.optionDict = {}
        pageTabContents = []

        self.giveEditorObject(module)
        print "Creating options for ", module
        if hasattr(module, "inputs"):
            if isinstance(module.inputs, list):
                for tabData in module.inputs:
                    title, page, pageRect = self.makeTabPage(self.tool, tabData)
                    pages.add_page(title, page)
                    pages.set_rect(pageRect.union(pages._rect))
            elif isinstance(module.inputs, tuple):
                title, page, pageRect = self.makeTabPage(self.tool, module.inputs)
                pages.add_page(title, page)
                pages.set_rect(pageRect)
        else:
            self.size = (0, 0)

        pages.shrink_wrap()
        self.add(pages)
        self.shrink_wrap()
        if len(pages.pages):
            if (pages.current_page != None):
                pages.show_page(pages.current_page)
            else:
                pages.show_page(pages.pages[0])

        for eachPage in pages.pages:
            self.optionDict = dict(self.optionDict.items() + eachPage.optionDict.items())
开发者ID:LaChal,项目名称:MCEdit-Unified,代码行数:37,代码来源:filter.py

示例3: __init__

# 需要导入模块: from albow import Widget [as 别名]
# 或者: from albow.Widget import __init__ [as 别名]
    def __init__(self, items, keysColumn=None, buttonsColumn=None, item_spacing=None):
        warn(self)
        if keysColumn is None:
            keysColumn = []
        if buttonsColumn is None:
            buttonsColumn = []
        labels = []

        Widget.__init__(self)
        for t in items:
            if len(t) == 3:
                (hotkey, title, action) = t
                tooltipText = None
            else:
                (hotkey, title, action, tooltipText) = t
            if isinstance(title, (str, unicode)):
                button = Button(title, action=action)
            else:
                button = ValueButton(ref=title, action=action, width=200)
            button.anchor = self.anchor

            label = Label(hotkey, width=100, margin=button.margin)
            label.anchor = "wh"

            label.height = button.height

            labels.append(label)

            if tooltipText:
                button.tooltipText = tooltipText

            keysColumn.append(label)
            buttonsColumn.append(button)

        self.buttons = list(buttonsColumn)

        #.#
        if item_spacing == None:
            buttonsColumn = Column(buttonsColumn)
        else:
            buttonsColumn = Column(buttonsColumn, spacing=item_spacing)
        #.#
        buttonsColumn.anchor = self.anchor
        #.#
        if item_spacing == None:
            keysColumn = Column(keysColumn)
        else:
            keysColumn = Column(keysColumn, spacing=item_spacing)

        commandRow = Row((keysColumn, buttonsColumn))
        self.labels = labels
        self.add(commandRow)
        self.shrink_wrap()
开发者ID:BossosaurusRex,项目名称:MCEdit-Unified,代码行数:55,代码来源:mceutils.py

示例4: __init__

# 需要导入模块: from albow import Widget [as 别名]
# 或者: from albow.Widget import __init__ [as 别名]
    def __init__(self, macro_data, *args, **kw):
        self._parent = None
        self._macro_data = macro_data
        if '_parent' in kw.keys():
            self._parent = kw.pop('_parent')

        Widget.__init__(self, *args, **kw)

        infoColList = []
        stepsLabel = wrapped_label("Number of steps: %s" % macro_data["Number of steps"], 300)
        infoColList.append(stepsLabel)
        for step in sorted(macro_data.keys()):
            if step != "Number of steps":
                infoColList.append(wrapped_label("Step %s: %s" % (int(step) + 1, macro_data[step]["Name"]), 300))
        self.add(Column(infoColList))
        self.shrink_wrap()
开发者ID:gwpantazes,项目名称:MCEdit-Unified,代码行数:18,代码来源:filter.py

示例5: __init__

# 需要导入模块: from albow import Widget [as 别名]
# 或者: from albow.Widget import __init__ [as 别名]
 def __init__(self, file_types=None, operation=0, **kwds):
     Widget.__init__(self, **kwds)
     if file_types is None:
         self.file_types = ["*.*",]
     else:
         self.file_types = file_types
     self.file_path = None
     self._button = None
         
     if operation == self.OPEN_FILE:
         self._button = Button("Choose a file", action=self._open_file)
     elif operation == self.SAVE_FILE:
         self._button = Button("Save a file", action=self._save_file)
         
     self.add(self._button)
     
     self.shrink_wrap()
开发者ID:TropicSapling,项目名称:MCEdit-Unified,代码行数:19,代码来源:filter.py

示例6: __init__

# 需要导入模块: from albow import Widget [as 别名]
# 或者: from albow.Widget import __init__ [as 别名]
    def __init__(self, editor):
        Widget.__init__(self)

        self.nudgeButton = NudgeButton(editor)
        self.nudgeButton.nudge = self._nudge

        self.xField = IntField(value=0)
        self.yField = IntField(value=0)
        self.zField = IntField(value=0)

        for field in (self.xField, self.yField, self.zField):
            field.change_action = self._coordsChanged
            field.enter_passes = False

        offsetCol = Column((self.xField, self.yField, self.zField))

        nudgeOffsetRow = Row((offsetCol, self.nudgeButton))

        self.add(nudgeOffsetRow)
        self.shrink_wrap()
开发者ID:Crayder,项目名称:MCEdit-Unified,代码行数:22,代码来源:clone.py

示例7: __init__

# 需要导入模块: from albow import Widget [as 别名]
# 或者: from albow.Widget import __init__ [as 别名]
 def __init__(self, value=None):
     Widget.__init__(self)
     self.choiceButton = ChoiceButton(self.choices)
     self.add(self.choiceButton)
     self.shrink_wrap()
开发者ID:vongola12324,项目名称:MCEdit-Unified,代码行数:7,代码来源:nbtexplorer.py

示例8: __init__

# 需要导入模块: from albow import Widget [as 别名]
# 或者: from albow.Widget import __init__ [as 别名]
 def __init__(self, materials, blockInfo=None, **kw):
     Widget.__init__(self, **kw)
     self.materials = materials
     self.blockInfo = blockInfo
开发者ID:Aiybe,项目名称:MCEdit-Unified,代码行数:6,代码来源:thumbview.py


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