From 4ab15ba924dfa888e881a777ecaa89ae9cf3cbff Mon Sep 17 00:00:00 2001 From: Sven Augustin Date: Sun, 22 May 2022 20:03:30 +0200 Subject: [PATCH] refactor --- stand.py | 11 ++--------- utils/st_utils.py | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/stand.py b/stand.py index 88296ac..540202d 100644 --- a/stand.py +++ b/stand.py @@ -4,7 +4,7 @@ from st_aggrid import AgGrid, GridOptionsBuilder import hacks from restapi import restapi -from utils.st_utils import get_session_id, rerun +from utils.st_utils import get_session_id, rerun, hide_UI_elements from utils.df_utils import to_excel_binary @@ -14,14 +14,7 @@ st.set_page_config( layout="wide" ) -hide_st_style = """ - -""" -st.markdown(hide_st_style, unsafe_allow_html=True) +hide_UI_elements() diff --git a/utils/st_utils.py b/utils/st_utils.py index bceb344..0d576cd 100644 --- a/utils/st_utils.py +++ b/utils/st_utils.py @@ -19,3 +19,25 @@ def get_session_id(): +def hide_UI_elements(menu=True, header=True, footer=True): + HIDDEN = " {visibility: hidden;}" + res = [] + + if menu: + res.append("#MainMenu" + HIDDEN) + + if header: + res.append("header" + HIDDEN) + + if footer: + res.append("footer" + HIDDEN) + + if not res: + return + + res = [""] + res = "\n".join(res) + return st.markdown(res, unsafe_allow_html=True) + + +