本文整理匯總了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))