本文整理汇总了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()
示例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())
示例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()
示例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()
示例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()
示例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()
示例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()
示例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