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


Python tags.invisible函数代码示例

本文整理汇总了Python中nevow.tags.invisible函数的典型用法代码示例。如果您正苦于以下问题:Python invisible函数的具体用法?Python invisible怎么用?Python invisible使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: rend

    def rend(self, context, data):
        defaults = context.locate(iformless.IFormDefaults)
        value = defaults.getDefault(context.key, context)
        context.remember(data.typedValue, iformless.ITyped)

        if data.typedValue.getAttribute('immutable'):
            inp = tags.span(id=keyToXMLID(context.key))[value]
        else:
            ##value may be a deferred; make sure to wait on it properly before calling self.input
            ## TODO: If flattening this results in an empty string, return an empty string
            inp = tags.invisible(
                render=lambda c, value: self.input( context, tags.invisible(), data, data.name, value ),
                data=value)

        if data.typedValue.getAttribute('hidden') or data.typedValue.getAttribute('compact'):
            return inp

        context.fillSlots( 'label', data.label )
        context.fillSlots( 'name', data.name )
        context.fillSlots( 'input', inp )
        context.fillSlots( 'error', getError(context) )
        context.fillSlots( 'description', data.description )
        context.fillSlots( 'id', keyToXMLID(context.key) )
        context.fillSlots( 'value', value )

        return context.tag
开发者ID:StetHD,项目名称:nevow,代码行数:26,代码来源:webform.py

示例2: test_deferredRememberInRenderer

 def test_deferredRememberInRenderer(self):
     class IFoo(compy.Interface):
         pass
     def rememberIt(ctx, data):
         ctx.remember("bar", IFoo)
         return defer.succeed(ctx.tag)
     def locateIt(ctx, data):
         return IFoo(ctx)
     tag = tags.invisible(render=rememberIt)[tags.invisible(render=locateIt)]
     self.assertEquals(self.render(tag), "bar")
开发者ID:KatiaBorges,项目名称:exeLearning,代码行数:10,代码来源:test_flatstan.py

示例3: _render

        def _render(self, ctx, key, args, errors, value, tag):
            def data_facets(ctx, data):

                storeSession = util.getStoreSession(ctx)
                avatar = util.getAvatar(ctx)

                @defer.deferredGenerator
                def loadCategories(facets):
                    d = defer.waitForDeferred(avatar.getCategoryManager(storeSession))
                    yield d
                    categories = d.getResult()
                    rv = []
                    for f in facets:
                        facetData = FacetData()
                        facetData.label = f[2]
                        facetData.textid = f[1]
                        rv.append(facetData)
                        d = defer.waitForDeferred(categories.loadCategories(facetData.textid))
                        yield d
                        facetData.tree = d.getResult().children
                    yield rv

                d = avatar.getCategoryManager(storeSession)
                d.addCallback(lambda categories: categories.loadFacets())
                d.addCallback(loadCategories)
                return d

            def render_facet(ctx, data):
                tag = ctx.tag
                tag.fillSlots("facetlabel", data.label)
                return tag

            def render_node(ctx, data):
                tag = ctx.tag
                tag.fillSlots("value", data.path)
                tag.fillSlots("label", data.label)
                if data.path in value:
                    tag.children[0] = tag.children[0](checked="checked")
                else:
                    tag.children[0](checked=None)
                return tag

            template = T.div(class_="categorieswidget")[
                T.p(class_="opener")["click to open/close"],
                T.ul(class_="panel", data=data_facets, render=rend.sequence)[
                    T.li(pattern="item", render=render_facet)[
                        T.slot("facetlabel"),
                        T.div(data=T.directive("tree"), render=tree.render)[
                            T.invisible(pattern="item", render=render_node)[tag, T.slot("label")]
                        ],
                    ]
                ],
            ]

            return T.invisible()[template]
开发者ID:timparkin,项目名称:timparkingallery,代码行数:55,代码来源:categorieswidget.py

示例4: render_macif

 def render_macif(self, ctx, data):
     if not data:
         return ctx.tag["I did not find this MAC on any interface."]
     return ctx.tag["This MAC was found on the following interfaces: ",
                    T.ul [ [ T.li[
                 T.invisible(data=l[0],
                             render=T.directive("hostname")),
                 " (", T.invisible(data=l[1],
                                   render=T.directive("ip")), ") "
                 "interface ", T.span(_class="data") [ l[2] ] ]
                      for l in data] ] ]
开发者ID:GennadySpb,项目名称:wiremaps,代码行数:11,代码来源:search.py

示例5: test_deferredRememberInRenderer

 def test_deferredRememberInRenderer(self):
     class IFoo(Interface):
         pass
     def rememberIt(ctx, data):
         ctx.remember("bar", IFoo)
         return defer.succeed(ctx.tag)
     def locateIt(ctx, data):
         return IFoo(ctx)
     tag = tags.invisible(render=rememberIt)[tags.invisible(render=locateIt)]
     self.render(tag, wantDeferred=True).addCallback(
         lambda result: self.assertEqual(result, "bar"))
开发者ID:perkinslr,项目名称:nevow-py3,代码行数:11,代码来源:test_flatstan.py

示例6: render_macfdb

 def render_macfdb(self, ctx, data):
     if not data:
         return ctx.tag["I did not find this MAC on any FDB entry."]
     return ctx.tag["This MAC was found in FDB of the following equipments: ",
                    T.ul [ [ T.li[
                 T.invisible(data=l[0],
                             render=T.directive("hostname")),
                 " (", T.invisible(data=l[1],
                                   render=T.directive("ip")), ") "
                 "on port ", T.span(_class="data") [ l[2] ],
                 " (out of %d MAC address%s)" % (l[4], l[4]>1 and "es" or "") ]
                      for l in data] ] ]
开发者ID:GennadySpb,项目名称:wiremaps,代码行数:12,代码来源:search.py

示例7: render

 def render(self, data):
     return [("%s  / Host" % self.discovery_name,
              T.invisible(data=data[0][2],
                          render=T.directive("hostname")),
              data[0][2]),
             ("%s  / IP" % self.discovery_name,
              T.invisible(data=data[0][0],
                          render=T.directive("ip")),
              data[0][0]),
             ("%s  / Description" % self.discovery_name,
              data[0][1], None),
             ("%s  / Port" % self.discovery_name,
              data[0][3], None)]
开发者ID:GennadySpb,项目名称:wiremaps,代码行数:13,代码来源:ports.py

示例8: _getRenderViewScroller

 def _getRenderViewScroller(self):
     """
     Get a L{hyperbola_view.ShareScrollingElement} by way of
     L{hyperbola_view.BlogBlurbViewer.view}.
     """
     fragment = hyperbola_view.BlogBlurbViewer(self.publicBlogShare)
     return fragment.view(FakeRequest(), tags.invisible())
开发者ID:pombredanne,项目名称:hyperbola,代码行数:7,代码来源:test_view.py

示例9: _renderTag

    def _renderTag(self, ctx, tparser, tvalue, namer, readonly):
        tag=T.invisible()
        if len(self.parsers) > 1:
            tp = T.select(name=namer('tparser'),id=render_cssid(namer('tparser')))
            if readonly:
                tp(class_='disabled', disabled='disabled')        
            
            for k,v in self.parsers:
                if k == tparser:
                    tp[T.option(selected='selected',value=k)[ v ]]
                else:
                    tp[T.option(value=k)[ v ]]
        else:
            tp = T.input(type='hidden',name=namer('tparser'),id=render_cssid(namer('tparser')),value=self.parsers[0][0])
        tag[tp]     
               
        if self.itemTypes is not None:
            tag[ T.input(type='hidden',class_="itemTypes",name=namer('itemTypes'),id=render_cssid(namer('itemTypes')),value=encodeTypes(self.itemTypes)) ]
        if self.itemTemplates is not None:
            tag[ T.input(type='hidden',class_="itemTemplates",name=namer('itemTemplates'),id=render_cssid(namer('itemTemplates')),value=','.join(self.itemTemplates)) ]

        ta=T.textarea(name=namer('tvalue'), id=render_cssid(namer('tvalue')), cols=self.cols, rows=self.rows)[tvalue or '']
        if readonly:
            ta(class_='readonly', readonly='readonly')
        tag[ [T.br,ta ]]
        return tag
开发者ID:timparkin,项目名称:into-the-light,代码行数:26,代码来源:richtextarea.py

示例10: _renderTag

    def _renderTag(self, ctx, key, value, converter, disabled):

        def renderOption(ctx, itemKey, itemLabel, num, selected):
            cssid = render_cssid(key, num)
            tag = T.input(name=key, type='radio', id=cssid, value=itemKey)
            if selected:
                tag = tag(checked='checked')
            if disabled:
                tag = tag(disabled='disabled')
            return tag, ' ', T.label(for_=cssid)[itemLabel], T.br

        def renderOptions(ctx, data):
            # A counter to assign unique ids to each input
            idCounter = itertools.count()
            if self.noneOption is not None:
                itemKey = iformal.IKey(self.noneOption).key()
                itemLabel = iformal.ILabel(self.noneOption).label()
                yield renderOption(ctx, itemKey, itemLabel, idCounter.next(), itemKey==value)
            if not data:
                return
            for item in data:
                itemKey = iformal.IKey(item).key()
                itemLabel = iformal.ILabel(item).label()
                itemKey = converter.fromType(itemKey)
                yield renderOption(ctx, itemKey, itemLabel, idCounter.next(), itemKey==value)

        return T.invisible(data=self.options)[renderOptions]
开发者ID:nakedible,项目名称:vpnease-l2tp,代码行数:27,代码来源:widget.py

示例11: generateBindings

 def generateBindings():
     for name in bindingNames:
         bnd = configurable.getBinding(context, name)
         renderer = iformless.IBindingRenderer(bnd, defaultBindingRenderer)
         renderer.isGrouped = True
         renderer.needsSkin = True
         yield tags.invisible(data=bnd, render=renderer, key=name)
开发者ID:perkinslr,项目名称:nevow-py3,代码行数:7,代码来源:webform.py

示例12: _dataRows

    def _dataRows(self, items, count):
        # Find the patterns
        dataRow = self._patterns.patternGenerator('dataRow')
        dataCell = self._patterns.patternGenerator('dataCell')
        emptyDataRow = self._patterns.patternGenerator('emptyDataRow')

        # Return an empty data row if there are no results
        if not items:
            return emptyDataRow()

        # Create a tag to hold the rows
        rowsTag = tags.invisible()
        for item in items:
            item = itabular.IItem(item)
            rowTag = dataRow()
            rowsTag[rowTag]
            for col in self.columns:
                cellTag = col.rend(self._patterns, item)

#                cellTag = dataCell()
#                cellTag.fillSlots('value',
#                        item.getAttributeValue(col.attribute))
                rowTag[cellTag]

        return rowsTag
开发者ID:timparkin,项目名称:into-the-light,代码行数:25,代码来源:tabular.py

示例13: render

    def render(self, ctx, key, args, errors):

        if errors:
            value = args.get(key,[None])[0]
        else:
            if args is not None:
                value = iforms.IStringConvertible(self.original).fromType(args.get(key))

        def render_node(ctx, data):
            tag = ctx.tag
            data = self.nodeInterface(data)
            tag.fillSlots('value',data.value)
            tag.fillSlots('label',data.label)
            if str(data.value) == str(value):
                tag = tag(checked='checked')
            return tag

        template = T.div()[
            T.input(pattern='item', render=render_node, type='radio', name=key,
                    value=T.slot('value'))[
                T.slot('label')
                ],
            T.input(pattern='itemdisabled', render=render_node,
                    disabled="disabled", type='radio', name=key,
                    value=T.slot('value'))[
                T.slot('label')
                ]
            ]

        return T.invisible(data=self.tree, render=tree.render)[template]
开发者ID:timparkin,项目名称:into-the-light,代码行数:30,代码来源:xforms.py

示例14: _renderTag

    def _renderTag(self, ctx, key, value, readonly):
        tag = T.invisible()
        ta = T.textarea(name=key, id=render_cssid(key), cols=self.cols, rows=self.rows)[value or ""]
        if readonly:
            ta(class_="readonly", readonly="readonly")
        tag[ta]

        if not readonly:
            try:
                import docutils
            except ImportError:
                raise
            else:
                form = iformal.IForm(ctx)
                srcId = render_cssid(key)
                previewDiv = render_cssid(key, "preview-div")
                frameId = render_cssid(key, "preview-frame")
                targetURL = widgetResourceURLFromContext(ctx, form.name).child(key).child(srcId)
                tag[T.br()]
                onclick = ["return Forms.Util.previewShow('", previewDiv, "', '", frameId, "', '", targetURL, "');"]
                tag[T.button(onclick=onclick)["Preview ..."]]
                tag[
                    T.div(id=previewDiv, class_="preview-hidden")[
                        T.iframe(class_="preview-frame", name=frameId, id=frameId),
                        T.br(),
                        T.button(onclick=["return Forms.Util.previewHide('", previewDiv, "');"])["Close"],
                    ]
                ]

        return tag
开发者ID:bne,项目名称:squeal,代码行数:30,代码来源:restwidget.py

示例15: _renderReSTTag

        def _renderReSTTag(self, ctx, content, key, readonly):
            namer = self._namer(key)

            tag=T.invisible()
            ta=T.textarea(name=namer('content'), id=formal_keytocssid(namer('content')), cols=self.cols, rows=self.rows)[content or '']
            if readonly:
                ta(class_='readonly', readonly='readonly')
            tag[ta]

            if not readonly:
                try:
                    import docutils
                except ImportError:
                    raise
                else:
                    form = iformal.IForm( ctx )
                    srcId = formal_keytocssid(namer('content'))
                    previewDiv = srcId + '-preview-div'
                    frameId = srcId + '-preview-frame'
                    targetURL = formal_widgetResourceURLFromContext(ctx, form.name).child(key).child( srcId )
                    tag[T.br()]
                    tag[T.button(onClick="return Forms.Util.previewShow('%s', '%s', '%s');"%(previewDiv, frameId, targetURL))['Preview ...']]
                    if self.withImagePicker:
                        tag[T.button(onclick=["return Cms.Forms.ImagePicker.popup('",srcId,"','tag')"])['Choose image ...']]

                    tag[T.div(id=previewDiv, class_="preview-hidden")[
                            T.iframe(class_="preview-frame", name=frameId, id=frameId),
                            T.br(),
                            T.button(onClick=["return Forms.Util.previewHide('",previewDiv,"');"])['Close']
                        ]
                    ]

            return tag
开发者ID:timparkin,项目名称:into-the-light,代码行数:33,代码来源:richtext.py


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