File size: 3,056 Bytes
e0bab69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# ─────────────────────────────────────────────────────────────────────────────
# Building Acoustics Analysis Tool  ·  Streamlit 1.35
# RT60 · Background-Noise · Speech-Intelligibility   
# Version: V4-2025
# Date: July 2025
# ─────────────────────────────────────────────────────────────────────────────

import streamlit as st
from config import MAJOR_TABS, DEFAULTS
from sections import (
    section_instructions, section_initial_data, section_initial_checks,
    section_acoustic_treatment, section_final_checks, section_faq,
    nav_to, nav_buttons
)
from report import generate_docx

# ── page config (unchanged) ────────────────────────────────────────────────
st.set_page_config("Building Acoustics Analysis Tool", "🏫",
                   layout="wide", initial_sidebar_state="expanded")

# ── ensure session-state keys exist ────────────────────────────────────────
for k, v in DEFAULTS.items():
    st.session_state.setdefault(k, v)

# ── sidebar navigation ─────────────────────────────────────────────────────
with st.sidebar:
    st.header("Navigation")
    for tab in MAJOR_TABS:
        st.button(tab, on_click=nav_to, args=(tab,))
    st.markdown("---")
    st.write("Version: V4-2025")
    if st.session_state.major_tab == "Final Compliance Checks":
        st.download_button("📥 Word Report",
                           generate_docx(),
                           "Acoustics_Report.docx",
                           "application/vnd.openxmlformats-officedocument."
                           "wordprocessingml.document")

# ── router ─────────────────────────────────────────────────────────────────
ROUTES = {
    "Instructions": section_instructions,
    "Initial Data Entry": section_initial_data,
    "Initial Compliance Checks": section_initial_checks,
    "Acoustic Treatment": section_acoustic_treatment,
    "Final Compliance Checks": section_final_checks,
    "FAQ / Help": section_faq,
}
ROUTES[st.session_state.major_tab]()

# ── footer ─────────────────────────────────────────────────────────────────
st.write("---")
st.write("Developed by Dr Abdul-Manan Sadick · Deakin University · 2025")