コード例 #1
0
 def input_change(self, event):
     dout = document['searchresult']
     dout.clear()
     text = event.target.value
     if len(text) <= 1:
         return
     else:
         result = [udf for udf in self.udf_list if text.lower() in udf.lower()]
         if result:
             for udf in result:
                 dout <= A(udf, href=f'#{udf}')
                 dout <= BR()
         else:
             dout <= B('No match')
コード例 #2
0
ファイル: main.py プロジェクト: kwarwp/patricia
    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
        ]
コード例 #3
0
ファイル: main.py プロジェクト: kwarwp/patricia
 def topo(self):
     return H("Hello World", Class=t) + P(
         "My first website with " + B("Bulma"), Class=u)
コード例 #4
0
def menu(title, links):
    # links is a list of tuples (name,href)
    res = B(title)
    for _name, href in links:
        res += BR() + A(_name, href=href)
    return res
コード例 #5
0
 def create_table(self):
     dindex.style.display = 'none'
     dtop.clear()
     doutput.clear()
     section = self.get_section()
     aoa = section.aoa
     #
     document.title = f'{get_protocol_name()} {section.name}'
     dtop <= SPAN(self.release)
     dtop <= SPAN(A('Index', href='#'))
     #
     b = BUTTON('copy tree')
     b.bind('click', ready.copy_tree)
     dtop <= SPAN(b)
     #
     b = BUTTON('export xlsx')
     b.bind('click', self.export_xlsx)
     dtop <= SPAN(b)
     #
     b = BUTTON('table view')
     b.bind('click', self.change_view)
     dtop <= SPAN(b)
     #
     b = BUTTON('Popup On')
     b.bind('click', ready.button_popup)
     dtop <= SPAN(b)
     b.style.backgroundColor = 'lightgreen'
     #
     dtop <= SPAN(f'{section.id} {section.name}')
     self.create_prev_next()
     #
     table = TABLE(Class='asn1tree', tview='tree', core='')
     head = [
         "", "", 'IE', 'Need', 'Refer', 'Type', 'Description', 'Crit',
         'Assign'
     ]
     table <= TR([TD(B(v)) for v in head])
     table.rows[0].cells[6].className = 'desc'
     #
     for row in aoa:
         flag, level, ie, need, udf, vrange, desc, crit, assign = row
         pad, ie = get_pad_and_ie(ie)
         tr = TR()
         tr <= TD(flag, Class='flag')
         tr <= TD(level)
         hasdesc = 'hasdesc' if desc else ''
         tr <= TD(
             SPAN(pad,
                  Class='iepad',
                  treepad=pad,
                  tablepad='>' * level + ' ') +
             SPAN(ie, Class='ie', desc=hasdesc))
         tr <= TD(need)
         if udf:
             tr <= TD(A(udf, href=f'#{udf}'))
         else:
             tr <= TD()
         tr <= TD(vrange, Class='vrange')
         tr <= TD(desc, Class='desc')
         tr <= TD(crit)
         tr <= TD(assign)
         table <= tr
     for tr in table.rows:
         tr <= TD(tr.rowIndex)
     doutput <= table
     ready.ready_table(table)
コード例 #6
0
 def creat_head_row(self, table):
     head = ["", "", 'IE', 'Need', 'Define', 'Range', 'Description', '']
     table <= TR([TD(B(v)) for v in head])
     table.rows[0].cells[3].title = need_str
     table.rows[0].cells[3].style.color = 'blue'
     table.rows[0].cells[6].className = 'desc'
コード例 #7
0
                (" 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']:
        revi2 = DIV(
            B(x, Class="a-ReviewsBlock_Reviewer") +
            SPAN(str(y) + ' % ', Class="a-ReviewsBlock_Score"))
        container <= revi2

    divaver = DIV("Average user rating:", Class="a-UserRating")