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 description_render(): data = this.props.data or this.state.data el = None if this.props.edit_mode: el = h("div", e(simpleprops.EditText, update_data=this.props.update_data, data_key=this.props.data_key, defaultValue=data, edit_mode=this.props.edit_mode, fluid=utils.defined_or(this.props.fluid, True), as_=ui.TextArea), className="ui form") else: el = e(ui.Header, data, size="tiny", className="sub-text") return el
def PrefSegment(props): return e( ui.Segment, e(ui.Form, props.children), e(ui.Divider, horizontal=True), e(ui.Message, h( "p", tr( props.props.tab, "ui.t-setting-restart", "One or more setting modifications require a restart to take effect" )), warning=True, size="tiny", hidden=not props.props.restart), basic=True, )
def urls_render(): data = this.props.data or this.state.data els = [] if data: for n, u in enumerate(data): if this.props.edit_mode: u_el = e(EditText, defaultValue=u.js_name, defaultOpen=not bool(u.js_name), edit_mode=this.props.edit_mode, update_data=this.on_update, data_id=n, fluid=True) else: u_el = h("a", u.js_name, href=u.js_name, target="_blank") els.append(e(ui.List.Item, e(ui.List.Icon, js_name="external share") if not this.props.edit_mode else e(ui.List.Icon, js_name="remove", onClick=this.on_remove, link=True, **{'data-id': n}), e(ui.List.Content, u_el, className="fullwidth", ), key=n + u.js_name) ) if this.props.edit_mode: els.append(e(ui.List.Item, e(ui.List.Icon, js_name="plus", onClick=this.on_create_item, color="green", link=True), key="new") ) return e(ui.List, this.props.children if this.props.children else els, size=this.props.size, relaxed=this.props.relaxed, className=this.props.className, as_=this.props.as_)
'set_msg_to': lambda msg: this.setState({'to_server': msg}), 'set_msg_from': lambda msg: this.setState({'from_server': msg}), 'render': lambda: e( ui.Segment, e(TitleChange, title="API"), e( ui.Grid.Column, e( ui.Message, e(ui.Message.Header, tr(this, "ui.h-server-comm", "Server Communication")), h(ui.Message.Content, tr(this, "ui.t-server-comm-tutorial", "..."), style={"whiteSpace": "pre-wrap"}), info=True, ), e(ui.Divider), e(ApiForm, to_server=this.set_msg_to, from_server=this.set_msg_from), e(ui.Divider), e(LabelAccordion, formatted_json(this.state['to_server']), label=tr(this, "ui.t-message", "Message"), default_open=True), e(LabelAccordion, formatted_json(this.state['from_server']), label=tr(this, "ui.t-response", "Response"),
def titles_render(): data = this.props.data or this.state.data pref_el = [] pref_title = "" if this.props.preferred and not this.props.edit_mode: pref_title = this.props.preferred.js_name pref_el.append( e( ui.Table.Row, e(ui.Table.Cell, e(ui.Header, pref_title, size="medium"), colSpan="2", textAlign="center"), )) els = [] if data: for n, t in enumerate(data): if t.js_name == pref_title and not this.props.edit_mode: continue els.append( e( ui.Table.Row, e(ui.Table.Cell, e(simpleprops.Language, data_id=n, update_data=this.update_language, edit_mode=this.props.edit_mode, data=t.language, size="tiny", className="sub-text" if not this.props.edit_mode else ""), collapsing=True), e( ui.Table.Cell, e(ui.Header, h("span", e(ui.Icon, js_name="remove", onClick=this.on_remove, link=True, **{'data-id': n}), className="right") if this.props.edit_mode else None, e(simpleprops.EditText, defaultValue=t.js_name, defaultOpen=not bool(t.js_name), edit_mode=this.props.edit_mode, update_data=this.update_title, data_id=n, fluid=True), size="tiny", className="sub-text" if not this.props.edit_mode else "")), key=n + t.js_name, )) if this.props.edit_mode: els.append( e( ui.Table.Row, e( ui.Table.Cell, e(ui.Header, h("span", e(ui.Icon, color="green", js_name="plus", onClick=this.on_create_item, link=True), className="right"), size="tiny"), #e(ui.Icon, js_name="plus", color="green"), colSpan="2"), key="add")) return e(ui.Table, *pref_el, this.props.children if this.props.children else els, size=this.props.size, basic="very", className=this.props.className, as_=this.props.as_)
def tagprops_render(): ns = this.props.namespace or this.state.namespace or "" tag = this.props.tag or this.state.tag or "" if ns == "__namespace__": ns = "" fav = 0 description = "" if tag: description = tr(this, "tag.{}".format(tag), "") rows = [] rows.append( e( ui.Table.Row, e(ui.Table.Cell, e(ui.Header, e(ui.Header.Subheader, ns), tag, size="medium"), colSpan="2", textAlign="center", verticalAlign="middle"))) rows.append( e( ui.Table.Row, e(ui.Table.Cell, h("span", description, className="sub-text"), colSpan="2"))) if ns: url_search_query = {'search': '"{}":"{}"'.format(ns, tag)} else: url_search_query = {'search': '"{}"'.format(tag)} # if fav: # lbl_args['icon'] = "star" #e(ui.Rating, icon="heart", size="massive", rating=fav) return e( ui.Grid, e( ui.Grid.Row, e(ui.Grid.Column, e(ui.Rating, icon="heart", size="huge", rating=fav), floated="left", verticalAlign="middle", width=2), e(ui.Grid.Column, e( ui.Button.Group, 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)), basic=True, size="tiny", ), textAlign="right", width=14, 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", ), )), )
def pref_advanced(props): cfg = props.cfg #u_cfg = props.u_cfg items = [] if defined(cfg.core): if defined(cfg.core.debug): items.append( e( ui.Form.Field, e( ui.Checkbox, toggle=True, label=tr(props.tab, "ui.t-run-in-debug", "Run in debug mode"), defaultChecked=cfg.core.debug, onChange=lambda e, d: props.upd( "core.debug", d.checked), ))) if defined(cfg.core.report_critical_errors): items.append( e( ui.Form.Field, e( ui.Checkbox, toggle=True, label=tr( props.tab, "ui.t-send-critical-error", "Send occurring critical errors to me (creator) so I can fix them faster (contains no sensitive information)" ), defaultChecked=cfg.core.report_critical_errors, onChange=lambda e, d: props.upd( "core.report_critical_errors", d.checked), ))) if defined(cfg.core.unrar_tool_path): items.append( e( ui.Form.Group, e(ui.Form.Input, width=16, label=tr(props.tab, "ui.t-path-to-unrar", "Path to unrar tool"), placeholder=tr(props.tab, "", "unrar"), defaultValue=cfg.core.unrar_tool_path, onChange=lambda e: props.upd("core.unrar_tool_path", e. target.value)))) if defined(cfg.core.check_new_releases): items.append( e(ui.Header, tr(props.tab, "ui.h-updates", "Updates"), size="small", dividing=True)) items.append( e( ui.Form.Field, e( ui.Checkbox, toggle=True, label=tr(props.tab, "ui.t-check-for-update", "Regularly check for new releases"), defaultChecked=cfg.core.check_new_releases, onChange=lambda e, d: props.upd( "core.check_new_releases", d.checked), ))) if defined(cfg.core.check_release_interval): items.append( e( ui.Form.Field, h( "label", tr( props.tab, "ui.t-update-interval", "Interval in minutes between checking for a new release, set 0 to only check once every startup" )), e( ui.Input, width=4, js_type="number", defaultValue=cfg.core.check_release_interval, onChange=lambda e, d: props.upd( "core.check_release_interval", int(e.target.value) ), ))) if defined(cfg.core.allow_beta_releases): items.append( e( ui.Form.Field, e( ui.Checkbox, toggle=True, label=tr(props.tab, "ui.t-update-beta", "Allow downloading beta releases"), defaultChecked=cfg.core.allow_beta_releases, onChange=lambda e, d: props.upd( "core.allow_beta_releases", d.checked), ))) if defined(cfg.core.allow_alpha_releases): items.append( e( ui.Form.Field, e( ui.Checkbox, toggle=True, label=tr(props.tab, "ui.t-update-alpha", "Allow downloading alpha releases"), defaultChecked=cfg.core.allow_alpha_releases, onChange=lambda e, d: props.upd( "core.allow_alpha_releases", d.checked), ))) if state.debug: items.append( e( ui.Form.Field, e( ui.Checkbox, toggle=True, label=tr(props.tab, "ui.t-ping-for-notifications", "Ping for notifications"), defaultChecked=utils.storage.get("ping_for_notifications", True), onChange=lambda e, d: utils.storage.set( "ping_for_notifications", d.checked), ))) return e(PrefSegment, *items, props=props)
def sidebar_nav_render(): if this.props.mobile: 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("", position="left", handler=this.props["toggler"], content=e(ui.Icon, className="hpx-alternative huge left"))) items.append( MenuItem("Manage", "ui.mi-manage", icon="plus square outline", url="/manage", position="left", handler=this.props["toggler"])) #items.append(MenuItem("Dashboard", "ui.mi-dashboard", icon="home", url="/dashboard", handler=this.props["toggler"])) items.append( MenuItem("Favorites", "ui.mi-favorites", icon="heart", url="/favorite", handler=this.props["toggler"])) items.append( MenuItem("Library", "ui.mi-browse", icon="grid layout", url="/library", handler=this.props["toggler"])) items.append( MenuItem("directory", "ui.mi-directory", icon="cubes", url="/directory", handler=this.props["toggler"])) # Note: Artists, Tags, Etc. Able to favorite artists and tags items.append( MenuItem("Activity", "ui.mi-activity", icon="tasks", url="/activity", handler=this.props["toggler"])) pref_item = MenuItem("Preferences", "ui.mi-preferences", modal=[ e( ui.Modal.Content, e(ui.Header, icon="settings", content=tr(this, "ui.mi-preferences", "Preferences")), e(preferences.PrefTab), ), ], icon="settings", position="right", handler=this.props["toggler"]) items.append(pref_item) about_item = MenuItem("About", "ui.mi-about", modal=[ e( ui.Modal.Content, e(ui.Header, icon="info", content=tr(this, "ui.mi-about", "About")), e(about.AboutTab), ) ], icon="info", position="right", handler=this.props["toggler"]) items.append(about_item) 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 content = tr(this, x.t_id, menu_name) if x.content is None else x.content item_children = [] if menu_icon: item_children.append( e(ui.Icon, js_name=menu_icon, className="left", size=icon_size)) item_children.append(content 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, icon=not menu_name, **as_link) if x.modal: menu_el = e(ui.Modal, *x.modal, trigger=menu_el, dimmer="inverted", closeIcon=True, onClose=x.on_modal_close, onOpen=x.on_modal_open, centered=False, className="min-400-h") container.append(menu_el) 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)
def Itemviewvonfig_render(): props = this.props cfg_suffix = props.suffix or "" infinite_scroll_cfg = "infinite_scroll" item_count_cfg = "item_count" external_viewer_cfg = "external_viewer" group_gallery_cfg = "group_gallery" blur_cfg = "blur" default_sort_cfg = "def_sort_idx" default_sort_order_cfg = "def_sort_order" default_view_cfg = "def_view_type" item_count_options = [ { 'key': 10, 'text': '10', 'value': 10 }, { 'key': 20, 'text': '20', 'value': 20 }, { 'key': 30, 'text': '30', 'value': 30 }, { 'key': 40, 'text': '40', 'value': 40 }, { 'key': 50, 'text': '50', 'value': 50 }, { 'key': 75, 'text': '75', 'value': 75 }, { 'key': 100, 'text': '100', 'value': 100 }, { 'key': 125, 'text': '125', 'value': 125 }, { 'key': 150, 'text': '150', 'value': 150 }, { 'key': 200, 'text': '200', 'value': 200 }, { 'key': 250, 'text': '250', 'value': 250 }, #{'key': 300, 'text': '300', 'value': 300}, #{'key': 400, 'text': '400', 'value': 400}, #{'key': 500, 'text': '500', 'value': 500}, ] ext_viewer_el = [] if utils.is_same_machine(): ext_viewer_el.append( e( ui.Form.Field, control=ui.Checkbox, label=tr(this, "ui.t-open-external-viewer", "Open in external viewer"), toggle=True, defaultChecked=utils.storage.get( external_viewer_cfg + cfg_suffix, False), onChange=lambda e, d: all( (props.on_external_viewer(e, d), utils.storage.set(external_viewer_cfg + cfg_suffix, d. checked))), )) grp_gallery_el = [] if props.item_type in (ItemType.Gallery, ItemType.Grouping): grp_gallery_el.append( e( ui.Form.Field, control=ui.Checkbox, label=tr(this, "ui.t-group-galleries", "Gallery Series"), toggle=True, defaultChecked=utils.storage.get( group_gallery_cfg + cfg_suffix, False), onChange=lambda e, d: all( (props.on_group_gallery(e, d), utils.storage.set(group_gallery_cfg + cfg_suffix, d. checked))), )) sort_el = [] if props.item_type != ItemType.Page: sort_el.append( e( ui.Form.Field, h("label", tr(this, "ui.t-default-sort", "Default sorting")), e(item.SortDropdown, query=False, item_type=props.item_type, defaultValue=utils.storage.get(default_sort_cfg + props.item_type + cfg_suffix), on_change=lambda e, d: utils.storage.set( default_sort_cfg + props.item_type + cfg_suffix, d.value) )), ) sort_order_el = [] sort_order_el.append( e(ui.Form.Select, label=h("label", tr(this, "ui.t-default-sort-order", "Default sort order")), options=[{ 'key': 0, 'text': tr(this, "ui.t-ascending", "Ascending"), 'value': 0 }, { 'key': 1, 'text': tr(this, "ui.t-descending", "Descending"), 'value': 1 }], defaultValue=utils.storage.get(default_sort_order_cfg + cfg_suffix, 0), onChange=lambda e, d: utils.storage.set( default_sort_order_cfg + cfg_suffix, d.value)), ) view_el = [] if props.item_type != ItemType.Page: view_el.append( e( ui.Form.Field, h("label", tr(this, "ui.t-default-view", "Default view")), e(item.ViewDropdown, query=False, view_type=props.view_type if props.view_type == ViewType.Favorite else js_undefined, defaultValue=utils.storage.get(default_view_cfg + cfg_suffix), item=True, selection=True, on_change=lambda e, d: utils.storage.set( default_view_cfg + cfg_suffix, d.value))), ) return e( ui.Sidebar, e( ui.Form, *grp_gallery_el, e( ui.Form.Field, control=ui.Checkbox, label=tr(this, "ui.t-infinite-scroll", "Infinite Scroll"), toggle=True, defaultChecked=utils.storage.get( infinite_scroll_cfg + cfg_suffix, False), onChange=lambda e, d: all( (props.on_infinite_scroll(e, d), utils.storage.set(infinite_scroll_cfg + cfg_suffix, d. checked))), ), e( ui.Form.Field, control=ui.Checkbox, label=tr(this, "ui.t-blur", "Blur"), toggle=True, defaultChecked=utils.storage.get(blur_cfg + cfg_suffix, False), onChange=lambda e, d: all( (props.on_blur(e, d), utils.storage.set(blur_cfg + cfg_suffix, d.checked))), ), *ext_viewer_el, e( ui.Form.Select, options=item_count_options, label=tr(this, "ui.t-items-per-page", "Items per page"), inline=True, defaultValue=utils.storage.get(item_count_cfg + cfg_suffix, props.default_item_count or 30), onChange=lambda e, d: all( (props.on_item_count(e, d), utils.storage.set(item_count_cfg + cfg_suffix, d.value))), ), *sort_el, *sort_order_el, *view_el, e(ui.Form.Field, tr(this, "ui.b-close", "Close"), control=ui.Button), onSubmit=props.on_close, ), as_=ui.Segment, size="small", basic=True, visible=props.visible, direction="right", animation="push", )
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, className="secondary" if (this.props.transparent if utils.defined(this.props.transparent) else True) else "", placeholder=tr(this, "ui.t-search-main-placeholder", "Search title, artist, namespace & tags"), label=e( Identity, e( "div", 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, ), e(ui.Icon, js_name="remove", link=True, onClick=this.search_empty) if this.state.query else None)), icon={ 'name': 'search', 'link': True, 'onClick': this.on_search }, ), minCharacters=3, fluid=this.props.fluid, open=this.state.suggest if not this.state.suggest else js_undefined, onSearchChange=this.on_search_change, value=this.state.query), className=cls_name, onSubmit=this.on_search)
search_render }) __pragma__("tconv") ViewOptions = createReactClass({ 'displayName': 'ViewOptions', 'getInitialState': lambda: { 'page': 0, 'limit': 50, 'infinitescroll': False, 'items': [], "element": None, "loading": True }, 'render': lambda: h("div") }) def itembuttons_change(e, d): if this.props.query: utils.go_to(this.props.history, query={'item_type': d.value}, push=False) if this.props.on_change: this.props.on_change(e, d) def itembuttons_render(): ch = this.props.children if not isinstance(ch, list):
def galleryprops_render(): title = "" rating = this.props.rating artists = [] item_id = this.props.id info = "" read_count = 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 tags = this.props.tags titles = [] if this.props.data: if this.props.data.id: item_id = this.props.data.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.read_count: read_count = 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 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.urls: for u in this.props.data.urls: urls.append(u.js_name) if not utils.defined(rating) and this.props.data.rating: rating = this.props.data.rating status = status.js_name if status else tr(this, "ui.t-unknown", "Unknown") language = language.js_name if language else tr(this, "ui.t-unknown", "Unknown") 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"))) if this.props.compact: rows.append( e( ui.Table.Row, e( ui.Table.Cell, e(DateLabel, tr(this, "ui.t-date-added", "Date added"), timestamp=date_added, format="LLL"), e(DateLabel, tr(this, "ui.t-last-read", "Last read"), timestamp=date_read, format="LLL"), e(DateLabel, tr(this, "ui.t-last-updated", "Last updated"), timestamp=date_upd, format="LLL"), 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(artistitem.ArtistLabel, data=x) for x in artists)))) if circles: 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(circleitem.CircleLabel, data=x) for x in circles)))) if parodies: 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(parodyitem.ParodyLabel, data=x) for x in parodies)))) 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, language))) 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, 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(ui.Label, tr(this, "general.db-status-{}".format(status.lower()), status), color={ "completed": "green", "ongoing": "orange", "unreleased": "red", "unknown": "grey" }.get(status.lower(), "blue"))))) 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)))) 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(ui.Label, read_count, circular=True)))) 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, 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-url", "URL") + ':', size="tiny", className="sub-text"), 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 ], size="small", relaxed=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 gallery_render(): fav = 0 title = "" rating = 0 urls = [] artist_names = [] item_id = this.state.id inbox = False data = this.state.data if data: if data.rating: rating = data.rating if data.preferred_title: title = data.preferred_title.js_name if data.metatags: inbox = data.metatags.inbox if data.metatags.favorite: fav = 1 if not item_id and data.id: item_id = data.id if data.artists: for a in data.artists: if len(a.names) > 0: artist_names.append(a.names[0].js_name) if data.urls: for u in data.urls: urls.append(u.js_name) gallery_url = '/item/gallery/' + str(item_id) add_cls = this.props.className or "" link = True if not this.props.link == js_undefined: link = this.props.link read_button_args = {} read_button_args['onClick'] = this.on_read if not this.props.external_viewer: read_button_args['as'] = Link read_button_args['to'] = "/item/gallery/{}/page/1".format(item_id) thumb = e(thumbitem.Thumbnail, item_id=item_id, centered=True, blur=this.props.blur, item_type=this.state.item_type, size_type=this.props.size_type if this.props.size_type else ImageSize.Medium, size=this.props.size, dimmer=e(ui.Dimmer, active=this.state.dimmer, content=e(ui.Responsive, e(ui.List, e(ui.List.Item, e(ui.Button, e(ui.Icon, js_name="envelope open outline"), tr(this, "ui.b-read", "Read"), primary=True, size="tiny", **read_button_args)), e(ui.List.Item, e(ui.Button, e(ui.Icon, js_name="bookmark outline"), tr(this, "ui.b-save-later", "Save for later"), size="tiny") if not inbox else e(ui.Button, e(ui.Icon, js_name="grid layout"), tr(this, "ui.b-send-library", "Send to library"), onClick=this.send_to_library, color="green", size="tiny")), ), minWidth=900, ), inverted=True), ) if link: thumb = e(Link, thumb, to={'pathname': gallery_url, 'state': {'gallery': data}, }) menu_options = [] menu_options.append(e(ui.List.Item, content=tr(this, "ui.b-read", "Read"), icon="envelope open outline", **read_button_args)) menu_options.append(e(ui.List.Item, content=tr(this, "ui.b-save-later", "Save for later"), icon="bookmark outline", onClick=this.read_later)) if inbox: menu_options.append(e(ui.List.Item, content=tr( this, "ui.b-send-library", "Send to library"), onClick=this.send_to_library, icon="grid layout")) menu_options.append(e(ui.List.Item, content=tr(this, "ui.b-add-to-filter", "Add to filter"), icon="filter")) menu_options.append(e(ui.List.Item, content=tr(this, "ui.b-add-to-collection", "Add to collection"), icon="plus square outline")) menu_options.append(e(ui.List.Item, content=tr(this, "ui.b-add-to-series", "Add to series"), icon="add square")) menu_options.append(e(ui.List.Item, content=tr(this, "ui.b-send-trash", "Send to Trash"), icon="trash", onClick=this.send_to_trash)) return e(ui.Card, e(ui.Dimmer.Dimmable, h("div", thumb, e(ui.Rating, icon="heart", onRate=this.favorite, size="massive", className="card-item top left above-dimmer", rating=fav), *([e(ui.Icon, js_name="inbox", title=tr(this, "ui.t-inboxed-gallery", "This gallery is in your inbox"), bordered=True, inverted=True, className="card-item top right above-dimmer")] if inbox else []), e(ui.Popup, e(ui.Rating, icon="star", defaultRating=rating, maxRating=10, clearable=True, className=""), trigger=e( ui.Label, rating, className="card-item bottom left above-dimmer", size="large", color="yellow", as_="a"), hoverable=True, on="click", hideOnScroll=True, position="left center", ), e(ui.Popup, e(ui.List, *menu_options, selection=True, relaxed=True), trigger=e(ui.Icon, js_name="ellipsis vertical", bordered=True, link=True, className="card-item bottom right above-dimmer", inverted=True), hoverable=True, on="click", hideOnScroll=True, position="right center", ), className="card-content", ), dimmed=this.state.dimmer, onMouseEnter=this.dimmer_show, onMouseLeave=this.dimmer_hide, ), e(ui.Modal, e(ui.Modal.Content, e(gallerypropsview.GalleryProps, compact=True, data=data, rating=rating, tags=this.state.tags, on_tags=this.on_tags, size="small"), ), 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 artist_names], className="text-ellipsis"), ), # dimmer="inverted", size="small", closeOnDocumentClick=True, closeIcon=True, centered=False, ), centered=this.props.centered, className=add_cls, # color="pink", link=True)
def pref_view(props): cfg = props.cfg #u_cfg = props.u_cfg items = [] if defined(cfg.client): __pragma__('tconv') __pragma__('jsiter') if state.locales: locale_options = [] for l in state.locales: locale_options.append({ 'key': l, 'value': l, 'text': state.locales[l]['locale'] }) items.append( e( ui.Form.Select, options=locale_options, defaultValue=cfg.client.translation_locale, label=tr(props.tab, "ui.t-language", "Language"), onChange=lambda e, d: all( (utils.storage.set("locale", d.value), props.upd("client.translation_locale", d.value), client.set_locale(d.value), client.get_translations(locale=d.value))), )) items.append( h( "p", h("a", tr( props.tab, "ui.t-help-translate", "Not satisfied with the translation? Consider helping out" ), href="https://happypandax.github.io/translation.html", target="_blank"))) if state.debug: items.append( e( ui.Form.Field, e( ui.Checkbox, toggle=True, label=tr(props.tab, "ui.t-untranslated-text", "Show untranslated text"), defaultChecked=state.untranslated_text, onChange=set_untranslated_text, ))) items.append( e( ui.Form.Field, e( ui.Checkbox, toggle=True, label=tr(props.tab, "ui.t-translation-id-error", "Error on invalid translation ID"), defaultChecked=state.translation_id_error, onChange=set_translation_error, ))) __pragma__('nojsiter') __pragma__('notconv') return e(PrefSegment, *items, props=props)
def formatted_json(msg): return h('pre', dangerouslySetInnerHTML={'__html': msg}, className="overflow-auto")
def collection_render(): title = "" item_id = this.state.id fav = 0 data = this.props.data or this.state.data if this.state.data: title = this.state.data.js_name if not item_id: item_id = this.state.data.id if this.state.data.metatags.favorite: fav = 1 cls_name = "segment piled" if this.props.className: cls_name += ' ' + this.props.className collection_url = '/item/collection/' + str(item_id) link = True if not this.props.link == js_undefined: link = this.props.link thumb = e( thumbitem.Thumbnail, item_id=item_id, centered=True, blur=this.props.blur, item_type=this.state.item_type, size_type=this.props.size_type if this.props.size_type else ImageSize.Medium, ) if link: thumb = e(Link, thumb, to={ 'pathname': collection_url, 'state': { 'collection': data }, }) return e( ui.Card, h( "div", thumb, e(ui.Rating, icon="heart", size="massive", className="card-item top left above-dimmer", rating=fav), e( ui.Popup, e(ui.List, [], selection=True, relaxed=True), trigger=e(ui.Icon, js_name="ellipsis vertical", bordered=True, link=True, className="card-item bottom right above-dimmer", inverted=True), hoverable=True, hideOnScroll=True, on="click", position="right center", ), className="card-content", ), e( ui.Card.Content, e(ui.Card.Header, title, className="text-ellipsis card-header"), ), centered=this.props.centered, # color="purple", className=cls_name, link=True)
def tagspage_render(): tag_lbl = [] nstags = this.state.data if nstags.__namespace__: # somehow transcrypt ignores this in the loop below tags = sorted([x.js_name for x in nstags.__namespace__]) for t in tags: tag_lbl.append( e( ui.Modal, e( ui.Modal.Content, e(tagpropsview.TagProps, tag=t, namespace=""), ), trigger=e(ui.Card, e(ui.Card.Content, e(ui.Card.Description, t)), centered=True, link=True, className="default-card"), dimmer="inverted", size="small", closeOnDocumentClick=True, closeIcon=True, )) for ns in sorted(dict(nstags).keys()): tags = [x.js_name for x in nstags[ns]] for t in sorted(tags): tag_lbl.append( e( ui.Modal, e( ui.Modal.Content, e(tagpropsview.TagProps, tag=t, namespace=ns), ), trigger=e(ui.Card, e( ui.Card.Content, e(ui.Card.Description, h("span", ns + ':', className="sub-text"), t)), centered=True, link=True, className="default-card"), dimmer="inverted", size="small", closeOnDocumentClick=True, closeIcon=True, )) return e(SimpleLayout, e(TitleChange, title=tr(this, "ui.mi-dir-tags", "Tags")), e( ui.Card.Group, *tag_lbl, itemsPerRow=4, doubling=True, stackable=True, as_=ui.Transition.Group, animation="scale", duration=500, ), loading=this.state.data_loading, pages=True, item_count=this.state.count, limit=this.state.limit, page=this.state.page, set_page=this.set_page, search=True, search_query=this.state.search_query, search_change=this.update_search, search_placeholder=tr(this, "ui.t-search-tags-placeholder", "Search tags"), stats=[ e( ui.Statistic, e(ui.Statistic.Value, this.state.count), e(ui.Statistic.Label, tr(this, "ui.t-total-tags", "Total Tags"))) ])
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 artistprops_render(): name = "" fav = 0 nstags = this.props.tags or this.state.tags or {} data = this.props.data or this.state.data urls = [] circles = [] if data: if data.names: name = data.names[0].js_name if data.metatags.favorite: fav = 1 for u in data.urls: urls.append(u.js_name) if data.circles: for c in data.circles: circles.append(c) tag_lbl = [] if nstags.__namespace__: # somehow transcrypt ignores this in the loop below tags = sorted([x.js_name for x in nstags.__namespace__]) for t in tags: tag_lbl.append(e(tagitem.TagLabel, tag=t)) for ns in sorted(dict(nstags).keys()): tags = [x.js_name for x in nstags[ns]] for t in tags: tag_lbl.append( e(tagitem.TagLabel, namespace=ns, tag=t, show_ns=True)) lbl_args = {'content': name} if fav: lbl_args['icon'] = "star" rows = [] rows.append( e( ui.Table.Row, e(ui.Table.Cell, e(ui.Header, name, size="medium"), colSpan="2", textAlign="center", verticalAlign="middle"))) if circles: 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(circleitem.CircleLabel, data=x) for x in circles)))) rows.append( e( ui.Table.Row, e(ui.Table.Cell, e(ui.Header, tr(this, "ui.t-galleries", "Galleries") + ":", size="tiny", className="sub-text"), collapsing=True), e(ui.Table.Cell, this.state.gallery_count))) if urls: rows.append( e( ui.Table.Row, e(ui.Table.Cell, e(ui.Header, tr(this, "ui.t-url", "URL") + ":", size="tiny", className="sub-text"), collapsing=True), e( ui.Table.Cell, *[ 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 ]))) slider_el = [] # slider_el.append(e(ui.Grid.Row, e(ui.Grid.Column, # e(Slider, *[e(galleryitem.Gallery, data=x) for x in series_data], # loading=this.state.loading_group, # secondary=True, # sildesToShow=4, # label="Series"), # ))) url_search_query = {'search': 'artist:"{}"'.format(name)} return e( ui.Grid, e( ui.Grid.Row, e(ui.Grid.Column, e(ui.Rating, icon="heart", size="huge", rating=fav), floated="left", verticalAlign="middle", width=2), e(ui.Grid.Column, e( ui.Button.Group, 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)), basic=True, size="tiny", ), width=14, textAlign="right", verticalAlign="top"), ), e( ui.Grid.Row, e( ui.Grid.Column, e( ui.Table, e(ui.Table.Body, *rows), basic="very", size="small", compact="very", ), )), e(ui.Grid.Row, e(ui.Grid.Column, e( ui.Segment, e(ui.Label, tr(this, "ui.t-most-common-tags", "Most common tags"), attached="top"), e(ui.Label.Group, *tag_lbl), basic=True, ), width=16), columns=1), *slider_el, )
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, ), ))
def page_render(): els = [] if state['guest_allowed']: els.append( e(ui.Button, tr(this, "ui.t-continue-as-guest", "Connect as guest"), fluid=True, primary=True, onClick=this.as_guest)) els.append(e(ui.Divider, tr(this, "ui.t-or", "Or"), horizontal=True)) return e( ui.Grid, e(TitleChange, title=tr(this, "ui.t-login", "Login")), e(ui.Grid.Row), e( ui.Grid.Row, e( ui.Grid.Column, e( ui.Segment, this.props.children, h("center", e(ui.Icon, className="hpx-standard", size="massive")), e(ui.Divider, hidden=True, horizontal=True), *els, e( ui.Form, e( ui.Form.Input, label=tr(this, "ui.t-username", "Username"), placeholder="default", onChange=this.set_user, error=not this.state.accepted if defined( this.state.accepted) else this.state.accepted, ), e( ui.Form.Input, label=tr(this, "ui.t-password", "Password"), js_type="password", placeholder="default", onChange=this.set_pass, error=not this.state.accepted if defined( this.state.accepted) else this.state.accepted, ), e(ui.Message, tr(this, "ui.t-wrong-credentials", "Wrong credentials!"), error=True), e(ui.Button, tr(this, "ui.b-connect", "Connect"), js_type="submit", primary=True, floated="right"), onSubmit=this.submit, loading=this.state.loading, error=not this.state.accepted if defined( this.state.accepted) else this.state.accepted, ), clearing=True, ), width="7", widescreen="3", largescreen="4", mobile="15", tablet="9", computer="7", )), e(ui.Grid.Row), verticalAlign="middle", centered=True, className="fullheight")