Exemple #1
0
def input(ev):
    global user
    global chat
    global check
    global chat_rec
    if user:
        name = user
    else:
        name = 'Anonnymous'
    if checking_chat() is False and check is False:
        check = True
        if ev.target.value != '':
            print("bvbvbvbvv")
            text_chat = [name, ev.target.value, win.Date.now()]
            chat.append(text_chat)
            chat_rec = json.dumps(chat)
            storage['chat'] = chat_rec
            doc['controle'] <= html.B(name) + " : " + ev.target.value + html.BR()
            ev.target.value = ""
    else:
        if ev.target.value != '':
            doc['controle'] <= html.B(name) + " : " + ev.target.value + html.BR()
            print("zeazeazea")
            text_chat = [name, ev.target.value, win.Date.now()]
            ev.target.value = ""
            chat.append(text_chat)
            chat_rec = json.dumps(chat)
            storage['chat'] = chat_rec
    show_button()
    def setup(self, container):
        first = True
        for key, value in sorted(self.game.worlds.items(),
                                 key=lambda e: e[1].sortorder):
            world_container = html.DIV(Class="world-container" +
                                       (" world-container-enabled" if first
                                        else " world-container-hidden"),
                                       id="world-container_" + key)
            first = False
            resources = html.DIV(id="resources")

            resources <= html.B("Resources availible on " + value.name)
            resources <= html.HR()
            resources <= html.DIV(Class="currency-holder-holder")
            world_container <= resources
            buildings = html.DIV(id="buildings")
            buildings <= html.B("Buildings on " + value.name)
            buildings <= html.HR()
            buildings <= html.DIV(Class="building-holder-holder")
            world_container <= buildings
            world_container <= html.DIV(id="upgrades")
            vis = html.DIV(id="visualize")
            vis <= html.H1(key)
            vis <= html.IMG(src=value.image)
            world_container <= vis
            container["world-container-container"] <= world_container
Exemple #3
0
        def __init__(self):
            # Create a shadow root
            shadow = self.attachShadow({'mode': 'open'})

            # Insert the value of attribute "data-val" in bold italic
            # in the shadow root
            shadow <= html.B(html.I(self.attrs['data-val']))
def listEntryDelete(item : str, itemType : str) -> dialog.Dialog:
	d = dialog.Dialog("Confirm Deletion", ok_cancel = ("Yes", "No"), default_css = False)

	d.panel <= html.B(
		"Are you sure you want to delete the \"" + item + "\" " + itemType + "?"
	)
	
	return d
def levelSet() -> dialog.Dialog:
	d = dialog.Dialog("Set Character Level", ok_cancel = True, default_css = False)

	d.panel <= html.LABEL("Enter your new Character Level (1 -> 20):", For = "newCharLevel")
	d.panel <= html.INPUT(id = "newCharLevel", type = "number", min = 1, max = 20)
	d.panel <= html.BR()

	d.panel <= html.B(
		"Please note that changing your level will set your experience to the minimum required to match."
	)

	return d
Exemple #6
0
def checking_chat():
    global chat_rec
    global chat
    global check
    if "chat" not in storage:
        return False
    else:
        if check is False:
            chat_rec = storage['chat']
            chat_rec = json.loads(chat_rec)
            chat = chat_rec
            for x in chat_rec:
                doc['controle'] <= html.B(x[0]) + " : " + x[1] + html.BR()
            check = True
Exemple #7
0
 def create_root(self):
     root = html.DIV()
     root <= html.DIV(
         html.B(
             f"Replicator - Un Ennemi du peuple ({version})")) + html.BR()
     table = html.TABLE()
     table <= html.TR(
         html.TD("1. Sélectionner le personnage", Id="char_sel_panel_title")
         + html.TD("2. Sélectionner la scène", Id="scene_sel_panel_title"))
     table <= html.TR(
         html.TD(self.create_character_selection_panel(),
                 Id="char_sel_panel_td") + html.
         TD(self.create_scene_selection_panel(), Id="scene_sel_panel_td"))
     root <= table
     root <= html.HR()
     root <= html.DIV("3. Jouer", Id="start_game_panel_title")
     root <= html.DIV(self.create_start_game_panel(), Id="start_game_panel")
     return root
def experienceAdjust(method) -> dialog.Dialog:
	if method == "Edit":
		titleString = "Set Experience"
		labelString = "New Total Experience:"
	elif method == "Add":
		titleString = "Add Experience"
		labelString = "Amount of Experience to add:"
	
	d = dialog.Dialog(titleString, ok_cancel = True, default_css = False)

	d.panel <= html.LABEL(labelString, For = "xpAmount")
	d.panel <= html.INPUT(id = "xpAmount", type = "number", min = 0)

	if method == "Edit":
		d.panel <= html.BR()
		d.panel <= html.B(
			"Please note that changing your experience will set your character level to match."
		)

	return d
Exemple #9
0
# issue 1384
class A(html.DIV):
    def __init__(self, s):
        self.myattr = s


x = A("Andy")
assert x.myattr == "Andy"
del x.myattr
assert not hasattr(x, "myattr")
try:
    del x.attrs
    raise Exception("should have raised AttributeError")
except AttributeError:
    pass


class B(svg.line):
    def __init__(self, s):
        self.myattr = s


y = B("Didier")
assert y.myattr == "Didier"
del y.myattr
assert not hasattr(y, "myattr")

# chained insertions
html.P() <= html.B() <= html.I("coucou")
Exemple #10
0
pages = [ws.NotebookPage("Introduction", "powderblue", tabwidth="12%", id="intro")]
for i in range(1,8):
    rgb1, rgb2 = ws.hwbtorgb(60+i*180,0.5,0)[1], ws.hwbtorgb(60+i*180,0.4,0.1)[1]
    pages.append(DemoPage("Demo "+str(i), "rgb({},{},{})".format(*rgb1), tabwidth=None, id="demo"+str(i)))
    pages.append(ws.NotebookPage("Code "+str(i), "rgb({},{},{})".format(*rgb2), html.TEXTAREA(open("demo"+str(i)+".py").read()), tabwidth=None, id="code"+str(i)))
document.select("body")[0].innerHTML = ""
document <= (notebook := ws.Notebook(pages))
pageheight = f"calc(95vh - {notebook.tabrow.offsetHeight}px)"
for page in pages: page.style.height = pageheight

introtext = html.DIV([
html.H1("BrySVG DEMO"),
html.P("""The other tabs on this page provide a series of short demos showing the capabilities of the BrySVG module.
For each demo there is also a tab showing the code needed to create it.  A brief description of each demo follows:"""),
html.P(html.B("Demo 1")+""" - This illustrates MouseMode.PAN: drag the canvas to move the viewport."""+html.BR()+
"""It also shows how to create most of the SVG objects:
CanvasObject, PolylineObject, PolygonObject, RectangleObject, EllipseObject, CircleObject, BezierObject,
ClosedBezierObject, SmoothBezierObject, SmoothClosedBezierObject, TextObject, WrappingTextObject"""+html.BR()+
"""and the use of the CanvasObject methods rotateElement and translateElement.
(The same set of objects is also used in Demo2 and Demo 6.)"""),
html.P(html.B("Demo 2")+""" - This is the famous Tangram puzzle, which demonstrates MouseMode.DRAG and canvas.vertexSnap.
Drag a piece onto the square. If a vertex of the piece is close to a vertex of the square, the piece will "snap"
so that the vertices match. To complete the puzzle, fill the square completely with the pieces."""),
html.P(html.B("Demo 3")+""" - This demonstrates MouseMode.TRANSFORM. Objects can be dragged around on the canvas.
In addition, clicking on an object shows a bounding box and a number of handles which can be used to transform the shape:
top-left: rotate; middle-right: stretch horizontally; bottom-middle: stretch vertically; bottom-right: enlarge"""),
html.P(html.B("Demo 4")+""" - This demonstrates canvas.edgeSnap, and also how to create RegularPolygons.
Drag the polygons around, matching edges as closely as possible. If the angle between the edges is not too great,
the dragged polygon should rotate so that the edges coincide. Polygons can also be rotated by hand."""),
html.P(html.B("Demo 5")+""" - This demonstrates ImageButtons, MouseMode.DRAW, and MouseMode.EDIT. Choose a type of shape.
Exemple #11
0
from browser import html

doc <= html.B("Brython") + "將會用來取代 "
doc <= html.A("Python", href="http://www.python.org") + " 作為網際程式語言!"