Exemplo n.º 1
0
                      ui.Grid.Column,
                      props.children,
                      width=16,
                  )),
                  *pages_el,
                  padded="horizontally",
              ),
              secondary=True,
              basic=True,
              loading=props.loading)))


__pragma__("notconv")

SimpleLayout = createReactClass({
    'displayName': 'SimpleLayout',
    'render': simplelayout_render
})


def get_db_status(data=None, error=None):
    if data is not None and not error:
        this.setState({"data": data, 'data_loading': False})
    elif error:
        state.app.notif("Failed to fetch status", level="error")
        this.setState({'data_loading': False})
    else:
        client.call_func("get_items",
                         this.get_items,
                         item_type=ItemType.Status)
        this.setState({'data_loading': True})
Exemplo n.º 2
0
    return h(
        "div",
        e(ui.Dimmer, e(ui.Loader), active=this.state.loading, inverted=True),
        el,
    )


Thumbnail = createReactClass(
    {
        'displayName': 'Thumbnail',
        'is_mounted': False,
        'getInitialState': lambda: {
            'img':
            this.props.img or "/static/img/default.png",
            'loading':
            False if this.props.img else True,
            'placeholder':
            this.props.placeholder if utils.defined(this.props.placeholder)
            else "/static/img/default.png",
            'active_cmd':
            None,
        },
        'get_thumb': thumbnail_get_thumb,
        'set_thumb': thumbnail_set_thumb,
        'componentDidMount': thumbnail_did_mount,
        'componentWillUnmount': thumbnail_will_unmount,
        'componentDidUpdate': thumbnail_on_update,
        'render': thumbnail_render
    },
    pure=True)
Exemplo n.º 3
0
ScanPage = createReactClass({
    'displayName':
    'ScanPage',
    'scan_cmd':
    None,
    'view_cmd':
    None,
    'getInitialState':
    lambda: {
        'config': {},
        'limit': 50,
        'page': utils.get_query("page", 1),
        'loading': False,
        'view_loading': False,
        'progress_data': None,
        'view_progress_data': None,
        'view_id': utils.session_storage.get("scan_view_id", None),
        'view_data': {},
        'path': "",
        'submitted_path': '',
        'gallery.add_to_inbox': js_undefined,
        'scan.skip_existing_galleries': js_undefined,
    },
    'set_path':
    lambda e, d: all((this.setState({'path': d.value}), )),
    'get_view':
    get_view,
    'submit_view':
    submit_view,
    'set_page':
    lambda p: all((this.setState({'page': p}), )),
    'scan_galleries':
    scan_galleries,
    'on_scan_submit':
    on_scan_submit,
    'on_view_submit':
    on_view_submit,
    'on_scan_progress':
    on_scan_progress,
    'on_view_progress':
    on_view_progress,
    'on_add_to_inbox':
    lambda e, d: all((
        this.setState({'gallery.add_to_inbox': d.checked}),
        this.set_config(cfg={'gallery.add_to_inbox': d.checked}, save=False),
    )),
    'on_only_new':
    lambda e, d: all((
        this.setState({'scan.skip_existing_galleries': not d.checked}),
        this.set_config(cfg={'scan.skip_existing_galleries': d.checked},
                        save=False),
    )),
    'get_config':
    get_config,
    'set_config':
    set_config,
    'componentDidUpdate':
    scanpage_update,
    'componentDidMount':
    lambda: all((
        this.get_view(),
        this.get_config(cfg={
            'gallery.add_to_inbox': True,
            'scan.skip_existing_galleries': True,
        }),
    )),
    'render':
    scanpage_render
})
Exemplo n.º 4
0
        link=True)


Collection = createReactClass(
    {
        'displayName':
        'Collection',
        'getInitialState':
        lambda: {
            'id': None,
            'data': None,
            'gallery_count': 0,
            'galleries': [],
            'item_type': ItemType.Collection
        },
        'dimmer_show':
        lambda: this.setState({'dimmer': True}),
        'dimmer_hide':
        lambda: this.setState({'dimmer': False}),
        'componentWillMount':
        lambda: this.setState({
            'data': this.props.data,
            'id': 0
        }),
        'componentDidUpdate':
        collection_on_update,
        'render':
        collection_render
    },
    pure=True)
Exemplo n.º 5
0
    cnt_el = 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")

    el_args = {
        'as': ui.Menu,
        'animation': "overlay",
        'width': nav_width,
        'vertical': True,
        'visible': this.props.toggled,
        'icon': icon,
        'defaultActiveIndex': 3,
        'size': "small",
        'className': "window-height",
        'inverted': True
    }

    if this.props.mobile:
        el_args['direction'] = "right"

    return e(ui.Sidebar, cnt_el, **el_args)


SideBar = createReactClass({
    'displayName': 'SideBar',
    'render': sidebar_nav_render
})
Exemplo n.º 6
0
CircleSelector = createReactClass({
    'displayName':
    'CircleSelector',
    'getInitialState':
    lambda: {
        'data': this.props.data or [],
        'selected': [],
        'loading': False,
        'loading_more': False,
        'limit': 20,
        'search_query': this.props.search_query or "",
        'item_count': 0,
        'page': 1,
        'item_type': ItemType.Circle,
        'context_el': None,
    },
    'on_new_item':
    selector_on_new_item,
    'on_item':
    selector_on_item,
    'on_item_remove':
    selector_on_item_remove,
    'on_submit':
    selector_on_submit,
    'get_items':
    get_db_items,
    'get_items_count':
    get_items_count,
    'get_context_el':
    lambda n: this.setState({'context_el': n}),
    'update_search':
    lambda e, d: all((this.setState({
        'search_query': d.value,
        'page': 1
    }), this.setState({'loading': True}))),
    'get_more':
    get_more,
    'componentDidMount':
    lambda: all((this.get_items(), this.get_items_count(),
                 this.setState({'loading': True}))),
    'componentDidUpdate':
    selector_update,
    'render':
    selector_render
})
Exemplo n.º 7
0
FilterSelector = createReactClass({
    'displayName':
    'FilterSelector',
    'getInitialState':
    lambda: {
        'data': this.props.data or [],
        'selected': [],
        'loading': False,
        'loading_more': False,
        'limit': 99999,
        'item_count': 0,
        'page': 1,
        'default_selected': this.props.defaultSelected or [],
        'item_type': ItemType.GalleryFilter,
        'context_el': None,
    },
    'on_item':
    selector_on_item,
    'on_submit':
    selector_on_submit,
    'get_current_items':
    get_current_db_items,
    'add_item':
    add_item,
    'remove_item':
    remove_item,
    'get_items':
    get_db_items,
    'get_items_count':
    get_items_count,
    'get_context_el':
    lambda n: this.setState({'context_el': n}),
    'update_search':
    lambda e, d: all((this.setState({
        'search_query': d.value,
        'page': 1
    }), this.setState({'loading': True}))),
    'get_more':
    get_more,
    'componentDidMount':
    lambda: all(
        (this.get_items(), this.get_items_count(), this.get_current_items()
         if this.props.item_type and this.props.item_id else None,
         this.setState({'loading': True}))),
    'componentDidUpdate':
    selector_update,
    'render':
    selector_render
})
Exemplo n.º 8
0
        e(ui.Button,
          icon="grid layout",
          title=tr(this, "ui.t-show-galleries", "Show galleries"),
          as_=Link,
          to=utils.build_url("/library",
                             query=url_search_query,
                             keep_query=False)),
        e(ui.Button,
          icon="heart",
          title=tr(this, "ui.t-show-fav-galleries", "Show favorite galleries"),
          as_=Link,
          to=utils.build_url("/favorite",
                             query=url_search_query,
                             keep_query=False)),
        className=this.props.ClassName,
        basic=True,
        size=this.props.size or "tiny",
    )


__pragma__("notconv")

CircleProps = createReactClass({
    'displayName': 'CircleProps',
    'getInitialState': lambda: {
        'data': this.props.data,
        'id': this.props.id,
    },
    'render': circleprops_render
})
Exemplo n.º 9
0
GalleryProps = createReactClass({
    'displayName':
    'GalleryProps',
    'getInitialState':
    lambda: {
        'id': None,
        'data': this.props.data,
        'item_type': ItemType.Gallery,
        'lang_data': this.props.language,
        'tags_data': this.props.tags,
        'category_data': this.props.category,
        'status_data': this.props.status,
        'sources': this.props.sources,
    },
    'componentWillMount':
    lambda: this.setState({
        'id':
        this.props.data.id if this.props.data else this.state.data.id
        if this.state.data else None
    }),
    'componentDidMount':
    lambda: all((this.get_lang()
                 if not this.props.new_mode else None, this.get_status()
                 if not this.props.new_mode else None, this.get_category()
                 if not this.props.new_mode else None)),
    'on_rate':
    on_rate,
    'get_lang':
    get_lang,
    'get_status':
    get_status,
    'get_category':
    get_category,
    'update_data':
    utils.update_data,
    'componentDidUpdate':
    gallery_on_update,
    'render':
    galleryprops_render
})
Exemplo n.º 10
0
    return el


__pragma__("notconv")

ArtistLabel = createReactClass(
    {
        'displayName': 'ArtistLabel',
        'getInitialState': lambda: {
            'id': this.props.id,
            'data': this.props.data,
            'tags': this.props.tags,
            'item_type': ItemType.Artist,
        },
        'update_data': utils.update_data,
        'on_tags': lambda d: this.setState({"tags": d}),
        'update_metatags': update_metatags,
        'get_tags': artistpropsview.get_tags,
        'favorite': item_favorite,

        # 'componentDidMount': lambda: this.get_tags() if not utils.defined(this.props.tags) else None,
        'render': artistlbl_render
    },
    pure=True)


def artistitem_render():
    name = ""
    fav = 0
    data = this.props.data or this.state.data
Exemplo n.º 11
0
            selection=True,
            relaxed="very",
            divided=True,
            animated=True,
        ),
    )


Page = createReactClass({
    'displayName':
    'ActivityPage',
    'interval_func':
    None,
    'componentWillMount':
    lambda: this.props.menu([
        e(ui.Menu.Item, e(TR, "ui.mi-batch-urls", default="Batch URLs")),
    ]),
    'componentDidMount':
    page_mount,
    'componentWillUnmount':
    lambda: clearInterval(this.interval_func) if this.interval_func else None,
    'getInitialState':
    lambda: {
        'data': [],
    },
    'get_progress':
    get_progress,
    'render':
    page_render
})
Exemplo n.º 12
0
             ),
             hoverable=True,
             hideOnScroll=True,
             wide="very",
             on="click",
             position="top center")


__pragma__("notconv")

ArtistLabel = createReactClass(
    {
        'displayName':
        'ArtistLabel',
        'getInitialState':
        lambda: {
            'id': this.props.id,
            'data': this.props.data,
            'tags': this.props.tags,
            'item_type': ItemType.Artist,
        },
        'get_tags':
        artistpropsview.get_tags,
        'componentDidMount':
        lambda: this.get_tags()
        if not utils.defined(this.props.tags) else None,
        'render':
        artistlbl_render
    },
    pure=True)
Exemplo n.º 13
0
Page = createReactClass({
    'displayName':
    'DasboardPage',
    'componentWillMount':
    lambda: this.props.menu(None),
    'getInitialState':
    lambda: {},
    'render':
    lambda: e(
        ui.Grid.Column,
        e(
            ui.Segment,
            e(ui.Label,
              tr(this, "", "Newest Additions"),
              attached="top",
              size="small"),
            e(Slider, *[e(galleryitem.Gallery) for x in range(10)]),
        ),
        e(
            ui.Segment,
            e(ui.Label,
              tr(this, "", "Artist Spotlight"),
              attached="top",
              size="small"),
            e(Slider, *[e(galleryitem.Gallery) for x in range(10)]),
        ),
        e(
            ui.Segment,
            e(ui.Label,
              tr(this, "", "Previously Read"),
              attached="top",
              size="small"),
            e(Slider, *[e(galleryitem.Gallery) for x in range(10)]),
        ),
        e(
            ui.Segment,
            e(ui.Label,
              tr(this, "", "Based On Today's Tags"),
              attached="top",
              size="small"),
            e(Slider, *[e(galleryitem.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(galleryitem.Gallery) for x in range(10)]),
        ),
        e(
            ui.Segment,
            e(ui.Label, tr(this, "", "Random"), attached="top", size="large"),
            e(Slider, *[e(galleryitem.Gallery) for x in range(10)]),
        ),
        e(
            ui.Segment,
            e(ui.Label,
              tr(this, "", "From your favorite artists"),
              attached="top",
              size="large"),
            e(Slider, *[e(galleryitem.Gallery) for x in range(10)]),
        ),
        e(
            ui.Segment,
            e(ui.Label,
              tr(this, "", "From your favorite tags"),
              attached="top",
              size="large"),
            e(Slider, *[e(galleryitem.Gallery) for x in range(10)]),
        ),
        e(
            ui.Segment,
            e(ui.Label,
              tr(this, "", "Needs Tagging"),
              attached="top",
              size="large"),
            e(Slider, *[e(galleryitem.Gallery) for x in range(10)]),
        ),
        e(
            ui.Segment,
            e(ui.Label,
              tr(this, "", "Recently Rated High"),
              attached="top",
              size="large"),
            e(Slider, *[e(galleryitem.Gallery) for x in range(10)]),
        ),
    )
})
Exemplo n.º 14
0
                               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",
             )


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

    'getInitialState': lambda: {'id': None,
                                'data': None,
                                'artists': [],
                                'galleries': [],
                                'item_type': ItemType.Grouping},

    'componentWillMount': lambda: this.setState({'data': this.props.data, 'id': 0}),

    'render': grouping_render
}, pure=True)
Exemplo n.º 15
0
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, "ui.t-parameter", "Parameter"),
          onChange=this.set_key,
          inline=True,
          width="6"),
        e(ui.Form.Input,
          js_name="value",
          label=tr(this, "ui.t-value", "Value"),
          onChange=this.set_value,
          inline=True,
          width="10"),
    )
})
Exemplo n.º 16
0
    else:
        edit_el = []
        if this.props.edit_mode:
            edit_el.append(h("span", e(ui.Icon, js_name="pencil alternate", link=True, onClick=this.on_click)))
        el = h("div", this.state.data, *edit_el, className="editable" if this.props.edit_mode else "")

    return el


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

    'getInitialState': lambda: {
        'edit_mode': utils.defined_or(this.props.defaultOpen, False),
        'data': this.props.defaultValue,
    },
    'on_click': lambda: this.setState({'edit_mode': True}),
    'on_change': lambda e, d: this.setState({'data': d.value}),
    'update_data': utils.update_data,
    'on_submit': edittext_update,
    'on_key': edittext_on_key,
    'render': edittext_render
})


def editnumber_on_key(e):
    if e.key == 'Enter':
        e.preventDefault()
        this.on_submit()


def editnumber_update():
Exemplo n.º 17
0
Pagination = createReactClass({
    'displayName':
    'Pagination',
    'getInitialState':
    lambda: {
        'current_page':
        this.props.default_page if this.props.default_page else
        (utils.get_query("page", 1)
         if this.props.history and this.props.query else 1),
        'go_to_page':
        1,
    },
    'change_page':
    pagination_change,
    'go_to_change':
    lambda e, d: this.setState({'go_to_page': int(d.value)}),
    'go_to_page':
    lambda e, d: this.change_page(int(this.state.go_to_page)),
    'go_page':
    lambda e, d: this.change_page(int(d.js_name)),
    'go_prev':
    lambda e, d: this.change_page(
        (int(this.props.current_page or this.state.current_page) - 1)),
    'go_next':
    lambda e, d: this.change_page(
        int(this.props.current_page or this.state.current_page) + 1),
    'componentDidMount':
    lambda: this.change_page(
        this.props.current_page or this.props.default_page or utils.get_query(
            "page", 1), True)
    if this.props.history and this.props.query else None,
    'componentWillReceiveProps':
    pagination_receive_props,
    'render':
    pagination_render
})
Exemplo n.º 18
0
                basic=True,
            ),
            width=16),
          columns=1),
        *slider_el,
    )


ArtistProps = createReactClass({
    'displayName':
    'ArtistProps',
    'getInitialState':
    lambda: {
        'id': this.props.id,
        'data': this.props.data,
        'tags': this.props.tags,
        'item_type': ItemType.Artist,
        'gallery_count': 0,
    },
    'get_tags':
    get_tags,
    'get_gallery_count':
    get_gallery_count,
    'componentDidMount':
    lambda: all((this.get_tags()
                 if not utils.defined(this.props.tags) else None,
                 this.get_gallery_count())),
    'render':
    artistprops_render
})
Exemplo n.º 19
0
    if defined(this.props.menu_args):
        menu_args = this.props.menu_args
    else:
        menu_args = {}

    el = e(ui.Menu,
           *elements_left,
           *elements,
           *menu_contents,
           *elements_right,
           secondary=True,
           borderless=True,
           stackable=True,
           size="tiny",
           **menu_args
           )

    return el


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

    'getInitialState': lambda: {'fixed': False},

    'render': menu_nav_render,

    'toggle_fixed': lambda: this.setState({'fixed': not this.state.fixed})
}, pure=False)
Exemplo n.º 20
0
    lbl_args = {'content': name}
    return e(ui.Popup,
             e(circlepropsview.CircleProps, data=data),
             trigger=e(ui.Label,
                       basic=True,
                       color="teal",
                       as_="a",
                       **lbl_args,
                       ),
             hoverable=True,
             wide="very",
             on="click",
             hideOnScroll=True,
             position="top center"
             )


__pragma__("notconv")

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

    'getInitialState': lambda: {
        'id': this.props.id,
        'data': this.props.data,
        'item_type': ItemType.Circle,
    },

    'render': circlelbl_render
}, pure=True)
Exemplo n.º 21
0
    el = e(this.props.as_ if this.props.as_ else ui.List.Item,
           this.props.icon if this.props.icon else None,
           e(
               ui.List.Content,
               e(ui.Header, name, size="tiny"),
           ),
           className=this.props.className,
           onClick=this.on_click,
           **el_kwargs if not this.props.as_ else None)
    return el


GenericItem = createReactClass(
    {
        'displayName':
        'GenericItem',
        'getInitialState':
        lambda: {
            'id': this.props.id,
            'data': this.props.data,
            'item_type': this.props.item_type,
        },
        'on_click':
        lambda e, d: all(
            (this.props.onClick(e, this.props.data or this.state.data)
             if this.props.onClick else None, )),
        'render':
        genericitem_render
    },
    pure=True)
Exemplo n.º 22
0
              verticalAlign="top"),
            verticalAlign="top",
        ),
        e(
            ui.Grid.Row,
            e(
                ui.Grid.Column,
                e(
                    ui.Table,
                    e(ui.Table.Body, *rows),
                    basic="very",
                    size="small",
                    compact="very",
                ),
            )),
    )


__pragma__("notconv")

TagProps = createReactClass({
    'displayName': 'TagProps',
    'getInitialState': lambda: {
        'namespace': this.props.namespace,
        'tag': this.props.tag,
        'data': this.props.data,
        'id': this.props.id,
    },
    'render': tagprops_render
})
Exemplo n.º 23
0

CollectionProps = createReactClass({
    'displayName':
    'CollectionProps',
    'getInitialState':
    lambda: {
        'id': None,
        'data': this.props.data,
        'category_data': this.props.category,
        'gallery_count': this.props.gallery_count,
        'item_type': ItemType.Collection,
    },
    'componentWillMount':
    lambda: this.setState({
        'id':
        this.props.data.id if this.props.data else this.state.data.id
        if this.state.data else None
    }),
    'componentDidMount':
    lambda: all((this.get_category(), this.get_gallery_count())),
    'get_category':
    get_category,
    'get_gallery_count':
    get_gallery_count,
    'componentDidUpdate':
    collection_on_update,
    'render':
    collectionprops_render
})
Exemplo n.º 24
0
             className=this.props.className,
             as_=this.props.as_)


Titles = createReactClass({
    'displayName':
    'Titles',
    'getInitialState':
    lambda: {
        'data': this.props.data or [],
    },
    'update_title':
    update_title,
    'update_language':
    update_title_language,
    'on_create_item':
    lambda: all((this.props.data.append({}),
                 this.setState({'data': utils.JSONCopy(this.props.data)}))),
    # 'cancel_create_item': lambda: this.setState({'create_item': False}),
    'update_data':
    utils.update_data,
    'on_remove':
    remove_title,
    'componentDidUpdate':
    titles_update,
    'render':
    titles_render
})

__pragma__("kwargs")

Exemplo n.º 25
0
                x.stop()
        # HACK: blocks scroll restoration
        # TODO: scroll restoration
        if state.reset_scroll:
            window.scrollTo(0, 0)


def on_path_mount():
    state.history = this.props.history


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

    'componentWillReceiveProps': on_update,

    'componentDidMount': on_path_mount,

    'render': lambda: None
}, pure=True)

__pragma__("kwargs")


def notif(msg, header="", level="info", icon=None, **kwargs):
    _a = None
    _timeout = 5000
    if level == "warning":
        _a = Alert.warning
        _timeout = _timeout * 1.3
    elif level == "success":
Exemplo n.º 26
0
Page = createReactClass(
    {
        'displayName':
        'Page',
        'get_page_url':
        get_page_url,
        'getInitialState':
        lambda: {
            'gid':
            int(this.props.match.params.gallery_id),
            'number':
            int(this.props.match.params.page_number),
            'gallery':
            None,
            'pages': {},
            'page_list_ref':
            None,
            'page_list_page':
            0,
            'page_list_loading':
            False,
            'page_count':
            0,
            'data':
            this.props.data or {},
            'tag_data':
            this.props.tag_data or {},
            'item_type':
            ItemType.Page,
            'loading':
            True,
            'context':
            None,
            'config_visible':
            False,
            'pages_visible':
            False,
            'cfg_direction':
            utils.storage.get("reader_direction", ReaderDirection.left_to_right
                              ),
            'cfg_scaling':
            utils.storage.get("reader_scaling", ReaderScaling.default),
            'cfg_stretch':
            utils.storage.get("reader_stretch", False),
            'cfg_invert':
            utils.storage.get("reader_invert", True),
            'cfg_pagelist_open':
            utils.storage.get("reader_pagelist_open", False),
        },
        'cmd_data':
        None,
        'set_page':
        lambda e, d: this.setState({'data': d}),
        'go_prev':
        go_prev,
        'go_next':
        go_next,
        'go_left':
        go_left,
        'go_right':
        go_right,
        'set_pagelist_ref':
        lambda r: this.setState({'page_list_ref': r}),
        'set_thumbs':
        set_thumbs,
        'get_thumbs':
        get_thumbs,
        'get_item':
        get_item,
        'get_gallery':
        get_gallery,
        'get_pages':
        get_pages,
        'get_page_count':
        get_page_count,
        'on_key':
        on_key,
        'on_pagelist_load_more':
        lambda: this.get_pages(),
        'back_to_gallery':
        lambda: utils.go_to(this.props.history,
                            "/item/gallery/{}".format(this.props.match.params.
                                                      gallery_id),
                            keep_query=False),
        'set_cfg_direction':
        lambda e, d: all((this.setState({'cfg_direction': d.value}),
                          utils.storage.set("reader_direction", d.value))),
        'set_cfg_scaling':
        lambda e, d: all((this.setState({'cfg_scaling': d.value}),
                          utils.storage.set("reader_scaling", d.value))),
        'set_cfg_stretch':
        lambda e, d: all((this.setState({'cfg_stretch': d.checked}),
                          utils.storage.set("reader_stretch", d.checked))),
        'set_cfg_invert':
        lambda e, d: all((this.setState({'cfg_invert': d.checked}),
                          utils.storage.set("reader_invert", d.checked))),
        'set_cfg_pagelist_open':
        lambda e, d: all(
            (this.setState({'cfg_pagelist_open': d.checked}),
             utils.storage.set("reader_pagelist_open", d.checked))),
        'toggle_config':
        lambda: this.setState({
            'config_visible': not this.state.config_visible,
            'pages_visible': False
        }),
        'toggle_pages':
        lambda: this.setState({
            'pages_visible': not this.state.pages_visible,
            'config_visible': False
        }),
        'set_context':
        lambda c: this.setState({'context': c}),
        'on_canvas_click':
        on_canvas_click,
        'componentDidUpdate':
        on_update,
        'componentDidMount':
        lambda: all((window.addEventListener("keydown", this.on_key, False),
                     this.get_gallery())),
        'componentWillUnmount':
        lambda: all((window.removeEventListener("keydown", this.on_key, False),
                     state.update({'reset_scroll': True}))),
        'componentWillMount':
        lambda: all((this.props.menu([
            e(ui.Menu.Item,
              e(ui.Icon, js_name="ellipsis vertical", size="large"),
              icon=True,
              onClick=this.toggle_pages,
              position="left"),
            e(
                ui.Menu.Menu,
                e(ui.Menu.Item,
                  e(ui.Icon, js_name="arrow up", size="large"),
                  icon=True,
                  as_=Link,
                  to={
                      'pathname':
                      "/item/gallery/{}".format(this.props.match.params.
                                                gallery_id),
                      'state': {
                          'gallery': this.state.gallery
                      }
                  })),
            e(ui.Menu.Item,
              e(ui.Icon, js_name="options", size="large"),
              icon=True,
              onClick=this.toggle_config,
              position="right"),
        ]), (this.get_item() if not this.state.data else None),
                     state.update({'reset_scroll': False}))),
        'render':
        page_render
    },
    pure=True)
Exemplo n.º 27
0
from src.react_utils import (e,
                             createReactClass)
from src import pages
from src.i18n import tr
from src.ui import TitleChange
from org.transcrypt.stubs.browser import __pragma__
__pragma__('alias', 'as_', 'as')

__pragma__('skip')
require = window = require = setInterval = setTimeout = setImmediate = None
clearImmediate = clearInterval = clearTimeout = this = document = None
JSON = Math = console = alert = requestAnimationFrame = None
__pragma__('noskip')


def page_render():
    return [e(TitleChange, title=tr(this, "ui.mi-browse", "Browse"), key=1),
            e(pages.ItemViewPage,
              history=this.props.history,
              location=this.props.location,
              key=2)]


Page = createReactClass({
    'displayName': 'LibraryPage',

    'render': page_render
}, pure=True)
Exemplo n.º 28
0
Page = createReactClass({
    'displayName': 'CollectionPage',

    'cfg_suffix': "collectionpage",

    'getInitialState': lambda: {'id': int(this.props.match.params.item_id),
                                'data': this.props.data,
                                'rating': 0,
                                'fav': 0,
                                'item_type': ItemType.Collection,
                                'category_data': this.props.category_data or {},
                                'gallery_count': 0,
                                'loading': True,
                                'loading_group': True,
                                'send_to_recycle': True,
                                'visible_gallery_cfg': False,
                                },

    'get_item': get_item,
    'get_category': get_category,

    'toggle_galleries_config': lambda a: this.setState({'visible_gallery_cfg': not this.state.visible_gallery_cfg}),

    'componentWillMount': lambda: all(((this.get_item() if not this.state.data else None),
                                       )),
    'componentDidUpdate': collection_on_update,

    'render': page_render
})
Exemplo n.º 29
0
        ),
        hoverable=True,
        wide="very",
        on="click",
        hideOnScroll=True,
        position="top center")


__pragma__("notconv")

ParodyLabel = createReactClass(
    {
        'displayName': 'ParodyLabel',
        'getInitialState': lambda: {
            'id': this.props.id,
            'data': this.props.data,
            'item_type': ItemType.Parody,
        },
        'update_data': utils.update_data,
        'render': parodylbl_render
    },
    pure=True)


def parodyitem_render():
    name = ""
    data = this.props.data or this.state.data
    if data:
        if data.preferred_name:
            name = data.preferred_name.js_name

    el_kwargs = {'active': this.props.active}
Exemplo n.º 30
0
            ic_kwargs['name'] = "circle notch"
            ic_kwargs['color'] = "green"
        else:
            ic_kwargs['name'] = "circle notch"
            ic_kwargs['color'] = "red"

    return e(ui.Menu.Item,
             icon=e(ui.Icon, **ic_kwargs),
             )


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

    'getInitialState': lambda: {'connected': True,
                                'loading': False},

    'render': connect_render,

}, pure=False)


def menu_nav_render():
    icon_size = "large"

    items = []
    items.append(MenuItem("", position="left", header=True, handler=this.props["toggler"],
                          content=e(ui.Icon, className="hpx-standard huge")))

    elements = []
    elements_left = []