Exemplo n.º 1
0
def thumbnail_get_thumb(data=None, error=None):
    if not this.mounted:
        return
    if data is not None and not error:
        cmd_id = data[str(this.props.item_id)]
        if cmd_id:
            cmd = Command(cmd_id)
            this.setState({'active_cmd': cmd})
            cmd.set_callback(this.set_thumb)
            cmd.poll_until_complete(500)
    elif error:
        pass
    else:
        if this.state.active_cmd:
            this.state.active_cmd.stop()
            this.setState({'active_cmd': None})
        if this.props.item_id and this.props.size_type and this.props.item_type:
            client.call_func("get_image",
                             this.get_thumb,
                             item_ids=[this.props.item_id],
                             size=this.props.size_type,
                             url=True,
                             uri=True,
                             item_type=this.props.item_type)
            s = {'loading': True}
            if this.state.placeholder:
                s['img'] = this.state.placeholder
            this.setState(s)
Exemplo n.º 2
0
def get_similar(data=None, error=None):
    if data is not None and not error:
        cmd = Command(data)
        cmd.poll_until_complete(1000)
        cmd.poll_progress(callback=this.get_similar_progress)
        cmd.set_callback(this.get_similar_value)

    elif error:
        state.app.notif("Failed to fetch similar galleries ({})".format(
            this.state.id),
                        level="error")
Exemplo n.º 3
0
def get_thumbs(data=None, error=None, other=None):
    if data is not None and not error:
        this.cmd_data = data
        cmd = Command(list(dict(data).values()))
        cmd.set_callback(this.set_thumbs)
        cmd.poll_until_complete(500)
    elif error:
        pass
    else:
        if other:
            item_ids = [x.id for x in other]
            client.call_func("get_image", this.get_thumbs,
                             item_ids=item_ids,
                             size=this.state.image_size, url=True, uri=True,
                             item_type=this.state.item_type)