def addrow(): # we need to call a helper, similiar to document in JS tr = document.createElement("tr") td = document.createElement("td") td.appendChild(document.createTextNode("A row")) tr.appendChild(td) document.getElementById("atable").appendChild(tr)
def addrow(): # we need to call a helper, similiar to document in JS tr = document.createElement("tr") td = document.createElement("td") td.appendChild(document.createTextNode("A row")) tr.appendChild(td) document.getElementById("atable").appendChild(tr)
def create_debug_div(): debug_div = document.createElement("div") debug_div.setAttribute("id", "debug_div") # XXX attach it somewhere... #body = document.getElementsByTagName('body')[0] document.childNodes[0].childNodes[1].appendChild(debug_div) return debug_div
def create_debug_div(): debug_div = document.createElement("div") debug_div.setAttribute("id", "debug_div") # XXX attach it somewhere... #body = document.getElementsByTagName('body')[0] document.childNodes[0].childNodes[1].appendChild(debug_div) return debug_div
def add_text(text): data_elem = document.getElementById("data") lines = text.split('\n') lines.pop() for line in lines: pre = document.createElement('pre') pre.style.margin = '0px' pre.appendChild(document.createTextNode(line)) data_elem.appendChild(pre)
def add_text(text): data_elem = document.getElementById("data") lines = text.split('\n') lines.pop() for line in lines: pre = document.createElement('pre') pre.style.margin = '0px' pre.appendChild(document.createTextNode(line)) data_elem.appendChild(pre)
def appendPlayfieldXXX(): bgcolor = '#000000' document.body.setAttribute('bgcolor', bgcolor) div = document.createElement("div") div.id = 'playfield' div.style.width = 500 div.style.height = 250 div.style.position = 'absolute' div.style.top = '0px' div.style.left = '0px' document.body.appendChild(div)
def appendPlayfield(msg): body = document.getElementsByTagName('body')[0] bgcolor = '#000' body.style.backgroundColor = bgcolor div = document.createElement("div") div.id = 'playfield' div.style.width = msg['width'] div.style.height = msg['height'] div.style.position = 'absolute' div.style.top = '0px' div.style.left = '0px' div.appendChild(document.createTextNode('foobar?')) #document.body.childNodes.insert(0, div) body.appendChild(div)
def add_sprite(self, s, icon_code, x, y): #try: # img = self.sprite_queues[icon_code].pop() #except IndexError: stats.n_sprites += 1 img = document.createElement("img") img.src = self.filenames[icon_code] img.style.position = 'absolute' img.style.left = x + 'px' img.style.top = y + 'px' img.style.visibility = 'visible' document.getElementById("playfield").appendChild(img) try: self.sprites[s].style.visibility = "hidden" # FIXME: We should delete it except KeyError: self.sprites[s] = img return img
def __show_traceback(tb, exc): debug_div = document.getElementById("debug_div") if not debug_div: # create div here debug_div = create_debug_div() pre_div = document.createElement("pre") pre_div.style.color = "#FF0000" debug_div.appendChild(pre_div) txt = document.createTextNode("") pre_div.appendChild(txt) for tb_entry in tb[1:]: # list of tuples... fun_name, args, filename, lineno = tb_entry # some source maybe? or so? line1 = escape("%s %s" % (fun_name, args)) line2 = escape(" %s: %s\n" % (filename, lineno)) txt.nodeValue += line1 + '\n' + line2 txt.nodeValue += str(exc)
def __show_traceback(tb, exc): debug_div = document.getElementById("debug_div") if not debug_div: # create div here debug_div = create_debug_div() pre_div = document.createElement("pre") pre_div.style.color = "#FF0000" debug_div.appendChild(pre_div) txt = document.createTextNode("") pre_div.appendChild(txt) for tb_entry in tb[1:]: # list of tuples... fun_name, args, filename, lineno = tb_entry # some source maybe? or so? line1 = escape("%s %s" % (fun_name, args)) line2 = escape(" %s: %s\n" % (filename, lineno)) txt.nodeValue += line1 + '\n' + line2 txt.nodeValue += str(exc)