本文整理汇总了Python中albow.Widget.is_gl_container方法的典型用法代码示例。如果您正苦于以下问题:Python Widget.is_gl_container方法的具体用法?Python Widget.is_gl_container怎么用?Python Widget.is_gl_container使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类albow.Widget
的用法示例。
在下文中一共展示了Widget.is_gl_container方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: makeTabPage
# 需要导入模块: from albow import Widget [as 别名]
# 或者: from albow.Widget import is_gl_container [as 别名]
def makeTabPage(self, tool, inputs, trn=None, **kwargs):
page = Widget(**kwargs)
page.is_gl_container = True
rows = []
cols = []
max_height = tool.editor.mainViewport.height - tool.editor.toolbar.height - tool.editor.subwidgets[0].height -\
self._parent.filterSelectRow.height - self._parent.confirmButton.height - self.pages.tab_height
page.optionDict = {}
page.tool = tool
title = "Tab"
for optionSpec in inputs:
optionName = optionSpec[0]
optionType = optionSpec[1]
if trn is not None:
n = trn._(optionName)
else:
n = optionName
if n == optionName:
oName = _(optionName)
else:
oName = n
if isinstance(optionType, tuple):
if isinstance(optionType[0], (int, long, float)):
if len(optionType) == 3:
val, min, max = optionType
increment = 0.1
elif len(optionType) == 2:
min, max = optionType
val = min
increment = 0.1
else:
val, min, max, increment = optionType
rows.append(addNumField(page, optionName, oName, val, min, max, increment))
if isinstance(optionType[0], (str, unicode)):
isChoiceButton = False
if optionType[0] == "string":
kwds = []
wid = None
val = None
for keyword in optionType:
if isinstance(keyword, (str, unicode)) and keyword != "string":
kwds.append(keyword)
for keyword in kwds:
splitWord = keyword.split('=')
if len(splitWord) > 1:
v = None
try:
v = int(splitWord[1])
except ValueError:
pass
key = splitWord[0]
if v is not None:
if key == "width":
wid = v
else:
if key == "value":
val = "=".join(splitWord[1:])
if val is None:
val = ""
if wid is None:
wid = 200
field = TextFieldWrapped(value=val, width=wid)
page.optionDict[optionName] = AttrRef(field, 'value')
row = Row((Label(oName, doNotTranslate=True), field))
rows.append(row)
else:
isChoiceButton = True
if isChoiceButton:
if trn is not None:
__ = trn._
else:
__ = _
choices = [__("%s" % a) for a in optionType]
choiceButton = ChoiceButton(choices, doNotTranslate=True)
page.optionDict[optionName] = AttrRef(choiceButton, 'selectedChoice')
rows.append(Row((Label(oName, doNotTranslate=True), choiceButton)))
elif isinstance(optionType, bool):
cbox = CheckBox(value=optionType)
page.optionDict[optionName] = AttrRef(cbox, 'value')
row = Row((Label(oName, doNotTranslate=True), cbox))
rows.append(row)
elif isinstance(optionType, (int, float)):
rows.append(addNumField(self, optionName, oName, optionType))
elif optionType == "blocktype" or isinstance(optionType, pymclevel.materials.Block):
#.........这里部分代码省略.........
示例2: makeTabPage
# 需要导入模块: from albow import Widget [as 别名]
# 或者: from albow.Widget import is_gl_container [as 别名]
def makeTabPage(self, tool, inputs):
page = Widget()
page.is_gl_container = True
rows = []
cols = []
height = 0
max_height = 550
page.optionDict = {}
page.tool = tool
title = "Tab"
for optionName, optionType in inputs:
if isinstance(optionType, tuple):
if isinstance(optionType[0], (int, long, float)):
if len(optionType) > 2:
val, min, max = optionType
elif len(optionType) == 2:
min, max = optionType
val = min
rows.append(addNumField(page, optionName, val, min, max))
if isinstance(optionType[0], (str, unicode)):
isChoiceButton = False
if optionType[0] == "string":
kwds = []
wid = None
val = None
for keyword in optionType:
if isinstance(keyword, (str, unicode)) and keyword != "string":
kwds.append(keyword)
for keyword in kwds:
splitWord = keyword.split('=')
if len(splitWord) > 1:
v = None
key = None
try:
v = int(splitWord[1])
except:
pass
key = splitWord[0]
if v is not None:
if key == "lines":
lin = v
elif key == "width":
wid = v
else:
if key == "value":
val = splitWord[1]
if val is None:
val = ""
if wid is None:
wid = 200
field = TextField(value=val, width=wid)
page.optionDict[optionName] = AttrRef(field, 'value')
row = Row((Label(optionName), field))
rows.append(row)
else:
isChoiceButton = True
if isChoiceButton:
choiceButton = ChoiceButton(map(str, optionType))
page.optionDict[optionName] = AttrRef(choiceButton, 'selectedChoice')
rows.append(Row((Label(optionName), choiceButton)))
elif isinstance(optionType, bool):
cbox = CheckBox(value=optionType)
page.optionDict[optionName] = AttrRef(cbox, 'value')
row = Row((Label(optionName), cbox))
rows.append(row)
elif isinstance(optionType, (int, float)):
rows.append(addNumField(self, optionName, optionType))
elif optionType == "blocktype" or isinstance(optionType, pymclevel.materials.Block):
blockButton = BlockButton(tool.editor.level.materials)
if isinstance(optionType, pymclevel.materials.Block):
blockButton.blockInfo = optionType
row = Column((Label(optionName), blockButton))
page.optionDict[optionName] = AttrRef(blockButton, 'blockInfo')
rows.append(row)
elif optionType == "label":
rows.append(wrapped_label(optionName, 50))
elif optionType == "string":
input = None # not sure how to pull values from filters, but leaves it open for the future. Use this variable to set field width.
if input != None:
size = input
else:
size = 200
#.........这里部分代码省略.........
示例3: makeTabPage
# 需要导入模块: from albow import Widget [as 别名]
# 或者: from albow.Widget import is_gl_container [as 别名]
def makeTabPage(self, tool, inputs):
page = Widget()
page.is_gl_container = True
rows = []
cols = []
height = 0
max_height = 550
page.optionDict = {}
page.tool = tool
title = "Tab"
for optionName, optionType in inputs:
if isinstance(optionType, tuple):
if isinstance(optionType[0], (int, long, float)):
if len(optionType) > 2:
val, min, max = optionType
elif len(optionType) == 2:
min, max = optionType
val = min
rows.append(addNumField(page, optionName, val, min, max))
if isinstance(optionType[0], (str, unicode)):
isChoiceButton = False
if len(optionType) == 3:
a,b,c = optionType
if a == "strValSize":
field = TextField(value=b, width=c)
page.optionDict[optionName] = AttrRef(field, 'value')
row = Row((Label(optionName), field))
rows.append(row)
else:
isChoiceButton = True
elif len(optionType) == 2:
a,b = optionType
if a == "strVal":
field = TextField(value=b, width=200)
page.optionDict[optionName] = AttrRef(field, 'value')
row = Row((Label(optionName), field))
rows.append(row)
elif a == "strSize":
field = TextField(value="Input String Here", width=b)
page.optionDict[optionName] = AttrRef(field, 'value')
row = Row((Label(optionName), field))
rows.append(row)
else:
isChoiceButton = True
else:
isChoiceButton = True
if isChoiceButton:
choiceButton = ChoiceButton(map(str, optionType))
page.optionDict[optionName] = AttrRef(choiceButton, 'selectedChoice')
rows.append(Row((Label(optionName), choiceButton)))
elif isinstance(optionType, bool):
cbox = CheckBox(value=optionType)
page.optionDict[optionName] = AttrRef(cbox, 'value')
row = Row((Label(optionName), cbox))
rows.append(row)
elif isinstance(optionType, (int, float)):
rows.append(addNumField(self, optionName, optionType))
elif optionType == "blocktype" or isinstance(optionType, pymclevel.materials.Block):
blockButton = BlockButton(tool.editor.level.materials)
if isinstance(optionType, pymclevel.materials.Block):
blockButton.blockInfo = optionType
row = Column((Label(optionName), blockButton))
page.optionDict[optionName] = AttrRef(blockButton, 'blockInfo')
rows.append(row)
elif optionType == "label":
rows.append(wrapped_label(optionName, 50))
elif optionType == "string":
field = TextField(value="Input String Here", width=200)
page.optionDict[optionName] = AttrRef(field, 'value')
row = Row((Label(optionName), field))
rows.append(row)
elif optionType == "title":
title = optionName
else:
raise ValueError(("Unknown option type", optionType))
height = sum(r.height for r in rows)
if height > max_height:
h = 0
for i, r in enumerate(rows):
h += r.height
#.........这里部分代码省略.........