示例#1
0
    def update(self, one_state_change=False):
        if self.state["question"] >= len(QUIZ_CONTENT):
            print("Reached!")
            app = group(DIV(Class="m-3"), [
                H1(f"Correct: {self.state['correct']}"),
                H1(f"Wrong: {self.state['wrong']}"), reset := BUTTON(
                    "reset", Class="btn btn-danger")
            ])

            @bind(reset, "click")
示例#2
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.")
示例#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"))
        ])
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')
示例#5
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
示例#6
0
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
示例#7
0
    def render(self):
        txt = TxtManager()
        todo = List()
        app = group(
            DIV(Class="container d-flex flex-column justify-content-center"),
            group(DIV(Class="container-sm m-3"), [
                DIV(style={"margin": "10px"}),
                txt.render(),
                H1("Todo List With Breact"),
                DIV(style={"margin": "10px"}),
                todo.render(),
                group(DIV(Class="row"), [
                    group(DIV(Class="col-sm form-group"), [
                        LABEL("Enter Title", to="inputt", Class="form-label"),
                        title := INPUT(
                            id="inputt", type="text", Class="form-control"),
                    ]),
                    description := group(DIV(Class="col-sm form-group"), [
                        LABEL("Enter Description",
                              to="inputts",
                              Class="form-label"),
                        TEXTAREA(
                            id="inputts", type="text", Class="form-control")
                    ]),
                ]), btn := BUTTON("Submit please",
                                  Class="btn btn-primary m-2"),
                DIV(style={"margin": "40px"})
            ]))

        @bind(title, "keyup")
        def updateTitle(e):
            txt.setState({"title": e.target.value})

        @bind(description, "keyup")
        def updateDesc(e):
            txt.setState({"description": e.target.value})

        @bind(btn, "click")
        def submit(e):
            submission = {
                "title": txt.state["title"],
                "description": txt.state["description"]
            }
            todo.state["items"].append(submission)
            todo.setState({"items": todo.state["items"]})

        return app


# document["root"] <= Main().render()
示例#8
0
            return app

        elementOn = QUIZ_CONTENT[self.state["question"]]
        options = elementOn['options']
        question = elementOn['question']
        ans = elementOn['answer']

        def correctWrong():
            if "prev" in self.state:
                if self.state["prev"] == True:
                    return H3("Your answer is correct", Class="text-success")
                return H3("Your answer was wrong", Class="text-danger")
            return DIV()

        app = group(DIV(Class="container", style={"minWidth": "60vw"}), [
            H1(question + ":"),
            correctWrong(),
            group(DIV(Class="container"), [
                group(DIV(Class="row"), [
                    option1 := BUTTON(options[0],
                                      Class="col-sm btn btn-danger m-2"),
                    option2 := BUTTON(options[1],
                                      Class="col-sm btn btn-info m-2"),
                ]),
                group(DIV(Class="row"), [
                    option3 := BUTTON(options[2],
                                      Class="col-sm btn btn-warning m-2"),
                    option4 := BUTTON(options[3],
                                      Class="col-sm btn btn-success m-2"),
                ])
            ])
示例#9
0
def cabecalho():
    variavel = 10
    document <= H1('Página escrita em Brython')
示例#10
0
def parte_de_baixo():
    document <= H1('Parte de baixo')
示例#11
0
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))
示例#12
0
            # 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"))
        ])


document <= Router(
    {
        "/": homePage,
        "/quiz": Main().render,
        "/todo": TodoMain().render,
        "/playground": WithGroups().render,
        "/router-playground": RouterTestPage
    }, lambda: H1("An error occurred")).render()

"""welcome page with two buttons  login and register"""
div1 = DIV(id="welcome")
button1 = BUTTON("Register", id="but_register")
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")