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 init_options(): doc["Config"] <= H1("Column visibility") + make_table(headers, 3, True) doc['Config'] <= H1("Items") for base in types: doc["Config"] <= H2(base) + make_table(types[base], 3, item_class=base) doc["Config"] <= H1("Areas") + P( "'Unknown' is npcs that may only exist in the game files and not be present in the game. They are not attached to an area and don't have a BCS spawn script." ) + make_table(areas, 2) for el in doc.get(selector='.save'): if check_storage(el['data-id']): el.checked = False else: el.checked = True @bind('.save', 'change') def save_state(ev): if ev.target.type == 'checkbox': if ev.target.checked: del_storage(ev.target['data-id']) else: set_storage(ev.target['data-id'], 'unchecked')
def update_character(): char_tracker = {} for val in grind_table_state['total']: grind_table_state['total'][val] = 0 for char in grind_table_state['checked']: update_per_character(char, char_tracker) # Get a list of all chosen artifacts so we know what to farm for elt in doc.get(selector=f'.saved_arti'): char = elt.id.split('-')[1] if char in grind_table_state['checked'] and char in grind_table_state[ 'arti_check']: add_value_set(char_tracker, elt.id.split('-')[-1], elt.id.split('-')[1]) # adjust xp totals to units of their base type. grind_table_state['total']['mora'] += grind_table_state['total'][ 'xp'] // 5 + grind_table_state['total']['wep_xp'] // 10 grind_table_state['total']['xp'] = round( grind_table_state['total']['xp'] / 20000, 2) grind_table_state['total']['wep_xp'] = round( grind_table_state['total']['wep_xp'] / 10000, 2) # Build up and display farm table data = { 'any': { 0: {}, 20: {}, 40: {}, 60: {} }, 'mon': {}, 'tue': {}, 'wed': {}, 'thu': {}, 'fri': {}, 'sat': {}, 'sun': {}, } resin = { 'stormterror': 60, 'wolf_of_the_north': 60, 'golden_house': 60, 'azhdaha': 60, '60_boss': 60, '40_boss': 40, 'anemo_hypostasis': 40, 'cryo_regisvine': 40, 'cryo_hypostasis': 40, 'electro_hypostasis': 40, 'geo_hypostasis': 40, 'oceanid': 40, 'pyro_regisvine': 40, 'primo_geovishap': 40, 'maguu_kenki': 40, 'pyro_hypostasis': 40, 'perpetual_mechanical_array': 40, 'clear_pool_and_mountain_cavern': 20, 'domain_of_guyun': 20, 'hidden_palace_of_zhou_formula': 20, 'midsummer_courtyard': 20, 'valley_of_remembrance': 20, 'peak_of_vindagnyr': 20, 'court_of_flowing_sand': 20, 'violet_court': 20, 'momiji_dyed_court': 20, 'ridge_watch': 20, 'xp_leyline': 20, 'mora_leyline': 20 } arti_keys = [('arti', x) for x in char_tracker if x not in ingame_order] for section, item in [('base', 'xp'), ('base', 'wep_xp'), ('base', 'mora')] + ingame_order + arti_keys: if item in char_tracker: for day in farming_data[item]['when']: for loc in farming_data[item]['where']: if day == 'any': cost = 0 if loc not in resin else resin[loc] if loc not in data[day][cost]: data[day][cost][loc] = [] data[day][cost][loc].append(item) else: if loc not in data[day]: data[day][loc] = [] data[day][loc].append(item) d = SECTION(Class='grind') for day in ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']: d <= H2([strings[day]]) t = TABLE(TR( TH(strings["location"]) + TH(strings["item_s"]) + TH(strings["character_s"])), Class='borders body') empty = True for loc in sorted(data[day]): char_set = set() item_set = {} for x in data[day][loc]: if isinstance(strings[x], str) and grind_table_state['total'][ x] - grind_table_state['user'][x] > 0: char_set.update(char_tracker[x]) item_set[x] = { 'text': strings[x], 'count': readable_number(grind_table_state['total'][x] - grind_table_state['user'][x]) } else: for i in range(len(strings[x])): if grind_table_state['total'][ f"{x}_{i}"] - grind_table_state['user'][ f"{x}_{i}"] > 0: char_set.update(char_tracker[x]) item_set[f"{x}_{i}"] = { 'text': strings[x][i], 'count': readable_number( grind_table_state['total'][f"{x}_{i}"] - grind_table_state['user'][f"{x}_{i}"]) } if item_set: empty = False v = (DIV(IMG(src=f"img/{x}.png", alt=item_set[x]['text'], title=item_set[x]['text'], loading="lazy") + DIV(item_set[x]['count'], Class='bottom-right'), Class='container') for x in item_set) c = (IMG(src=f"img/{x}.png", alt=strings[x], title=strings[x], loading="lazy") for x in sorted(char_set)) t <= TR(TD(strings[loc], Class="location") + TD(v) + TD(c)) if empty: t <= TR( TD(strings['nothing'], Class="location") + TD(strings['nothing']) + TD(strings['nothing'])) d <= t if any([data['any'][x] for x in [0, 20, 40, 60]]): d <= H2([strings['any']]) for cost in [0, 20, 40, 60]: if data['any'][cost]: d <= H3(f"{cost} {strings['resin']}") t = TABLE(TR( TH(strings["location"]) + TH(strings["item_s"]) + TH(strings["character_s"])), Class='borders body') for loc in sorted(data['any'][cost]): char_set = set() item_set = {} for x in data['any'][cost][loc]: if isinstance(strings[x], str): if x in grind_table_state['total']: if 'xp' == x: val = int(grind_table_state['total'][x] - grind_table_state['user'][x] - grind_table_state['user'] [f"{x}_sub_1"] / 4 - grind_table_state['user'] [f"{x}_sub_0"] / 20 + .5) elif 'wep_xp' == x: val = int(grind_table_state['total'][x] - grind_table_state['user'][x] - grind_table_state['user'] [f"{x}_sub_1"] / 5 - grind_table_state['user'] [f"{x}_sub_0"] / 25 + .5) else: val = grind_table_state['total'][ x] - grind_table_state['user'][x] if val > 0: if x in ['xp', 'wep_xp', 'mora' ] and len(char_tracker[x]) > 5: char_set.add('many') else: char_set.update(char_tracker[x]) item_set[x] = { 'text': strings[x], 'count': readable_number(val) } else: char_set.update(char_tracker[x]) item_set[x] = {'text': strings[x], 'count': ''} else: for i in range(len(strings[x])): if grind_table_state['total'][ f"{x}_{i}"] - grind_table_state[ 'user'][f"{x}_{i}"] > 0: char_set.update(char_tracker[x]) item_set[f"{x}_{i}"] = { 'text': strings[x][i], 'count': readable_number( grind_table_state['total'] [f"{x}_{i}"] - grind_table_state['user'] [f"{x}_{i}"]) } if item_set: v = (DIV( IMG(src=f"img/{x}.png", alt=item_set[x]['text'], title=item_set[x]['text'], loading="lazy") + DIV(item_set[x]['count'], Class='bottom-right'), Class='container') for x in item_set) c = (IMG(src=f"img/{x}.png", alt=strings[x], title=strings[x], loading="lazy") for x in sorted(char_set)) t <= TR( TD(strings[loc], Class="location") + TD(v) + TD(c)) d <= t doc['daily'].text = '' doc['daily'] <= d
def show_details(self, details): self._details.html = "" self._details <= H2(details["name"]) self._details <= IMG(src=details["image"])
"The instigator of the whole," "keep them guessing and we'll keep making stuff up as we go' style drama", 'Episodes': [ " Pilot (Part 1) ", " Pilot (Part2) ", " Tabula Rasa ", " Walkabout ", " White Rabbit ", " House of the Rising Sun ", " The Moth ", " Confidence Man " ], "Reviews": [(" Rotten Potatos ", 62), (" Winge Central ", 46), (" Fan Base Fanatics ", 72)], 'UserRatings': [2, 8, 8, 8, 7, 6, 7, 8, 10, 6] }] print(dating) for data in dating: titre = H2(data["Title"], Class="a-Series_Title") descr = P(SPAN("Description: " + data['Description'], Class="a-Series_DescriptionHeader"), Class='a-Series_Description') epis = DIV(H4("First episodes", Class="a-EpisodeBlock_Title"), Class='a-EpisodeBlock') container <= titre + descr + epis for x, q in enumerate(data['Episodes'], 1): first = DIV(B(str(x)) + SPAN(q), Class="a-EpisodeBlock_Episode") container <= first if data['Ended'] is False: more = DIV("More to come !", Class="a-Series_More") container <= more reviews = DIV(Class="a-ReviewsBlock") revi1 = H4("Reviews", Class="a-ReviewsBlock_Title") reviews <= revi1