moved latout-related files
This commit is contained in:
@@ -0,0 +1,143 @@
|
||||
import dash_mantine_components as dmc
|
||||
from dash import dcc, html
|
||||
from typing import List
|
||||
|
||||
from src.model_experiential import ExperientialModelOutput
|
||||
from src.model_interpersonal import (
|
||||
ContactModelOutput,
|
||||
AngleModelOutput,
|
||||
PointOfViewModelOutput,
|
||||
DistanceModelOutput,
|
||||
ModalityLightingModelOutput,
|
||||
ModalityColorModelOutput,
|
||||
ModalityDepthModelOutput
|
||||
)
|
||||
from src.model_textual import (
|
||||
InformationValueModelOutput,
|
||||
FramingModelOutput,
|
||||
SalienceModelOutput
|
||||
)
|
||||
|
||||
def generate_option_labels(model) -> List[str]:
|
||||
"""Generate presentable list of attributes from an OutputModel."""
|
||||
labels = [
|
||||
label.replace('_', ' ').title()
|
||||
for label in model.list_fields()
|
||||
]
|
||||
return labels
|
||||
|
||||
def generate_experiential_options_map():
|
||||
"""Generate map of titles and options for experiential labels."""
|
||||
options_map = {}
|
||||
# add experiential labels
|
||||
options_map["experiential".title()] = generate_option_labels(ExperientialModelOutput)
|
||||
return options_map
|
||||
|
||||
def generate_interpersonal_options_map():
|
||||
"""Generate map of titles and options for interpersonal labels."""
|
||||
options_map = {}
|
||||
# add interpersonal labels
|
||||
options_map["contact".title()] = generate_option_labels(ContactModelOutput)
|
||||
options_map["angle".title()] = generate_option_labels(AngleModelOutput)
|
||||
options_map["point of view".title()] = generate_option_labels(PointOfViewModelOutput)
|
||||
options_map["distance".title()] = generate_option_labels(DistanceModelOutput)
|
||||
options_map["modality lighting".title()] = generate_option_labels(ModalityLightingModelOutput)
|
||||
options_map["modality color".title()] = generate_option_labels(ModalityColorModelOutput)
|
||||
options_map["modality depth".title()] = generate_option_labels(ModalityDepthModelOutput)
|
||||
return options_map
|
||||
|
||||
def generate_textual_options_map():
|
||||
"""Generate map of titles and options for textual labels."""
|
||||
options_map = {}
|
||||
# add textual labels
|
||||
options_map["information value".title()] = generate_option_labels(InformationValueModelOutput)
|
||||
options_map["framing".title()] = generate_option_labels(FramingModelOutput)
|
||||
options_map["salience".title()] = generate_option_labels(SalienceModelOutput)
|
||||
return options_map
|
||||
|
||||
def generate_body():
|
||||
image_container = dmc.Image(
|
||||
width=600,
|
||||
height=600,
|
||||
withPlaceholder=True,
|
||||
placeholder=[dmc.Loader(color="gray", size="md")],
|
||||
)
|
||||
# prepare experiential container
|
||||
experiential_map = generate_experiential_options_map()
|
||||
experiential_container = dmc.Col(
|
||||
children=[
|
||||
dmc.Container([
|
||||
html.H4(list(experiential_map.keys())[0]),
|
||||
html.B("visual syntax".title()),
|
||||
dcc.RadioItems(options=list(experiential_map.values())[0]),
|
||||
])
|
||||
], span=4
|
||||
)
|
||||
# prepare interpersonal container
|
||||
interpersonal_map = generate_interpersonal_options_map()
|
||||
interpersonal_container = dmc.Col(
|
||||
children=[
|
||||
html.H4("interpersonal".title()),
|
||||
], span=4
|
||||
)
|
||||
for title, options in interpersonal_map.items():
|
||||
interpersonal_container.children.append(
|
||||
dmc.Container([
|
||||
html.B(title),
|
||||
dcc.RadioItems(options)
|
||||
])
|
||||
)
|
||||
# prepare textual container
|
||||
textual_map = generate_textual_options_map()
|
||||
textual_container = dmc.Col(
|
||||
children=[
|
||||
html.H4("textual".title()),
|
||||
], span=4
|
||||
)
|
||||
for title, options in textual_map.items():
|
||||
textual_container.children.append(
|
||||
dmc.Container([
|
||||
html.B(title),
|
||||
dcc.RadioItems(options)
|
||||
])
|
||||
)
|
||||
# prepare labels container
|
||||
label_container = dmc.Grid(
|
||||
children=[
|
||||
experiential_container,
|
||||
interpersonal_container,
|
||||
textual_container,
|
||||
],
|
||||
)
|
||||
# build the full body container
|
||||
body_container = dmc.Container(
|
||||
dmc.Grid(
|
||||
children=[
|
||||
dmc.Col(
|
||||
dmc.Center(
|
||||
image_container,
|
||||
),
|
||||
span=5,
|
||||
),
|
||||
dmc.Col(
|
||||
# radio buttons part
|
||||
children = [
|
||||
label_container,
|
||||
dmc.Button(
|
||||
"confirm",
|
||||
id="submit-button",
|
||||
fullWidth=True,
|
||||
color="lime",
|
||||
radius="sm",
|
||||
size="md",
|
||||
style={
|
||||
"height": "50px"
|
||||
}
|
||||
),
|
||||
], span=7,
|
||||
),
|
||||
# dmc.Col(span=1),
|
||||
], grow=True
|
||||
), fluid=True
|
||||
)
|
||||
return body_container
|
||||
@@ -0,0 +1,15 @@
|
||||
import dash_mantine_components as dmc
|
||||
from dash import html
|
||||
|
||||
def generate_header():
|
||||
header = dmc.Header(
|
||||
height=80,
|
||||
children=[
|
||||
dmc.Container(
|
||||
children=[
|
||||
html.H2(children="Visual Critical Discourse Analysis Tool", style={"margin-left": "20px", "padding-top": "-5px"}),
|
||||
], size="xl", px="xl",
|
||||
),
|
||||
]
|
||||
)
|
||||
return header
|
||||
Reference in New Issue
Block a user