예제 #1
0
    def set_status(self, state: int) -> None:
        """
        Args:
            state (int):
                1 (running)
                2 (not running)
                3 (warning, stop unexpectedly)
                4 (stop for update)
                0 (hide)
                -1 (*state not changed)
        """
        if state == -1:
            return
        clear()

        if state == 1:
            put_row(
                [
                    put_loading(color="success").style("--loading-border--"),
                    None,
                    put_text(t("Gui.Status.Running")),
                ],
                size="auto 2px 1fr",
            )
        elif state == 2:
            put_row(
                [
                    put_loading(color="secondary").style("--loading-border-fill--"),
                    None,
                    put_text(t("Gui.Status.Inactive")),
                ],
                size="auto 2px 1fr",
            )
        elif state == 3:
            put_row(
                [
                    put_loading(shape="grow", color="warning").style(
                        "--loading-grow--"
                    ),
                    None,
                    put_text(t("Gui.Status.Warning")),
                ],
                size="auto 2px 1fr",
            )
        elif state == 4:
            put_row(
                [
                    put_loading(shape="grow", color="success").style(
                        "--loading-grow--"
                    ),
                    None,
                    put_text(t("Gui.Status.Updating")),
                ],
                size="auto 2px 1fr",
            )
예제 #2
0
def create_profile(df: pd.DataFrame):
    with put_loading(shape='grow'):
        report = sv.analyze(df)
        report.show_html()
    with open('SWEETVIZ_REPORT.html', 'r') as f:
        html = f.read()
        put_html(html)
예제 #3
0
 def u(state):
     if state == -1:
         return
     clear("remote_loading")
     clear("remote_state")
     clear("remote_info")
     if state in (1, 2):
         put_loading("grow", "success", "remote_loading").style(
             "--loading-grow--"
         )
         put_text(t("Gui.Remote.Running"), scope="remote_state")
         put_text(t("Gui.Remote.EntryPoint"), scope="remote_info")
         entrypoint = RemoteAccess.get_entry_point()
         if entrypoint:
             if State.electron:  # Prevent click into url in electron client
                 put_text(entrypoint, scope="remote_info").style(
                     "text-decoration-line: underline"
                 )
             else:
                 put_link(name=entrypoint, url=entrypoint, scope="remote_info")
         else:
             put_text("Loading...", scope="remote_info")
     elif state in (0, 3):
         put_loading("border", "secondary", "remote_loading").style(
             "--loading-border-fill--"
         )
         if (
             State.deploy_config.EnableRemoteAccess
             and State.deploy_config.Password
         ):
             put_text(t("Gui.Remote.NotRunning"), scope="remote_state")
         else:
             put_text(t("Gui.Remote.NotEnable"), scope="remote_state")
         put_text(t("Gui.Remote.ConfigureHint"), scope="remote_info")
         url = "http://app.azurlane.cloud" + (
             "" if State.deploy_config.Language.startswith("zh") else "/en.html"
         )
         put_html(
             f'<a href="{url}" target="_blank">{url}</a>', scope="remote_info"
         )
         if state == 3:
             put_warning(
                 t("Gui.Remote.SSHNotInstall"),
                 closable=False,
                 scope="remote_info",
             )
예제 #4
0
파일: app.py 프로젝트: niktanya/pyexplorer
def create_profile(df: pd.DataFrame = None, title: Optional[str] = 'Title'):
    profile = None
    with put_loading(shape='grow'):
        report = sv.analyze(df)
        # NOTE: Line below will take some time to complete...
        profile = report.show_html(layout='vertical')
    if profile:
        print(session_info.user_language)
        put_html(profile)
    else:
        put_markdown(t(
            r"""
                ## <p align="middle">_Errors occured analyzing the \"csv\" file._</p>
                """, r"""
                ## <p align="middle">_При анализе загруженного \"csv\" файла возникли ошибки._</p>
                """),
                     strip_indent=4)
예제 #5
0
#!/usr/bin/env python3
# vim: set fileencoding=utf-8

import pywebio.output as out

import time

i = 0

for color in ('primary', 'secondary', 'success', 'danger', 'warning', 'info',
              'light', 'dark'):
    with out.put_loading(shape='border', color=color):
        time.sleep(1)
        out.put_text(i)
        i += 1

out.put_text("Done")
예제 #6
0
#!/usr/bin/env python3
# vim: set fileencoding=utf-8

import pywebio.output as out

import time

with out.put_loading(shape='border', color='primary'):
    time.sleep(5)
    out.put_text("Done")
예제 #7
0
 def u(state):
     if state == -1:
         return
     clear('updater_loading')
     clear('updater_state')
     clear('updater_btn')
     if state == 0:
         put_loading('border', 'secondary',
                     'updater_loading').style("--loading-border-fill--")
         put_text(t('Gui.Update.UpToDate'), scope='updater_state')
         put_button(t('Gui.Button.CheckUpdate'),
                    onclick=updater.check_update,
                    color='info',
                    scope='updater_btn')
         update_table()
     elif state == 1:
         put_loading('grow', 'success',
                     'updater_loading').style("--loading-grow--")
         put_text(t('Gui.Update.HaveUpdate'), scope='updater_state')
         put_button(t('Gui.Button.ClickToUpdate'),
                    onclick=updater.run_update,
                    color='success',
                    scope='updater_btn')
         update_table()
     elif state == 'checking':
         put_loading('border', 'primary',
                     'updater_loading').style("--loading-border--")
         put_text(t('Gui.Update.UpdateChecking'), scope='updater_state')
     elif state == 'failed':
         put_loading('grow', 'danger',
                     'updater_loading').style("--loading-grow--")
         put_text(t('Gui.Update.UpdateFailed'), scope='updater_state')
         put_button(t('Gui.Button.RetryUpdate'),
                    onclick=updater.run_update,
                    color='primary',
                    scope='updater_btn')
     elif state == 'start':
         put_loading('border', 'primary',
                     'updater_loading').style("--loading-border--")
         put_text(t('Gui.Update.UpdateStart'), scope='updater_state')
         put_button(t('Gui.Button.CancelUpdate'),
                    onclick=updater.cancel,
                    color='danger',
                    scope='updater_btn')
     elif state == 'wait':
         put_loading('border', 'primary',
                     'updater_loading').style("--loading-border--")
         put_text(t('Gui.Update.UpdateWait'), scope='updater_state')
         put_button(t('Gui.Button.CancelUpdate'),
                    onclick=updater.cancel,
                    color='danger',
                    scope='updater_btn')
     elif state == 'run update':
         put_loading('border', 'primary',
                     'updater_loading').style("--loading-border--")
         put_text(t('Gui.Update.UpdateRun'), scope='updater_state')
         put_button(t('Gui.Button.CancelUpdate'),
                    onclick=updater.cancel,
                    color='danger',
                    scope='updater_btn',
                    disabled=True)
     elif state == 'reload':
         put_loading('grow', 'success',
                     'updater_loading').style("--loading-grow--")
         put_text(t('Gui.Update.UpdateSuccess'), scope='updater_state')
         update_table()
     elif state == 'finish':
         put_loading('grow', 'success',
                     'updater_loading').style("--loading-grow--")
         put_text(t('Gui.Update.UpdateFinish'), scope='updater_state')
         update_table()
     elif state == 'cancel':
         put_loading('border', 'danger',
                     'updater_loading').style("--loading-border--")
         put_text(t('Gui.Update.UpdateCancel'), scope='updater_state')
         put_button(t('Gui.Button.CancelUpdate'),
                    onclick=updater.cancel,
                    color='danger',
                    scope='updater_btn',
                    disabled=True)
     else:
         put_text("Something went wrong, please contact develops",
                  scope='updater_state')
         put_text(f"state: {state}", scope='updater_state')
예제 #8
0
 def u(state):
     if state == -1:
         return
     clear("updater_loading")
     clear("updater_state")
     clear("updater_btn")
     if state == 0:
         put_loading("border", "secondary",
                     "updater_loading").style("--loading-border-fill--")
         put_text(t("Gui.Update.UpToDate"), scope="updater_state")
         put_button(
             t("Gui.Button.CheckUpdate"),
             onclick=updater.check_update,
             color="info",
             scope="updater_btn",
         )
         update_table()
     elif state == 1:
         put_loading("grow", "success",
                     "updater_loading").style("--loading-grow--")
         put_text(t("Gui.Update.HaveUpdate"), scope="updater_state")
         put_button(
             t("Gui.Button.ClickToUpdate"),
             onclick=updater.run_update,
             color="success",
             scope="updater_btn",
         )
         update_table()
     elif state == "checking":
         put_loading("border", "primary",
                     "updater_loading").style("--loading-border--")
         put_text(t("Gui.Update.UpdateChecking"), scope="updater_state")
     elif state == "failed":
         put_loading("grow", "danger",
                     "updater_loading").style("--loading-grow--")
         put_text(t("Gui.Update.UpdateFailed"), scope="updater_state")
         put_button(
             t("Gui.Button.RetryUpdate"),
             onclick=updater.run_update,
             color="primary",
             scope="updater_btn",
         )
     elif state == "start":
         put_loading("border", "primary",
                     "updater_loading").style("--loading-border--")
         put_text(t("Gui.Update.UpdateStart"), scope="updater_state")
         put_button(
             t("Gui.Button.CancelUpdate"),
             onclick=updater.cancel,
             color="danger",
             scope="updater_btn",
         )
     elif state == "wait":
         put_loading("border", "primary",
                     "updater_loading").style("--loading-border--")
         put_text(t("Gui.Update.UpdateWait"), scope="updater_state")
         put_button(
             t("Gui.Button.CancelUpdate"),
             onclick=updater.cancel,
             color="danger",
             scope="updater_btn",
         )
     elif state == "run update":
         put_loading("border", "primary",
                     "updater_loading").style("--loading-border--")
         put_text(t("Gui.Update.UpdateRun"), scope="updater_state")
         put_button(
             t("Gui.Button.CancelUpdate"),
             onclick=updater.cancel,
             color="danger",
             scope="updater_btn",
             disabled=True,
         )
     elif state == "reload":
         put_loading("grow", "success",
                     "updater_loading").style("--loading-grow--")
         put_text(t("Gui.Update.UpdateSuccess"), scope="updater_state")
         update_table()
     elif state == "finish":
         put_loading("grow", "success",
                     "updater_loading").style("--loading-grow--")
         put_text(t("Gui.Update.UpdateFinish"), scope="updater_state")
         update_table()
     elif state == "cancel":
         put_loading("border", "danger",
                     "updater_loading").style("--loading-border--")
         put_text(t("Gui.Update.UpdateCancel"), scope="updater_state")
         put_button(
             t("Gui.Button.CancelUpdate"),
             onclick=updater.cancel,
             color="danger",
             scope="updater_btn",
             disabled=True,
         )
     else:
         put_text(
             "Something went wrong, please contact develops",
             scope="updater_state",
         )
         put_text(f"state: {state}", scope="updater_state")