def login_form(): form = FORM(id="meu-forme", action="#", method="GET", target="_blank") form <= LABEL('seu nome', For='nome', name="nome") form <= INPUT(id='nome') form <= BR() form <= LABEL('sua senha', For='senha', senha="senha") form <= INPUT(id='senha', type='password', required=True) form <= BR() form <= INPUT(id='submit', type='submit') return form
def init_flags(): data = [('useFrenzyCharges', 'Frenzy'), ('usePowerCharges', 'Power'), ('useEnduranceCharges', 'Endurance')] t = make_table(data, 3, 'Charges') doc['Flags'] <= STRONG('Charges:') + ' Do you sustain charges?' + t + BR() t = TABLE() t <= TR(TD(INPUT(type="number", Id="PowerCount", value="0", data_normal="1", style={"width": "3em"}, Class="dps_val")) + TD('Power')) t <= TR(TD(INPUT(type="number", Id="FrenzyCount", value="0", data_normal="1", style={"width": "3em"}, Class="dps_val")) + TD('Frenzy')) t <= TR(TD(INPUT(type="number", Id="EnduranceCount", value="0", data_normal="1", style={"width": "3em"}, Class="dps_val")) + TD('Endurance')) t <= TR(TD(INPUT(type="number", Id="ImpaleStacks", value="0", data_normal="1", style={"width": "3em"}, Class="dps_val")) + TD('Number of Impales on Target')) doc['Flags'] <= STRONG('Misc Counts:') + ' The "count" of various things affecting your build.' + t + BR() data = ['Attack', 'Spell'] t = make_table(data, 2, 'Type') doc['Flags'] <= STRONG('Type:') + ' Generally select 1 based on your combat style' + t + BR() data = ['Mace', 'Bow', 'Wand', 'Claw', 'Staff', 'Sword', 'Axe', 'Dagger', 'Trap', 'Mine', 'Totem'] t = make_table(data, 4, 'Class') doc['Flags'] <= STRONG('Class:') + ' Select your weilded weapon types. Trap/Mine/Totem if you are using those supports' + t + BR() data = ['Elemental', 'Fire', 'Cold', 'Lightning', 'Projectile', 'Melee', 'Area', 'Spectre', 'Exerted', 'Trigger', 'Vaal'] t = make_table(data, 4, 'Tags') doc['Flags'] <= STRONG('Tags:') + ' Check all the tags that match your primary skill' + t + BR() data = ['Shield', ('DualWielding', 'Dual Wielding'), ('TwoHandedWeapon', 'Two Handed Weapon')] t = make_table(data, 3, 'Hands') doc['Flags'] <= STRONG('Hands:') + ' Choose 1 based on wielded weapons' + t + BR() data = [('KilledRecently', 'You Kill'), ('MinionsKilledRecently', 'Minion Kill'), ('NoRecentKill', 'Not Kill'), ('CritRecently', 'Crit'), ('NoRecentCrit', 'Not Crit'), ('UsedMinionSkillRecently', 'Minion Skill'), 'Stun', 'Shatter', ('beShocked', 'Be Shocked')] t = make_table(data, 3, 'Recently') doc['Flags'] <= STRONG('Recently:') + " Tic all the things your build can do 'recently'" + t + BR() data = [('EnemyPoisoned', 'Poisoned'), ('EnemyBlinded', 'Blinded'), ('EnemyIgnited', 'Ignited'), ('EnemyBurning', 'Burning'), ('EnemyChilled', 'Chilled'), ('EnemyFrozen', 'Frozen'), ('EnemyShocked', 'Shocked'), ('EnemyMaimed', 'Maimed')] t = make_table(data, 4, 'Enemy is') doc['Flags'] <= STRONG('Enemy is:') + ' Status effects on your target' + t + BR() data = ['Spellslinger', ('SpellslingerDW', 'Spellslinger(DW)'), 'BattleMage', ('Leeching', 'Leeching (Generic)'), ('leechLife', 'Leeching Life'), ('leechMana', 'Leeching Mana'), ('UsingFlask', 'Flasked'), ] t = make_table(data, 3, 'You are/have') doc['Flags'] <= STRONG('You are/have:') + ' Tic all the things affecting you' + t + P(STRONG('Spellslinger/Battlemage Notes:') + " Only select, at max, one of the Spellslingers and remember Spellslinger only works with wands. Physical damage is not correct as it depends on base item, quality, %ipd. Existing search mods don't allow for a meaningful weight to be generated.") + BR() data = [('NearbyRareUnique', 'Nearby Rare or Unique Monster'), ('NearbyEnemy', 'Nearby Enemy (helm mods)'), ('otherringshaper', 'Other Ring is Shaper'), ('otherringelder', 'Other Ring is Elder')] t = make_table(data, 1, 'Other Options') doc['Flags'] <= STRONG('Other options:') + ' choices that don\'t neatly fit a section' + BR() + t
def on_message(evt): print("Message recv'ed") div = doc['outputwindow'] code = doc['outputcode'] code <= BR() + evt.data div.scrollTop = div.scrollHeight handle_msg(evt.data)
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 login_form(): form = FORM(Class='form login-form', id="meu-forme", action="#", method="GET", target="blank") form <= H2('Meu formulário') form <= LABEL('seu nome', For='nome') form <= INPUT(id='nome', name='nome', required=True) form <= BR() form <= LABEL('sua senha', For='senha') form <= INPUT(id='senha', type='password', name='senha', required=True) form <= BR() form <= INPUT(id='submit', type='submit') document <= form
def handle_msg_output(msg): global code_blks proc_id = msg['process_id'] pipe_name = msg['pipe'] codeBlock = code_blks.get((proc_id, pipe_name), None) if codeBlock: codeBlock <= BR() + msg['contents'] codeBlock.parentNode.scrollTop = codeBlock.parentNode.scrollHeight
def toggle_ie_desc(event): button = event.target text = button.text if text == 'show IE description': button.text = 'hide IE description' for s, div in zip(ie_desc_array, document.select('.iedescdiv')): if div.needsep == 'y': div <= BR() div <= sniff_24008_link(s) else: button.text = 'show IE description' for div in document.select('.iedescdiv'): div.clear()
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 generate_query(ev): league = leagues[doc['league'].selectedIndex] set_storage('league', league) base = bases[doc['base'].selectedIndex] set_storage('base', base) for _f in saved_states: if doc[_f].checked: set_storage(_f, "T") else: set_storage(_f, "") url_api = f'https://www.pathofexile.com/trade/search/{league}?q=' dps = {} for elt in doc.get(selector='input[type="number"].dps_val'): dps[elt.id] = [float(elt.value)/float(elt.getAttribute("data-normal")), float(elt.value)] dps['extrarandom'] = [(dps['extrafire'][0] + dps['extracold'][0] + dps['extralightning'][0]) / 3, (dps['extrafire'][1] + dps['extracold'][1] + dps['extralightning'][1]) / 3] selections = set() for elt in doc.get(selector='input[type="checkbox"]'): if elt.checked: selections.add(elt.id) mjson_max = max(mjson) if mjson_max != current_version: for mod in mjson[mjson_max]: if mod['name'] not in dps: dps[mod['name']] = [0, 0] querystring, count, culled = gensearchparams(dps, selections, base) doc['culled'].text = '' if culled: mystr = '' for _x in [BR() + x for x in culled]: mystr += _x doc['culled'] <= BR() + f'{len(culled)} mods were culled from query.' + BR() + mystr doc["query"].href = url_api + querystring doc["modcount"].text = count doc["414bypass"].value = querystring doc["query"].style.display = "inline" doc["notice"].style.display = "inline" doc["414by"].style.display = "inline"
def cadastro_pessoa(): form = FORM(id="meu-form", action="#", method="get", target="_blank") form <= LABEL('Nome', id='nome') form <= INPUT(id='Nome', name='Nome') form <= BR() form <= LABEL('CPF', id='cPF') form <= INPUT(id='CPF', type='password', name='CPF') form <= BR() form <= LABEL('Telefone', id='telefone') form <= INPUT(id='Telefone', type='password', name='Telefone') form <= BR() form <= LABEL('Adicionar', id='add') form <= BUTTON(id='submit', name='submit', type='button') form <= BR() form <= LABEL('Mostrar lista de pessoas:', id='stud_list') form <= BUTTON(id='all_students', name='students list', type='button') form <= BR() form <= H1('Deletar pessoa do banco de dados') form <= LABEL('ID da pessoa', id='delete_stud') form <= INPUT(id='id', name='ID') form <= BR() form <= LABEL('Deletar: ', id='delete_stud') form <= BUTTON(id='delete', name='delete', type='button') form <= H1('Adicionar curso a pessoa') form <= LABEL('ID da pessoa', id='id_pessoa') form <= INPUT(id='id_pcurso', name='ID') form <= BR() form <= LABEL('Curso', id='curso_type') form <= INPUT(id='curso', name='Curso') form <= BR() form <= LABEL('Adicionar curso: ', id='add_pessoa_curso') form <= BUTTON(id='add_pc', name='add_pc', type='button') form <= BR() form <= LABEL('Mostrar cursos: ', id='cursos') form <= BUTTON(id='show_curso', name='show_cursos', type='button') #open('GET', 'http://127.0.0.1:5000/alunos/add', True) #get('http://127.0.0.1:5000/alunos/add') return form
def init_information(): order_index = [x[1] for x in ingame_order] data = {k: set() for k in order_index} char_data = {} # iterate all the characters and add items they need to data for character in characters: char_data[character] = set() for field in characters[character]: # keys with subkeys if field in ['ascension', 'talent']: for key in characters[character][field]: val = characters[character][field][key] if val in data: data[val].add(character) char_data[character].add(val) else: val = characters[character][field] if val in data: data[val].add(character) char_data[character].add(val) trav_data = {} # do the same thing for traveler talents for tal_group in traveler: trav_data[tal_group] = set() for row in traveler[tal_group]: for field in row: trav_data[tal_group].add(row[field]) for t_char in traveler_talent: char_data[t_char] = set() for talent in traveler_talent[t_char]: for item in trav_data[talent]: data[item].add(t_char) char_data[t_char].add(item) # create a table with the character->item dictionary we just built t_chars = TABLE(TR(TH(strings["character"]) + TH(strings["item_s"])), Class='borders body') for char in sorted(char_data): item_set = {} for item in char_data[char]: if item in strings: i_idx = order_index.index(item) if isinstance(strings[item], list): c = len(strings[item]) - 1 item_set[i_idx] = [f"{item}_{c}", strings[item][c]] else: item_set[i_idx] = [item, strings[item]] i = (IMG(src=f"img/{item_set[x][0]}.png", alt=item_set[x][1], title=item_set[x][1], loading="lazy") for x in sorted(item_set)) c = IMG(src=f"img/{char}.png", alt=strings[char], title=strings[char], loading="lazy") t_chars <= TR(TD(c) + TD(i)) # create a table with the item->character dictionary we just built t_items = TABLE(TR(TH(strings["item_s"]) + TH(strings["character_s"])), Class='borders body') for typ, item in ingame_order: if item in data: if data[item]: # only show items used by a character if isinstance(strings[item], list): i = (IMG(src=f"img/{item}_{c}.png", alt=strings[item][c], title=strings[item][c], loading="lazy") for c in range(len(strings[item]))) else: i = IMG(src=f"img/{item}.png", alt=strings[item], title=strings[item], loading="lazy") c = (IMG(src=f"img/{x}.png", alt=strings[x], title=strings[x], loading="lazy") for x in sorted(data[item])) t_items <= TR(TD(i) + TD(c)) doc['information'] <= SECTION(P(strings['character_mats']) + t_chars + BR()+ BR() + t_items, Class='grind')
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 process_querystring(): global current_version if len(str(doc.query)): if 'vals' in doc.query: n_arr = doc.query['vals'].split(',') version = int(n_arr[0]) if version in mjson: if version != current_version: doc['specialnotice'] <= H1("You are using an outdated version of mods.json, this should automatically update when you (re)start PoB-Item-Tester" + BR() + f"Current version is {current_version}, you are using {version}.") doc['specialnotice'].style.display = 'block' current_version = version init_weight(current_version) for c, val in enumerate(n_arr[1:]): if val: doc[mjson[version][c]['name']].value = float(val) else: doc['specialnotice'] <= H1("You are using an unsupported version of mods.json, this should automatically update when you (re)start PoB-Item-Tester" + BR() + f"Current version is {current_version}, you are using {version}.") doc['specialnotice'].style.display = 'block' init_weight(current_version) # Handle mods that aren't weights or flags for key in doc.query: if key not in ['Flags', 'vals']: try: doc[key].value = doc.query[key] except KeyError: print(f"Key '{key}' recieved but not currently supported") else: init_weight(max(mjson)) doc['specialnotice'] <= H1("You are using an outdated version of PoB-Item-Tester" + BR() + f"Update from " + A("VolatilePulse's Github Repository", href="https://github.com/VolatilePulse/PoB-Item-Tester", target="_blank")) doc['specialnotice'].style.display = 'block' current_version = max(mjson) for key in doc.query: if key not in ['Flags']: try: doc[key].value = doc.query[key] except KeyError: print(f"Key '{key}' recieved but not currently supported") try: flags = doc.query["Flags"].strip(',').split(',') for f in flags: if f.startswith('condition'): f = f[9:] try: doc[f].checked = True except KeyError: print("Flag '{}' recieved but not currently supported.".format(f)) if 'CritRecently' not in flags: doc["NoRecentCrit"].checked = True if 'KilledRecently' not in flags: doc["NoRecentKill"].checked = True except KeyError: print("No Flags parameter passed in query string") for val in ['Skill', 'Character']: try: if doc.query[val]: doc[val] <= doc.query[val] except KeyError: doc[val].style.display = "none" else: init_weight(current_version) print("No query string found") # Set default states doc["PseudoMods"].checked = True for _f in saved_states: if check_storage(_f): doc[_f].checked = bool(get_storage(_f))
def init_page(): create_league_list() create_base_list() pages = ['Main', 'Weights', 'Flags', 'About', 'Changelog'] for c, page in enumerate(pages): doc['buttons'] <= BUTTON(page, data_id=page, Class=f'page{" current_tab" if not c else ""}', Id=f'b_{page}') doc['pages'] <= SECTION(Id=page) if c: doc[page].style.display = 'none' data = [('includeDelve', 'Include Precursor Emblem mods'), ('NoSearingImplicitMods', 'Ignore Searing Exarch only Implicit Mods'), ('NoTangledImplicitMods', 'Ignore Eater of Worlds only Implicit Mods'), ('NoSynthImplicitMods', 'Ignore Synth only Implicit Mods'), ('NoCorruptImplicitMods', 'Ignore Corruption only Implicit Mods'), ('NoImplicitMods', 'Ignore All Implicit Mods including corrupt and synth'), ('PseudoMods', 'Use PseudoMods in Search'), ('IgnoreCastSpeed', 'Set Cast Speed Weight to 0'), ('IgnoreAttackSpeed', 'Set Attack Speed Weight to 0')] # ('NoCraftedMods', 'Ignore Crafted Mods'), t = make_table(data, 1, 'ignore') doc['searchflags'] <= STRONG('Options:') + ' choices that affect type of returned mods' + BR() + t + BR() init_about() init_flags() init_change() doc["query"].style.display = "none" doc["notice"].style.display = "none" doc["414by"].style.display = "none" b_generate = BUTTON("Generate Query") b_generate.bind("click", generate_query) doc["generate"] <= b_generate process_querystring() init_main() doc["loading"].style.display = "none" # Make it so navigation buttons work @bind('.page', 'click') def change_page(ev): val = ev.target['data-id'] if val == 'Main': init_main() doc[val].style.display = 'block' doc[f'b_{val}'].attrs['class'] = 'current_tab page' idx = pages.index(val) for i in pages[:idx] + pages[idx+1:]: doc[i].style.display = 'none' doc[f'b_{i}'].attrs['class'] = 'page'
button2 = BUTTON("Login", id="but_login") div1 <= button1 + button2 container <= div1 """event button for show login div and show register div """ doc['but_login'].bind('click', login) doc['but_register'].bind('click', register) """login page"""" div2 = DIV(id="login", Class="w3-center") title1 = H1("Login in") input1 = INPUT(placeholder="Your email") input2 = INPUT(placeholder="Your password") back_button = BUTTON("Back", id="back_login") button_submit = BUTTON("Submit") div2 <= title1 + input1 + input2 + BR() + \ back_button + BR() + button_submit container <= div2 doc['back_login'].bind('click', back) """register page""" div3 = DIV(id="register", Class="w3-center") title2 = H1("Register") input3 = INPUT(placeholder="Your email") input4 = INPUT(placeholder="Your password") back_button = BUTTON("Back", id="back_register") button_submit = BUTTON("Submit") div3 <= title2 + input3 + input4 + BR() + \ back_button + BR() + button_submit container <= div3 doc['back_register'].bind('click', back)