Beispiel #1
0
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 init_show_hide():
	# initialize options
	element = set()
	weapon = set()
	for char in characters:
		if char == 'traveler':
			continue
		element.add(characters[char]['element'])
		weapon.add(characters[char]['weapon'])
	# selected
	cst = SELECT(Id=f"selected", Class=f"save onehundred")
	for s in ['any', 'checked', 'unchecked']:
		cst <= OPTION(s.capitalize(), value=s)
	# element
	est = SELECT(Id=f"element", Class=f"save onehundred")
	for s in ['any'] + sorted(element):
		est <= OPTION(s.capitalize(), value=s)
	# weapon
	wst = SELECT(Id=f"weapon", Class=f"save onehundred")
	for s in ['any'] + sorted(weapon):
		wst <= OPTION(s.capitalize(), value=s)

	t = TABLE(TR(TH() + TH('Option')))
	t <= TR(TD('Character', Class="right_text") + TD(cst))
	t <= TR(TD('Element', Class="right_text") + TD(est))
	t <= TR(TD('Weapon', Class="right_text") + TD(wst))
	t <= TR(TD('Character Search', Class="right_text") + TD(INPUT(Type='text', Id="keywords") + BUTTON('x', Id='clear_keywords')))

	doc['show_hide'] <= t + P("Note that all selections have to be true for a character to be visible.  Additionally the keyword search overrides all other filter settings so clear it to use them.")
Beispiel #3
0
def homePage():
    return group(
        DIV(Class=
            "container d-flex flex-column justify-content-center align-items-center",
            style={"height": "100vh"}),
        [
            H1("Breact: A python framework for single page webapps",
               Class="text-center"),
            P('''
            This app was coded in python in Breact. Look in the inspector, and you will see
            <br>
            <code>&lt;script src="text/python" &gt; </code>
        ''',
              Class="text-center"),

            # P('''
            #     Breact is similar to react,
            #     with components and state. The main difference, however, is that
            #     Breact doesn't have a virtual dom; instead, each stateful element
            #     (element that uses setState) is assigned a unique id and is retrieved
            #     and changed when necessary. Breact is very lightweight- the main base
            #     class file is at around 40 lines of code; but that's just because some parts of react;
            #     lifecycle methods, or stateful functional components, haven't been implemented yet.
            # ''', Class="text-center"),
            H3("Sample Apps:"),
            Link("/todo").render(
                BUTTON("Simple Todolist", Class="btn btn-primary m-2")),
            Link('/quiz').render(
                BUTTON("Small Quiz", Class="btn btn-primary m-2")),
            Link('/playground').render(
                BUTTON("A Little Playground", Class="btn btn-primary m-2")),
            Link('/router-playground').render(
                BUTTON("Router Playground", Class="btn btn-warning m-2"))
        ])
Beispiel #4
0
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))
Beispiel #5
0
def dump(obj):
    document <= P()

    table = TABLE()
    document <= table

    for x in sorted(dir(obj)):
        tr = TR()
        table <= tr
        tr <= TD(x)
        tr <= TD('???')
Beispiel #6
0
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
Beispiel #7
0
    def _go(self):
        body = S(D(D(H("Hello World", Class=t) +
                     P("My first website with " + B("Bulma"), Class=u),
                     Class=c),
                   Class=b),
                 Class=h + w + p) + S(D(
                     Class="tile is-ancestor has-text-centered",
                     Id="ancestor-tile"),
                                      Class="info-tiles")
        # ^^^ constrói a estrutura do corpo, onde 'ancestor-tile' é onde adiciona os ladrilhos

        document.body <= body  # instala os elementos estruturados no corpo do documento
        tiles = document[
            "ancestor-tile"]  # localiza os elemento onde coloca os ladrilhos
        dados = [("435k", "Usuários"), ("53k", "Produtos"),
                 ("735k", "Pedidos"), ("23", "Devoluções")]
        # ^^^ Pares (valor, legenda) que vão ser apresentados nos ladrilhos
        [
            tiles <= D(R(P(valor, Class=t) + P(legenda, Class=u),
                         Class="tile is-child box"),
                       Class="tile is-parent") for valor, legenda in dados
        ]
Beispiel #8
0
def barra_lateral():
    barraLateral = DIV(Class="barra-lateral")
    espacamento = DIV(Class="espacamento")
    mais = H1("Mais")
    palavra = P(
        "Se algum de vocês tem falta de sabedoria, peça-a a Deus, que a todos dá livremente, de boa vontade; e lhe será concedida. - Tiago 1:5"
    )
    img = IMG(src="img/psg7.jpg")
    espacamento <= mais
    espacamento <= palavra
    espacamento <= img
    barraLateral <= espacamento
    return barraLateral
Beispiel #9
0
 def __init__(self):
     DIV.__init__(self)  #, style={'max-width':'90px'})
     selTable = TABLE()
     self <= selTable
     self.inText = INPUT(Class="form-control")
     self.inText.bind('keyup', self.entrou)
     selTable <= TR(TD(P("Busca: ") + self.inText))  #,name="intext"))
     self.sel = SELECT(size=8,
                       Class='form-control')  # style={'max_width':'90px'})
     self.sel.bind('input', self.selec)
     selTable <= TR(TD(self.sel))
     self.sel.style.display = 'none'
     self.nutTab = MostraNut()
     self <= self.nutTab
Beispiel #10
0
def init_main():
	t = doc['Main']
	t.text = ''
	t <= P("This page is updated as you make changes on the Weights and Flags page and only shows non-zero weights and set flags.  Changes to weights here are also reflected on those pages.")
	table = TABLE()
	th = TR()
	th <= TH("Damage")
	th <= TH("Jewel Mod")
	table <= th
	for m in mjson[current_version]:
		if float(doc[m['name']].value):
			table <= TR(TD(f'<input type="number" data-id="{m["name"]}" value="{doc[m["name"]].value}" step="0.1", class="main_weight">') + TD(m['desc']))
	t <= table
	table = TABLE(TR(TH("Flag Group") + TH("Value")))
	flags = {}
	for elt in doc.get(selector='.flag_val'):
		temp = elt
		if temp.checked and temp['data-type'] != 'ignore':
			if temp['data-type'] not in flags:
				flags[temp['data-type']] = []
			flags[temp['data-type']].append(temp['data-id'])
	# Special section for charge counts
	charge_count = []
	for elt in [doc['PowerCount'], doc['FrenzyCount'], doc['EnduranceCount'], doc['ImpaleStacks']]:
		if int(elt.value):
			name = elt['id'][:-5] if elt['id'] != 'ImpaleStacks' else "Number of Impales on Target"
			charge_count.append(f"{name} ({elt.value})")
	if charge_count:
		flags['Misc Counts'] = charge_count
	for f in flags:
		table <= TR(TD(f) + TD(', '.join(flags[f])))
	t <= P("Summary of set flags.  Make changes on Flags page.") + table

	@bind('.main_weight', 'change')
	def update_weight(ev):
		tmp = ev.target
		doc[tmp['data-id']].value = tmp.value
Beispiel #11
0
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 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')
Beispiel #13
0
 def tile(self, valor, legenda):
     return P(valor, Class=t) + P(legenda, Class=u)
Beispiel #14
0
def init_change():
	doc['Changelog'] <= P('2021/10/24: 3.17 updates.  Support for new implicits.  Removed support for Scourge mods.')
	doc['Changelog'] <= P('2021/10/31: Disabled crafted mod support.  They are now a subset of explicit mods on the site for weighted searches')
	doc['Changelog'] <= P('2021/10/24: Added support for Scourge mods.')
	doc['Changelog'] <= P('2021/05/01: Seperated out Synth and Corrupted implicits.  Added options to exclude.')
	doc['Changelog'] <= P('2021/04/19: Updated mod wordings to match latest patch and added new mods.')
	doc['Changelog'] <= P('2021/04/19: Updated league list.')
	doc['Changelog'] <= P('2021/03/06: Added Culling Strike (v2 mods.json).  Note that culling dps assumes "perfect culls" at exactly 10% hp against non-healing targets, so actual damage gain will be less.')
	doc['Changelog'] <= P('2021/03/02: Bugfix: Some Precursor mods that can also appear on rares were restricted.')
	doc['Changelog'] <= P('2021/02/24: Implemented dozens of new mods including nearby resist(helmets) and aura effectiveness(weapons/corruptions).')
	doc['Changelog'] <= P('2021/02/22: Mods are now sorted for culling based on their total weights, not per point.')
	doc['Changelog'] <= P('2021/02/21: Updated UI and added support for array of weights in query string.')
	doc['Changelog'] <= P('2021/02/08: Battlemage added, pseudomods re-enabled. Please report any issues.')
def init_inventory():
	# Create a table of items we might need and store their ids in a lookup table
	# char xp, weapon xp, and mora
	t_own = TABLE(Class='borders center')
	t_own <= TR(TH(strings["item"]) + TH(strings["need"]) + TH(strings["have"]) + TH(strings["missing_"]))
	t_own <= TR(TD(IMG(src=f"img/wep_xp.png", alt=strings['wep_xp'], title=strings['wep_xp'], loading="lazy")) + TD('0', Id='wep_xp-total') + TD(INPUT(Type='number', min='0', step="1", value='0', Id='wep_xp-user', Class='save')) + TD('0', Id='wep_xp-need', Class='good'))
	t_own <= TR(TD(IMG(src=f"img/wep_xp_sub_1.png", alt=strings['wep_xp'], title=strings['wep_xp'], loading="lazy")) + TD() + TD(INPUT(Type='number', min='0', step="1", value='0', Id='wep_xp_sub_1-user', Class='save')) + TD())
	t_own <= TR(TD(IMG(src=f"img/wep_xp_sub_0.png", alt=strings['wep_xp'], title=strings['wep_xp'], loading="lazy")) + TD() + TD(INPUT(Type='number', min='0', step="1", value='0', Id='wep_xp_sub_0-user', Class='save')) + TD())
	t_own <= TR(TD(IMG(src=f"img/mora.png", alt=strings['mora'], title=strings['mora'], loading="lazy")) + TD('0', Id='mora-total') + TD(INPUT(Type='number', min='0', step="1", value='0', Id='mora-user', Class='save')) + TD('0', Id='mora-need', Class='good'))
	t_own <= TR(TD(IMG(src=f"img/xp.png", alt=strings['xp'], title=strings['xp'], loading="lazy")) + TD('0', Id='xp-total') + TD(INPUT(Type='number', min='0', step="1", value='0', Id='xp-user', Class='save')) + TD('0', Id='xp-need', Class='good'))
	t_own <= TR(TD(IMG(src=f"img/xp_sub_1.png", alt=strings['xp'], title=strings['xp'], loading="lazy")) + TD() + TD(INPUT(Type='number', min='0', step="1", value='0', Id='xp_sub_1-user', Class='save')) + TD())
	t_own <= TR(TD(IMG(src=f"img/xp_sub_0.png", alt=strings['xp'], title=strings['xp'], loading="lazy")) + TD() + TD(INPUT(Type='number', min='0', step="1", value='0', Id='xp_sub_0-user', Class='save')) + TD())
	doc['inventory'] <= P(strings['convert_notice']) + t_own

	width = 3
	alt_width = 2
	row = 0
	prev_section = "init"
	t_own = TABLE(Class='borders center spacer')
	t_head = TR()
	for c in range(width):
		t_head <= TH(strings["item"]) + TH(strings["need"]) + TH(strings["have"]) + TH(strings["missing_"])
		if c < width - 1:
			t_head <= TH(Class="spacer")
	c = 0
	t_own <= t_head
	t_row = TR(Class='tr_odd')
	lookup = {0: 14, 1: 9, 2: 4, 3: 0}
	for section, item in ingame_order:
		if section != prev_section:
			if c % width:
				if lookup[c]:
					t_row <= TD(colspan=lookup[c], Class='notvis')
				t_own <= t_row
				t_row = TR(Class='tr_odd' if row % 2 else 'tr_even')
				row += 1
				c = 0
			if prev_section != 'init':
				c = 0
				t_own <= TR(TD(colspan=14), Class='empty_row')
			prev_section = section
		if section in ['element_1', 'common', 'common_rare', 'wam', 'talent']:
			if section in ['element_1', 'wam']:
				if c:
					if lookup[c]:
						t_row <= TD(colspan=lookup[c], Class='notvis')
					t_own <= t_row
					t_row = TR(Class='tr_odd' if row % 2 else 'tr_even')
					row += 1
					c = 0
				t_width = alt_width
			else:
				t_width = width
			prev_section = 'end section'
			for i in range(len(strings[item])-1, -1, -1):
				t_td = TD(IMG(src=f"img/{item}_{i}.png", alt=strings[item][i], title=strings[item][i], loading="lazy")) + TD('0', Id=f"{item}_{i}-total") + TD(INPUT(Type='number', min='0', step="1", value='0', Id=f"{item}_{i}-user", Class='save')) + TD('0', Id=f"{item}_{i}-need")
				c += 1
				t_row <= t_td
				if not (c % t_width):
					if lookup[c]:
						t_row <= TD(colspan=lookup[c] if t_width == 3 else lookup[c] + 1, Class='notvis')
					t_own <= t_row
					t_row = TR(Class='tr_odd' if row % 2 else 'tr_even')
					c = 0
					row += 1
				elif c % width < width:
					t_row <= TD()
		else:  # section in ['boss', 'element_2', 'local', 'special']:
			t_td = TD(IMG(src=f"img/{item}.png", alt=strings[item], title=strings[item], loading="lazy")) + TD('0', Id=f"{item}-total") + TD(INPUT(Type='number', min='0', step="1", value='0', Id=f"{item}-user", Class='save')) + TD('0', Id=f"{item}-need")
			c += 1
			t_row <= t_td
			if not (c % width):
				if lookup[c]:
					t_row <= TD(colspan=lookup[c], Class='notvis')
				t_own <= t_row
				t_row = TR(Class='tr_odd' if row % 2 else 'tr_even')
				row += 1
				c = 0
			elif c % width < width:
				t_row <= TD()

	if c % width:
		if lookup[c]:
			t_row <= TD(colspan=lookup[c], Class='notvis')
		t_own <= t_row

	doc['inventory'] <= t_own

	b_reset = BUTTON(strings["reset_all_data"], Id='reset_all')
	doc["reset"] <= b_reset

	b_reset = BUTTON(strings["reset_character"], Id='reset_character')
	doc["reset"] <= b_reset

	b_reset = BUTTON(strings["reset_inventory"], Id='reset_inventory')
	doc["reset"] <= b_reset
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')
Beispiel #17
0
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")
Beispiel #18
0
 def on_object(self, obj):
     div = document['output']
     div <= P(repr(obj))
     print('%s => %r' % (type(obj).__name__, obj))
Beispiel #19
0
    '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
    container <= reviews
    for x, y in data['Reviews']:
Beispiel #20
0
 def topo(self):
     return H("Hello World", Class=t) + P(
         "My first website with " + B("Bulma"), Class=u)
Beispiel #21
0
def bprint(arg):
    """
    Print a thing into the document.
    """
    document <= P(arg)