def tableau_dict(colonnes, donnees, entete=True, trier=True, obj='ouvrages'): titres = TR() if entete: for colonne in colonnes: if colonne[1]: titre = A(colonne[0], href='#') titre.bind('click', lambda ev, col=colonne[1]: charger_liste( ev, obj, col, actualiser=False)) else: titre = P(colonne[0]) titres <= TH(titre.clone()) if trier: donnees = donnees if ASC else reversed(donnees) corps = TBODY() for element in donnees: lgn = TR() for colonne in colonnes: if 'id' in element: lien = '{}:{}'.format(obj, element['id']) cel = A(element[colonne[1]], href='#' + lien) cel.bind('click', lambda ev, col=lien: charger(ev, col)) else: cel = element[colonne[1]] lgn <= TD(cel) corps <= lgn return TABLE((THEAD(titres), corps))
def create_index(self): dtop.clear() doutput.clear() # document.title = f'{self.release}' dtop <= SPAN(f'{self.release}') dtop <= SPAN(A('Search', href=f'#search')) dtop <= SPAN(A('ASN1', href=self.asn1html)) # dindex.style.display = '' if dindex.html: return table = TABLE(Class='toctable') for i, row in enumerate(self.toc): flag, level, name = row tr = TR() tr <= TD(flag, Class='flag') tr <= TD(level) if level: td = TD(A(name, href=f'#{name}')) else: td = TD(name) tr <= td set_indent(td, level) tr <= TD(i) table <= tr dindex <= table ready.ready_table(table)
def init_about(): t = doc['About'] t <= H1('Usage Hint') t <= P('This tool is for finding additions to your current gear set. So if you are replacing an item, you should unequip it in PoB first and save, before doing a search.') t <= H1('Design Choices') t <= P("This page is designed for finding rares for any slot based on how they affect your damage. Attack weapons are not supported due to them not being modelable with weights. Additionally almost all unique only mods are ignored.") t <= P("A summary of mods/items that aren't supported (yet?). Some list items will be revisited after PoB 2.0 update.") t <= UL( LI('Curse/Mark on hit') + LI('Flasks') + LI('All uniques except delve rings and Shaper/Elder rings') + LI('effect of non-damaging ailments') + LI('cooldown reduction') + LI('while focused') + LI('with this weapon') + LI('bleed & ignite duration') + LI('chance to bleed/poison/ignite') + LI('local weapon mods except flat phys & element, for spellslinger and battlemage. phys can\'t account for % mods or weapon base stats') + LI('Heist weapon only implicits for mods that depend on the base weapon stats also. EG #% to Damage over Time Multiplier for Bleeding (Sundering Axe)') + LI('Increases and Reductions to Damage of Vaal Skills also apply to Non-Vaal Skills') + LI('+ minimum charges') + LI('onslaught') + LI('Mods such as # to # Added Attack Lightning Damage per 200 Accuracy Rating + 25% less accuracy') + LI('attack mods that can only appear on weapons') + LI('mh/oh specific mods') + LI('annoints') + LI('Flasks applied to you have #% increased Effect') + LI('#% to Quality (any type)') + LI('# to Level of Socketed Gems and other mods that require your skill to be socketed in that item.') ) t <= P("Here are all the " + A('Good Mods', href="https://github.com/xanthics/PoE_Weighted_Search/blob/master/helper_files/goodmod.py", target="_blank") + " that are implemented and " + A('Where they appear', href="https://github.com/xanthics/PoE_Weighted_Search/blob/master/restrict_mods.py", target="_blank") + " Here are all the " + A('Bad Mods', href="https://github.com/xanthics/PoE_Weighted_Search/blob/master/helper_files/badmod.py", target="_blank") + ' which are skipped.') t <= H1('Using this page.') t <= P('There are 2 primary ways to use this page. A script created by VolatilePulse and coldino, or manually adding the jewels with the necessary mods to PoB and copying the values over by hand.') t <= H3('Using VolatilePulse and coldino\'s script') t <= UL( LI("Go to" + A(" PoB Fork releases page ", href="https://github.com/PathOfBuildingCommunity/PathOfBuilding/releases", target="_blank") + "and download Path Of Building(Community Fork).") + LI("Install or extract files") + LI("Create and save a build. Leave PoB running") + LI("Navigate to" + A(" VolatilePulse's Github Repository", href="https://github.com/VolatilePulse/PoB-Item-Tester", target="_blank")) + LI("Clone or download, unzip, and enter directory") + LI("Run TestItem.ahk, select the build you want from the list.") + LI("Ctrl+Windows+d and it should automatically open this page with values filled out.") + LI("Ctrl+Alt+Windows+d will prompt you to choose build and then automatically open this page.") + LI("Double check all of the flags to make sure they match what you are trying to do. EG if you are molten strike you probably don't care about the melee flag as the projectile part is more important") ) t <= STRONG("Troubleshooting:") t <= P('After the first time you run TestItem.ahk it will generate TestItem.ini. You may need to modify "PathToPoB"') t <= H3("Manually copy from PoB") t <= P("This is what the Item Tester is automating for you. It is generally not recommended to use this method as it is more time consuming.") t <= P("You need to add jewels to Path of Building, if you have not yet done so. Note these will always be the latest verions.") t <= A("Text file to add jewels by hand", href="jewellist.txt", target="_blank") t <= P(A("xml file to add jewels direction to Path of Building Settings (at your own risk). ", href="jewellistxml.txt", target="_blank") + "As pointed out by github user coldino, you can edit your My Documents/Path of Building/Settings.xml directly. The lines from jewellistxml.txt should be added directly after the <SharedItems> tag. <Shared Items> should be right after </Accounts>. If you only have <SharedItems/> in that file, you will need to replace it with <SharedItems></SharedItems>") t <= P("You then need to spec an empty jewel node on your tree, or modify an item to have an empty socket, in PoB and mouse over each added jewel for the values to add in this table. After filling in the table and selection the relevant mods, click \"Generate Query\" and a query string will be created for you.")
def sniff_24008_ie(): for p in document['output'].select('p'): lst = [s for s in p.text.split(' ') if s] try: if lst[0] == 'See' and lst[1] == 'subclause' and lst[ 3] == 'in' and lst[4] == '3GPP' and lst[5] == 'TS' and lst[ 6] == '24.008': lst[2] = A(f'{lst[2]}', href=f'24008.html#ie{lst[2]}') lst[6] = A(f'{lst[6]}', href='24008.html') p.clear() for i in lst: p <= SPAN(i) + SPAN(' ') except: pass
def create_tree(self): dindex.style.display = 'none' dtop.clear() doutput.clear() aoa = self.get_aoa() # document.title = f'{get_protocol_name()} {self.anchor}' document.title = f'{get_protocol_name()} {self.get_short_title()}'.strip() dtop <= SPAN(self.release) dtop <= SPAN(A('Index', href='#')) dtop <= SPAN(A('Search', href=f'#search')) dtop <= SPAN(A('ASN1', href=f'{self.asn1html}#{self.anchor}')) # b = BUTTON('copy tree') b.bind('click', ready.copy_tree) dtop <= SPAN(b) # b = BUTTON('export xlsx') b.bind('click', self.export_xlsx) dtop <= SPAN(b) # b = BUTTON('table view') b.bind('click', self.change_view) dtop <= SPAN(b) # b = BUTTON('Popup On') b.bind('click', ready.button_popup) dtop <= SPAN(b) b.style.backgroundColor = 'lightgreen' # t = int((self.get_nrows()/1000) * 2 + 1 ) t = f'{t}s' b = BUTTON(f'expand all ({self.get_nrows()} rows, need {t})') b.bind('click', self.click_expand_all) dtop <= SPAN(b) # b = BUTTON('Hidden Prefix') b.bind('click', self.click_hidden_prefix) dtop <= SPAN(b) # dtop <= SPAN(f'{self.anchor}') # table = TABLE(Class='asn1tree', tview='tree') self.creat_head_row(table) for row in aoa: table <= self.create_tree_tr(row) doutput <= table for tr in table.rows: tr.cells[-1].html = tr.rowIndex ready.ready_table(table)
def menu(): menu = UL() lien_ouvrages = A('Ouvrages', href='#liste') lien_auteurs = A('Auteurs', href='#liste') lien_editeurs = A('Éditeurs', href='#liste') lien_ouvrages.bind('click', lambda ev: charger_liste(ev, 'ouvrages', 'titre')) lien_auteurs.bind('click', lambda ev: charger_liste(ev, 'auteurs', 'nom')) lien_editeurs.bind('click', lambda ev: charger_liste(ev, 'editeurs', 'nom')) menu <= LI(lien_ouvrages) menu <= LI(lien_auteurs) menu <= LI(lien_editeurs) doc['menu'].clear() doc['menu'] <= menu
def create_search(self): dindex.style.display = 'none' dtop.clear() doutput.clear() # document.title = f'{self.release} Search' dtop <= SPAN(f'{self.release}') dtop <= SPAN(A('Index', href='#')) # dsearch = DIV() doutput <= dsearch dsearch.style.paddingLeft = '20px' chars = sorted({item[0].upper() for item in self.udf_list}) div = DIV() div.style.marginBottom = '10px' dsearch <= div for c in chars: span = SPAN(c) span.style.color = 'blue' span.style.textDecoration = 'underline' span.style.padding = '2px 5px 10px 5px' span.style.cursor = 'pointer' span.onclick = self.click_one div <= span # input = INPUT(type="text") input.title = 'Search' input.style.width = '40ch' input.style.marginBottom = '10px' dsearch <= input input.bind('input', self.input_change) # dsearch <= DIV(id='searchresult')
def header(): """ Footer que será usado em todas as páginas. A implementação desse header está baseada na implementação do terminal CSS Foi feita uma cópia do header princial e resontruíuda em bryhton. link: https://terminalcss.xyz/dark/#Navigation """ div_container = DIV(Class='container') terminal_nav = DIV(Class='terminal-nav') header = DIV(Class='terminal-logo', id='header') terminal_menu = NAV(Class='terminal-menu') logo = DIV(Class='logo terminal-prompt') link_logo = A('Olar Jovis :)', Class='no-style') link_logo.href = '/' ul = UL() youtube = nav_element('Youtube', 'https://www.youtube.com/eduardomendes') apoiase = nav_element('Apoia.se', 'https://apoia.se/livedepython') curso = nav_element('Curso', 'https://dunossauro.github.io/curso-python-selenium') cdc = nav_element( 'CDC', 'https://github.com/dunossauro/curso-python-selenium/blob/master/cdc.md', # NOQA ) logo <= link_logo header <= logo ul <= youtube + apoiase + curso + cdc terminal_menu <= ul terminal_nav <= header terminal_nav <= terminal_menu div_container <= terminal_nav document['header'] <= div_container
def create_index(self): dtop.clear() doutput.clear() # document.title = f'{self.release}' dtop <= SPAN(f'{self.release}') # dindex.style.display = '' if dindex.html: return table = TABLE(Class='toctable') for i, row in enumerate(self.toc): flag, level, sid, width, sname = row tr = TR() tr <= TD(flag, Class='flag') tr <= TD(level) span = SPAN(sid) span.style.width = f"{width}ch" span.style.display = 'inline-block' if self.get_section(sid).aoa: td = TD(span + A(sname, href=f'#{sid}')) else: td = TD(span + sname) tr <= td set_indent(td, level - 2) tr <= TD(i) table <= tr dindex <= table ready.ready_table(table)
def create_ie(name): ie = id_ie_map[name[2:]] document.title = f'{g.release}: {ie.id} {ie.name}' document['title'] <= document.title document['top'] <= A('Index', href='') document['output'].html = ie.html_text sniff_24008_ie()
def click_one(self, event): dout = document['searchresult'] dout.clear() c = event.target.html for item in self.udf_list: if item[0].upper() == c: dout <= A(item, href=f'#{item}') dout <= BR()
def create_prev_next(self): sid = self.anchor try: i = self._map2.index(sid) if i - 1 >= 0: prev = self._map2[i - 1] dtop <= SPAN( A(f'Prev {prev}', href=f'#{prev}', title=self.get_section(prev).name)) if i + 1 < len(self._map2): next = self._map2[i + 1] dtop <= SPAN( A(f'Next {next}', href=f'#{next}', title=self.get_section(next).name)) except: return
def list_link(text, link): li_element = LI() element = A(text) element.target = '_blank' element.href = link li_element <= element return li_element
def jogo(): jogo = TABLE(Class="jogo") aux = "" for line in range(len(tabuleiro)): for coluna in range(len(tabuleiro[line])): aux += TD(A(tabuleiro[line][coluna], onclick='celula()'), value=coluna) jogo <= TR(aux, value=line) aux = "" return jogo
def create_index_24008(): document.title = g.release document['title'] <= g.release document['top'] <= '' msg_list = g.msg_list table = TABLE(id='indextable') document['output'] <= table table <= TR(TD(HR(), colspan='2')) table <= TR(TD('Messages', colspan='2')) for m in msg_list: table <= TR(TD(m.id) + TD(A(f'{m.name}', href=f'#{m.name}'))) table <= TR(TD(HR(), colspan='2')) table <= TR(TD('information elements', colspan='2')) for ie in g.ie_list: table <= TR(TD(ie.id) + TD(A(f'{ie.name}', href=f'#ie{ie.id}')))
def gerarCampoVisao(tabuleiro): document['tabelajogo'].clear() def hovertrueposition(event): event.target.style.background = 'rgba(0, 255, 0, 0.3)' def hoverfalseposition(event): event.target.style.background = 'rgba(255, 0, 0, 0.3)' def hoverleaveposition(event): event.target.style.background = '' def toast(event): new = DIV(event.path[2].id + " / " + event.path[1].id, Class='toast') document['desenv'] <= new def hidden(): new.style.display = 'none' timer.set_timeout(hidden, 3000) jogo = TABLE(Class="jogo") for line in range(7): aux = '' for coluna in range(7): if tabuleiro[line][coluna] == '.': aux += TD(A({tabuleiro[line][coluna] }).bind('click', incr).bind('click', toast), id=coluna).bind('mouseenter', hovertrueposition).bind( 'mouseleave', hoverleaveposition) else: aux += TD(A({tabuleiro[line][coluna]}).bind('click', toast), id=coluna).bind('mouseenter', hoverfalseposition).bind( 'mouseleave', hoverleaveposition) jogo <= TR(aux, id=line) aux = "" return jogo
def create_index(): document.title = g.release document['title'] <= g.release document['top'] <= '' msg_list = g.msg_list mobility_msg_list = [m for m in msg_list if m.id.startswith('8.2')] session_msg_list = [m for m in msg_list if m.id.startswith('8.3')] d5_list = [m for m in msg_list if m.id.startswith('D.5')] table = TABLE(id='indextable') document['output'] <= table if g.release.startswith('24301'): generation = 'EPS' elif g.release.startswith('24501'): generation = '5GS' mm = '{} mobility management messages'.format(generation) sm = '{} session management messages'.format(generation) d5 = 'UE policy delivery protocol messages' table <= TR(TD(HR(), colspan='2')) table <= TR(TD(mm, colspan='2')) for m in mobility_msg_list: table <= TR(TD(m.id) + TD(A(f'{m.name}', href=f'#{m.name}'))) table <= TR(TD(HR(), colspan='2')) table <= TR(TD(sm, colspan='2')) for m in session_msg_list: table <= TR(TD(m.id) + TD(A(f'{m.name}', href=f'#{m.name}'))) if d5_list: table <= TR(TD(HR(), colspan='2')) table <= TR(TD(d5, colspan='2')) for m in d5_list: table <= TR(TD(m.id) + TD(A(f'{m.name}', href=f'#{m.name}'))) table <= TR(TD(HR(), colspan='2')) table <= TR(TD('information elements', colspan='2')) for ie in g.ie_list: table <= TR(TD(ie.id) + TD(A(f'{ie.name}', href=f'#ie{ie.id}')))
def sniff_24008_link(ie_text): result = ie_text try: line1 = ie_text.split('\n')[0] line2 = ie_text.split('\n')[1] lst = [s for s in line2.split(' ') if s] try: if lst[0] == 'See' and lst[1] == 'subclause' and lst[ 3] == 'in' and lst[4] == '3GPP' and lst[5] == 'TS' and lst[ 6] == '24.008': lst[2] = A(f'{lst[2]}', href=f'24008.html#ie{lst[2]}') lst[6] = A(f'{lst[6]}', href='24008.html') result = SPAN() result <= SPAN(line1 + '\n') for i in lst: result <= SPAN(i) + SPAN(' ') except: return ie_text except: return ie_text return result
def cabecalho(): div = DIV(Class="cabecalho") logo = DIV(Class="logo-cabecalho") logo <= A("Meu Blog", href="index.html") pesquisa = DIV(Class="pesquisa") pesquisa <= INPUT(type="text") pesquisa <= INPUT(type="submit", value="Pesquisar") div <= logo div <= pesquisa return div
def create_table(name): global ie_desc_array ie_desc_array = [] # m = name_msg_map[name] document.title = f'{g.release}: {m.id} {m.name}' document['title'] <= document.title # button = BUTTON('show IE description') document['top'] <= button button.bind('click', toggle_ie_desc) # document['top'] <= SPAN(' ') document['top'] <= A('Index', href='') document['output'] <= PRE(m.id + ' ' + m.name + '\n' + m.definition, Class='definition') table = TABLE(id='msgtable') document['output'] <= table for r, row in enumerate(m.aoa): tr = TR(Class=f'r{r}') table <= tr for c, v in enumerate(row): title = '' if r == 0 and c in (2, 3, 4, 5): title, v = v, '' elif c == 2: lst = v.replace('\n', ' ').split(' ') lst2 = [ie for ieid, ie in id_ie_map.items() if ieid in lst] if len(lst2) == 1: ie = lst2[0] title = f'{ie.id} {ie.name}\n{ie.definition}' v = A(f'{ie.id}', href=f'#ie{ie.id}') ie_desc_array.append(title) elif r != 0 and c == 6: if v: v = DIV(v) + DIV('', Class='iedescdiv', needsep='y') else: v = DIV('', Class='iedescdiv', needsep='n') tr <= TD(v, title=title, Class=f'c{c}')
def input_change(self, event): dout = document['searchresult'] dout.clear() text = event.target.value if len(text) <= 1: return else: result = [udf for udf in self.udf_list if text.lower() in udf.lower()] if result: for udf in result: dout <= A(udf, href=f'#{udf}') dout <= BR() else: dout <= B('No match')
def nav_element(text, link): """ Cria links para uma lista. Parans: - text: texto que aparecerá no link - link: href """ li_element = LI() element = A(text, Class='menu-item') element.target = '_blank' element.href = link li_element <= element return li_element
def create_tree_tr(self, row, pad_prefix='', start_level=0): flag, pad, level, ie, udf, vrange, need, desc, ch5link = row pad = pad_prefix + pad level += start_level tr = TR() tr <= TD(flag, Class='flag') tr <= TD(level) tr <= TD(SPAN(pad, Class='iepad', treepad=pad, tablepad='>'*level+' ')+SPAN(ie, Class='ie', desc=ch5link)) tr <= TD(need) if udf: tr <= TD(A(udf, href=f'#{udf}')) else: tr <= TD() tr <= TD(vrange, Class='vrange') tr <= TD(desc, Class='desc') tr <= TD() return tr
def handle_msg_config_process_mgr_list(msg): """Enable the dropdown, clear out the old contents, and update""" dropListNode = doc['procmgrlist'] dropListNode.clear() doc["procmgrdropbox"].classList.remove('disabled') print("MsgConfigProcessMgrList") for process_mgr in msg['process_mgrs']: print(process_mgr) newNode = A(process_mgr['name']) id_ = process_mgr['id'] #newNode.bind('click', lambda evt :switch_to_new_process_mgr(evt=evt,id_=id_) ) newNode.bind('click', functools.partial(switch_to_new_process_mgr, id_=id_)) dropListNode <= LI(newNode) # And switch to the first node by default: switch_to_new_process_mgr(None, id_=msg['process_mgrs'][0]['id'])
def tableau(tbl, entete=True, trier=True): titres = TR() if entete: titres <= TH(P(colonne[0]) for colonne in tbl[0]) tbl = tbl[1] if trier: tbl = tbl if ASC else reversed(tbl) corps = TBODY() for ligne in tbl: lgn = TR() for cellule in ligne: if isinstance(cellule, list): cel = A(cellule[0], href='#{}'.format(cellule[1])) cel.bind('click', lambda ev, col=cellule[1]: charger(ev, col)) else: cel = cellule lgn <= TD(cel) corps <= lgn return TABLE((THEAD(titres), corps))
def gerarCampoDePossibilidades(tabuleiro): document['tabelajogo'].clear() tabela = TABLE(Class="jogo") for line in range(7): aux = '' for coluna in range(7): if (jogo.acao[0] == line and jogo.acao[1] == coluna): aux += TD(A({tabuleiro[line][coluna]}).bind('click', incrlog), Class='acao') elif (jogo.acao[0] == line and (jogo.acao[1] - 2) == coluna and jogo.validacao[0]): aux += TD(A({tabuleiro[line][coluna]}).bind('click', incrlog), id=0, Class='possibilidade') elif (jogo.acao[0] == line and (jogo.acao[1] + 2) == coluna and jogo.validacao[1]): aux += TD(A({tabuleiro[line][coluna]}).bind('click', incrlog), id=1, Class='possibilidade') elif ((jogo.acao[0] - 2) == line and jogo.acao[1] == coluna and jogo.validacao[2]): aux += TD(A({tabuleiro[line][coluna]}).bind('click', incrlog), id=2, Class='possibilidade') elif ((jogo.acao[0] + 2) == line and jogo.acao[1] == coluna and jogo.validacao[3]): aux += TD(A({tabuleiro[line][coluna]}).bind('click', incrlog), id=3, Class='possibilidade') else: aux += TD(A({tabuleiro[line][coluna]})) tabela <= TR(aux, id=line) aux = "" return tabela
def submitClicked(event): #Handles the submit button being clicked global currentKeyIndex global keySequence userIn = (document["userTextBox"].value) if keySequence[currentKeyIndex][0] == "numerical": try: document["zone"] <= P( percentComparison(keySequence[currentKeyIndex][1], float(userIn))) document["zone"] <= P(facts[keySequence[currentKeyIndex][1]]) if ((currentKeyIndex + 1) < len(keySequence)): currentKeyIndex += 1 document["question"].clear() document["question"] <= P( STRONG("What is your " + keySequence[currentKeyIndex][1] + "?")) except ValueError: document["zone"] <= P("Please double check your input") if keySequence[currentKeyIndex][0] == "NonNumerical": try: if keySequence[currentKeyIndex][1] == "eye colour": document["question"] <= P(EyeDescription()) document["question"] <= P(("1. " + STRONG("Brown")) + (" 2. " + STRONG("Blue")) + (" 3. " + STRONG("Hazel")) + (" 4. " + STRONG("Amber"))) document["question"] <= P(("5. " + STRONG("Green")) + (" 6. " + STRONG("Red/Violet")) + (" 7. " + STRONG("Heterochromia")) + (" 8. " + STRONG("Other"))) document["zone"] <= P(ReturnEyeComparison((userIn).lower())) document["zone"] <= P(ReturnFact((userIn).lower())) if ((currentKeyIndex + 1) < len(keySequence)): currentKeyIndex += 1 document["question"].clear() document["question"] <= P(STRONG(ContDescription1())) document["question"] <= P(ContDescription2()) document["question"] <= P(("1. " + STRONG("Asia")) + (" 2. " + STRONG("Africa")) + (" 3. " + STRONG("Europe"))) document["question"] <= P(("4. " + STRONG("South America")) + (" 5. " + STRONG("North America")) + (" 6. " + STRONG("Oceania"))) if keySequence[currentKeyIndex][1] == "continent": document["zone"] <= P(ReturnContComparison((userIn).lower())) document["zone"] <= P(ReturnFact((userIn).lower())) if ((currentKeyIndex + 1) < len(keySequence)): currentKeyIndex += 1 document["question"].clear() document["question"] <= P(STRONG(SexDescription1())) document["question"] <= P(SexDescription2()) document["question"] <= P(("1. " + STRONG("Male")) + (" 2. " + STRONG("Female")) + (" 3. " + STRONG("Intersex"))) if keySequence[currentKeyIndex][1] == "sex": document["zone"] <= P(ReturnSexComparison((userIn).lower())) document["zone"] <= P(ReturnFact((userIn).lower())) if ((currentKeyIndex + 1) < len(keySequence)): currentKeyIndex += 1 document["question"].clear() document["question"] <= P(STRONG("Thank you!")) document["submission"].clear() document["zone"] <= P( STRONG( "If any of these figures about wealth or income equality concern you, consider looking at some of these charities..." )) document["zone"] <= P( A(' The UN Development Project ', href='https://www.undp.org')) document["zone"] <= P( A(' The Borgen Project ', href='https://borgenproject.org/')) document["zone"] <= P( A(' Oxfam ', href='https://www.oxfam.org')) except ValueError: document["zone"] <= P("Please double check your input")
def menu(title, links): # links is a list of tuples (name,href) res = B(title) for _name, href in links: res += BR() + A(_name, href=href) return res
def create_table(self): dindex.style.display = 'none' dtop.clear() doutput.clear() section = self.get_section() aoa = section.aoa # document.title = f'{get_protocol_name()} {section.name}' dtop <= SPAN(self.release) dtop <= SPAN(A('Index', href='#')) # b = BUTTON('copy tree') b.bind('click', ready.copy_tree) dtop <= SPAN(b) # b = BUTTON('export xlsx') b.bind('click', self.export_xlsx) dtop <= SPAN(b) # b = BUTTON('table view') b.bind('click', self.change_view) dtop <= SPAN(b) # b = BUTTON('Popup On') b.bind('click', ready.button_popup) dtop <= SPAN(b) b.style.backgroundColor = 'lightgreen' # dtop <= SPAN(f'{section.id} {section.name}') self.create_prev_next() # table = TABLE(Class='asn1tree', tview='tree', core='') head = [ "", "", 'IE', 'Need', 'Refer', 'Type', 'Description', 'Crit', 'Assign' ] table <= TR([TD(B(v)) for v in head]) table.rows[0].cells[6].className = 'desc' # for row in aoa: flag, level, ie, need, udf, vrange, desc, crit, assign = row pad, ie = get_pad_and_ie(ie) tr = TR() tr <= TD(flag, Class='flag') tr <= TD(level) hasdesc = 'hasdesc' if desc else '' tr <= TD( SPAN(pad, Class='iepad', treepad=pad, tablepad='>' * level + ' ') + SPAN(ie, Class='ie', desc=hasdesc)) tr <= TD(need) if udf: tr <= TD(A(udf, href=f'#{udf}')) else: tr <= TD() tr <= TD(vrange, Class='vrange') tr <= TD(desc, Class='desc') tr <= TD(crit) tr <= TD(assign) table <= tr for tr in table.rows: tr <= TD(tr.rowIndex) doutput <= table ready.ready_table(table)
def menuOption(self, frase, action): o = LI(A(frase)) o.bind('click', action) return o