def update_rsync(): if glob.finished: return elem = dom.document.getElementById("Tests") if glob.rsync_done is True: elem.childNodes[0].nodeValue = "Tests" return text = "Rsyncing" + '.' * glob.rsync_dots glob.rsync_dots += 1 if glob.rsync_dots > 5: glob.rsync_dots = 0 elem.childNodes[0].nodeValue = "Tests [%s]" % text dom.setTimeout(update_rsync, 1000)
def show_host(host_name="aa"): elem = dom.document.getElementById("jobs") if elem.childNodes: elem.removeChild(elem.childNodes[0]) tbody = create_elem("tbody") for item in glob.host_pending[host_name]: tr = create_elem("tr") td = create_elem("td") td.appendChild(create_text_elem(item)) tr.appendChild(td) tbody.appendChild(tr) elem.appendChild(tbody) elem.style.visibility = "visible" glob.host = host_name dom.setTimeout(reshow_host, 100)
def host_init(host_dict): tbody = dom.document.getElementById("hostsbody") for host in host_dict.keys(): tr = create_elem('tr') tbody.appendChild(tr) td = create_elem("td") td.style.background = "#ff0000" txt = create_text_elem(host_dict[host]) td.appendChild(txt) td.id = host tr.appendChild(td) td.setAttribute("onmouseover", "show_host('%s')" % host) td.setAttribute("onmouseout", "hide_host()") glob.rsync_dots = 0 glob.rsync_done = False dom.setTimeout(update_rsync, 1000) glob.host_dict = host_dict glob.host_pending = {} for key in host_dict.keys(): glob.host_pending[key] = []
def s_timeout_call(): setTimeout(to_timeout, 300)