예제 #1
0
    def __init__(self, todos, filter):
        count = len([todo for todo in todos if not todo.completed])
        item_text = 'item' if count == 1 else 'items'

        super().__init__(
            [
                H.SPAN(
                    [
                        H.STRONG(count),
                        ' {} left'.format(item_text),
                    ],
                    Class='todo-count',
                ),
                H.UL(
                    [
                        H.LI(
                            FilterLink('All',
                                       filter=ALL_FILTER,
                                       current_filter=filter), ),
                        H.LI(
                            FilterLink('Active',
                                       filter=ACTIVE_FILTER,
                                       current_filter=filter), ),
                        H.LI(
                            FilterLink('Completed',
                                       filter=COMPLETED_FILTER,
                                       current_filter=filter), ),
                    ],
                    Class='filters',
                ),
                ClearCompletedButton(todos),
            ],
            Class='footer',
            style={'display': 'block' if len(todos) else 'none'},
        )
예제 #2
0
    def __init__(self, container=None, parent=None):
        self.container = container
        self.parent = parent
        self.panel = html.UL(style=st1)
        self.container <= self.panel

        document.bind("click", self.hide_menus)
예제 #3
0
 def display_item(item):
     # Display the item as a list with one criterion and value
     # per list item. Highlight the criteria value that differ
     # between the two options.
     return H.UL([
          H.LI([T(name + ': '),
              (T(value) if a[i] == b[i] else H.STRONG(T(value)))])
          for i, (name, value)
          in enumerate(zip(criterion_names, item))])
예제 #4
0
    def __init__(self, title, returnaction=None, extlist=[], id=None):
        DialogBox.__init__(self, title, returnaction, id=id)
        self.path = None
        self.extlist = extlist

        self.fileinput = html.INPUT(id="fileinput")
        self <= self.fileinput
        self.filelistbox = html.UL(id="filelistbox")
        self <= self.filelistbox
예제 #5
0
    async def asker(a, b):
        # Present the choices as a list with buttons.

        global n_questions
        n_questions += 1

        buttons = {}
        def button(the_id, text):
            buttons[the_id] = lambda _: signal('choice', the_id)
            return H.BUTTON(T(text), id = the_id)

        def display_item(item):
            # Display the item as a list with one criterion and value
            # per list item. Highlight the criteria value that differ
            # between the two options.
            return H.UL([
                 H.LI([T(name + ': '),
                     (T(value) if a[i] == b[i] else H.STRONG(T(value)))])
                 for i, (name, value)
                 in enumerate(zip(criterion_names, item))])

        document['dm'] <= H.DIV(
            [H.P(T('Q{}: Which would you prefer?'.format(n_questions))), H.UL([
                H.LI([button('option_a', 'Option A'),
                    display_item(a)]),
                H.LI([button('option_b', 'Option B'),
                    display_item(b)]),
                H.LI([button('equal', 'Equal'),
                    T('The two options are equally preferable')])])],
            Class = 'query')

        for button, callback in buttons.items():
            document[button].bind('click', callback)

        # Wait for the user to click a button.
        choice = await get_signal('choice')
        if choice == 'quit':
            raise Quit()

        # Replace the buttons with indicators of the user's decision.
        for button in buttons:
            document[button].replaceWith(H.SPAN(
               T('your choice' if button == choice else 'not chosen'),
               Class = 'chosen' if button == choice else 'not-chosen'))

        # Return the choice.
        return dict(option_a = GT, option_b = LT, equal = EQ)[choice]
예제 #6
0
def employee_list():
    global response
    try:
        response = urllib.request.urlopen("http://127.0.0.1:8001/employee/default/liste_employee.json")
        response = response.read()
        response = json.loads(response)
        li = html.UL(id="id01", Class="w3-ul w3-card-4")
        for x in response['employee']:
            ul = html.LI(Class="w3-bar",style={'display': "none"})
            img = html.IMG(Class="w3-bar-item w3-circle",
                           src="img/img_avatar2.png",
                           style={"width":"85px"})
            divbar = html.DIV(Class="w3-bar-item")
            a = html.A(x['full_name'],id=str(x['id']),
                       href="#employee" + str(x['id']))
            divbar <=a
            ul <= img + divbar
            li <= ul
        return li
    except:
        return html.DIV("We're sorry, server is busy",
                        Class="w3-center w3-xxlarge w3-text-blue")
예제 #7
0
    def render(self):
        app = group(html.DIV(), [
            html.H1("HI THERE!"),
            html.H2("GOOD TO SEE YOU!"),
            html.P("Some things about me:"),
            html.UL([html.LI("I am"),
                     html.LI("Does this work")]),
            html.H2("here is a nice little ticker"),
            TickerWithDescription().render(),
            TextField("here is a prop being passed").render()
        ])
        return app


# app = html.DIV(id="hithere")

# # app <= html.H1("hi there", id="what")
# thing = group(app, [WithGroups().render()])
# # thing = app
# document["root"] <= thing
# thid = document["hithere"]
# thid.innerHTML = "hedy"
# print(document.getElementById("hithere").innerHTML)
# document["what"] <= html.H1("buy")
예제 #8
0
def detail_employee(ev):
    global response
    if response is not None:
        test = eval(ev.target.id)
        if isinstance(test, int):
            div = html.DIV(Class="w3-animate-left")
            div1 = html.DIV(Class="w3-border-bottom w3-bar w3-animate-left")
            i = html.I(Class="fa fa-angle-left w3-xxxlarge w3-text-cyan", id="back1")
            a = html.A(Class="w3-bar-item",id="back", style={"width": "10%"})
            a <= i
            h1 =  html.H1("Employee Details",
                      Class="w3-wide w3-myfont w3-xlarge w3-bar-item w3-center",
                      style={"width": "90%"})
            div1 <= a + h1
            for x in response['employee']:
                ul = html.UL(Class="w3-ul w3-border w3-animate-left")
                if x['id'] == int(ev.target.id):
                    li = html.LI(Class="w3-bar")
                    img = html.IMG(Class="w3-bar-item w3-circle",
                           src="img/img_avatar2.png", style={"width":"85px"})
                    #first li
                    div2 = html.DIV(Class="w3-bar-item")
                    span1 = html.SPAN(x['full_name']) + html.BR()
                    span2 = html.SPAN(x['job'])
                    div2 <= span1 + span2
                    li <= img + div2
                    #second li
                    li2=  html.LI(Class="w3-bar w3-button w3-hover-cyan",id="office")
                    div3 = html.DIV(Class="w3-bar-item")
                    span3 = html.SPAN("Call Office") + html.BR()
                    span4 = html.SPAN("781-000-002")
                    a1 = html.A(href="tel:781-000-002",id="number" ,style={"display":"none"})
                    span = html.SPAN(html.I(Class="fa fa-angle-right w3-xxlarge"),
                                 Class="w3-right w3-bar-item")
                    div3 <= span3 + span4 + a1
                    li2 <= span + div3
                    #third li
                    li3 = html.LI(Class="w3-bar w3-button w3-hover-cyan", id="call")
                    div4 = html.DIV(Class="w3-bar-item")
                    span5 = html.SPAN("Call Mobile") + html.BR()
                    span6 = html.SPAN("615-000-002", href="tel:615-000-002")
                    a2 = html.A(href="tel:615-000-002",id="mobile" ,style={"display":"none"} )
                    spanbis = html.SPAN(html.I(Class="fa fa-angle-right w3-xxlarge"),
                                 Class="w3-right w3-bar-item")
                    div4 <= span5 + span6 + a2
                    li3 <= spanbis + div4
                    # fourth li
                    li4 = html.LI(Class="w3-bar w3-button w3-hover-cyan", id="sms")
                    div5 = html.DIV(Class="w3-bar-item")
                    span7 = html.SPAN("Number Sms") + html.BR()
                    span8 = html.SPAN("615-000-002", href="tel:615-000-002")
                    a3 = html.A(href="sms:615-000-002", id="sendsms", style={"display": "none"})
                    spanbis1 = html.SPAN(html.I(Class="fa fa-angle-right w3-xxlarge"),
                                 Class="w3-right w3-bar-item")
                    div5 <= span7 + span8 + a3
                    li4 <= spanbis1 + div5
                    #five li
                    li5 = html.LI(Class="w3-bar w3-button w3-hover-cyan", id="email")
                    div6 = html.DIV(Class="w3-bar-item")
                    span9 = html.SPAN("Email Professional") + html.BR()
                    span10 = html.SPAN("*****@*****.**",href="mailto:[email protected]")
                    a4 = html.A(href="mailto:[email protected]", id="sendemail",style={"display": "none"})
                    spanbis1 = html.SPAN(html.I(Class="fa fa-angle-right w3-xxlarge"),
                                     Class="w3-right w3-bar-item")
                    div6 <= span9 + span10 + a4
                    li5 <= spanbis1  + div6
                    #end
                    ul <= li + li2 + li3 + li4 +li5
                    retail <= div1 + html.BR() + ul
                    doc['detail'].bind("click", direction)
                    return  retail
예제 #9
0
from browser import document, html
from scripts.links import anchor_in_list

lista_exercicios = html.UL()
for n in range(1, 11):
    lista_exercicios <= anchor_in_list(f'Exercício {n}',
                                       f'exercicio_0{n}.html')

lista_aulas = html.UL()
for n in range(3, 10):
    lista_aulas <= anchor_in_list(f'Aula {n}', f'aula_0{n}.html')

document['aside'] <= html.H1('Lista de Aulas')
document['aside'] <= lista_aulas

document['main'] <= html.H1('Lista de exercícios')
document['main'] <= lista_exercicios
예제 #10
0
# Toggle the class
button = html.BUTTON("Toggle Largess")

button.bind('click', lambda e: main.classList.toggle("huge"))

main <= button

# My favorite things
favorites = [
    "Programming",
    "Sweets",
    "Westworld",
]

ul = html.UL([html.LI(fav) for fav in favorites])

main <= ul

# Canvas
import math

canvas = html.CANVAS(width=200, height=200)
canvas.style = dict(border="10px black", backgroundColor="white")
ctx = canvas.getContext("2d")
draw_button = html.BUTTON("Draw a circle")

x = 50


@draw_button.bind("click")
예제 #11
0
from browser import document, html
from scripts.links import anchor_in_list

lista_aulas = html.UL()
for n in range(3, 10):
    if n not in [8]:
        lista_aulas <= anchor_in_list(f'Aula {n}', f'aula_0{n}.html')

document['aside'] <= html.H1('Páginas das aulas')
document['aside'] <= lista_aulas
paginas_praticar = html.UL()

document['aside'] <= html.H1('Páginas para praticar')
paginas_praticar <= anchor_in_list('Caixinha', 'caixinha.html')
paginas_praticar <= anchor_in_list('Teclado', 'keyboard.html')
paginas_praticar <= anchor_in_list('Logger', 'logger.html')
paginas_praticar <= anchor_in_list('Drag n Drop', 'drag.html')
paginas_praticar <= anchor_in_list('TODO list', 'todo_list.html')
document['aside'] <= paginas_praticar

lista_explicacoes = html.UL()
document['aside'] <= html.H1('Páginas de explicação')
lista_explicacoes <= anchor_in_list('Aula 4a', 'aula_04_a.html')
lista_explicacoes <= anchor_in_list('Aula 4b', 'aula_04_b.html')
lista_explicacoes <= anchor_in_list('Aula 5a', 'aula_05_a.html')
lista_explicacoes <= anchor_in_list('Aula 5b', 'aula_05_b.html')
lista_explicacoes <= anchor_in_list('Aula 5c', 'aula_05_c.html')
lista_explicacoes <= anchor_in_list('Aula 6a', 'aula_06_a.html')
lista_explicacoes <= anchor_in_list('Aula 7a', 'aula_07_a.html')
lista_explicacoes <= anchor_in_list('Aula 7b', 'aula_07_b.html')
lista_explicacoes <= anchor_in_list('Aula 7c', 'aula_07_c.html')