Example #1
0
    def __init__(self, view="hHh lpR fff", **kwargs):
        super().__init__(view=view, **kwargs)
        header = jp.QHeader(a=self)
        toolbar = jp.QToolbar(a=header)

        drawer = jp.QDrawer(a=self,
                            show_if_above=True,
                            v_mode="left",
                            bordered=True)
        scroller = jp.QScrollArea(a=drawer, classes="fit")
        qlist = jp.QList(a=scroller)
        a_classes = "p-2 m-2 text-lg text-blue-400 hover:text-blue-700"
        jp.A(a=qlist, text="Home", href="/", classes=a_classes)
        jp.Br(a=qlist)
        jp.A(a=qlist, text="Dictionary", href="/dictionary", classes=a_classes)
        jp.Br(a=qlist)
        jp.A(a=qlist, text="About", href="/about", classes=a_classes)
        jp.Br(a=qlist)

        jp.QBtn(a=toolbar,
                dense=True,
                flat=True,
                round=True,
                icon="menu",
                click=self.move_drawer,
                drawer=drawer)
        jp.QToolbarTitle(a=toolbar, text="Instant Dictionary")
Example #2
0
    def __init__(self, **kwargs):
        super().__init__(**kwargs)

        # layout = jp.QLayout(a=self, view="hHh lpR fFf")
        header = jp.QHeader(a=self, elevated=True)
        # header.on("class", "bg-primary text-white")
        toolbar = jp.QToolbar(a=header)
        q_drawer = jp.QDrawer(a=self,
                              show_if_above=True,
                              v_model="left",
                              side="left",
                              bordered=True)

        scroll_area = jp.QScrollArea(a=q_drawer, classes="fit")
        drawer_list = jp.QList(a=scroll_area)
        list_classes = "p-2 m-2 text-lg text-blue-400 hover:text-blue-700"
        jp.A(a=drawer_list, text="Home", href="/", classes=list_classes)
        jp.Br(a=drawer_list)
        jp.A(a=drawer_list,
             text="Dictionary",
             href="/dictionary",
             classes=list_classes)
        jp.Br(a=drawer_list)
        jp.A(a=drawer_list, text="About", href="/about", classes=list_classes)
        jp.Br(a=drawer_list)

        jp.QBtn(a=toolbar,
                dense=True,
                flat=True,
                icon="menu",
                click=self.move_drawer,
                drawer=q_drawer)
        # q_button.on("round", True)
        jp.QToolbarTitle(a=toolbar, text="Instant Dictionary")
Example #3
0
def index():
    wp = jp.WebPage()
    ymd = datetime.date.today().strftime("%Y%m%d")
    for media_id in media_list:
        d = jp.Div(a=wp, classes='flex bg-blue-200 text-lg p-2 m-2')
        jp.A(text=media_list[media_id], href=f'/news/{media_id}/{ymd}', a=d)
    return wp
Example #4
0
async def news(request):
    media_id = request.path_params.get('media_id', '009')
    ymd = request.path_params.get('ymd', '20200101')

    wp = jp.WebPage()
    head = jp.Div(a=wp, classes='text-lg')
    jp.A(text='Home', href='/', a=head, classes='p-2 bg-green-200')
    jp.Span(text=media_list[media_id], a=head, classes='m-2 p-2 bg-blue-200')
    jp.A(text='<', href=f'/news/{media_id}/{get_next_ymd(ymd, -1)}', a=head, classes='p-2 bg-red-200')
    jp.Span(text=ymd, a=head, classes='p-2 bg-red-100')
    jp.A(text='>', href=f'/news/{media_id}/{get_next_ymd(ymd, 1)}', a=head, classes='p-2 bg-red-200')
    articles = get_article_list(media_id, ymd)

    for article in articles:
        div = jp.Div(a=wp, classes='flex bg-gray-200 p-1 m-1 text-lg')
        jp.A(text=article['title'], href=article['link'], a=div)

    return wp
    def __init__(self, view="hHh lpR fFf", **kwargs):
        super().__init__(view=view, **kwargs)

        header = jp.QHeader(a=self)
        toolbar = jp.QToolbar(a=header, classes="bg-purple-700")

        drawer = jp.QDrawer(a=self, show_if_above=True, v_mode='left', bordered=True)
        scroller = jp.QScrollArea(a=drawer, classes="fit")
        qlist = jp.QList(a=scroller)
        a_class = "p-2 m-2 text-lg text-purple-400 hover:text-purple-700"
        jp.A(a=qlist, text="Home", href="/", classes=a_class)
        jp.Br(a=qlist)
        jp.A(a=qlist, text="Dictionary", href="/dictionary", classes=a_class)
        jp.Br(a=qlist)
        jp.A(a=qlist, text="About", href="/about", classes=a_class)
        jp.Br(a=qlist)
        jp.A(a=qlist, text="Flat Mate Bill", href="/fmb", classes=a_class)
        jp.Br(a=qlist)

        jp.QBtn(a=toolbar, dense=True, flat=True, round=True, icon="menu",
                click=self.move_drawer, drawer=drawer)
        jp.QToolbarTitle(a=toolbar, text='OOP course modules')
Example #6
0
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     c1 = self
     c1.classes = 'bg-grey-3'
     c2 = jp.QBtn(flat=True, round=True, dense=True, a=c1)
     c3 = jp.QIcon(name='menu', a=c2)
     c4 = jp.QMenu(a=c2)
     c5 = jp.QList(style='min-width: 100px', a=c4)
     c6 = jp.QItem(clickable=True, v_close_popup=True, a=c5)
     c7 = jp.QItemSection(a=c6)
     c8 = jp.A(href='/about',
               style='text-decoration: none',
               a=c7,
               text='about')
     c9 = jp.QSeparator(a=c5)
     c10 = jp.QItem(clickable=True, v_close_popup=True, a=c5)
     c11 = jp.QItemSection(a=c10)
     c12 = jp.A(href='/tool',
                style='text-decoration: none',
                a=c11,
                text='help')
     c13 = jp.QToolBarTitle(a=c1, text='Toolbar')
     c14 = jp.QBtn(flat=True, round=True, dense=True, a=c1)
     c15 = jp.QIcon(name='more_vert', a=c14)
Example #7
0
async def page():
    wp = jp.WebPage()
    wp.head_html = "<link href='https://afeld.github.io/emoji-css/emoji.css' rel='stylesheet'></link>"
    root = jp.Div(a=wp)
    body = jp.Div(
        classes='bg-gray-400 font-sans leading-normal tracking-normal', a=root)
    c2 = jp.Nav(classes='bg-gray-800 p-2 mt-0 w-full', a=body)
    c3 = jp.Div(
        classes='container mx-auto flex flex-wrap items-center', a=c2)
    c4 = jp.Div(
        classes='flex w-full md:w-1/2 justify-center md:justify-start text-white font-extrabold', a=c3)
    logo_link = jp.A(
        classes='text-white no-underline hover:text-white hover:no-underline', href='#', a=c4)
    logo_cont = jp.Span(classes='flex text-2xl pl-2', a=logo_link)
    logo = jp.I(classes='em em-email my-auto', a=logo_cont)
    title = jp.Div(classes="p-2", text="Spam Detector", a=logo_cont)
    cont_main = jp.Div(
        classes='container mx-auto flex flex-col md:flex-row items-center my-6 md:my-12', a=body)
    cont_left = jp.Div(
        classes='flex flex-col w-full lg:w-1/2 justify-center items-start pt-12 pb-24 px-6', a=cont_main)
    tagline = jp.P(classes='uppercase tracking-loose',
                   a=cont_left, text='Version: 1.0')
    main_title = jp.H1(classes='font-bold text-3xl my-4',
                       a=cont_left, text='Spam Detector')
    description = jp.P(classes='leading-normal mb-4', a=cont_left,
                       text='Keep the bad guys out! Enter the text of your email below and the Spam Detector will tell you how likely it\'s contents is spam:')
    text_in = jp.Textarea(classes='w-full border-2 h-32',
                          placeholder='Please type here', a=cont_left)
    text_in.div = jp.Div(a=cont_left)
    text_in.on('input', predict)
    cont_right = jp.Div(
        classes='w-full lg:w-1/2 lg:py-6 text-center', a=cont_main)
    mailbox = jp.I(
        classes='text-6xl w-3/5 mx-auto em-svg em-mailbox_with_mail', viewBox='0 0 20 20', a=cont_right)
    footer = jp.Div(classes='bg-white h-1', a=body)
    footer_cont = jp.Div(
        classes='container mx-auto pt-12 md:pt-6 px-6', a=footer)
    footer_text_cont = jp.P(classes='py-4', a=footer_cont)
    love = jp.I(classes='em em-hearts', a=footer_text_cont)
    data = jp.I(classes='em em-bar_chart', a=footer_text_cont)
    science = jp.I(classes='em em-test_tube', a=footer_text_cont)

    return wp
def link_demo_bookmark():
    wp = jp.WebPage()
    link = jp.A(
        text="Scroll to target",
        a=wp,
        classes="inline-block m-2 p-2 text-xl text-white bg-blue-500 hover:bg-blue-700",
    )
    # jp.Br(a=wp)
    for i in range(50):
        jp.P(text=f"{i+1} Not a target", classes="m-1 p-1 text-white bg-blue-300", a=wp)
    target = jp.Link(
        text=f"This is the target - it is linked to first link, click to jump there",
        classes="inline-block m-1 p-1 text-white bg-red-500",
        a=wp,
    )
    link.bookmark = target
    link.scroll = True
    target.bookmark = link
    target.scroll = True
    for i in range(50):
        jp.P(
            text=f"{i+50} Not a target", classes="m-1 p-1 text-white bg-blue-300", a=wp
        )
    return wp
logging.basicConfig(level=logging.WARN)

## Description of elements styles attributes.
bbox_style = 'm-2 p-2 h-132 text-xl border-2 background-gray-300 text-white'
inbox_style = "flex m-1 h-6 sm:h-8 lg:h-6 text-base sm:text-xl lg:text-sm bg-gray-200  w-full font-mono font-bold border-2 border-gray-200 rounded px-2 text-gray-700 focus:outline-none focus:bg-white focus:border-purple-500"
boton_style = "p-4 font-bold text-black bg-gray-500 border-2 border-gray  hover:bg-blue-300 rounded"
message_classes = 'ml-4 p-2 text-lg text-white overflow-auto font-mono rounded-lg'
label_item_clas = inbox_style.rsplit('bg-')[0]  # re-use of inbox style classes
cell_style = 'flex-col p-2 flex-grow-0  flex-shrink-0'

logo_url = 'http://vfx-sup.com/wp-content/uploads/2017/05/CucardaVFXsup_fdoNegro-e1495057122527.png'  # "http://vfx-sup.com/wp-content/uploads/2017/05/CucardaVFXsup-150x150.png"

head_div = jp.Div(classes='m-2 flex border border-gray-800 overflow-auto',
                  delete_flag=False)
logolink = jp.A(href='http://vfx-sup.com', target='_blank')  #
logo = jp.Img(a=logolink,
              src=logo_url,
              classes="m-2 box-border object-left object-contain h-10"
              )  #TO-DO agregar link y un about a la main page .
info_link_box = jp.Div(classes='justify-end')
info_link = jp.A(
    a=info_link_box,
    text='Info adicional',
    href='http://vfx-sup.com',
    title='InformaciĆ³n del autor y de uso',
    classes=
    'text-gray-800 align-middle text-xs text-right font-style: italic justify-end px-8'
)  # , target='_blank' invisible bg-gray-900 border-2 border-gray-700
title_to_show = jp.P(text="Calculador de jornadas de filmaciĆ³n",
                     classes='m-4 text-xl font-bold text-white overflow-auto')