Пример #1
0
def create_html_tree(template: Airium, curr_beg: str, ele,
                     all_existing_files: List[str]) -> None:
    """
    Method used to create all of HTML tree chooser's branches and leaves.
    """
    if len(ele) > 0:
        with template.ul():
            for key, value in ele.items():
                file_name = curr_beg + "-" + key if len(curr_beg) > 0 else key
                action = ""
                if file_name in all_existing_files:
                    action = file_name
                elif file_name + "-Main" in all_existing_files:
                    action = file_name + "-Main"
                if len(value) > 0:
                    klass = "section"
                    with template.li(klass=klass):
                        template.input(type="checkbox", id=file_name)
                        with template.label(for_=file_name):
                            template.a(href=action, _t=key)
                        beg = curr_beg
                        if len(curr_beg) == 0:
                            beg = key
                        else:
                            beg = beg + "-" + key
                        create_html_tree(template, beg, value,
                                         all_existing_files)
                else:
                    with template.li():
                        template.a(href=action, _t=key)
Пример #2
0
def buildTemplateTab():
    html = Airium()
    data = readTemplate()

    html.h3(_t='Organisation settings')
    html.table(_t=buildTable(data['org']))
    html.h3(_t='Network settings')
    html.table(_t=buildTable(data['net']))

    return str(html)
Пример #3
0
def homepage():
    connection = postgres.connect(instance.db_host())
    response = postgres.read_sql(connection, "./db/get/user.sql", False)
    username = response[0][0][1]
    balance = response[0][0][3]

    code = Airium()

    code('<!DOCTYPE html>')
    with code.html(lang="ru"):
        with code.head():
            code.meta(charset="utf-8")
            code.title(_t="Test")

        with code.body():
            with code.h3(id="id01", klass='main_header'):
                code("Привет, " + str(username) + ", твой баланс составляет " +
                     str(balance) + " ежей.")
    return str(code)
Пример #4
0
def html_phins2(Data, page_name, L, path):

	a = Airium()

	a('<!DOCTYPE html>')

	with a.html(lang="pl"):

		a("<link rel=\"stylesheet\"  href=\"test.css\"/>")

		with a.body():

			with a.h1(id="id23409231", klass='main_header'):
				a(page_name)

			a(plotly.offline.plot(L[0], include_plotlyjs='cdn', output_type='div'))

			with a.h1(id="id23409231", klass='main_header'):
				a("Pitch Curve")

			with a.p():

				a("Max negative : "+str(Data.msg_phins["pitch_min"])+" (deg)"+'<br>')
				a("Max positive : "+str(Data.msg_phins["pitch_max"])+" (deg)"+'<br>')
				a("Mean value : "+str(Data.msg_phins["pitch_mean"])+" (deg)"+'<br>')

			a(plotly.offline.plot(L[1], include_plotlyjs='cdn', output_type='div'))

			with a.h1(id="id23409231", klass='main_header'):
				a("Roll Curve")

			with a.p():

				a("Max negative : "+str(Data.msg_phins["roll_min"])+" (deg)"+'<br>')
				a("Max positive : "+str(Data.msg_phins["roll_max"])+" (deg)"+'<br>')
				a("Mean value : "+str(Data.msg_phins["roll_mean"])+" (deg)"+'<br>')

			a(plotly.offline.plot(L[2], include_plotlyjs='cdn', output_type='div'))



	html = str(a) # casting to string extracts the value



	with open(Data.ihm_path + path, 'w') as f:

		 f.write(str(html))
Пример #5
0
def html_gps(Data, page_name, L, path):

	a = Airium()

	a('<!DOCTYPE html>')

	with a.html(lang="pl"):

		with a.h1(id="id23409231", klass='main_header'):
			a(page_name)

		with a.p():
			a("Total Distance performed : "+str(Data.msg_gps["global_dist"])+" km"+'<br>')
			a("Average speed : "+str(Data.msg_gps['global_speed'])+" in m/s, "+str(Data.msg_gps["global_knots"])+" in knot"+'<br>')

		with a.p():
			a("Survey distance : "+str(Data.msg_gps["path_following_dist"])+' kms'+'<br>')
			a("Survey Average speed : "+str(Data.msg_gps["path_following_speed"])+' m/s, '+'<br>')
			a("Survey duration : "+str(Data.msg_gps["path_following_dt"])+'  '+'<br>')


		a(plotly.offline.plot(L[0], include_plotlyjs='cdn', output_type='div'))
		a(plotly.offline.plot(L[1], include_plotlyjs='cdn', output_type='div'))


	html = str(a) # casting to string extracts the value

	with open(Data.ihm_path + path, 'w') as f:

		 f.write(str(html))
Пример #6
0
def html_page_creation(Data, page_name, L, path):

	a = Airium()

	a('<!DOCTYPE html>')

	with a.html(lang="pl"):

		with a.h1(id="id23409231", klass='main_header'):
				a(page_name)
			
		
		for k in L:
			a(plotly.offline.plot(k, include_plotlyjs='cdn', output_type='div'))

	html = str(a) # casting to string extracts the value



	with open(Data.ihm_path + path, 'w') as f:

		 f.write(str(html))
Пример #7
0
    def showcase_uhtml(**kwargs):
        html = Airium()

        div_style = 'padding-top:9px'
        if kwargs['is_first']:
            div_style = ('padding-left:6px;'
                         'padding-top:18px;'
                         'min-width:80px;'
                        f'background-image: url(\'{SHOWCASE_BORDER_1}\');'
                         'background-repeat: no-repeat')

        with html.td(style='padding:5px'):
            with html.div(style=div_style):
                html.a(href=kwargs['unit_url'], _t=kwargs['img_uhtml'])
        
        return html
Пример #8
0
def generate_html():
    a = Airium()

    a('<!DOCTYPE html>')
    with a.html():
        with a.head():
            a.title(_t="Speech Evaluation")
            a.meta(name="viewport",
                   content="width=device-width, initial-scale=1.0")
            a.link(
                href=
                "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css",
                rel="stylesheet",
                integrity=
                "sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6",
                crossorigin="anonymous")
        with a.body():
            with a.div(klass="container pb-5 pt-5"):
                a.h1(_t="Emotional Speech Evaluation",
                     klass="text-center text-success display-1 pt-5 pb-5")
                a.p(_t=
                    "Thank you for your time and welcome to the subjective evaluation of our emotional speech samples!",
                    klass="pt-5")
                a.p(_t=
                    """First, you will need to answer 5 questions about yourself to make us know you more.
                    Then you will hear overall 80 audio samples, for each of which you are invited to answer 5 questions.
                    If you are uncertain about an answer listen to the audio sample multiple times.
                    """)
                a.p(_t=
                    """It is highly recommended to wear headphones during the evaluation.
                    """)
                with a.p():
                    a.span(
                        _t=
                        """After you click ‘Submit’, all your answers will be recorded, and a CSV file will be
                    downloaded. Please send the CSV file to 
                    """)
                    a.a(href=
                        "mailto:[email protected]?subject=Emotional Speech Evalution",
                        _t="*****@*****.**",
                        target="_blank",
                        rel="noopener noreferrer")
                    a.span(_t=". Thanks for your help!")
                a.p(_t=
                    "Note: Please answer all questions. ‘Submit’ button will bring you back to the unfinished questions."
                    )
                a.p(_t=
                    "When answering questions related to emotions please consider the following definitions:"
                    )
                with a.ul():
                    with a.li():
                        a.span(_t="Please select ")
                        a.strong(_t="‘Neutral’")
                        a.span(
                            _t=
                            " if you think the speaker does not express a particular emotion."
                        )
                    with a.li():
                        a.span(_t="Please select ")
                        a.strong(_t="‘Anger’")
                        a.span(
                            _t=
                            " if you think the speaker is mad or furious about something."
                        )
                    with a.li():
                        a.span(_t="Please select ")
                        a.strong(_t="‘Amused’")
                        a.span(
                            _t=
                            " if you think the speaker finds something funny or interesting."
                        )
                    with a.li():
                        a.span(_t="Please select ")
                        a.strong(_t="‘Disgust’")
                        a.span(
                            _t=
                            " if you think the speaker feels nauseating or disgusted."
                        )
                    with a.li():
                        a.span(_t="Please select ")
                        a.strong(_t="‘Sleepy’")
                        a.span(
                            _t=
                            " if you think the speaker is tired or exhausted.")
                with a.form(klass="pt-5 pb-5",
                            id="evaluation-form",
                            action="#",
                            onsubmit="return submitForm();"):
                    with a.div(klass="form-group col-md-4"):
                        a.label(_t="Name", for_="name-input")
                        a.input(id="name-input",
                                klass="form-control",
                                type="text",
                                placeholder="Jane Smith",
                                required=True)
                    with a.div(klass="form-group col-md-8"):
                        for index, question in enumerate(
                                SELF_EVALUATION_QUESTIONS):
                            with a.div(klass="card mt-5"):
                                with a.div(klass="card-body"):
                                    a.p(_t=question, klass="pb-3")
                                    with a.div(
                                            klass=
                                            "custom-control custom-radio form-check-inline"
                                    ):
                                        a.input(
                                            type="radio",
                                            id=f"self-evaluation-{index}-1",
                                            name=f"self-evaluation-{index}",
                                            klass="custom-control-input",
                                            value=1,
                                            required=True)
                                        a.label(
                                            _t="1 — Strongly disagree",
                                            klass="custom-control-label",
                                            for_=f"self-evaluation-{index}-1")
                                    with a.div(
                                            klass=
                                            "custom-control custom-radio form-check-inline"
                                    ):
                                        a.input(
                                            type="radio",
                                            id=f"self-evaluation-{index}-2",
                                            name=f"self-evaluation-{index}",
                                            klass="custom-control-input",
                                            value=2)
                                        a.label(
                                            _t="2 — Disagree",
                                            klass="custom-control-label",
                                            for_=f"self-evaluation-{index}-2")
                                    with a.div(
                                            klass=
                                            "custom-control custom-radio form-check-inline"
                                    ):
                                        a.input(
                                            type="radio",
                                            id=f"self-evaluation-{index}-3",
                                            name=f"self-evaluation-{index}",
                                            klass="custom-control-input",
                                            value=3)
                                        a.label(
                                            _t="3 — Neutral",
                                            klass="custom-control-label",
                                            name=f"self-evaluation-{index}",
                                            for_=f"self-evaluation-{index}-3")
                                    with a.div(
                                            klass=
                                            "custom-control custom-radio form-check-inline"
                                    ):
                                        a.input(
                                            type="radio",
                                            id=f"self-evaluation-{index}-4",
                                            name=f"self-evaluation-{index}",
                                            klass="custom-control-input",
                                            value=4)
                                        a.label(
                                            _t="4 — Agree",
                                            klass="custom-control-label",
                                            for_=f"self-evaluation-{index}-4")
                                    with a.div(
                                            klass=
                                            "custom-control custom-radio form-check-inline"
                                    ):
                                        a.input(
                                            type="radio",
                                            id=f"self-evaluation-{index}-5",
                                            name=f"self-evaluation-{index}",
                                            klass="custom-control-input",
                                            value=5)
                                        a.label(
                                            _t="5 — Strongly agree",
                                            klass="custom-control-label",
                                            for_=f"self-evaluation-{index}-5")
                    a.h4(_t="Emotional Speech Evalution",
                         klass="mt-5 pt-5 text-success")
                    for index, file in enumerate(get_file_list()):
                        if index % 2 == 1:
                            color_scheme = "bg-secondary bg-gradient text-white"
                        else:
                            color_scheme = "bg-light bg-gradient"
                        with a.div(klass=f"card mt-5 {color_scheme}"):
                            with a.div(klass="card-body"):
                                with a.div(klass="row"):
                                    with a.div(
                                            klass="col-lg-4 align-self-center"
                                    ):
                                        with a.div(klass="text-center"):
                                            a.h6(_t=f"Sample {index + 1}")
                                            a.audio(controls=True,
                                                    src=f"samples/{file}",
                                                    klass='mb-5 mt-5')
                                    with a.div(klass="col-lg-8"):
                                        with a.p(klass="pb-1"):
                                            a.strong(_t="What emotion")
                                            a.span(
                                                _t=
                                                " do you think of the voice expressed?"
                                            )
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-1-1-{file}",
                                                name=f"tts-evaluation-1-{file}",
                                                klass="custom-control-input",
                                                value=1,
                                                required=True)
                                            a.label(
                                                _t="1 — Neutral",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-1-1-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-1-2-{file}",
                                                name=f"tts-evaluation-1-{file}",
                                                klass="custom-control-input",
                                                value=2)
                                            a.label(
                                                _t="2 — Amused",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-1-2-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-1-3-{file}",
                                                name=f"tts-evaluation-1-{file}",
                                                klass="custom-control-input",
                                                value=3)
                                            a.label(
                                                _t="3 — Anger",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-1-3-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-1-4-{file}",
                                                name=f"tts-evaluation-1-{file}",
                                                klass="custom-control-input",
                                                value=4)
                                            a.label(
                                                _t="4 — Disgust",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-1-4-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-1-5-{file}",
                                                name=f"tts-evaluation-1-{file}",
                                                klass="custom-control-input",
                                                value=5)
                                            a.label(
                                                _t="5 — Sleepy",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-1-5-{file}")

                                        with a.p(klass="pb-1 pt-5"):
                                            a.span(_t="If ")
                                            a.strong(_t="NOT neutral")
                                            a.span(
                                                _t=", what do you think of the "
                                            )
                                            a.strong(_t="intensity")
                                            a.span(
                                                _t=
                                                " of the emotion expressed? (If neutral, please skip this question)"
                                            )
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-2-1-{file}",
                                                name=f"tts-evaluation-2-{file}",
                                                klass="custom-control-input",
                                                value=1,
                                                required=True)
                                            a.label(
                                                _t="1 — Very weak",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-2-1-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-2-2-{file}",
                                                name=f"tts-evaluation-2-{file}",
                                                klass="custom-control-input",
                                                value=2)
                                            a.label(
                                                _t="2 — Weak",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-2-2-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-2-3-{file}",
                                                name=f"tts-evaluation-2-{file}",
                                                klass="custom-control-input",
                                                value=3,
                                                checked=True)
                                            a.label(
                                                _t="3 — Moderate",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-2-3-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-2-4-{file}",
                                                name=f"tts-evaluation-2-{file}",
                                                klass="custom-control-input",
                                                value=4)
                                            a.label(
                                                _t="4 — Strong",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-2-4-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-2-5-{file}",
                                                name=f"tts-evaluation-2-{file}",
                                                klass="custom-control-input",
                                                value=5)
                                            a.label(
                                                _t="5 — Very strong",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-2-5-{file}")

                                        with a.p(klass="pb-1 pt-5"):
                                            a.strong(_t="How close to human")
                                            a.span(
                                                _t=
                                                " would you rate the voice speaking?"
                                            )
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-3-1-{file}",
                                                name=f"tts-evaluation-3-{file}",
                                                klass="custom-control-input",
                                                value=1,
                                                required=True)
                                            a.label(
                                                _t="1 — Not at all",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-3-1-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-3-2-{file}",
                                                name=f"tts-evaluation-3-{file}",
                                                klass="custom-control-input",
                                                value=2)
                                            a.label(
                                                _t="2 — A little bit close",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-3-2-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-3-3-{file}",
                                                name=f"tts-evaluation-3-{file}",
                                                klass="custom-control-input",
                                                value=3)
                                            a.label(
                                                _t="3 — Close",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-3-3-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-3-4-{file}",
                                                name=f"tts-evaluation-3-{file}",
                                                klass="custom-control-input",
                                                value=4)
                                            a.label(
                                                _t="4 — Very close",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-3-4-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-3-5-{file}",
                                                name=f"tts-evaluation-3-{file}",
                                                klass="custom-control-input",
                                                value=5)
                                            a.label(
                                                _t="5 — Extremely close",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-3-5-{file}")

                                        with a.p(klass="pb-1 pt-5"):
                                            a.span(
                                                _t="Do you think the voice is "
                                            )
                                            a.strong(
                                                _t="clear and understandable")
                                            a.span(_t="?")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-4-1-{file}",
                                                name=f"tts-evaluation-4-{file}",
                                                klass="custom-control-input",
                                                value=1,
                                                required=True)
                                            a.label(
                                                _t="1 — Strongly disagree",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-4-1-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-4-2-{file}",
                                                name=f"tts-evaluation-4-{file}",
                                                klass="custom-control-input",
                                                value=2)
                                            a.label(
                                                _t="2 — Disagree",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-4-2-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-4-3-{file}",
                                                name=f"tts-evaluation-4-{file}",
                                                klass="custom-control-input",
                                                value=3)
                                            a.label(
                                                _t="3 — Neutral",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-4-3-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-4-4-{file}",
                                                name=f"tts-evaluation-4-{file}",
                                                klass="custom-control-input",
                                                value=4)
                                            a.label(
                                                _t="4 — Agree",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-4-4-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-4-5-{file}",
                                                name=f"tts-evaluation-4-{file}",
                                                klass="custom-control-input",
                                                value=5)
                                            a.label(
                                                _t="5 — Strongly agree",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-4-5-{file}")

                                        with a.p(klass="pb-1 pt-5"):
                                            a.span(_t="How much do you ")
                                            a.strong(_t="like")
                                            a.span(_t=" the voice speaking?")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-5-1-{file}",
                                                name=f"tts-evaluation-5-{file}",
                                                klass="custom-control-input",
                                                value=1,
                                                required=True)
                                            a.label(
                                                _t="1 — Not at all",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-5-1-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-5-2-{file}",
                                                name=f"tts-evaluation-5-{file}",
                                                klass="custom-control-input",
                                                value=2)
                                            a.label(
                                                _t="2 — Hardly",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-5-2-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-5-3-{file}",
                                                name=f"tts-evaluation-5-{file}",
                                                klass="custom-control-input",
                                                value=3)
                                            a.label(
                                                _t="3 — Moderately",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-5-3-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-5-4-{file}",
                                                name=f"tts-evaluation-5-{file}",
                                                klass="custom-control-input",
                                                value=4)
                                            a.label(
                                                _t="4 — Greatly",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-5-4-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-5-5-{file}",
                                                name=f"tts-evaluation-5-{file}",
                                                klass="custom-control-input",
                                                value=5)
                                            a.label(
                                                _t="5 — Extremely",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-5-5-{file}")
                    with a.div(klass="from-group mt-5"):
                        a.label(
                            _for="open-comments",
                            _t=
                            "Please leave your general opinion about the speeches here. We are also happy to hear your valuable suggestions. Thanks!"
                        )
                        a.textarea(klass="form-control",
                                   id="open-comments",
                                   name="open-comments",
                                   placeholder="(Optional)",
                                   rows="3")
                    a.button(_t="Submit",
                             type="submit",
                             klass="btn btn-primary mt-5")
                    with a.p(klass="mt-3"):
                        a.span(_t="Please send the generated CSV file to ")
                        a.a(href=
                            "mailto:[email protected]?subject=Emotional Speech Evalution",
                            _t="*****@*****.**",
                            target="_blank",
                            rel="noopener noreferrer")
                        a.span(
                            _t=
                            ". Your e-mail address will not be collected or linked with the data. Thanks for your help!"
                        )
        with a.script():
            a(f'''
                function clearForm() {{
                    document.getElementById("evaluation-form").reset();
                }}

                function buildCsvRow(fileName, questionResponses) {{
                    return `${{fileName}};${{questionResponses[0]}};${{questionResponses[1]}};${{questionResponses[2]}};${{questionResponses[3]}};${{questionResponses[4]}}\\n`
                }}

                function getQuestionResponse(input_name) {{
                    return $(`input[name="${{input_name}}"]:checked`).val();
                }}

                function getSelfEvaluationResponses() {{
                    return [{",".join([f"getQuestionResponse('self-evaluation-{index}')" for index in range(5)])}];
                }}

                function getTtsEvaluationResponsesForFile(file_name) {{
                    return [{",".join([f"getQuestionResponse(`tts-evaluation-{index}-${{file_name}}`)" for index in range(1, 6)])}];
                }}

                function getOpenComments() {{
                    let comments = $(`textarea[name="open-comments"]`).val();
                    if ("" === comments) {{
                        return "(Optional)\\n";
                    }} else {{
                        return comments.replace(/\\r?\\n|\\r/g, " ") + "\\n";
                    }}
                }}

                function submitForm() {{
                    let name = $("#name-input").val();
                    let files = [{",".join([f"'{file}'" for file in get_file_list()])}];
                    let csv = "data:text/csv;charset=utf-8,";
                    csv += "filename;q1;q2;q3;q4;q5\\n";
                    csv += buildCsvRow("self_evaluation", getSelfEvaluationResponses());
                    for (let i = 0; i < files.length; i++) {{
                        csv += buildCsvRow(files[i], getTtsEvaluationResponsesForFile(files[i]));
                    }}
                    csv += getOpenComments();
                    let encodedUri = encodeURI(csv);
                    let downloadLink = document.createElement("a");
                    downloadLink.setAttribute("download", `${{name}}_results.csv`);
                    downloadLink.setAttribute("href", encodedUri);
                    document.body.appendChild(downloadLink);
                    downloadLink.click();
                    downloadLink.remove();
                    return false;
                }}
                ''')
        a.script(
            src=
            "https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js",
            integrity=
            "sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf",
            crossorigin="anonymous")
        a.script(
            src="https://code.jquery.com/jquery-3.6.0.min.js",
            integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=",
            crossorigin="anonymous")

    return str(a)
Пример #9
0
def generate_html():
    a = Airium()

    a('<!DOCTYPE html>')
    with a.html():
        with a.head():
            a.title(_t="TTS Demo Files")
            a.meta(name="viewport",
                   content="width=device-width, initial-scale=1.0")
            a.link(
                href=
                "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css",
                rel="stylesheet",
                integrity=
                "sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6",
                crossorigin="anonymous")
        with a.body():
            with a.div(klass="container pb-5 pt-5"):
                a.h1(_t="Emotional TTS Demo Files",
                     klass="text-center display-1 pt-5 pb-5")
                a.h5(
                    _t="21/04/19  : Reproduced VAW-GAN based emotion converter",
                    klass="pt-5 pb-3")
                a.h5(
                    _t=
                    "21/06/01-A: Added phoneme embeddings to the encoder of VAW-GAN",
                    klass="pt-5 pb-3")
                a.h5(
                    _t="21/06/01-B: Tested CMU-MOSEI with the vanilla VAW-GAN",
                    klass="pt-5 pb-3")
                a.h5(
                    _t=
                    "21/06/22  : Tested VAW-GAN with forced alignment on word-level",
                    klass="pt-5 pb-3")
                a.h5(
                    _t=
                    "21/07/06  : Tested VAW-GAN with forced alignment on word-level with MFCC Nonspeech Masking",
                    klass="pt-5 pb-3")
                a.h5(
                    _t=
                    "21/08/24-A: Tested VAW-GAN with pyworld.harvest() in WORLD",
                    klass="pt-5 pb-3")
                a.h5(
                    _t=
                    "21/08/24-B: Tested VAW-GAN with synthesised neutral speech as the training set",
                    klass="pt-5 pb-3")
                for folder, files_by_file_name in get_file_list().items():
                    a.h3(_t=
                         f"Samples from {convert_folder_name_to_date(folder)}",
                         klass="text-center display-6 pt-5")
                    for original_file_name, files_by_model in files_by_file_name.items(
                    ):
                        a.h4(_t=original_file_name,
                             klass="pt-5 pb-5 text-success")
                        for model, files in files_by_model.items():
                            if 'neu' == model:
                                with a.div(
                                        klass="row row-cols-1 row-cols-md-2 g-4"
                                ):
                                    with a.div(klass="col"):
                                        with a.div(klass="card"):
                                            with a.div(
                                                    klass=
                                                    "card-body text-center"):
                                                a.h5(
                                                    _t=
                                                    extract_emotion_from_file_name(
                                                        files[0]),
                                                    klass="card-title")
                                                a.audio(controls=True,
                                                        src=os.path.join(
                                                            'samples', folder,
                                                            files[0]))
                            else:
                                if len(files) > 0:
                                    a.h5(_t=f"Samples Generated with {model}",
                                         klass="pt-5 pb-3")
                                    with a.div(
                                            klass=
                                            "row row-cols-1 row-cols-md-2 g-4"
                                    ):
                                        for file in files:
                                            with a.div(klass="col"):
                                                with a.div(klass="card"):
                                                    with a.div(
                                                            klass=
                                                            "card-body text-center"
                                                    ):
                                                        a.h5(
                                                            _t=
                                                            extract_emotion_from_file_name(
                                                                file),
                                                            klass="card-title")
                                                        a.audio(
                                                            controls=True,
                                                            src=os.path.join(
                                                                'samples',
                                                                folder, file))
        a.script(
            src=
            "https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js",
            integrity=
            "sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf",
            crossorigin="anonymous")

    return str(a)
Пример #10
0
def home():
    # Set some vars
    rate = refreshRate

    # Set up the page
    page = Airium()
    page('<!DOCTYPE html>')
    with page.html():
        with page.head():
            page.title("PR Panel")
            page.link(rel="stylesheet", href='static/css/main.css')
            page.meta(http_equiv="refresh", content="REFRESHRATE")

    # Loop over defined repos
    rr = refreshRate
    for repo in config['repo']:
        # Get PR data for the repo
        prs = []
        failed = False
        try:
            prs = parsePRData(repo['id'])
        except:
            failed = True
            rr = 30

        # Add header
        with page.body().div(class_="repoHeader"):
            page(repo['id'])
            with page.div(class_="repoTimeStamp"):
                if failed:
                    page.img(src="static/img/warning.svg", class_="checkIcon")
                page(strftime("%H:%M", gmtime()))

        if failed:
            with page.body().div(class_="repoMessage"):
                page(
                    "Failed to get PR info for this repo. Retrying in 30 seconds..."
                )
        elif len(prs):
            prDataToHTML(prs, page)
        else:
            with page.body().div(class_="repoMessage"):
                page("No open PRs for this repository.")

    # Need to tweak the generated html slightly to:
    # - Change the string "http_equiv" to "http-equiv" - we couldn't do this earlier as the '-' is interpreted as a minus in the key.
    # - Set the actual page refresh time, which depends on the success of retrieving repository data
    html = str(page).replace("http_equiv", "http-equiv")
    html = html.replace("REFRESHRATE", str(rr))

    return html
Пример #11
0
def form_html_plot():
    #initilize figure object
    fig = go.Figure()
    zulip_data = get_zulip_data(config.name)
    git_data = get_git_data(config.name)
    jitsiClasses_data = get_jitsiClasses_data(config.email)
    jitsiSession_data = get_jitsiSession_data(config.email)

    fig.add_trace(
        go.Bar(name='Zulip Activity',
               x=list(zulip_data[0].keys()),
               y=list(zulip_data[0].values()),
               text=list(zulip_data[0].values()),
               textposition='auto'))

    fig.add_trace(
        go.Bar(name='GitLab Activity',
               x=list(git_data[0].keys()),
               y=list(git_data[0].values()),
               text=list(git_data[0].values()),
               textposition='auto'))

    fig.add_trace(
        go.Bar(name='JitsiClasses Activity',
               x=list(jitsiClasses_data[0].keys()),
               y=list(jitsiClasses_data[0].values()),
               text=list(jitsiClasses_data[0].values()),
               textposition='auto'))

    fig.add_trace(
        go.Bar(name='JitsiSession Activity',
               x=list(jitsiSession_data[0].keys()),
               y=list(jitsiSession_data[0].values()),
               text=list(jitsiSession_data[0].values()),
               textposition='auto'))

    fig.update_layout(
        title=f'Activity in MIEM Services. Name  - {config.name}',
        xaxis_title='Time',
        yaxis_title='Amount',
        barmode='group')
    fig.update_xaxes(dtick="M1", tickformat="%b-%Y")

    #Form html file
    a = Airium()
    a('<!DOCTYPE html>')

    with a.html():
        with a.head():
            with a.html(lang='en'):
                a.meta(charset='utf-8')
                a.title(_t=config.name)
                a.link(href='style.css', rel='stylesheet', type='text/css')
                a.script(src='https://cdn.plot.ly/plotly-latest.min.js')
                a.font('Courier New, monospace')
                #a.style()

        with a.body():
            a.append(
                plotly.offline.plot(fig,
                                    include_plotlyjs=False,
                                    output_type='div'))
            with a.font(size='3',
                        face="Courier New, monospace",
                        color='#2a3f5f'):
                with a.table(align='center',
                             style='border-spacing: 100px 0px'):
                    with a.tr(klass='header_row'):
                        a.th(_t='Name of the service')
                        a.th(_t='Total action amount')
                        a.th(_t='Profile existence')

                    with a.tr():
                        a.td(_t='Zulip', align='center')
                        a.td(_t=zulip_data[1], align='center')
                        a.td(_t=zulip_data[2], align='center')

                    with a.tr():
                        a.td(_t='GitLab', align='center')
                        a.td(_t=git_data[1], align='center')
                        a.td(_t=git_data[2], align='center')

                    with a.tr():
                        a.td(_t='JitsiClasses', align='center')
                        a.td(_t=jitsiClasses_data[1], align='center')
                        a.td(_t='-', align='center')  # can use _t or text

                    with a.tr():
                        a.td(_t='JitsiSession', align='center')
                        a.td(_t=jitsiSession_data[1], align='center')
                        a.td(_t='-', align='center')
                with a.h3(klass='main_header', align='center'):
                    a(f"Activity grade:  {cult_grade(zulip_data, git_data,jitsiClasses_data,jitsiSession_data)}"
                      )
                with a.div(align='center'):
                    a(f"Данные актуальны на {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}"
                      )

    html = str(a)
    with open(config.html_path, 'w') as f:
        f.write(str(html))
Пример #12
0
def create_index_page(out_dir: str, out_name: str, gen_files: List[str]) -> None:
    """
    Generates index page.
    """
    template = Airium()
    logging.info("Generating: %s", out_name)
    with template.html():
        with template.head():
            template.title(_t="Enso Reference")
            template.link(href="style.css", rel="stylesheet")
            template.link(href="favicon.ico", rel="icon")
            template.style(_t="ul { padding-inline-start: 15px; }")
            template.style(
                _t="""ul, .section ul {
                              list-style: none;
                              padding: 0;
                              margin: 0;
                              word-wrap: initial;
                            }
                            
                            ul li {
                              padding: 5px 10px;
                            }
                            
                            .section ul { display: none; }
                            .section input:checked ~ ul { display: block; }
                            .section input[type=checkbox] { display: none; }
                            .section { 
                              position: relative; 
                              padding-left: 20px !important;
                            }
                            
                            .section label:after {
                              content: "+";
                              position: absolute;
                              top: 0; left: 0;
                              padding: 0;
                              text-align: center;
                              font-size: 17px;
                              color: cornflowerblue;
                              transition: all 0.3s;
                            }
                            
                            .section input:checked ~ label:after { 
                              color: cadetblue;
                              transform: rotate(45deg);
                            }
                            
                            @media only screen and (max-width: 1100px) {
                                #tree {
                                    width: 30% !important;
                                }
                            }
                            """
            )
            template.script(
                _t="""function set_frame_content(file) {
                          document.getElementById("frame").src = file
                      }"""
            )
        with template.body(style="background-color: #333"):
            template.h2(
                style="""text-align: center;
                         padding: 15px; 
                         margin: 0; 
                         color: #fafafa""",
                _t="Enso Reference",
            )
            with template.div(
                style="background-color: #fafafa; display: flex; height: 100%"
            ):
                with template.div(
                    id="tree",
                    style="""background-color: #efefef;
                             border-radius: 14px; 
                             width: 20%; 
                             margin: 15px; 
                             padding-left: 20px;
                             overflow: scroll;
                             height: 90%;""",
                ):
                    grouped_file_names = group_by_prefix(gen_files)
                    create_html_tree(template, "", grouped_file_names, gen_files)
                template.iframe(
                    frameborder="0",
                    height="100%",
                    id="frame",
                    src="Base-Main.html",
                    width="100%",
                    target="_blank",
                )

    html_file = open(out_dir + "/" + out_name, "w")
    html_file.write(str(template))
    html_file.close()
Пример #13
0
def add_breadcrumbs_to_pages(out_dir: str, temp_dir: str,
                             gen_files: List[str]) -> None:
    """
    Method used to create breadcrumbs (for now - tree) and add them to generated content.
    """
    template = Airium()
    logging.info("Generating breadcrumbs")
    gen_files.remove("Main")
    grouped_file_names = group_by_prefix(gen_files)
    create_html_tree(template, "", grouped_file_names, gen_files)
    breadcrumbs = str(template).replace('class="', 'className="')

    stl = """
    <style jsx>{`
        .section ul {
          cursor: pointer;
          list-style: none;
          padding: 0;
          margin: 0;
          word-wrap: initial;
        }
 
        .section span {
          cursor: pointer;
        }
 
        ul li {
          padding: 5px 10px;
        }
 
        .section ul {
          display: none;
        }
        .section input:checked ~ ul {
          display: block;
        }
        .section input[type='checkbox'] {
          display: none;
        }
        .section {
          position: relative;
          padding-left: 20px !important;
          list-style-type: none;
        }
 
        .section label:after {
          content: '▶';
          position: absolute;
          top: 7px;
          left: 0;
          padding: 0;
          text-align: center;
          font-size: 14px;
          color: rgba(75, 88, 100, var(--tw-text-opacity));
          transition: all 0.3s;
        }
 
        .section input:checked ~ label:after {
          transform: rotate(90deg);
        }
      `}</style>
      """

    breadcrumbs = "<div>" + stl + breadcrumbs + "</div>"

    for out_name in gen_files:
        temp_file = open(temp_dir + "/" + out_name + ".js", "r")
        out_file = open(out_dir + "/" + out_name + ".js", "w")
        temp_br = breadcrumbs
        partials = out_name.split("-")
        valid_ids = ["-".join(partials[:i]) for i in range(len(partials))]
        for elem in valid_ids:
            beg = '<input type="checkbox" id="' + elem + '" '
            temp_br = temp_br.replace(beg + "/>", beg + 'checked="True" />')
        beg_link = 'href="' + out_name + '"'
        temp_br = temp_br.replace(beg_link,
                                  beg_link + ' className="font-bold"')
        out_file.write(temp_file.read().replace("{/*BREADCRUMBS*/}", temp_br))
        temp_file.close()
        out_file.close()

    std_main_file = open(temp_dir + "/" + "Base-Data-Maybe.js", "r")
    index_file = open(out_dir + "/" + "index.js", "w")
    index_file.write(std_main_file.read().replace(
        "{/*BREADCRUMBS*/}",
        breadcrumbs.replace('a href="', 'a href="reference/')))
    std_main_file.close()
    index_file.close()
Пример #14
0
 def __init__(self):
     self.html = Airium()
Пример #15
0
def generate_ihm(report_data):

	a = Airium()

	a('<!DOCTYPE html>')
	with a.html(lang="pl"):
		with a.head():
			a.meta(charset="utf-8")
			a.title(_t="Mission Report")

		with a.body():
			with a.h1(id="id23409231", klass='main_header'):
				a("Mission Report")

			with a.p():
				a("Drix mission between "+ display_date(report_data.date_d)+" and "+ display_date(report_data.date_f))

			with a.h2(id="id23409231", klass='main_header'):
				a("Gps data : "+"<a href = ../IHM/gps/Bilan_gps.html>Processed</a>"+'<br>')

			with a.p():
				a("Total Distance performed : "+str(report_data.msg_gps["global_dist"])+" km"+'<br>')
				a("Average speed : "+str(report_data.msg_gps['global_speed'])+" in m/s, "+str(report_data.msg_gps["global_knots"])+" in knot")

			with a.h2(id="id23409231", klass='main_header'):
				a("Drix status data: "+"<a href = ../IHM/drix_status/Bilan_drix_status.html>Processed</a>"+'<br>')

			with a.h2(id="id23409231", klass='main_header'):
				a("Telemetry data : "+"<a href = ../IHM/telemetry/Bilan_telemetry.html>Processed</a>"+'<br>')

			with a.h2(id="id23409231", klass='main_header'):
				a("Gpu state data : "+"<a href = ../IHM/gpu_state/Bilan_gpu_state.html>Processed</a>"+'<br>')

			with a.h2(id="id23409231", klass='main_header'):
				a("Phins data : "+"<a href = ../IHM/phins/Bilan_phins.html>Processed</a>"+'<br>')

			with a.h2(id="id23409231", klass='main_header'):
				a("Trimmer data : "+"<a href = ../IHM/trimmer_status/Bilan_trimmer_status.html>Processed</a>"+'<br>')

			with a.h2(id="id23409231", klass='main_header'):
				a("Iridium data : "+"<a href = ../IHM/iridium/Bilan_iridium_status.html>Processed</a>"+'<br>')

			with a.h2(id="id23409231", klass='main_header'):
				a("Autopilot data : "+"<a href = ../IHM/autopilot/Bilan_autopilot.html>Processed</a>"+'<br>')

			with a.h2(id="id23409231", klass='main_header'):
				a("RC_command data : "+"<a href = ../IHM/rc_command/Bilan_rc_command.html>Processed</a>"+'<br>')

			with a.h2(id="id23409231", klass='main_header'):
				a("Diagnostics data : "+"<a href = ../IHM/diagnostics/Bilan_diagnostics.html>Processed</a>"+'<br>')

	html = str(a) # casting to string extracts the value

	with open('../IHM/Mission_report.html', 'w') as f:
		 f.write(str(html))
Пример #16
0
def buildTable(data):
    html = Airium()
    with html.table(klass='templateTable'):
        for i in data:
            with html.tr():
                html.td(_t=i['name'])
                if (isinstance(i['value'], bool)):
                    with html.td():
                        if ('enable'):
                            html.input(type='checkbox', checked='')
                        else:
                            html.input(type='checkbox')
                elif (isinstance(i['value'], dict)):
                    html.td()
    return str(html)
Пример #17
0
def generate_html():
    a = Airium()

    a('<!DOCTYPE html>')
    with a.html():
        with a.head():
            a.title(_t="Speech Evaluation")
            a.meta(name="viewport",
                   content="width=device-width, initial-scale=1.0")
        with a.body():
            a.h5(_t="Hello, world!")

    return str(a)
Пример #18
0
def generate_index_html(user_classes: list, user_class_to_href):
    a = Airium()
    a('<!DOCTYPE html>')
    with a.html(lang="zh-Hans"):
        with a.head():
            a.meta(charset="utf-8")
            a.title(_t='ibuprofen ' + time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))
        with a.body():
            for user_class in user_classes:
                with a.p():
                    with a.a(href=user_class_to_href(user_class)):
                        a(user_class.name)
    return str(a)
Пример #19
0
def generate_html(user_class: UserClass):
    a = Airium()
    a('<!DOCTYPE html>')
    with a.html(lang="zh-Hans"):
        with a.head():
            a.meta(charset="utf-8")
            a.title(_t=user_class.name)
        with a.body():
            for record in reversed(user_class.lessons_schedules):
                if not 'title' in record:
                    continue
                with a.p():
                    a(record['title'])
                    with a.i(style="font-size:3px;"):
                        a(record['guid'])
                for resource in record['RefrenceResource']:
                    if not 'fileURI' in resource:
                        continue
                    with a.a(href=resource['fileURI']):
                        a(resource['title'])
                    a.br()
    return str(a)
Пример #20
0
def generate_index_html(user: User):
    a = Airium()
    a('<!DOCTYPE html>')
    with a.html(lang="zh-Hans"):
        with a.head():
            a.meta(charset="utf-8")
            a.title(_t='ibuprofen')
        with a.body():
            for user_class in user.user_classes:
                with a.p():
                    with a.a(href='user_class_' + user_class.guid + '.html'):
                        a(user_class.name)
    return str(a)
Пример #21
0
def fuelTable(data):
    html = Airium()

    if data:
        with html.table():
            ft = "Fuel type: " + FuelTypes[int(data[0]["fuelType"])]
            with html.div(klass='fueltype_header', _t=ft):
                with html.tr():
                    html.th(klass='Price', _t='Price')
                    html.th(klass='Name', _t='Name')
                    html.th(_t='Address')
                    html.th(klass='Location', _t='Location')
                for d in data:
                    with html.tr():
                        html.td(_t=d['price'])
                        html.td(_t=d['trading-name'])
                        html.td(_t=d['address'])
                        html.td(_t=d['location'])

    return str(html)
Пример #22
0
def generate_user_class_html(user_class):
    a = Airium()
    a('<!DOCTYPE html>')
    with a.html(lang="zh-Hans"):
        with a.head():
            a.meta(charset="utf-8")
            a.title(_t=user_class.name)
        with a.body():
            with a.div(id='subject-filter'):
                with a.label():
                    a.input(checked='checked', onchange='changeSubjectFilterAll(this.checked)', type='checkbox')
                    a("全选")
                for key in index_to_subject_name:
                    with a.label():
                        a.input(checked='checked', name='category', onchange='onSubjectCheckboxChange()', type='checkbox',
                                value=key)
                        a(index_to_subject_name[key])
            with a.div(id='user-login'):
                a.label(for_='user-id', _t='用户名:')
                a.input(id='user-id', type='text')
                a.input(onclick='login(document.getElementById("user-id").value)', type='submit', value='登录')
            with a.ul():
                for record in reversed(user_class.lesson_schedules):
                    if not 'title' in record:
                        continue

                    with a.li(klass='lesson-schedule', **{'data-subject': record['numberSubject']}):
                        a.p(klass='lesson-schedule-title', _t=record['title'])
                        if not 'file_resources' in record:
                            continue
                        with a.ul():
                            for resource in record['file_resources']:
                                if not 'fileURI' in resource:
                                    continue
                                with a.li(klass='resource', **{'data-guid': resource['guid']}):
                                    with a.a(href=resource['fileURI']):
                                        a(resource['title'])
                                    if resource['ext'] in pdf_convertable_exts:
                                        a.br()
                                        with a.i():
                                            with a.a(href=resource['fileURI'].replace(resource['ext'], 'pdf')):
                                                a('PDF')
                                    a.br()
                                    a.button(onclick='getAnswerSheet(this)', _t='答题卡')
            with a.script():
                with Path('site/scripts/api.js').open(mode='r') as f:
                    a(f.read())
            with a.script():
                with Path('site/scripts/user-class-page-script.js').open(mode='r') as f:
                    a(f.read())
    return str(a)
Пример #23
0
def buildOrgTab():
    orgs = dashboard.organizations.getOrganizations()

    html = Airium()

    with html.table(klass='orgTable'):
        with html.tr():
            html.th(klass='id', _t='ID')
            html.th(klass='org', _t='Organisation')
            html.th(klass='orgbutton', _t='Update')

            for org in orgs:
                with html.tr():
                    html.td(id=org['id'], _t=org['id'])
                    html.td(_t=org['name'])
                    with html.td():
                        updateOrg = 'updateOrg(' + org['id'] + ')'
                        html.button(type='button',
                                    _t='Update',
                                    onclick=updateOrg)

    return str(html)
Пример #24
0
@media only screen and (max-width: 700px){
  .modal-content {
    width: 100%;
  }
}
'''


if __name__ == "__main__":
    rows = [0.01, 0.02, 0.05, 0.10]
    cols = [0.0, 0.001, 0.002, 0.01]

    filenames = [["g{:.6f}_k{:.6f}.html".format(g_value, k_value) for k_value in rows] for g_value in cols]
    print(filenames)

    a = Airium()
    a('<!DOCTYPE html>')

    with a.html(lang="en"):
        with a.head():
            a.meta(charset="utf-8")
            a.title(_t="Index")
            a.style(_t=CSS_STRING())
            # a.script(type="text/javascript", src="index.js")

        with a.body():
            a.h2(_t="Index")

            with a.table(id='table_372'):
                with a.tr():
                    pivot_str = "k \\ g"
Пример #25
0
    def steam_game_uhtml(**kwargs):
        html = Airium()

        game_stat_style = ('vertical-align:bottom;'
                           'font-size:10px;'
                           'color:#FFF;'
                           'padding: 0px 5px 5px 0px')

        with html.tr():
            html.td(style='padding: 0px 5px 5px 5px',
                    _t=kwargs['img_uhtml'])

            with html.td(align='left', style='vertical-align:top; font-size:10px'):
                html.a(href=kwargs['url'], style='color:#FFF', _t=kwargs['name'])

            with html.td(align='right', style=game_stat_style):
                html(f"""{kwargs['recent_hours']} hrs last 2 weeks""")
                html.br()
                html(f"""{kwargs['total_hours']} hrs total playtime""")

        return html