First version of usage context and participants. Added theme customization
Browse files- sdc_view.py +128 -9
sdc_view.py
CHANGED
@@ -2,6 +2,7 @@ import streamlit as st
|
|
2 |
from dataModel import AST
|
3 |
from eventHanlder import handle_value_change
|
4 |
import json
|
|
|
5 |
|
6 |
|
7 |
|
@@ -145,6 +146,29 @@ def render_sdc():
|
|
145 |
cached_text_input("Organization name", f"{key}_name", "Name or identifier of the organization")
|
146 |
group(key)
|
147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
def group(key):
|
149 |
colr, coll = st.columns([1, 1])
|
150 |
with colr:
|
@@ -199,11 +223,68 @@ def render_sdc():
|
|
199 |
##
|
200 |
## Title
|
201 |
##
|
202 |
-
st.
|
203 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
st.markdown("""\
|
205 |
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
|
206 |
""")
|
|
|
|
|
207 |
|
208 |
##
|
209 |
## Master info
|
@@ -276,17 +357,55 @@ def render_sdc():
|
|
276 |
|
277 |
|
278 |
with usageContext:
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
285 |
|
286 |
|
287 |
|
288 |
with participants:
|
289 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
|
291 |
|
292 |
|
|
|
2 |
from dataModel import AST
|
3 |
from eventHanlder import handle_value_change
|
4 |
import json
|
5 |
+
import datetime
|
6 |
|
7 |
|
8 |
|
|
|
146 |
cached_text_input("Organization name", f"{key}_name", "Name or identifier of the organization")
|
147 |
group(key)
|
148 |
|
149 |
+
def team(key):
|
150 |
+
#cached_text_input("Team name", f"{key}_name", "Name or identifier of the team")
|
151 |
+
#cached_text_area("Team description", f"{key}_desc", "Description of the team")
|
152 |
+
agesize = f"{key}_size"
|
153 |
+
if agesize not in st.session_state:
|
154 |
+
st.session_state[agesize] = 0 # default value
|
155 |
+
# Display a number input widget
|
156 |
+
st.slider(
|
157 |
+
label="The number of participants in the team:",
|
158 |
+
min_value=0,
|
159 |
+
max_value=120,
|
160 |
+
value=(10,20),
|
161 |
+
key=agesize,
|
162 |
+
on_change=lambda: (st.session_state.form_data.update({key: st.session_state[agesize]}), save_to_cache())[1]
|
163 |
+
)
|
164 |
+
colr, coll = st.columns([1, 1])
|
165 |
+
with colr:
|
166 |
+
st.date_input(label="Start date of the team", value=datetime.date(2019, 7, 6),key=f"{key}_startdate",on_change=lambda: (st.session_state.form_data.update({key: st.session_state[f"{key}_startdate"]}), save_to_cache())[1])
|
167 |
+
with coll:
|
168 |
+
st.date_input(label="End date of the team", value=datetime.date(2019, 7, 6),key=f"{key}_enddate",on_change=lambda: (st.session_state.form_data.update({key: st.session_state[f"{key}_enddate"]}), save_to_cache())[1])
|
169 |
+
|
170 |
+
group(key)
|
171 |
+
|
172 |
def group(key):
|
173 |
colr, coll = st.columns([1, 1])
|
174 |
with colr:
|
|
|
223 |
##
|
224 |
## Title
|
225 |
##
|
226 |
+
col1, col2 = st.columns([8, 2])
|
227 |
+
with col1:
|
228 |
+
st.title("The Software Diversity Card :woman_and_man_holding_hands: :memo:")
|
229 |
+
with col2:
|
230 |
+
# Theme options
|
231 |
+
themes = {
|
232 |
+
"Cool Blue": {
|
233 |
+
"primaryColor" : "#007ACC", # A vibrant, clear blue
|
234 |
+
"backgroundColor" : "#E6F7FF" , # A light, airy blue for a fresh feel
|
235 |
+
"secondaryBackgroundColor" : "#B3E0FF", # A gentle pastel blue
|
236 |
+
"textColor" : "#003366" , # Deep navy for contrast
|
237 |
+
"font" : "sans serif",
|
238 |
+
},
|
239 |
+
"Light": {
|
240 |
+
"primaryColor": "#4CAF50",
|
241 |
+
"backgroundColor": "#FFFFFF",
|
242 |
+
"secondaryBackgroundColor": "#F0F2F6",
|
243 |
+
"textColor": "#262730",
|
244 |
+
},
|
245 |
+
"Dark": {
|
246 |
+
"primaryColor": "#BB86FC",
|
247 |
+
"backgroundColor": "#121212",
|
248 |
+
"secondaryBackgroundColor": "#1E1E1E",
|
249 |
+
"textColor": "#E0E0E0",
|
250 |
+
},
|
251 |
+
"Solarized": {
|
252 |
+
"primaryColor": "#268BD2",
|
253 |
+
"backgroundColor": "#FDF6E3",
|
254 |
+
"secondaryBackgroundColor": "#EEE8D5",
|
255 |
+
"textColor": "#657B83",
|
256 |
+
}
|
257 |
+
|
258 |
+
}
|
259 |
+
|
260 |
+
# UI to select a theme
|
261 |
+
theme_choice = st.selectbox("Choose a theme:", list(themes.keys()))
|
262 |
+
|
263 |
+
# Apply theme
|
264 |
+
selected_theme = themes[theme_choice]
|
265 |
+
st.markdown(
|
266 |
+
f"""
|
267 |
+
<style>
|
268 |
+
.stApp {{
|
269 |
+
background-color: {selected_theme["backgroundColor"]};
|
270 |
+
color: {selected_theme["textColor"]};
|
271 |
+
}}
|
272 |
+
.stButton > button {{
|
273 |
+
background-color: {selected_theme["primaryColor"]};
|
274 |
+
color: white;
|
275 |
+
}}
|
276 |
+
.stSidebar {{
|
277 |
+
background-color: {selected_theme["secondaryBackgroundColor"]};
|
278 |
+
}}
|
279 |
+
</style>
|
280 |
+
""",
|
281 |
+
unsafe_allow_html=True
|
282 |
+
)
|
283 |
st.markdown("""\
|
284 |
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
|
285 |
""")
|
286 |
+
|
287 |
+
|
288 |
|
289 |
##
|
290 |
## Master info
|
|
|
357 |
|
358 |
|
359 |
with usageContext:
|
360 |
+
colr, coll = st.columns([1, 1])
|
361 |
+
with colr:
|
362 |
+
key = "socialContext"
|
363 |
+
cached_text_area("Social context",f"{key}_description", "Description of the usage and social context of the app")
|
364 |
+
with coll:
|
365 |
+
cached_multiple_radio(f"{key}_countries",ISO3166,"The countries where the app is intended to be deployed and used")
|
366 |
+
cached_multiple_radio( f"{key}_languages", ISO3166, "The relevant languages for the app usage's context")
|
367 |
+
targetCommunities, adaptations = st.tabs([
|
368 |
+
"Targeted Communities",
|
369 |
+
"Adpatations",
|
370 |
+
])
|
371 |
+
with targetCommunities:
|
372 |
+
keyTarget = key+"_targetCommunity"
|
373 |
+
cached_text_input("Name",f"{keyTarget}_name", "Name or ID of the target community")
|
374 |
+
cached_text_area("Description",f"{keyTarget}_description", "Description of the target community")
|
375 |
+
group(keyTarget)
|
376 |
+
|
377 |
+
with adaptations:
|
378 |
+
keyAdapt = key+"_adaptation"
|
379 |
+
cached_text_input("Name",f"{keyAdapt}_name", "Name or ID of the adaptation")
|
380 |
+
cached_text_area("Description",f"{keyAdapt}_description", "Description of the adaptation")
|
381 |
|
382 |
|
383 |
|
384 |
with participants:
|
385 |
+
# Participants
|
386 |
+
st.write("Add the different teams participating the software project")
|
387 |
+
key = "participants"
|
388 |
+
init_state(key)
|
389 |
+
if st.button("Add a team of participants"):
|
390 |
+
add_text_area(key)
|
391 |
+
# Loop over the array and create a text area with a remove button for each element
|
392 |
+
|
393 |
+
for idx, text in enumerate(st.session_state[key]):
|
394 |
+
# Create two columns: one for the text area, one for the remove button
|
395 |
+
with st.container(border=True):
|
396 |
+
col1, col2 = st.columns([2, 2])
|
397 |
+
with col1:
|
398 |
+
cached_text_input("Team name", f"{key}_{idx}_name", "The name of id of the team")
|
399 |
+
cached_text_area("Team description", f"{key}_{idx}_description", "A description of the team")
|
400 |
+
|
401 |
+
|
402 |
+
with col2:
|
403 |
+
if st.button("Remove", key=f"{key}_remove_{idx}"):
|
404 |
+
remove_text_area(idx,key)
|
405 |
+
cached_multiple_radio(f"{key}_{idx}_type", ['Development Team', 'NonCoding Contributor', 'Tester Team', 'Public Reporter TEam'], f"Team role type" )
|
406 |
+
team(f"{key}_{idx}")
|
407 |
+
|
408 |
+
|
409 |
|
410 |
|
411 |
|