示例#1
0
文件: webapp.py 项目: sandhawke/riftr
def select_processor(div, state, method, field_name):

    for p in plugin.registry:
        if hasattr(p, method):
            desc = []
            desc.append(p.__doc__)
            if hasattr(p, 'spec'):
                desc.append(h.span('  (See ', h.a('language specification', 
                                                href=p.spec), ")"))

            if cgi_args.getfirst(field_name) == p.id:
                button = h.input(type="radio",
                            name=field_name,
                            checked='YES',
                            value=p.id)
            else:
                button = h.input(type="radio",
                            name=field_name,
                            value=p.id)

            examples = h.span()
            if getattr(p, 'examples', []):
                examples << h.br()
                examples << "Load example input: "
                for (name, text) in p.examples:
                    examples << h.input(type="submit", name="load_example", 
                                        value=name)

            div << h.p(button, desc, examples)
示例#2
0
def expander(name, inner):
    control = html.span("&#x25ba;",
                        id="control-%s" % name,
                        onclick='expand("%s");' % name)
    div = html.div(inner, id="inner-%s" % name, style="display: none;")

    return control + div
示例#3
0
def expander(name, inner):
	control = html.span("&#x25ba;",
	                    id="control-%s" % name,
	                    onclick='expand("%s");' % name)
	div = html.div(inner,
	               id="inner-%s" % name,
	               style="display: none;")

	return control + div
示例#4
0
文件: webapp.py 项目: sandhawke/riftr
def select_middle(div, args):

    any = False
    line = h.p("[NOT WORKING RIGHT NOW].  Select plugins to instantiate: ")
    div << line
    for p in plugin.registry:
        if hasattr(p, "transform") or hasattr(p,"analyze"):
            line << h.span(p.id)   # javascript so click makes a new block for it appear below....
            line << " "
            any = True
    if not any:
        line << "(none available)."
示例#5
0
 def italize_control_char(line):
     return (html.span(line[0], **{"class": "h"}), line[1:])
示例#6
0
 def html(self, indent=0):
     out = html.span(str(self.addr).rjust(9), 'op-addr')
     out += ' '
     out += html.span(html.pad(indent) + self.target.html() + ' = ' + self.source.html(), 'op-name')
     out += html.span(self.signature(), 'op-signature')
     return out + '\n'
示例#7
0
 def html(self):
     return html.span(self, 'constant')
示例#8
0
 def html(self):
     return html.span(self, 'register')