Пример #1
0
def thumbnail_render():
    img_url = "static/img/default.png"
    if this.state.img:
        img_url = this.state.img
    fluid = True
    if this.props.fluid != js_undefined:
        fluid = this.props.fluid

    if this.props.size:
        fluid = False  # can't be defined together

    return h(
        "div", e(ui.Loader, active=this.state.loading, inverted=True),
        e(ui.Image,
          src=img_url,
          fluid=fluid,
          size=this.props.size,
          disabled=this.props.disabled,
          centered=this.props.centered,
          bordered=this.props.bordered,
          avatar=this.props.avatar,
          dimmer=this.props.dimmer,
          height=this.props.height,
          as_=this.props.as_,
          hidden=this.props.hidden,
          shape=this.props.shape,
          spaced=this.props.spaced,
          ui=this.props.ui,
          verticalAlign=this.props.verticalAlign,
          width=this.props.width))
Пример #2
0
def grouping_render():
    title = ""
    fav = 0
    item_id = this.state.id
    if this.state.data:
        title = this.state.data.js_name
        if not item_id:
            item_id = this.state.data.id

    artists = []
    for a in this.state.artists:
        if len(a.names) > 0:
            artists.append(a.names[0].js_name)
    artist_el = [h("span", x) for x in artists]

    return e(
        ui.Segment,
        e(
            ui.Card,
            h(
                "div",
                e(Thumbnail,
                  item_id=item_id,
                  item_type=this.state.item_type,
                  size_type=ImageSize.Medium),
                #e(ui.Label, e(ui.Icon, js_name="star half empty"), avg_rating, className="card-item bottom left", circular=True, size="large", color="orange"),
                e(ui.Icon,
                  js_name="ellipsis vertical",
                  bordered=True,
                  className="card-item bottom right",
                  link=True,
                  inverted=True),
                e(
                    ui.Label,
                    e(ui.Icon, js_name="block layout"),
                    len(this.state.galleries),
                    className="card-item top right",
                ),
                className="card-content",
            ),
            e(ui.Popup,
              trigger=e(
                  ui.Card.Content,
                  e(ui.Card.Header,
                    title,
                    className="text-ellipsis card-header"),
                  e(ui.Card.Meta, *artist_el, className="text-ellipsis"),
              ),
              header=title,
              content=h("div", *artist_el),
              hideOnScroll=True,
              position="bottom center"),
            link=True),
        stacked=True,
        className="no-padding-segment",
    )
Пример #3
0
def SliderNav(props):
    return e(ui.Icon,
             js_name="chevron {}".format(props.direction),
             link=True,
             circular=True,
             inverted=True,
             className="slide-next {}".format(props.direction),
             onClick=props.onClick)
Пример #4
0
def SortDropdown(props):
    item_options = []
    return e(ui.Dropdown,
             placeholder="Sort by",
             selection=True,
             item=True,
             options=item_options,
             defaultValue=props.value,
             onChange=props.on_change)
Пример #5
0
def menu_nav_render():
    items = []
    items.append(MenuItem("HPX", icon="sidebar", position="left", header=True, handler=this.props["toggler"]))

    elements = []
    elements_left = []
    elements_right = []
    for n, x in enumerate(items, 1):
        menu_name = x.name
        menu_icon = x.icon
        icon_size = "large"

        if x.position == "right":
            container = elements_right
        elif x.position == "left":
            container = elements_left
        else:
            container = elements

        children = []
        for c in x.children:
            children.append(e(ui.Dropdown.Item, c.name))

        container.append(e(ui.Menu.Item,
                            e(ui.Icon, js_name=menu_icon, size=icon_size, className="medium-size"),
                            menu_name,
                            js_name=menu_name,
                            header=x.header,
                            onClick=x.handler,
                            index=n)
                         )
    menu_contents = this.props.contents
    if not isinstance(menu_contents, list):
        menu_contents = [menu_contents]
    return e(ui.Menu,
                        *elements_left,
                        *elements,
                        *menu_contents,
                        *elements_right,
                        secondary=True,
                        attached="top",
                        fluid=True,
                        size="small",
                        stackable=True)
Пример #6
0
def item_view_render():
    items = this.state['items']
    el = this.state.element
    limit = this.props.limit or this.state.default_limit
    if not el:
        return e(Error, content="An error occured")

    return e(
        ItemViewBase,
        *[e(el, data=x, className="medium-size") for x in items],
        loading=this.state.loading,
        secondary=this.props.secondary,
        tertiary=this.props.tertiary,
        container=this.props.container,
        item_count=this.state.item_count,
        limit=limit,
        page=this.state.page,
        set_page=this.set_page,
        label=this.props.label,
    )
Пример #7
0
def page_render():
    fav = 0
    title = ""
    item_id = this.state.id
    if this.state.data:
        title = str(this.state.data.number)
        if this.state.data.metatags.favorite:
            fav = 1
        if not item_id:
            item_id = this.state.data.id

    add_cls = this.props.className or ""

    return e(ui.Card,
             h(
                 "div",
                 e(Thumbnail,
                   item_id=item_id,
                   item_type=this.state.item_type,
                   size_type=ImageSize.Medium),
                 e(ui.Icon,
                   js_name="ellipsis vertical",
                   bordered=True,
                   className="card-item bottom right",
                   link=True,
                   inverted=True),
                 className="card-content",
             ),
             e(
                 ui.Card.Content,
                 e(ui.Card.Header,
                   e(ui.Label, title, circular=True),
                   className="text-ellipsis card-header")),
             className=add_cls,
             link=True)
Пример #8
0
def ItemViewBase(props):
    paginations = e(Pagination,
                    pages=props.item_count / props.limit,
                    current_page=props.page,
                    on_change=props.set_page,
                    query=True,
                    scroll_top=True)

    lscreen = 3
    wscreen = 2
    if props.container:
        lscreen = wscreen = 4

    els = props.children
    if not els:
        els = []

    add_el = []

    if props.label:
        add_el.append(
            e(ui.Label,
              props.label,
              e(ui.Label.Detail, props.item_count),
              attached="top"))

    return e(
        ui.Segment,
        *add_el,
        e(ui.Grid,
          e(ui.Grid.Row, paginations, centered=True),
          *[
              e(ui.Grid.Column,
                c,
                computer=4,
                tablet=4,
                mobile=8,
                largeScreen=lscreen,
                widescreen=wscreen) for c in els
          ],
          e(ui.Grid.Row, paginations, centered=True),
          padded=True,
          stackable=True),
        basic=True,
        loading=props.loading,
        secondary=props.secondary,
        tertiary=props.tertiary,
    )
Пример #9
0
def Notif(props):
    return h(
        "div",
        h(
            "div",
            e(
                ui.Message,
                header=props.customFields.header,
                content=props.customFields.content,
                onDismiss=props.handleClose,
                **props.customFields.mskwargs,
            ),
            className="s-alert-box-inner",
        ),
        className=props.classNames,
        id=props.id,
        style=props.styles,
    )
Пример #10
0
def itemdropdown_render():
    props = this.props
    item_options = [
        {
            'text': "Collection",
            'value': ItemType.Collection
        },
        {
            'text': "Gallery",
            'value': ItemType.Gallery
        },
    ]
    return e(ui.Dropdown,
             placeholder="Item Type",
             selection=True,
             options=item_options,
             item=True,
             defaultValue=ItemType.Gallery
             if props.value == ItemType.Grouping else props.value,
             onChange=this.item_change)
Пример #11
0
def search_render():
    fluid = this.props.fluid

    return e(ui.Search,
             size=this.props.size,
             input=e(ui.Input,
                     fluid=this.props.fluid,
                     placeholder="Search title, artist, namespace & tags",
                     label=e(
                         ui.Popup,
                         e(SearchOptions),
                         trigger=e(ui.Label,
                                   e(ui.Icon, js_name="options"),
                                   "Search Options",
                                   as_="a"),
                         hoverable=True,
                         on="click",
                         hideOnScroll=True,
                     )),
             fluid=True,
             icon=e(ui.Icon, js_name="search", link=True),
             className=this.props.className,
             onSearchChange=this.on_search_change,
             defaultValue=utils.get_query("search", ""))
Пример #12
0
def sidebar_nav_render():
    if this.props['toggled']:
        nav_width = "very thin"
    else:
        nav_width = "thin"

    icon = False
    if nav_width == "very thin":
        icon = True

    def nav_toggle_handler(e, props):
        print(props)

    items = []
    items.append(MenuItem("Dashboard", "ui.mi-dashboard", icon="home", url="/dashboard"))
    items.append(MenuItem("Favorites", "ui.mi-favorites", icon="heart", url="/favorite"))
    items.append(MenuItem("Library", "ui.mi-library", icon="grid layout", url="/library"))
    items.append(MenuItem("Inbox", "ui.mi-inbox", icon="inbox", url="/inbox"))
    items.append(MenuItem("Downloads", "ui.mi-downloads", icon="tasks", url="/downloads"))
    pref_item = MenuItem("Preferences", "ui.mi-preferences",
                         modal=[e(ui.Modal.Header, tr(this, "ui.mi-preferences", "Preferences"))],
                         icon="settings", position="right")
    items.append(pref_item)
    pref_item.children.append(MenuItem("General"))
    pref_item.children.append(MenuItem("Logins"))
    pref_item.children.append(MenuItem("Metadata"))
    pref_item.children.append(MenuItem("Download"))
    pref_item.children.append(MenuItem("Monitoring"))
    pref_item.children.append(MenuItem("Ignoring"))
    pref_item.children.append(MenuItem("Client"))
    pref_item.children.append(MenuItem("Server"))

    about_item = MenuItem("About", "ui.mi-about",
                        modal=[e(ui.Modal.Header, tr(this, "ui.mi-about", "About"))],
                        icon="info", position="right")
    items.append(about_item)
    about_item.children.append(MenuItem("Plugins"))
    about_item.children.append(MenuItem("Statistics"))
    about_item.children.append(MenuItem("Help"))
    about_item.children.append(MenuItem("Check for updates"))
    about_item.children.append(MenuItem("Report bug"))
    about_item.children.append(MenuItem("Visit homepage"))

    elements = []
    elements_left = []
    elements_right = []
    for n, x in enumerate(items, 1):
        menu_name = x.name
        menu_icon = x.icon
        icon_size = "large"
        if icon:
            menu_name = ""

        if x.position == "right":
            container = elements_right
        elif x.position == "left":
            container = elements_left
        else:
            container = elements

        item_children = (e(ui.Icon, js_name=menu_icon, className="left medium-size", size=icon_size), tr(this, x.t_id, menu_name) if not icon else "",)

        as_link = {}
        if x.url:
            as_link = {"as":NavLink, "to":x.url, "activeClassName":"active"}

        menu_el = e(ui.Menu.Item,
                            *item_children,
                            js_name=menu_name,
                            header=x.header,
                            onClick=x.handler,
                            index=n,
                            **as_link)
        if x.modal:
            menu_el = e(ui.Modal, *x.modal,
                        trigger=menu_el,
                        )

        container.append(menu_el)

    return e(ui.Sidebar,
                        h("div",
                        h("div",
                            *elements_left,
                            className="top-aligned"),
                        h("div",
                            *elements,
                            className="middle-aligned"),
                        h("div",
                            *elements_right,
                            className="bottom-aligned"),
                        className="flex-container"),
                        as_=ui.Menu,
                        animation="push",
                        width=nav_width,
                        vertical=True,
                        visible=True,
                        icon=icon,
                        defaultActiveIndex=3,
                        className="sidebar-nav",
                        size="small"
                        )
Пример #13
0
def gallery_render():
    fav = 0
    title = ""
    rating = 0
    artists = []
    item_id = this.state.id
    if this.state.data:
        rating = this.state.data.rating
        title = this.state.data.titles[0].js_name
        if this.state.data.metatags.favorite:
            fav = 1
        if not item_id:
            item_id = this.state.data.id

        for a in this.state.data.artists:
            if len(a.names) > 0:
                artists.append(a.names[0].js_name)

    add_cls = this.props.className or ""
    link = True
    if not this.props.link == js_undefined:
        link = this.props.link

    thumb = e(
        Thumbnail,
        item_id=item_id,
        item_type=this.state.item_type,
        size_type=ImageSize.Medium,
        size=this.props.size,
    )
    if link:
        thumb = e(Link,
                  thumb,
                  to={
                      'pathname': '/item/gallery',
                      'search': utils.query_to_string({'id': item_id})
                  })

    return e(ui.Card,
             h(
                 "div",
                 thumb,
                 e(ui.Rating,
                   icon="heart",
                   size="massive",
                   className="card-item top left",
                   defaultRating=fav),
                 e(ui.Popup,
                   e(ui.Rating,
                     icon="star",
                     defaultRating=rating,
                     maxRating=10,
                     clearable=True),
                   trigger=e(ui.Label,
                             e(ui.Icon, js_name="star"),
                             rating,
                             className="card-item bottom left",
                             circular=True,
                             size="large",
                             color="yellow",
                             as_="a"),
                   hoverable=True,
                   on="click",
                   hideOnScroll=True,
                   position="left center"),
                 e(ui.Icon,
                   js_name="ellipsis vertical",
                   bordered=True,
                   className="card-item bottom right",
                   link=True,
                   inverted=True),
                 className="card-content",
             ),
             e(ui.Popup,
               trigger=e(
                   ui.Card.Content,
                   e(ui.Card.Header,
                     title,
                     className="text-ellipsis card-header"),
                   e(ui.Card.Meta,
                     *[h("span", x) for x in artists],
                     className="text-ellipsis"),
               ),
               header=title,
               content=h("div", *[h("span", x) for x in artists]),
               hideOnScroll=True,
               position="bottom center"),
             className=add_cls,
             link=True)
Пример #14
0
Collection = createReactClass({
    'displayName':
    'Collection',
    'getInitialState':
    lambda: {
        'id': None,
        'data': None,
        'items': [],
        'item_type': ItemType.Collection
    },
    'render':
    lambda: e(ui.Card,
              e(ui.Image, src='/static/img/default.png'),
              e(
                  ui.Card.Content,
                  e(ui.Card.Header, "Title"),
                  e(ui.Card.Meta, "Artist"),
              ),
              e(ui.Card.Content, extra=True),
              link=True)
})


def grouping_render():
    title = ""
    fav = 0
    item_id = this.state.id
    if this.state.data:
        title = this.state.data.js_name
        if not item_id:
            item_id = this.state.data.id
Пример #15
0
    this.setState({'value':value})
    this.props.on_change(this.props.idx, (this.state['key'], value))

ApiKwarg = createReactClass({
    'displayName': 'ApiKwarg',

    'getInitialState': lambda: {
        "key":"",
        "value":"",
        },

    'set_key': set_key,
    'set_value': set_value,

    'render': lambda: e(ui.Form.Group,
                        e(ui.Form.Input, js_name="param", label=tr(this, "", "Parameter"), onChange=this.set_key, inline=True, width="6"),
                        e(ui.Form.Input, js_name="value", label=tr(this, "", "Value"), onChange=this.set_value, inline=True, width="10"),
                        )
})

def handle_submit(ev):
    ev.preventDefault()
    this.setState({'calling':True})
    serv_data = {
        'fname': this.state['func_name']
        }

    def serv_rsponse(ctx, d, err):
        ctx.props.from_server(utils.syntax_highlight(JSON.stringify(d, None, 4)))
        ctx.setState({'calling':False})

    serv_data.update(this.state['kwargs'])
Пример #16
0
def page_render():
    return e(items.ItemViewPage, view_type=ViewType.Library)
Пример #17
0
def item_view_menu(on_item_change=None, default_item=None, on_search=None):
    return [
        e(ui.Menu.Item,
          e(withRouter(ItemDropdown),
            on_change=on_item_change,
            value=default_item,
            query=True),
          fitted=True),
        e(ui.Menu.Item,
          e(ui.Icon, js_name="sort"),
          e(SortDropdown, on_change=None, value=None),
          fitted=True),
        e(ui.Menu.Menu,
          e(
              ui.Menu.Item,
              e(withRouter(Search),
                size="small",
                fluid=True,
                className="fullwidth",
                on_search=on_search,
                query=True),
              className="fullwidth",
          ),
          position="left",
          className="fullwidth"),
        e(
            ui.Popup,
            e(ui.Grid, centered=True),
            trigger=e(
                ui.Menu.Item,
                e(ui.Icon, js_name="options"),
                "View Options",
            ),
            hoverable=True,
            on="click",
            flowing=True,
        ),
    ]
Пример #18
0
def Slider(props):
    children = React.Children.toArray(props.children)
    items = [e(ui.Segment, x, basic=True, size=props.size) for x in children]
    add_el = []
    if props.label:
        add_el.append(
            e(ui.Label,
              props.label,
              e(ui.Label.Detail, len(items)),
              attached="top"))

    return e(
        ui.Segment,
        *add_el,
        e(slick,
          *items,
          dots=True,
          dotsClass="circle slick-dots",
          draggable=True,
          infinite=False,
          centerMode=False,
          accessibility=True,
          lazyLoad=True,
          slidesToShow=4,
          slidesToScroll=2,
          nextArrow=e(SliderNav, direction="right"),
          prevArrow=e(SliderNav, direction="left"),
          responsive=[{
              'breakpoint': 425,
              'settings': {
                  'slidesToShow': 1
              }
          }, {
              'breakpoint': 610,
              'settings': {
                  'slidesToShow': 2
              }
          }, {
              'breakpoint': 768,
              'settings': {
                  'slidesToShow': 3
              }
          }, {
              'breakpoint': 1024,
              'settings': {
                  'slidesToShow': 4
              }
          }, {
              'breakpoint': 1280,
              'settings': {
                  'slidesToShow': 5
              }
          }, {
              'breakpoint': 1440,
              'settings': {
                  'slidesToShow': 6
              }
          }, {
              'breakpoint': 2560,
              'settings': {
                  'slidesToShow': 7
              }
          }, {
              'breakpoint': 100000,
              'settings': 'unslick'
          }]),
        basic=True,
        loading=props.loading,
        secondary=props.secondary,
        tertiary=props.tertiary,
    )
Пример #19
0
def pagination_render():
    limit = this.props.limit
    if not limit:
        limit = 6
    pages = this.props.pages
    if not pages or pages < 1:
        pages = 1
    current_page = this.props.current_page or this.state.current_page
    if not current_page:
        current_page = 1

    pages = math.floor(pages)

    page_list = range(1, pages + 1)
    ellipsis_pos = 2
    nav_back = True
    nav_next = True
    first_ellipses = False
    second_ellipses = False

    if current_page - 1 == 0:
        nav_back = False

    if current_page == len(page_list):
        nav_next = False

    if limit and current_page > limit and current_page > ellipsis_pos:
        first_ellipses = True

    if (pages - current_page) > limit and pages > ellipsis_pos:
        second_ellipses = True

    go_next = this.go_next
    go_prev = this.go_prev
    go_page = this.go_page

    half_limit = int(limit / 2)
    l_index = current_page - half_limit
    r_index = current_page + half_limit + 1
    if r_index > len(page_list):
        r_index = len(page_list)
        l_index = len(page_list) - (limit + 1)

    if l_index < 0:
        l_index = 0
        r_index = limit
    current_pages = page_list[l_index:r_index]

    if this.props.query:
        make_items = lambda i: [
            e(ui.Menu.Item,
              js_name=str(x),
              active=current_page == x,
              onClick=go_page,
              as_=QueryLink,
              query={'page': x}) for x in i
        ]
    else:
        make_items = lambda i: [
            e(ui.Menu.Item,
              js_name=str(x),
              active=current_page == x,
              onClick=go_page) for x in i
        ]

    items = make_items(current_pages)

    if first_ellipses:
        ellip_items = make_items(page_list[:ellipsis_pos])
        ellip_items.append(e(ui.Menu.Item, "...", disabled=True))
        ellip_items.extend(items)
        items = ellip_items

    if second_ellipses:
        items.append(e(ui.Menu.Item, "...", disabled=True))
        items.extend(make_items(page_list[-ellipsis_pos:]))

    if nav_back:
        if this.props.query:
            items.insert(
                0,
                e(ui.Menu.Item,
                  icon="angle left",
                  onClick=go_prev,
                  as_=QueryLink,
                  query={'page': current_page - 1}))
        else:
            items.insert(0, e(ui.Menu.Item, icon="angle left",
                              onClick=go_prev))
    if nav_next:
        if this.props.query:
            items.append(
                e(ui.Menu.Item,
                  icon="angle right",
                  onClick=go_next,
                  as_=QueryLink,
                  query={'page': current_page + 1}))
        else:
            items.append(e(ui.Menu.Item, icon="angle right", onClick=go_next))

    return e(ui.Menu, *items, pagination=True)
Пример #20
0
def page_render():
    return e(items.ItemViewPage, view_type=ViewType.Inbox)
Пример #21
0
def gallerypage_render():

    fav = 0
    title = ""
    rating = 0
    artists = []
    item_id = this.state.id
    info = ""
    inbox = False
    read_count = 0
    date_pub = ""
    date_upd = ""
    date_read = ""
    date_added = ""
    urls = []
    parodies = []
    if this.state.data:
        parodies = this.state.data.parodies
        date_pub = utils.moment.unix(this.state.data.pub_date).format("LL")
        date_upd = utils.moment.unix(this.state.data.last_updated).format("LLL")
        date_read = utils.moment.unix(this.state.data.last_read).format("LLL")
        date_added = utils.moment.unix(this.state.data.timestamp).format("LLL")
        date_added += " (" + utils.moment.unix(this.state.data.timestamp).fromNow() + ")"
        date_upd += " (" + utils.moment.unix(this.state.data.last_updated).fromNow() + ")"
        date_read += " (" + utils.moment.unix(this.state.data.last_read).fromNow() + ")"
        read_count = this.state.data.times_read
        rating = this.state.data.rating
        info = this.state.data.info
        title = this.state.data.titles[0].js_name
        if this.state.data.metatags.favorite:
            fav = 1
        inbox = this.state.data.metatags.inbox
        if not item_id:
            item_id = this.state.data.id

        for a in this.state.data.artists:
            if len(a.names) > 0:
                artists.append(a.names[0].js_name)

        for u in this.state.data.urls:
            urls.append(u.js_name)

    series_data = []
    if this.state.group_data:
        series_data = this.state.group_data

    status = this.state.status_data.js_name if this.state.status_data.js_name else "Unknown"

    rows = []

    rows.append(e(ui.Table.Row,
                  e(ui.Table.Cell, e(ui.Header, info, as_="h5"), colSpan="2")))
    rows.append(e(ui.Table.Row,
                  e(ui.Table.Cell, e(ui.Header, "Artist(s):", as_="h5"), collapsing=True), 
                  e(ui.Table.Cell, *(e("span", x) for x in artists))))
    if parodies:
        rows.append(e(ui.Table.Row, 
                      e(ui.Table.Cell, e(ui.Header, "Parody:", as_="h5"), collapsing=True),
                      e(ui.Table.Cell,)))
    rows.append(e(ui.Table.Row, 
                  e(ui.Table.Cell, e(ui.Header, "Language:", as_="h5"), collapsing=True),
                  e(ui.Table.Cell, this.state.lang_data.js_name)))
    rows.append(e(ui.Table.Row, 
                  e(ui.Table.Cell, e(ui.Header, "Status:", as_="h5"), collapsing=True),
                  e(ui.Table.Cell, e(ui.Label, status, color={"completed":"green", "ongoing":"orange"}.get(status.lower(), "grey")))))
    rows.append(e(ui.Table.Row, 
                  e(ui.Table.Cell, e(ui.Header, "Times read:", as_="h5"), collapsing=True),
                  e(ui.Table.Cell, e(ui.Label, read_count, circular=True))))
    rows.append(e(ui.Table.Row, 
                  e(ui.Table.Cell, e(ui.Header, "Rating:", as_="h5"), collapsing=True),
                  e(ui.Table.Cell, e(ui.Rating, icon="star", defaultRating=rating, maxRating=10, size="huge", clearable=True))))
    tag_rows = []
    if this.state.tag_data.__namespace__: # somehow transcrypt ignores this in the loop below
        ns_tags = this.state.tag_data.__namespace__
        ns_tags = sorted([x.js_name for x in ns_tags])
        tag_rows.append(
            e(ui.Table.Row,
                e(ui.Table.Cell,
                  e(ui.Label.Group,
                    *[e(ui.Label, x, tag=False) for x in ns_tags],
                    ),
                  colSpan="2",
                  )))
    for ns in sorted(dict(this.state.tag_data).keys()):
        ns_tags = this.state.tag_data[ns]
        ns_tags = sorted([x.js_name for x in ns_tags])
        tag_rows.append(
            e(ui.Table.Row,
                e(ui.Table.Cell, ns, collapsing=True), 
                e(ui.Table.Cell,
                  e(ui.Label.Group,
                    *[e(ui.Label, x, tag=False) for x in ns_tags],
                    ),
                  )))

    rows.append(e(ui.Table.Row, 
                  e(ui.Table.Cell, e(ui.Header, "Tags:", as_="h5"), collapsing=True),
                  e(ui.Table.Cell,
                    e(ui.Table,
                      e(ui.Table.Body,
                        *tag_rows,
                        ),
                      celled=True,
                      basic="very",
                      compact=True,
                      ))))
    rows.append(e(ui.Table.Row, 
                  e(ui.Table.Cell, e(ui.Header, "URL(s):", as_="h5"), collapsing=True),
                  e(ui.Table.Cell, e(ui.List, *[e(ui.List.Item, h("span", h("a", x, href=x, target="_blank"), e(ui.List.Icon, js_name="external share"))) for x in urls]))))

    indicators = []
    if inbox:
        indicators.append(e(ui.Icon, js_name="inbox", size="large", title="This gallery is in your inbox"))


    return e(ui.Grid,
               e(ui.Grid.Row,e(ui.Grid.Column, e(ui.Breadcrumb, icon="right arrow",))),
               e(ui.Grid.Row, 
                 e(ui.Grid.Column,
                   e(ui.Grid, e(ui.Grid.Row, e(items.Thumbnail,
                                size_type=ImageSize.Big,
                                item_type=this.state.item_type,
                                item_id=item_id, 
                                size="medium",
                                shape="rounded",
                                bordered=True,),),
                     e(ui.Grid.Row,
                       e(ui.Grid.Column,
                         e(ui.Button.Group,
                           e(ui.Button, "Read", primary=True),
                           e(ui.Button.Or, text="or"),
                           e(ui.Button, "Save for later"),
                           ),
                         textAlign="center"
                         ),
                       centered=True,
                       ),
                    container=True, centered=True, verticalAlign="top"),
                   tablet=4, mobile=16, computer=5,  widescreen=5, largeScreen=5),
                 e(ui.Grid.Column,
                   e(ui.Grid,
                       e(ui.Grid.Row,
                           e(ui.Grid.Column, e(ui.Rating, icon="heart", size="massive", defaultRating=fav), floated="right",),
                           e(ui.Grid.Column, *indicators, floated="right", textAlign="right"),
                         columns=2,
                         ),
                       e(ui.Grid.Row,
                         e(ui.Grid,
                                e(ui.Grid.Row, e(ui.Grid.Column, e(ui.Header, title, as_="h3"), textAlign="center")),
                                e(ui.Grid.Row, 
                                  e(ui.Grid.Column, 
                                    e(ui.Table, 
                                      e(ui.Table.Body,
                                        *rows
                                        ),
                                      basic="very"
                                      ))),
                               stackable=True,
                               padded=False,
                               relaxed=True,
                            ),
                        ),
                     divided="vertically",
                     ),
                   tablet=12, mobile=16, computer=11,  widescreen=11, largeScreen=11),
                 columns=2,
                 as_=ui.Segment,
                 loading=this.state.loading,
                 basic=True,
                 ),
               e(ui.Grid.Row,
                 e(ui.Grid.Column, e(ui.Label, "Date added", e(ui.Label.Detail, date_added))), 
                 e(ui.Grid.Column, e(ui.Label, "Last read", e(ui.Label.Detail, date_read))), 
                 e(ui.Grid.Column, e(ui.Label, "Last updated", e(ui.Label.Detail, date_upd))), 
                 columns=3
                 ),
               e(ui.Grid.Row, e(ui.Grid.Column,
                                  e(Slider, *[e(items.Gallery, data=x) for x in series_data],
                                                  loading=this.state.loading_group,
                                                  secondary=True,
                                                  label="Series"),
                               )),
               e(ui.Grid.Row, e(ui.Grid.Column, e(items.ItemView,
                                                  item_id=item_id,
                                                  item_type=ItemType.Gallery,
                                                  related_type=ItemType.Page,
                                                  label="Pages",
                                                  container=True, secondary=True))),
               stackable=True,
               container=True
             )
Пример #22
0
 lambda: e(
     ui.Grid.Column,
     e(
         ui.Segment,
         e(ui.Label,
           tr(this, "", "Newest Additions"),
           attached="top",
           size="large"),
         e(Slider, *[e(items.Gallery) for x in range(10)]),
     ),
     e(
         ui.Segment,
         e(ui.Label,
           tr(this, "", "Artist Spotlight"),
           attached="top",
           size="large"),
         e(Slider, *[e(items.Gallery) for x in range(10)]),
     ),
     e(
         ui.Segment,
         e(ui.Label,
           tr(this, "", "Previously Read"),
           attached="top",
           size="large"),
         e(Slider, *[e(items.Gallery) for x in range(10)]),
     ),
     e(
         ui.Segment,
         e(ui.Label,
           tr(this, "", "Based On Today's Tags"),
           attached="top",
           size="large"),
         e(Slider, *[e(items.Gallery) for x in range(10)]),
     ),
     e(
         ui.Segment,
         e(ui.Label,
           tr(this, "", "Because you just read: ") + "XXXXX",
           attached="top",
           size="large"),
         e(Slider, *[e(items.Gallery) for x in range(10)]),
     ),
     e(
         ui.Segment,
         e(ui.Label, tr(this, "", "Random"), attached="top", size="large"),
         e(Slider, *[e(items.Gallery) for x in range(10)]),
     ),
     e(
         ui.Segment,
         e(ui.Label,
           tr(this, "", "Needs Tagging"),
           attached="top",
           size="large"),
         e(Slider, *[e(items.Gallery) for x in range(10)]),
     ),
     e(
         ui.Segment,
         e(ui.Label,
           tr(this, "", "Recently Rated High"),
           attached="top",
           size="large"),
         e(Slider, *[e(items.Gallery) for x in range(10)]),
     ),
 )
Пример #23
0
def Error(props):
    return e(ui.Message,
             header=props.header,
             content=props.content,
             error=True)
Пример #24
0
    'displayName': 'App',


    'getInitialState': lambda: {
        "sidebar_toggled":True,
        "menu_nav_contents":None,
        },

    'componentWillMount': app_will_mount,

    "notif":None,

    'add_notif': lambda o: add_notif,

    'toggle_sidebar': lambda: (this.setState({'sidebar_toggled':not this.state['sidebar_toggled']})),

    'set_menu_contents': lambda c: (this.setState({'menu_nav_contents':c})),
    'get_context_ref': get_container_ref,

    'api_page': lambda: e(api.Page, menu=this.set_menu_contents),
    'dashboard_page': lambda: e(dashboard.Page, menu=this.set_menu_contents),
    'library_page': lambda: e(library.Page, menu=this.set_menu_contents),
    'favorites_page': lambda: e(favorites.Page, menu=this.set_menu_contents),
    'inbox_page': lambda: e(inbox.Page, menu=this.set_menu_contents),
    'gallery_page': lambda: e(itempage.GalleryPage, menu=this.set_menu_contents),
    'collection_page': lambda: e(itempage.GalleryPage, menu=this.set_menu_contents),

    'render': app_render,
})

render(e(App), 'root')
Пример #25
0
def app_render():
    #state.app = this
    return e(Router,
            h("div",
                e(nav_ui.MenuNav, toggler=this.toggle_sidebar, contents=this.state["menu_nav_contents"]),
                e(ui.Sidebar.Pushable,
                e(nav_ui.SideBarNav, toggled=this.state["sidebar_toggled"]),
                h("div",
                    e(ui.Segment,
                    e(Route, path="/api", component=this.api_page),
                    e(Route, path="/dashboard", component=this.dashboard_page),
                    e(Route, path="/", exact=True, component=this.library_page),
                    e(Route, path="/library", component=this.library_page),
                    e(Route, path="/favorite", component=this.favorites_page),
                    e(Route, path="/inbox", component=this.inbox_page),
                    e(Route, path="/item/gallery", component=this.gallery_page),
                    e(Route, path="/item/collection", component=this.collection_page),
                    basic=True),
                    ref=this.get_context_ref,
                    className="sidebar-container",
                  ),
                as_=ui.Segment,
                attached="bottom",
                className="main-content"
                ),
                e(Alert, contentTemplate=Notif, stack={'limit':6, 'spacing':20}, position="top-right", effect="slide", offset=50),
                className="bodyheight"
                )
            )
Пример #26
0
def itemviewpage_render():
    return e(ItemView,
             item_type=this.state.item_type,
             view_filter=this.props.view_type,
             search_query=this.state.search_query)
Пример #27
0
def page_render():
    return e(items.ItemViewPage, view_type=ViewType.Favorite)