本文整理汇总了Python中view.View方法的典型用法代码示例。如果您正苦于以下问题:Python view.View方法的具体用法?Python view.View怎么用?Python view.View使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类view
的用法示例。
在下文中一共展示了view.View方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import view [as 别名]
# 或者: from view import View [as 别名]
def __init__(self, model = None, submodel = None, setup = None, controller = None, viewStack=None, *args, **kwargs):
"""
@type model: L{interfaces.IModel}
@param submodel: see L{Widget.setSubmodel}
@type submodel: String
@type setup: Callable
"""
self.errorFactory = Error
self.controller = controller
self.become = None
self._reset()
view.View.__init__(self, model)
self.node = None
self.templateNode = None
if submodel:
self.submodel = submodel
else:
self.submodel = ""
if setup:
self.setupMethods = [setup]
else:
self.setupMethods = []
self.viewStack = viewStack
self.initialize(*args, **kwargs)
示例2: generate
# 需要导入模块: import view [as 别名]
# 或者: from view import View [as 别名]
def generate(self, request, node):
if self.macroTemplate:
templ = view.View(
self.model,
template = self.macroTemplate).lookupTemplate(request)
else:
templ = view.View(
self.model,
templateFile=self.macroFile,
templateDirectory=self.macroFileDirectory).lookupTemplate(request)
## We are going to return the macro node from the metatemplate,
## after replacing any slot= nodes in it with fill-slot= nodes from `node'
macrolist = domhelpers.locateNodes(templ.childNodes, "macro", self.macroName)
assert len(macrolist) == 1, ("No macro or more than "
"one macro named %s found." % self.macroName)
macro = macrolist[0]
del macro.attributes['macro']
slots = domhelpers.findElementsWithAttributeShallow(macro, "slot")
for slot in slots:
slotName = slot.attributes.get("slot")
fillerlist = domhelpers.locateNodes(node.childNodes, "fill-slot", slotName)
assert len(fillerlist) <= 1, "More than one fill-slot found with name %s" % slotName
if len(fillerlist):
filler = fillerlist[0]
filler.tagName = filler.endTagName = slot.tagName
del filler.attributes['fill-slot']
del slot.attributes['slot']
filler.attributes.update(slot.attributes)
slot.parentNode.replaceChild(filler, slot)
return macro
示例3: __init__
# 需要导入模块: import view [as 别名]
# 或者: from view import View [as 别名]
def __init__(self, view: View, info: Dict[str, Any], api: TwitchAPI, quality: str, temp_dir: str = '.') -> None:
if not TwitchVideo._schema:
with open('video_info.schema') as json_data:
TwitchVideo._schema = json.load(json_data)
self._validate_info(info)
self.info = info
self.api = api
self.quality = quality
self.temp_dir = temp_dir
self.view = view
self.download_done: bool = False
self.file: Optional[IO[bytes]] = None
示例4: __init__
# 需要导入模块: import view [as 别名]
# 或者: from view import View [as 别名]
def __init__(self):
self.instance = view.View()
示例5: __str__
# 需要导入模块: import view [as 别名]
# 或者: from view import View [as 别名]
def __str__(self):
return str(View(self))