diff --git a/streamlit/Introduction.py b/streamlit/Introduction.py index 2f070e4..f689cf7 100644 --- a/streamlit/Introduction.py +++ b/streamlit/Introduction.py @@ -11,7 +11,8 @@ st.set_page_config( page_title="BattMo", - page_icon=Image.open(os.path.join(os.path.dirname(os.path.abspath(__file__)),"images", "battmo_logo.png")) + page_icon=Image.open(os.path.join(os.path.dirname(os.path.abspath(__file__)),"images", "battmo_logo.png")), + #layout="wide" ) ############################## @@ -23,18 +24,29 @@ sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) # set config is done before import to avoid streamlit error -from app_scripts.app_controller import set_heading, set_page_navigation, set_external_links +from app_scripts.app_controller import set_heading, set_page_navigation, set_external_links, set_acknowlegent_info +from app_scripts import app_view def run_app(): #Set Introduction page heading wil title, BattMo logo, and BattMo info. set_heading() + app_view.st_space(space_width=3) + #Set page navigation - set_page_navigation() + col = set_page_navigation() #Set external links to websites and documentation set_external_links() + + with st.sidebar: + app_view.st_space(space_width=3) + + #Set funding acknowledgement + set_acknowlegent_info(col) + + if __name__ == "__main__": run_app() diff --git a/streamlit/app_scripts/app_controller.py b/streamlit/app_scripts/app_controller.py index 644b7e0..f4ce429 100644 --- a/streamlit/app_scripts/app_controller.py +++ b/streamlit/app_scripts/app_controller.py @@ -85,6 +85,9 @@ def set_material_description(): def get_results_data(): return view.GetResultsData() +def set_acknowlegent_info(col): + return view.SetAcknowledgementInfo(col) + ##################################### # Images diff --git a/streamlit/app_scripts/app_view.py b/streamlit/app_scripts/app_view.py index f5a888d..a52cefe 100644 --- a/streamlit/app_scripts/app_view.py +++ b/streamlit/app_scripts/app_view.py @@ -74,6 +74,7 @@ def __init__(self, logo): devices. It simulates the Current-Voltage response of a battery using Physics-based models. """ + self.info = "Hover over the following buttons to see what you can find on each page." # Set heading self.set_heading() @@ -81,7 +82,8 @@ def __init__(self, logo): def set_heading(self): self.set_title_and_logo() - self.set_description() + self.set_description() + self.set_info() def set_title_and_logo(self): # Title and subtitle @@ -92,7 +94,11 @@ def set_title_and_logo(self): def set_description(self): # Description - st.text(self.description) + st.write(self.description) + + def set_info(self): + + st.info(self.info) class SetPageNavigation: @@ -101,7 +107,6 @@ class SetPageNavigation: """ def __init__(self): - self.info = "Hover over the following buttons to see what you can find on each page." self.help_simulation = "Define your input parameters and run a simulation." self.help_results = "Download and visualize your results." self.help_materials_and_models = "See which pre-defined materials and which simulation models are available." @@ -109,25 +114,29 @@ def __init__(self): def set_page_navigation(self): - self.set_info() - self.set_page_buttons() - - - def set_info(self): + col = self.set_page_buttons() - st.info(self.info) + return col + def set_page_buttons(self): - simulation_page = st.button(label = "Simulation", + _,col1,_ = st.columns([2.95,2,2.5]) + st_space(space_width=6) + _,col2,_ = st.columns([3.15,2,2.5]) + st_space(space_width=6) + _,col3,col4 = st.columns([2.45,2,2.5]) + st_space(space_width=6) + + simulation_page = col1.button(label = "Simulation", help = self.help_simulation ) - results_page = st.button(label = "Results", + results_page = col2.button(label = "Results", help = self.help_results ) - materials_and_models_page = st.button(label = "Materials and models", + materials_and_models_page = col3.button(label = "Materials and models", help = self.help_materials_and_models ) @@ -140,6 +149,38 @@ def set_page_buttons(self): if materials_and_models_page: switch_page("Materials and models") + return col4 + + +class SetAcknowledgementInfo: + """ + Used to render the info on the funding of the project on the 'Introduction' page. + """ + def __init__(self,col): + + self.col = col + self.text = "This project has received [funding](https://github.com/BattMoTeam/BattMo#) from the European Union" + self.flag_image = Image.open(os.path.join(app_access.get_path_to_images_dir(), "flag_of_europe.jpg")) + + self.set_acknowledgement() + + def set_acknowledgement(self): + + #col1,col2,col3 = st.columns([1,2,3]) + #_,col2 = st.columns([4,1.5]) + self.set_europe_flag() + self.set_funding_info() + + + def set_funding_info(self): + + st.write(self.text) + + def set_europe_flag(self): + + st.image(self.flag_image, width = 90) + + class SetExternalLinks: """ diff --git a/streamlit/images/flag_of_europe.jpg b/streamlit/images/flag_of_europe.jpg new file mode 100644 index 0000000..7f43123 Binary files /dev/null and b/streamlit/images/flag_of_europe.jpg differ