def filterdropdown_render(): item_options = [] __pragma__("iconv") if this.state.db_items: for d in sorted(this.state.db_items): item_options.append({ 'text': d, 'value': this.state.db_items[d]['id'], 'icon': "filter" }) __pragma__("noiconv") return e(ui.Dropdown, placeholder=tr(this, "ui.t-filterdropdown-placeholder", "Filter"), options=item_options, search=True, allowAdditions=True, value=this.props.value or js_undefined, defaultValue=this.props.defaultValue, onChange=this.item_change, loading=this.state.loading, selectOnBlur=False, pointing=this.props.pointing, labeled=this.props.labeled, inline=this.props.inline, compact=this.props.compact, button=this.props.button, item=this.props.item if utils.defined(this.props.item) else True, selection=this.props.selection if utils.defined(this.props.selection) else True, basic=this.props.basic)
def sortdropdown_render(): item_options = [] __pragma__("iconv") if this.state.sort_items: for x in sorted(this.state.sort_items, key=lambda k: k['name']): if x['item_type'] == this.props.item_type: item_options.append({ 'value': x['index'], 'text': x['name'], 'icon': 'sort' }) __pragma__("noiconv") return e(ui.Dropdown, placeholder=tr(this, "ui.t-sortdropdown-placeholder", "Sort by"), options=item_options, value=this.props.value, defaultValue=this.props.defaultValue, onChange=this.item_change, loading=this.state.loading, selectOnBlur=False, pointing=this.props.pointing, labeled=this.props.labeled, inline=this.props.inline, compact=this.props.compact, button=this.props.button, item=this.props.item if utils.defined(this.props.item) else True, selection=this.props.selection if utils.defined(this.props.selection) else True, basic=this.props.basic)
def get_items_count(data=None, error=None): if data is not None and not error: this.setState({"item_count": data['count']}) elif error: pass else: item = this.props.item_type or this.state.item_type filter_id = (this.props.filter_id if utils.defined( this.props.filter_id) else this.state.filter_id) func_kw = {'item_type': item} if this.props.view_filter: func_kw['view_filter'] = this.props.view_filter or None if filter_id: func_kw['filter_id'] = filter_id if this.state.search_query: func_kw['search_query'] = this.state.search_query if this.props.search_options or this.state.search_options: func_kw[ 'search_options'] = this.props.search_options or this.state.search_options if this.props.related_type: func_kw['related_type'] = this.props.related_type if this.props.item_id: func_kw['item_id'] = this.props.item_id if item: client.call_func("get_view_count", this.get_items_count, **func_kw)
def QueryLink(props): to_obj = {'pathname': location.pathname} if isinstance(props.to, str): to_obj.pathname = props.to elif props.to: to_obj = props.to query = dict() if props.keep_search or props.keep_search == js_undefined: query.update(utils.query_to_obj(location.search)) if props.query: query.update(props.query) to_obj['search'] = utils.query_to_string(query) c = props.children if utils.defined(props.children) else [] return e(Link, *c, to={ 'pathname': to_obj.pathname, 'search': to_obj.search, 'hash': to_obj.hash, 'state': to_obj.state }, js_replace=props.js_replace, className=props.className, onClick=props.onClick)
def itembuttons_render(): ch = this.props.children if not isinstance(ch, list): ch = [ch] return e( ui.Button.Group, *ch, e( ui.Button, tr(this, "general.db-item-collection", "Collection"), value=ItemType.Collection, onClick=this.item_change, primary=True, basic=this.props.value == ItemType.Collection, ), e( ui.Button, tr(this, "general.db-item-gallery", "Gallery"), value=ItemType.Gallery, onClick=this.item_change, primary=True, basic=this.props.value == ItemType.Gallery, ), toggle=True, basic=True, size=this.props.size if utils.defined(this.props.size) else "small")
def item_view_on_update(p_props, p_state): if p_props.item_type != this.props.item_type: this.get_element() this.setState({'items': []}) if utils.defined(this.props.search_query) and (this.props.search_query != this.state.search_query): squery = this.props.search_query if not squery: squery = '' this.setState({'search_query': squery}) if any(( p_props.item_type != this.props.item_type, p_state.item_type != this.state.item_type, p_props.related_type != this.props.related_type, p_props.item_id != this.props.item_id, p_props.filter_id != this.props.filter_id, p_state.filter_id != this.state.filter_id, p_props.view_filter != this.props.view_filter, p_props.search_options != this.props.search_options, p_state.search_options != this.state.search_options, p_state.search_query != this.state.search_query, p_props.limit != this.props.limit, p_state.limit != this.state.limit, )): this.reset_page() this.get_items_count() if any(( p_props.item_type != this.props.item_type, p_state.item_type != this.state.item_type, p_props.related_type != this.props.related_type, p_props.item_id != this.props.item_id, p_props.filter_id != this.props.filter_id, p_state.filter_id != this.state.filter_id, p_props.view_filter != this.props.view_filter, p_props.search_options != this.props.search_options, p_state.search_options != this.state.search_options, p_state.search_query != this.state.search_query, p_props.limit != this.props.limit, p_state.limit != this.state.limit, p_state.page != this.state.page, p_props.sort_by != this.props.sort_by, p_state.sort_by != this.state.sort_by, p_props.sort_desc != this.props.sort_desc, p_state.sort_desc != this.state.sort_desc, )): this.get_items() if not this.state.infinite_scroll: this.setState({'items': []}) if any(( p_props.sort_by != this.props.sort_by, p_state.sort_by != this.state.sort_by, p_props.sort_desc != this.props.sort_desc, p_state.sort_desc != this.state.sort_desc, )): this.reset_page()
def search_render(): cls_name = "" if this.props.fluid: cls_name = "fullwidth" if this.props.className: cls_name += " " + this.props.className return h( "form", e(ui.Search, size=this.props.size, input=e( ui.Input, fluid=this.props.fluid, transparent=this.props.transparent if utils.defined(this.props.transparent) else True, placeholder=tr(this, "ui.t-search-main-placeholder", "Search title, artist, namespace & tags"), label=e( ui.Popup, e( SearchOptions, history=this.props.history, query=this.props.query, on_change=this.on_search_options, case_=this.state['case'], regex=this.state.regex, whole=this.state.whole, all=this.state.all, desc=this.state.desc, suggest=this.state.suggest, on_key=this.state.on_key, ), trigger=e(ui.Button, icon=e(ui.Icon.Group, e(ui.Icon, js_name="options"), e(ui.Icon, js_name="search", corner=True)), js_type="button", basic=True, size=this.props.size), hoverable=True, on="click", hideOnScroll=True, ), ), minCharacters=3, fluid=this.props.fluid, action={'icon': 'search'}, open=this.state.suggest if not this.state.suggest else js_undefined, onSearchChange=this.on_search_change, defaultValue=this.state.query), className=cls_name, onSubmit=this.on_search)
def on_update(p_props, p_state): if p_state.data != this.state.data: this.setState({'number': this.state.data.number}) if any((p_props.match.params.page_number != this.props.match.params.page_number, )): this.get_item() this.setState({'config_visible': False}) if not this.state.cfg_pagelist_open: this.setState({'pages_visible': False}) scroll_top = this.props.scroll_top if utils.defined(this.props.scroll_top) else True if scroll_top: el = this.props.context or this.state.context or state.container_ref utils.scroll_to_element(el)
def status_render(): data = this.props.data or this.state.data if data.id and not data.js_name: data = utils.lodash_find(this.state.all_data, lambda v, i, c: v['id'] == data.id) or data el = None stat_name = data.js_name or tr(this, "ui.t-unknown", "Unknown") if this.state.edit_mode: options = [] for i in this.state.all_data: options.append({ 'key': i.id or i.js_name, 'value': i.id or i.js_name, 'text': i.js_name }) el = e(ui.Select, options=options, placeholder=tr(this, "ui.t-status", "Status"), defaultValue=data.id, size=this.props.size, basic=this.props.basic, compact=this.props.compact, as_=this.props.as_, onChange=this.on_update, loading=this.state.loading, onBlur=this.on_blur, allowAdditions=True, search=True, additionLabel=tr(this, "ui.t-add", "add") + ' ') elif data: el = e( ui.Label, stat_name, color={ "completed": "green", "ongoing": "orange", "unreleased": "red", "unknown": "grey" }.get(stat_name.lower(), "blue"), size=this.props.size, basic=this.props.basic, className=this.props.className, onClick=this.on_click if this.props.edit_mode else js_undefined, onRemove=this.on_remove if this.props.edit_mode else js_undefined, as_=this.props.as_ if utils.defined(this.props.as_) else "a" if this.props.edit_mode else js_undefined) return el
def get_tags(data=None, error=None): if data is not None and not error: this.setState({"data": data}) if this.props.on_tags: this.props.on_tags(data) elif error: state.app.notif("Failed to fetch tags ({})".format(this.props.item_id), level="error") else: if this.props.item_id and this.props.item_type: args = {} args['item_id'] = this.props.item_id args['item_type'] = this.props.item_type if utils.defined(this.props.raw): args['raw'] = this.props.raw client.call_func("get_tags", this.get_tags, **args)
def thumbnail_render(): img_url = this.state.placeholder 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 ex = this.props.kwargs if utils.defined(this.props.kwargs) else {} clsname = "" if this.props.blur: clsname = "blur" if this.props.className: clsname += ' ' + this.props.className el = e(ui.Image, src=img_url, fluid=fluid, size=this.props.size, disabled=this.props.disabled, centered=this.props.centered, bordered=this.props.bordered, rounded=this.props.rounded, floated=this.props.floated, avatar=this.props.avatar, dimmer=this.props.dimmer, height=this.props.height, as_=this.props.as_, href=this.props.href, hidden=this.props.hidden, shape=this.props.shape, spaced=this.props.spaced, ui=this.props.ui, verticalAlign=this.props.verticalAlign, width=this.props.width, style=this.props.style, className=clsname, **ex) return h( "div", e(ui.Dimmer, e(ui.Loader), active=this.state.loading, inverted=True), el, )
def __init__(self, data, callback=None, func_name=None, contextobj=None, memoize=False): ServerMsg.msg_id += 1 self.id = self.msg_id self.data = data self.callback = callback self.func_name = func_name self.contextobj = contextobj self._msg = {} self.memoize = memoize * 1000 if isinstance(memoize, int) else memoize self._called = False if self.memoize: r = ServerMsg.server_results.js_get(utils.object_hash(self.data)) if utils.defined(r): self.call_callback(r[0], r[1], skip_memoize=True)
def category_render(): data = this.props.data or this.state.data el = None if data.id and not data.js_name: data = utils.lodash_find(this.state.all_data, lambda v, i, c: v['id'] == data.id) or data cat_name = data.js_name or tr(this, "ui.t-unknown", "Unknown") if this.state.edit_mode: options = [] for i in this.state.all_data: options.append({ 'key': i.id or i.js_name, 'value': i.id or i.js_name, 'text': i.js_name }) el = e(ui.Select, options=options, placeholder=tr(this, "ui.t-category", "Category"), defaultValue=data.id, size=this.props.size, basic=this.props.basic, compact=this.props.compact, as_=this.props.as_, onChange=this.on_update, loading=this.state.loading, onBlur=this.on_blur, allowAdditions=True, search=True, additionLabel=tr(this, "ui.t-add", "add") + ' ') elif not utils.lodash_lang.isEmpty(data) or this.props.edit_mode: el = e( ui.Label, cat_name, color="black", basic=this.props.basic, size=this.props.size, className=this.props.className, onClick=this.on_click if this.props.edit_mode else js_undefined, onRemove=this.on_remove if this.props.edit_mode else js_undefined, as_=this.props.as_ if utils.defined(this.props.as_) else "a" if this.props.edit_mode else js_undefined) return el
def app_render(): if this.state.logged_in: sidebar_args = { 'location': this.props.location, 'toggler': this.toggle_sidebar, 'toggled': this.state["sidebar_toggled"], } menu_args = { 'location': this.props.location, 'toggler': this.toggle_sidebar, 'contents': this.state["menu_nav_contents"], 'menu_args': this.state["menu_nav_args"] } server_push_close = this.server_push_close server_push_actions_el = [] if dict(this.state.server_push_msg).get("actions", False): server_push_actions = [] push_id = this.state.server_push_msg['id'] for a in this.state.server_push_msg['actions']: a_id = a['id'] if a['type'] == 'button': server_push_actions.append( e(ui.Button, a['text'], value=a_id, onClick=lambda ev, da: all(( server_notifications_reply(msg_id=push_id, values={da.value: da.value}), server_push_close())))) server_push_actions_el.append(e(ui.Modal.Actions, *server_push_actions)) modal_els = [] server_push_msg = dict(this.state.server_push_msg) push_body = server_push_msg.get("body", '') if server_push_msg['id'] in (PushID.Update,): push_body = tr(None, "ui.t-changelog-location", "About -> Changelog") + '\n' + push_body modal_els.append(e(ui.Modal, e(ui.Modal.Header, server_push_msg.get("title", '')), e(ui.Modal.Content, push_body, style={"whiteSpace": "pre-wrap"}), *server_push_actions_el, onClose=this.server_push_close, open=this.state.server_push, dimmer="inverted", closeIcon=True) ) api_route = [] if this.state.debug: api_route.append(e(Route, path="/api", component=this.api_page)) el = h("div", e(ui.Responsive, #e(ConnectStatus, context=this.state.root_ref), e(sidebar.SideBar, **sidebar_args), minWidth=767), e(ui.Responsive, e(sidebar.SideBar, mobile=True, **sidebar_args), maxWidth=768), e(Route, component=PathChange), e(ui.Ref, e(ui.Sidebar.Pusher, e(ui.Visibility, e(ui.Responsive, e(menu.Menu, **menu_args), minWidth=767), e(ui.Responsive, e(menu.Menu, mobile=True, **menu_args), maxWidth=768), onBottomPassed=this.toggle_scroll_up, once=False, ), e(Switch, *api_route, e(Route, path="/manage", component=this.manage_page), e(Route, path="/dashboard", component=this.dashboard_page), e(Route, path="/library", component=this.library_page), e(Route, path="/favorite", component=this.favorites_page), e(Route, path="/directory", component=this.directory_page), e(Route, path="/activity", component=this.activity_page), e(Route, path="/item/gallery/:gallery_id(\d+)/page/:page_number(\d+)", component=this.page_page), e(Route, path="/item/gallery/:item_id(\d+)", component=this.gallery_page), e(Route, path="/item/collection/:item_id(\d+)", component=this.collection_page), e(Redirect, js_from="/", exact=True, to={'pathname': "/library"}), ), # e(ui.Sticky, # e(ui.Button, icon="chevron up", size="large", floated="right"), # bottomOffset=55, # context=this.state.container_ref, # className="foreground-sticky"), e(ui.Dimmer, simple=True, onClickOutside=this.toggle_sidebar), *modal_els, dimmed=this.state.sidebar_toggled, as_=ui.Dimmer.Dimmable, className="min-fullheight", ), innerRef=this.get_context_ref, ), key="1", ), elif not utils.defined(this.state.logged_in): el = e(ui.Segment, e(ui.Dimmer, e(ui.Loader), active=True), basic=True, className="fullheight", key="1", ) else: el = e(login.Page, on_login=this.on_login, key="1"), alert_el = e(Alert, contentTemplate=Notif, stack={'limit': 6, 'spacing': 20}, position="top-right", effect="slide", offset=50, preserveContext=True, key="2", ) return [e(TitleChange), el, ReactDOM.createPortal(alert_el, this.state.portal_el)]
def get_items(data=None, error=None): if not this.mounted: return if data is not None and not error: new_data = [] if this.state.infinite_scroll and \ this.state.prev_page and this.state.prev_page < this.state.page: new_data.extend(this.state['items']) new_data.extend(data) this.setState({ "items": new_data, 'loading': False, 'loading_more': False }) elif error: state.app.notif("Failed to fetch item type: {}".format( this.props.item_type or this.state.item_type), level="error") else: item = this.props.item_type or this.state.item_type sort_by = int(this.props.sort_by if utils. defined(this.props.sort_by) else this.state.sort_by) if not sort_by: sort_item = this.props.related_type or this.props.item_type or this.state.item_type def_sort_key = "def_sort_idx" + sort_item + this.config_suffix() sort_by = utils.storage.get(def_sort_key, 0) if not sort_by: sort_by = { ItemType.Gallery: 2, ItemType.Collection: 51 }.get(sort_item, 0) utils.storage.set(def_sort_key, sort_by) sort_desc = (this.props.sort_desc if utils.defined( this.props.sort_desc) else this.state.sort_desc) filter_id = (this.props.filter_id if utils.defined( this.props.filter_id) else this.state.filter_id) func_kw = { 'item_type': item, 'page': max(int(this.state.page) - 1, 0), 'limit': this.props.limit or this.state.limit } if utils.defined(this.props.view_filter): func_kw['view_filter'] = this.props.view_filter or None if this.state.search_query: func_kw['search_query'] = this.state.search_query if sort_by: func_kw['sort_by'] = sort_by if sort_desc: func_kw['sort_desc'] = sort_desc if this.props.search_options or this.state.search_options: func_kw[ 'search_options'] = this.props.search_options or this.state.search_options if filter_id: func_kw['filter_id'] = filter_id if this.props.related_type: func_kw['related_type'] = this.props.related_type if this.props.item_id: func_kw['item_id'] = this.props.item_id if item: client.call_func("library_view", this.get_items, **func_kw) if not this.state.prev_page: this.setState({'loading': True})
def collectionprops_render(): title = "" info = "" date_pub = None date_upd = None date_added = None #category = this.props.category or this.state.category_data if this.props.data: if this.props.data.pub_date: date_pub = this.props.data.pub_date if this.props.data.last_updated: date_upd = this.props.data.last_updated if this.props.data.timestamp: date_added = this.props.data.timestamp info = this.props.data.info title = this.props.data.js_name rows = [] if this.props.compact: rows.append( e( ui.Table.Row, e(ui.Table.Cell, e(ui.Header, title, size="small"), colSpan="2", textAlign="center", verticalAlign="middle"))) if info: rows.append( e( ui.Table.Row, e(ui.Table.Cell, e(ui.Header, info, size="tiny", className="sub-text"), colSpan="2"))) rows.append( e( ui.Table.Row, e(ui.Table.Cell, e(ui.Header, tr(this, "ui.t-published", "Published") + ':', size="tiny", className="sub-text"), collapsing=True), e(ui.Table.Cell, e(DateLabel, timestamp=date_pub, full=True)))) if this.props.compact: rows.append( e( ui.Table.Row, e(ui.Table.Cell, e(ui.Header, tr(this, "ui.t-date-added", "Date added") + ':', size="tiny", className="sub-text"), collapsing=True), e(ui.Table.Cell, e(DateLabel, timestamp=date_added, format="LLL")))) rows.append( e( ui.Table.Row, e(ui.Table.Cell, e(ui.Header, tr(this, "ui.t-last-updated", "Last updated") + ':', size="tiny", className="sub-text"), collapsing=True), e(ui.Table.Cell, e(DateLabel, timestamp=date_upd, format="LLL")))) return e( ui.Table, e(ui.Table.Body, *rows), basic="very", size=this.props.size, compact="very" if utils.defined(this.props.compact) else 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 = [] elements_right = [] for n, x in enumerate(items, 1): menu_name = x.name menu_icon = x.icon 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)) content = menu_name if x.content is None else x.content icon_el = [] if menu_icon: icon_el.append(e(ui.Icon, js_name=menu_icon, size=icon_size)) container.append(e(ui.Menu.Item, *icon_el, content, js_name=menu_name if x.content is None else None, header=x.header, onClick=x.handler, index=n, icon=not menu_name, ) ) menu_contents = this.props.contents if not isinstance(menu_contents, list): menu_contents = [menu_contents] 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
def Slider(props): children = props.data or React.Children.toArray(props.children) items = [ e(ui.Segment, x, basic=True, size=props.size, className="slide-segment") for x in children ] add_el = [] if props.label: add_el.append( e(ui.Label, props.label, e(ui.Label.Detail, len(items)), color=props.color, attached="top")) base_size = props.sildesToShow if props.sildesToShow else 5 if items: add_el.append( e(slick, *items, dots=True, dotsClass="slick-dots", draggable=True, variableWidth=True, infinite=False if not utils.defined(props.infinite) else props.infinite, centerMode=False, accessibility=True, lazyLoad=False, adaptiveHeight=props.adaptiveHeight if utils.defined(props.adaptiveHeight) else False, slidesToShow=base_size, slidesToScroll=base_size - 1, nextArrow=e(SliderNav, direction="right"), prevArrow=e(SliderNav, direction="left"), responsive=[ { 'breakpoint': 425, 'settings': { 'slidesToShow': base_size - 3, 'slidesToScroll': base_size - 3 } }, { 'breakpoint': 610, 'settings': { 'slidesToShow': base_size - 2, 'slidesToScroll': base_size - 2 } }, { 'breakpoint': 768, 'settings': { 'slidesToShow': base_size - 1, 'slidesToScroll': base_size - 1 } }, { 'breakpoint': 1024, 'settings': { 'slidesToShow': base_size } }, { 'breakpoint': 1280, 'settings': { 'slidesToShow': base_size + 1 } }, { 'breakpoint': 1440, 'settings': { 'slidesToShow': base_size + 2 } }, { 'breakpoint': 1860, 'settings': { 'slidesToShow': base_size + 3 } }, { 'breakpoint': 100000, 'settings': { 'slidesToShow': base_size + 3 } }, ])) return e(ui.Segment, *add_el, basic=props.basic if utils.defined(props.basic) else True, loading=props.loading, secondary=props.secondary, tertiary=props.tertiary, className="no-padding-segment")
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 this.props.history and this.props.query and not current_page: current_page = utils.get_query("page", this.state.current_page) if not current_page: current_page = 1 current_page = int(current_page) pages = math.ceil(pages) page_list = range(1, pages + 1) ellipsis_pos = 2 if limit > 2 else 1 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 if half_limit else 1) 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: def make_items(i): return [ e( ui.Menu.Item, js_name=str(x), active=current_page == x, onClick=go_page, # noqa: E704 as_=QueryLink, query={'page': x}) for x in i ] # noqa: E704 else: def make_items(i): return [ e( ui.Menu.Item, js_name=str( # noqa: E704 x), active=current_page == x, onClick=go_page) for x in i ] # noqa: E704 items = make_items(current_pages) query_args = {} if this.props.query: query_args = { 'as': QueryLink, 'query': { 'page': this.state.go_to_page } } go_el = e(ui.Popup, e(ui.Form, e( ui.Form.Field, e(ui.Input, onChange=this.go_to_change, size="mini", js_type="number", placeholder=current_page, action=e(ui.Button, js_type="submit", compact=True, icon="share", onClick=this.go_to_page, **query_args), min=0, max=pages), ), onSubmit=this.go_to_page), on="click", hoverable=True, position="top center", trigger=e(ui.Menu.Item, "...")) if first_ellipses: ellip_items = make_items(page_list[:ellipsis_pos]) ellip_items.append(go_el) ellip_items.extend(items) items = ellip_items if second_ellipses: items.append(go_el) 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, borderless=True, size=this.props.size if utils.defined(this.props.size) else "small", as_=ui.Transition.Group, duration=1000, )
return e(ui.Table, e(ui.Transition.Group, *tag_rows, as_=ui.Table.Body, duration=1000), basic="very", celled=True, compact="very", size="small") TagView = createReactClass( { 'displayName': 'TagView', 'getInitialState': lambda: { 'data': this.props.data or {} }, 'get_tags': get_tags, 'componentDidMount': lambda: this.get_tags() if not utils.defined(this.props.data) else None, 'componentDidUpdate': tag_on_update, 'render': tag_render }, pure=True)
def get_item(data=None, error=None): if data is not None and not error: this.setState({"data": data, "loading": False, }) if data.metatags.favorite: this.setState({"fav": 1}) if data.category_id: client.call_func("get_item", this.get_category, item_type=ItemType.Category, item_id=data.category_id) if data.id: client.call_func("get_related_count", this.get_gallery_count, related_type=ItemType.Gallery, item_type=this.state.item_type, item_id=data.id) if data.id: inbox = data.metatags.inbox trash = data.metatags.trash menu_items = [] menu_left = [] min_width = 768 if inbox: menu_left.append(e(ui.Responsive, e(ui.Button, e(ui.Icon, js_name="grid layout"), tr(this, "ui.b-send-library", "Send to Library"), color="green", basic=True), as_=ui.Menu.Item, minWidth=min_width, )) menu_items.append(e(ui.Menu.Menu, *menu_left)) menu_right = [] menu_right.append( e(ui.Responsive, e(ui.Button, e(ui.Icon, js_name="trash" if not trash else "reply"), tr(this, "ui.b-send-trash", "Send to Trash") if not trash else tr(this, "ui.b-restore", "Restore"), color="red" if not trash else "teal", basic=True), as_=ui.Menu.Item, minWidth=min_width, )) if trash: menu_right.append( e(ui.Responsive, e(ui.Button.Group, e(ui.Button, e(ui.Icon, js_name="close"), tr(this, "ui.b-delete", "Delete"), color="red"), e(ui.Button, icon="remove circle outline", toggle=True, active=this.state.delete_files, title=tr(this, "ui.t-delete-files", "Delete files")), e(ui.Button, icon="recycle", toggle=True, active=this.state.send_to_recycle, title=tr(this, "ui.t-send-recycle-bin", "Send files to Recycle Bin")), basic=True, ), as_=ui.Menu.Item, minWidth=min_width, )) menu_right.append(e(ui.Responsive, e(ui.Button, e(ui.Icon, js_name="edit"), tr(this, "ui.b-edit", "Edit"), basic=True), as_=ui.Menu.Item, minWidth=min_width, )) menu_items.append(e(ui.Menu.Menu, *menu_right, position="right")) if len(menu_items): this.props.menu(menu_items) elif error: state.app.notif("Failed to fetch item ({})".format(this.state.id), level="error") else: if utils.defined(this.props.location): if this.props.location.state and this.props.location.state.collection: if int(this.props.match.params.item_id) == this.props.location.state.collection.id: this.get_item(this.props.location.state.collection) return item = this.state.item_type item_id = this.state.id if item and item_id: client.call_func("get_item", this.get_item, item_type=item, item_id=item_id) this.setState({'loading': True})
def item_view_render(): items = this.state['items'] remove_item = this.remove_item el = this.state.element limit = this.props.limit or this.state.limit size_type = this.props.size_type blur = this.state.blur count = this.state.item_count if not el: return e(Error, content="An error occured. No valid element available.") ext_viewer = this.props.external_viewer if utils.defined( this.props.external_viewer) else this.state.external_viewer cfg_el = this.props.config_el or e( ItemViewConfig, view_type=this.props.view_filter, item_type=this.props.related_type or this.props.item_type or this.state.item_type, on_close=this.props.toggle_config or this.toggle_config, visible=this.props.visible_config if utils.defined( this.props.visible_config) else this.state.visible_config, default_item_count=this.state.limit, on_infinite_scroll=this.on_infinite_scroll, suffix=this.config_suffix(), on_item_count=this.on_item_count, on_external_viewer=this.on_external_viewer, on_group_gallery=this.on_group_gallery, on_blur=this.on_blur, ) el_items = [(x.id, e(el, data=x, size_type=size_type, remove_item=remove_item, blur=blur, centered=True, className="medium-size", key=x.id, external_viewer=ext_viewer)) for x in items] if len(el_items) == 0 and count != 0: el_items = [(x.id, e(el, size_type=size_type, blur=blur, centered=True, className="medium-size", key=x)) for x in range(min(limit, 30))] return e( ItemViewBase, el_items, config_suffix=this.config_suffix(), history=this.props.history, location=this.props.location, 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, config_el=cfg_el, toggle_config=this.props.toggle_config, infinite_scroll=this.state.infinite_scroll, on_load_more=this.get_more, loading_more=this.state.loading_more, infinite_scroll_context=this.props.infinite_scroll_context, query=this.query(), context=this.props.context, show_count=this.props.show_count, show_pagination=this.props.show_pagination, show_search=this.props.show_search, on_search=this.on_search, default_search=this.state.search_query, show_sortdropdown=this.props.show_sortdropdown, on_sort_change=this.on_sort_change, on_sort_desc=this.toggle_sort_desc, default_sort=this.state.sort_by, default_sort_desc=this.state.sort_desc, show_itembuttons=this.props.show_itembuttons, on_item_change=this.on_item_change, default_item=this.state.item_type, show_filterdropdown=this.props.show_filterdropdown, on_filter_change=this.on_filter_change, default_filter=this.state.filter_id, )
__pragma__("notconv") CreateGallery = createReactClass({ 'displayName': 'CreateGallery', 'getInitialState': lambda: { 'data': {}, 'load_gallery_path': '', 'load_gallery_loading': False, 'options': { 'gallery.add_to_inbox': utils.storage.get( 'new_gallery.add_to_inbox', this.props.config[ 'gallery.add_to_inbox'] if utils.defined(this.props.config[ 'gallery.add_to_inbox']) else False), }, 'submitting': False, }, 'load_gallery': load_gallery, 'update_options': update_options, 'on_gallery_update': on_gallery_update, 'on_add_to_inbox': lambda e, d: all( (this.update_options('gallery.add_to_inbox', d.checked), utils.storage.set('new_gallery.add_to_inbox', d.checked))), 'on_load_gallery_submit': lambda e, d: this.load_gallery(),
show_ns=False, edit_mode=edit_mode) for x in ns_tags], ), ))) return e(ui.Table, *edit_row, e(ui.Transition.Group, *tag_rows, as_=ui.Table.Body, duration=500), basic="very", celled=True, compact="very", size="small") TagView = createReactClass({ 'displayName': 'TagView', 'getInitialState': lambda: {'data': [] if this.props.single else {}, 'tags_input': ''}, 'get_tags': get_tags, 'update_tags': update_tags, 'remove_tag': remove_tag, 'update_data': utils.update_data, 'on_input_submit': tag_on_input, 'on_input': lambda e, d: this.setState({'tags_input': d.value}), 'componentDidMount': lambda: this.get_tags() if not utils.defined(this.props.data) else None, 'componentDidUpdate': tag_on_update, 'render': tag_render }, pure=True)
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)
lambda: all((this.setState({'open': not this.state.open}), this.props.on_toggle(not this.state.open) if this.props.on_toggle else None), utils.storage.set('labelaccordion' + this.props.cfg_suffix, not this.state.open) if this.props.cfg_suffix else None), 'render': lambda: e( ui.Segment, e( ui.Label, e(ui.Icon, js_name="caret down" if this.state.open else "caret right"), this.props.label, *([e(ui.Label.Detail, this.props.detail)] if utils.defined(this.props.detail) else []), attached=this.props.attached or "top", onClick=this.toggle, color=this.props.color, as_="a", ), this.props.children if this.state.open else js_undefined, compact=this.props.compact, secondary=this.props.secondary, basic=this.props.basic if utils.defined(this.props.basic) else True, className="small-padding-segment", ), }, pure=True)
def galleryprops_render(): title = "" rating = this.props.rating artists = [] item_id = this.props.id info = "" times_read = 0 date_pub = None date_upd = None date_read = None date_added = None urls = [] parodies = [] circles = [] status = this.props.status or this.state.status_data language = this.props.language or this.state.lang_data category = this.props.category or this.state.category_data tags = this.props.tags or this.state.tags_data titles = [] title_data = None grouping_id = None if this.props.data: if this.props.data.id: item_id = this.props.data.id if this.props.data.grouping_id: grouping_id = this.props.data.grouping_id if this.props.data.parodies: parodies = this.props.data.parodies if this.props.data.titles: titles = this.props.data.titles # noqa: F841 if this.props.data.pub_date: date_pub = this.props.data.pub_date if this.props.data.last_updated: date_upd = this.props.data.last_updated if this.props.data.last_read: date_read = this.props.data.last_read if this.props.data.timestamp: date_added = this.props.data.timestamp if this.props.data.times_read: times_read = this.props.data.times_read if this.props.data.info: info = this.props.data.info if this.props.data.preferred_title: title = this.props.data.preferred_title.js_name # noqa: F841 title_data = this.props.data.preferred_title if this.props.data.artists: artists = this.props.data.artists circle_ids = [] for a in artists: if a.circles: for c in a.circles: if c.id in circle_ids: continue circles.append(c) circle_ids.append(c.id) if this.props.data.language: language = this.props.data.language if this.props.data.category: category = this.props.data.category if this.props.data.grouping and this.props.data.grouping.status: status = this.props.data.grouping.status if this.props.data.urls: urls = this.props.data.urls if this.props.data.taggable and not utils.lodash_lang.isEmpty( this.props.data.taggable.tags): tags = this.props.data.taggable.tags if not utils.lodash_lang.isEmpty(this.props.data.tags): tags = this.props.data.tags if not utils.defined(rating) and utils.defined(this.props.data.rating): rating = this.props.data.rating paths = [] if this.props.sources: paths = this.props.sources rows = [] if this.props.compact or this.props.new_mode: rows.append( e( ui.Table.Row, e(ui.Table.Cell, e(ui.Header, tr(this, "ui.t-title", "Title") + ':', size="tiny", className="sub-text"), collapsing=True) if this.props.new_mode else None, e(ui.Table.Cell, e(galleryprops.Titles, data=titles, preferred=title_data, update_data=this.update_data, data_key="titles", edit_mode=this.props.edit_mode, size="small"), colSpan="1" if this.props.new_mode else "2", verticalAlign="middle"))) if info or this.props.edit_mode: rows.append( e( ui.Table.Row, e(ui.Table.Cell, e(ui.Header, tr(this, "ui.t-description", "Description") + ':', size="tiny", className="sub-text"), collapsing=True) if this.props.new_mode else None, e(ui.Table.Cell, e(galleryprops.Description, data=info, update_data=this.update_data, data_key="info", edit_mode=this.props.edit_mode), colSpan="1" if this.props.new_mode else "2"))) if this.props.compact or this.props.new_mode: rows.append( e( ui.Table.Row, e( ui.Table.Cell, e(simpleprops.DateLabel, update_data=this.update_data, data_key="timestamp", edit_mode=this.props.edit_mode, text=tr(this, "ui.t-date-added", "Date added"), data=date_added, format="LLL"), e(simpleprops.DateLabel, update_data=this.update_data, data_key="last_read", edit_mode=this.props.edit_mode, text=tr(this, "ui.t-last-read", "Last read"), data=date_read, format="LLL"), e(simpleprops.DateLabel, update_data=this.update_data, data_key="last_updated", edit_mode=this.props.edit_mode, text=tr(this, "ui.t-last-updated", "Last updated"), data=date_upd, format="LLL", disabled=True if this.props.edit_mode else False) if not this.props.edit_mode else None, colSpan="2", textAlign="center", ))) rows.append( e( ui.Table.Row, e(ui.Table.Cell, e(ui.Header, tr(this, "ui.t-artist", "Artist") + ':', size="tiny", className="sub-text"), collapsing=True), e( ui.Table.Cell, e(galleryprops.Artists, data=artists, update_data=this.update_data, data_key="artists", edit_mode=this.props.edit_mode)))) if circles and not this.props.edit_mode: rows.append( e( ui.Table.Row, e(ui.Table.Cell, e(ui.Header, tr(this, "ui.t-circle", "Circle") + ':', size="tiny", className="sub-text"), collapsing=True), e( ui.Table.Cell, e(ui.Label.Group, [ e(circleitem.CircleLabel, data=x, key=x) for x in circles ])))) if parodies or this.props.edit_mode: rows.append( e( ui.Table.Row, e(ui.Table.Cell, e(ui.Header, tr(this, "ui.t-parody", "Parody") + ':', size="tiny", className="sub-text"), collapsing=True), e( ui.Table.Cell, e(galleryprops.Parodies, data=parodies, update_data=this.update_data, data_key="parodies", edit_mode=this.props.edit_mode)))) if (this.props.compact and category) or (this.props.edit_mode and not this.props.main): rows.append( e( ui.Table.Row, e(ui.Table.Cell, e(ui.Header, tr(this, "ui.t-category", "Category") + ':', size="tiny", className="sub-text"), collapsing=True), e( ui.Table.Cell, e(galleryprops.Category, data=category, update_data=this.update_data, data_key="category", edit_mode=this.props.edit_mode)))) rows.append( e( ui.Table.Row, e(ui.Table.Cell, e(ui.Header, tr(this, "ui.t-language", "Language") + ':', size="tiny", className="sub-text"), collapsing=True), e( ui.Table.Cell, e(simpleprops.Language, data=language, update_data=this.update_data, data_key="language", edit_mode=this.props.edit_mode)))) rows.append( e( ui.Table.Row, e(ui.Table.Cell, e(ui.Header, tr(this, "ui.t-rating", "Rating") + ':', size="tiny", className="sub-text"), collapsing=True), e( ui.Table.Cell, e(ui.Rating, onRate=this.props.on_rate or this.on_rate, icon="star", rating=rating, maxRating=10, size="huge", clearable=True)))) rows.append( e( ui.Table.Row, e(ui.Table.Cell, e(ui.Header, tr(this, "ui.t-status", "Status") + ':', size="tiny", className="sub-text"), collapsing=True), e( ui.Table.Cell, e(galleryprops.Status, update_data=this.update_data, grouping_id=grouping_id, data_key="grouping.status", data=status, edit_mode=this.props.edit_mode)))) rows.append( e( ui.Table.Row, e(ui.Table.Cell, e(ui.Header, tr(this, "ui.t-published", "Published") + ':', size="tiny", className="sub-text"), collapsing=True), e( ui.Table.Cell, e(simpleprops.DateLabel, update_data=this.update_data, data_key="pub_date", edit_mode=this.props.edit_mode, data=date_pub, full=True)))) rows.append( e( ui.Table.Row, e(ui.Table.Cell, e(ui.Header, tr(this, "ui.t-times-read", "Times read") + ':', size="tiny", className="sub-text"), collapsing=True), e( ui.Table.Cell, e(simpleprops.EditNumber, data_key="times_read", update_data=this.update_data, data=times_read, edit_mode=this.props.edit_mode)))) rows.append( e( ui.Table.Row, e(ui.Table.Cell, e(ui.Header, tr(this, "ui.t-tags", "Tags") + ':', size="tiny", className="sub-text"), collapsing=True), e( ui.Table.Cell, e(tagview.TagView, data_key='taggable.tags', update_data=this.update_data, single=this.props.single_tags, edit_mode=this.props.edit_mode, submitted_data=this.props.submitted_data, item_id=item_id, item_type=this.state.item_type, data=tags, on_tags=this.props.on_tags)))) rows.append( e( ui.Table.Row, e(ui.Table.Cell, e(ui.Header, tr(this, "ui.t-external-links", "External") + ':', size="tiny", className="sub-text"), collapsing=True), e( ui.Table.Cell, e(simpleprops.URLs, data_key="urls", update_data=this.update_data, edit_mode=this.props.edit_mode, data=urls, relaxed=True, size="small")))) if paths: rows.append( e( ui.Table.Row, e(ui.Table.Cell, e(ui.Header, tr(this, "ui.t-path", "Path") + ':', size="tiny", className="sub-text"), collapsing=True), e( ui.Table.Cell, e(ui.List, *[ e( ui.List.Item, e(ui.Header, x, size="tiny", className="sub-text"), ) for x in paths ], size="tiny", relaxed=True, divided=True)))) return e( ui.Table, e(ui.Table.Body, *rows), basic="very", size=this.props.size, compact="very" if utils.defined(this.props.compact) else False, )
def get_item(ctx=None, data=None, error=None, force=False, only_gallery=False): if not this.mounted: return if data is not None and not error: this.setState({ "data": data, "loading": False, "rating": data.rating, 'loading_group': True, }) if not ctx.only_gallery: trash = data.metatags.trash if data.metatags.favorite: this.setState({"fav": 1}) else: this.setState({"fav": 0}) if data.grouping_id: client.call_func("get_related_items", this.get_grouping, item_type=ItemType.Grouping, related_type=this.state.item_type, item_id=data.grouping_id) client.call_func("get_related_items", this.get_status, item_type=ItemType.Grouping, related_type=ItemType.Status, item_id=data.grouping_id) if data.language_id: client.call_func("get_item", this.get_lang, item_type=ItemType.Language, item_id=data.language_id) if data.category_id: client.call_func("get_item", this.get_category, item_type=ItemType.Category, item_id=data.category_id) if not trash and data.id: client.call_func("get_related_count", this.get_filter_count, related_type=ItemType.GalleryFilter, item_type=this.state.item_type, item_id=data.id) client.call_func("get_related_items", this.get_collection_data, related_type=ItemType.Collection, item_type=this.state.item_type, item_id=data.id) client.call_func("get_related_items", this.get_filters, item_type=ItemType.Gallery, related_type=ItemType.GalleryFilter, item_id=data.id) client.call_func("get_similar", this.get_similar, item_type=ItemType.Gallery, item_id=data.id, limit=30) this.setState({"similar_gallery_loading": True}) this.setState({'same_artist_data': []}) if not trash and len(data.artists): for a in list(data.artists)[:5]: client.call_func("get_related_items", this.get_same_artist_data, related_type=ItemType.Gallery, item_id=a.id, item_type=ItemType.Artist, limit=10 if len(data.artists) > 1 else 30) this.update_menu(data) elif error: state.app.notif("Failed to fetch item ({})".format(this.state.id), level="error") else: ctx = { 'only_gallery': only_gallery, } item_id = this.state.id if utils.defined(this.props.location): if this.props.location.state and this.props.location.state.gallery: if int(this.props.match.params.item_id ) == this.props.location.state.gallery.id: if not force: this.get_item(ctx, this.props.location.state.gallery) return else: item_id = this.props.match.params.item_id item = this.state.item_type if item and item_id: client.call_func("get_item", this.get_item, ctx=ctx, item_type=item, item_id=item_id) this.setState({'loading': True})
def scanpage_render(): view_data = this.state.view_data progress_text = "" title = "" percent = 0 if this.state.progress_data: p = this.state.progress_data progress_text = p.text title = p.title percent = p.percent pages_el = [] count_el = [] if not this.state.loading and view_data: if view_data['count'] > this.state.limit: pages_el.append( e(ui.Grid.Row, e( ui.Responsive, e(Pagination, limit=1, pages=view_data['count'] / this.state.limit, current_page=this.state.page, on_change=this.set_page, query=True, scroll_top=True, size="tiny"), maxWidth=578, ), e( ui.Responsive, e(Pagination, pages=view_data['count'] / this.state.limit, current_page=this.state.page, on_change=this.set_page, query=True, scroll_top=True), minWidth=579, ), centered=True), ) count_el.append( e( ui.Grid.Row, e(ui.Grid.Column, e( ui.Header, e(ui.Header.Subheader, tr(this, "ui.t-showing-count", "Showing {}".format(view_data['count']), placeholder={ 'from': (this.state.page - 1) * this.state.limit + 1, 'to': (this.state.page - 1) * this.state.limit + len(view_data['items']), 'all': view_data['count'] }), as_="h6"), ), textAlign="center", width=16))) items = [] view_progress_data = this.state.view_progress_data view_progress_el = [] submitted_view_data = view_progress_data if submitted_view_data: p_kwargs = {} p_kwargs['progress'] = 'value' if view_progress_data['max']: p_kwargs['value'] = view_progress_data['value'] p_kwargs['total'] = view_progress_data['max'] p_kwargs['autoSuccess'] = True else: p_kwargs['percent'] = 1 p_kwargs['autoSuccess'] = False view_progress_el.append( e(ui.Segment, e(ui.Progress, precision=2, indicating=True, active=True, **p_kwargs), basic=True)) if not this.state.loading and view_data: for t in this.state.view_data['items']: all_circles = [] [all_circles.extend(a.circles) for a in t.gallery.artists] circles = [] circle_names = [] for c in all_circles: if c.js_name not in circle_names: circles.append(c) circle_names.append(c.js_name) items.append( e( ui.List.Item, e( ui.List.Content, *(e(ui.Header, x, className="sub-text", as_="h5") for x in t.sources), e( ui.List.Description, e(ui.List, [ e( ui.List.Item, e(ui.Header, x.js_name, size="tiny"), ) for x in t.gallery.titles ], size="tiny", relaxed=True, bulleted=True), e(ui.Divider, hidden=True), e( ui.List, e( ui.List.Item, h("span", tr(this, "ui.t-artist", "Artist") + ':', size="tiny", className="sub-text"), *(e(artistitem.ArtistLabel, data=x) for x in t.gallery.artists)), e( ui.List.Item, h("span", tr(this, "ui.t-circle", "Circle") + ':', size="tiny", className="sub-text"), *((e(circleitem.CircleLabel, data=x) for x in circles)) if circles else []), e( ui.List.Item, h("span", tr(this, "general.db-item-collection", "Collection") + ':', size="tiny", className="sub-text"), *(e(ui.Label, x.js_name) for x in t.gallery.collections)), e( ui.List.Item, h("span", tr(this, "ui.t-language", "Language") + ':', size="tiny", className="sub-text"), *([ e(ui.Label, t.gallery.language.js_name) ] if t.gallery.language else [])), e( ui.List.Item, h("span", tr(this, "ui.t-pages", "Pages") + ': ', size="tiny", className="sub-text"), t.page_count), horizontal=True, relaxed=True, divided=True, ), *((e(ui.Label, e(ui.Icon, js_name="checkmark"), tr(this, "ui.t-metadata-file", "Metadata file"), title=tr(this, "ui.t-metadata-from-file", "Metadata was retrieved from file"), color="green", basic=True, className="right", size="small"), ) if t.metadata_from_file else []), e(ui.Divider, hidden=True, clearing=True), )), ), ) options_el = e( ui.Segment, e( ui.Form, e( ui.Form.Group, e( ui.Form.Checkbox, toggle=True, label=tr(this, "ui.t-add-to-inbox", "Add to inbox"), checked=this.state['gallery.add_to_inbox'] if utils.defined(this.state['gallery.add_to_inbox']) else this.state.config['gallery.add_to_inbox'] if utils.defined( this.state.config['gallery.add_to_inbox']) else False, onChange=this.on_add_to_inbox, ), e( ui.Form.Checkbox, toggle=True, label=tr(this, "ui.t-scan-for-new-galleries", "Only show new"), checked=not ( this.state['scan.skip_existing_galleries'] if utils.defined( this.state['scan.skip_existing_galleries']) else not this.state.config['scan.skip_existing_galleries'] if utils.defined( this.state.config['scan.skip_existing_galleries']) else False), onChange=this.on_only_new, ), inline=True, ), ), secondary=True) return h( "div", e(TitleChange, title=tr(this, "ui.mi-scan", "Scan")), e( ui.Container, e( ui.Message, e("div", dangerouslySetInnerHTML={ '__html': utils.marked(tr(this, "ui.de-scan-info", "")) })), e(ui.Divider, hidden=True), e( ui.Form, e( ui.Form.Group, e( ui.Form.Input, width=16, fluid=True, action=tr(this, "ui.mi-scan", "Scan"), placeholder=tr(this, "", "Directory"), onChange=this.set_path, ), ), onSubmit=this.on_scan_submit, ), options_el, e( ui.Form, *([ e(ui.Divider, e(ui.Button, tr(this, "ui.t-submit", "Submit"), disabled=submitted_view_data, primary=True, js_type="submit"), horizontal=True) ] if view_data and view_data['items'] else []), *view_progress_el, e( ui.Grid, *([e(ui.Label, title, attached="top")] if title else []), e( ui.Dimmer, e( ui.Loader, e(ui.Statistic, e(ui.Statistic.Value, "{}%".format(int(percent))), e(ui.Statistic.Label, progress_text), inverted=True, size="mini"), ), active=this.state.loading, ), e(ui.Divider, hidden=True), *count_el, *pages_el, e( ui.Grid.Row, e( ui.Grid.Column, e(ui.List, *items, relaxed=True, divided=True, animated=True), ), ), *pages_el, *count_el, as_=ui.Segment, loading=this.state.view_loading, secondary=True, className="min-300-h", ), *([ e(ui.Divider, e(ui.Button, tr(this, "ui.t-submit", "Submit"), disabled=submitted_view_data, primary=True, js_type="submit"), horizontal=True) ] if view_data and view_data['items'] else []), onSubmit=this.on_view_submit, ), ))
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 })