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


Python DOM.setAttribute方法代码示例

本文整理汇总了Python中DOM.setAttribute方法的典型用法代码示例。如果您正苦于以下问题:Python DOM.setAttribute方法的具体用法?Python DOM.setAttribute怎么用?Python DOM.setAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DOM的用法示例。


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

示例1: __init__

# 需要导入模块: import DOM [as 别名]
# 或者: from DOM import setAttribute [as 别名]
 def __init__(self, initialValue="", target="", method="POST"):
     Widget.__init__(self);
     self.id = "rte"+hash(self)
     fck = createFCK("fck"+self.id)
     fck.Height = "600px"
     self.setElement(DOM.createForm())
     DOM.setAttribute(self.element, "method", "POST")
     DOM.setAttribute(self.element, "target", target)
     JS("""
     var rte = this;
     this.element.onsubmit = function() {
         $wnd.setTimeout(function() { rte.onSave.call(rte) }, 0);
         return false;
     }
     """)
     self.setID(self.id)
     self.addStyleName("gwt-RichTextEditor")
     fck.Value = initialValue
     fck.BasePath = "fckeditor/"
     fck.Config.CustomConfigurationsPath = "../../fckconfig.js"
     fck.pyjsObject = self
     self.loaded = False
     self.saveListeners = []
     self.pendingHTML = None
     html = fck.CreateHtml()
     #console.log("fck html = %s", html)
     html = html
     DOM.setInnerHTML(self.getElement(), html)
开发者ID:pombredanne,项目名称:pyjamas-desktop,代码行数:30,代码来源:RichTextEditor.py

示例2: setTemplateText

# 需要导入模块: import DOM [as 别名]
# 或者: from DOM import setAttribute [as 别名]
    def setTemplateText(self, text):
        """
        Set the template text; if the template is not HTML, a subclass could override this
        to pre-process the text into HTML before passing it to the default implementation.
        """
        if self.allowEdit:
            self.originalText = text
        # If we have children, remove them all first since we are trashing their DOM
        for child in List(self.children):
            self.remove(child)
        
        DOM.setInnerHTML(self.getElement(), text)
        self.elementsById = {}
        self.links = []
        self.metaTags = {}
        self.forms = []
        self.metaTagList = []
        
        # Make the ids unique and store a pointer to each named element
        for node in DOM.walkChildren(self.getElement()):
            #console.log("Passing node with name %s", node.nodeName)
            if node.nodeName == "META":
                name = node.getAttribute("name")
                content = node.getAttribute("content")
                console.log("Found meta %o name %s content %s", node, name, content)
                self.metaTags[name] = content
                self.metaTagList.append(node)
            elif node.nodeName == "BODY":
                self.body = node
            elif node.nodeName == "TITLE":
                self.title = DOM.getInnerText(node)
            elif node.nodeName == "FORM":
                self.forms.append(node)

            nodeId = DOM.getAttribute(node, "id")
            if nodeId:
                self.elementsById[nodeId] = node
                DOM.setAttribute(node, "id", self.id+":"+node.id)
            nodeHref = DOM.getAttribute(node, "href")
            if nodeHref:
                self.links.append(node)
                
        self.loaded = True
        if self.attached:
            self.attachWidgets()
            self.widgetsAttached = True
            
        if self.allowEdit:
            self.editor = None
            self.editButton = Label("edit "+unescape(self.templateName))
            self.editButton.addStyleName("link")
            self.editButton.addStyleName("ContentPanelEditLink")
            self.editButton.addClickListener(EventDelegate("onClick", self, self.onEditContentClick))
            ComplexPanel.insert(self, self.editButton, self.getElement(), len(self.children))

        self.notifyLoadListeners()
开发者ID:pombredanne,项目名称:pyjamas-desktop,代码行数:58,代码来源:TemplatePanel.py

示例3: doc_process

# 需要导入模块: import DOM [as 别名]
# 或者: from DOM import setAttribute [as 别名]
def doc_process(module, REQUEST):
    from ui import RootPanel, get_widget_by_id, reset_widgets
    import DOM
    global xml_doc

    # first, carry out the initial document creation.
    reset_widgets()
    m = module()
    m.onModuleLoad()

    p = RootPanel()
    
    if REQUEST.has_key('__post__'):
        for k in REQUEST.keys():
            if k == '__post__':
                continue
            widget = get_widget_by_id(k)
            if not widget:
                continue
            event = DOM.BrowserEvent("click")
            DOM.dispatchEvent(event, widget.getElement(), widget)

    # last, set up a FORM around the entire document.
    body = xml_doc.find('body')
    form = DOM.createElement('form')
    DOM.setAttribute(form, "action", "./")
    DOM.setAttribute(form, "method", "GET")
    hidden = DOM.createElement('input')
    DOM.setAttribute(hidden, "type", "hidden")
    DOM.setAttribute(hidden, "name", "__post__")
    form.append(hidden)
    while len(body):
        child = body[0]
        body.remove(child)
        form.append(child)
    body.append(form)

    #from pickle import dump
    #f = open("/tmp/dump.obj", "w")
    #dump(m, f)
    return etree.tostring(xml_doc)
开发者ID:pombredanne,项目名称:pyjamas-desktop,代码行数:43,代码来源:__pyjamas__.py

示例4: setStyleName

# 需要导入模块: import DOM [as 别名]
# 或者: from DOM import setAttribute [as 别名]
 def setStyleName(self, style):
     DOM.setAttribute(self.element, "className", style)
开发者ID:Afey,项目名称:pyjs,代码行数:4,代码来源:test008.py


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