| |
| |
| |
| |
| import streamlit as st |
| from streamlit_option_menu import option_menu |
| import base64 |
| import sys |
| from pathlib import Path |
| script_dir = Path(__file__).resolve().parent |
| project_root = script_dir.parent |
| sys.path.append(str(project_root)) |
| |
| |
| |
| |
| from src.Streamlit_Magic_Sheet.components.header import * |
| from src.Streamlit_Magic_Sheet.components.body import * |
| from src.Streamlit_Magic_Sheet.components.navigation import * |
| from src.Streamlit_Magic_Sheet.components.metrics import * |
| from src.Streamlit_Magic_Sheet.components.charts import * |
| from src.Streamlit_Magic_Sheet.components.test import * |
| from src.Streamlit_Magic_Sheet.components.elements import * |
| |
|
|
| |
| |
| |
|
|
|
|
| def img_to_bytes(img_path): |
| img_bytes = Path(img_path).read_bytes() |
| encoded = base64.b64encode(img_bytes).decode() |
| return encoded |
|
|
|
|
| |
| def left_main_panel(): |
| custom_css = f""" |
| <style> |
| .sidebar .stImage {{ |
| display: block; |
| margin: 0; |
| padding: 0; |
| }} |
| .st-emotion-cache-10oheav {{padding: 0.1rem 0.2rem;}} |
| img{{ |
| vertical-align: middle; |
| margin-right: 70px; |
| float:right; |
| }} |
| </style> |
| """ |
|
|
| |
| st.sidebar.markdown(custom_css, unsafe_allow_html=True) |
| st.sidebar.markdown(f'''[<img src='data:image/png;base64,{img_to_bytes("src/Streamlit_Magic_Sheet/data unboxed.png")}' class='img-fluid' width=100 height=100>](https://Tushar-Aggarwal.com/)''', unsafe_allow_html=True) |
| |
| st.sidebar.markdown(f"##### <span style='margin-left: 45px;'>[Tushar-Aggarwal.com](https://tushar-aggarwal.com/)</span>", unsafe_allow_html=True) |
|
|
| with st.sidebar: |
| main_navbar =option_menu( |
| menu_title="", |
| options=['Magic Sheet','Write and Magic','Text Elements', 'Data Elements', 'Chart Elements', |
| 'Input Widgtes', 'Media Elements', 'Layouts and Containers', |
| 'Chat Elements', 'Status Elements', 'Control Flow', |
| 'Utilities', 'Mutate Charts', 'State Management', |
| 'Performance', 'Personalization', 'Connections and Databases', |
| 'App Menu', 'Button Behavior and Examples', 'Caching', |
| 'Command Line Options', 'Configuration', 'Theming', 'Connecting To Data', |
| 'Dataframes', 'Forms', 'Add Statefulness to Apps', 'Widget Behavior', |
| 'Working With Timezones', 'Static File Serving', |
| 'Https Support', 'Secrects Management', 'Security Reminders', |
| 'Connect to Data Sources'], |
| icons=['magic','blockquote-left','body-text','bar-chart-line-fill', 'bar-chart', |
| 'input-cursor-text', 'collection-play-fill', 'columns-gap', |
| 'chat-right-text', 'briefcase', 'diagram-3', |
| 'collection', 'pie-chart-fill', 'kanban-fill', |
| 'speedometer', 'columns', 'hdd', |
| 'menu-button', 'check2-square', 'memory', |
| 'list-columns', 'gear', 'columns-gap', 'gear-wide-connected', |
| 'table', 'ui-checks', 'menu-app-fill', 'card-heading', |
| 'calendar-date', 'file-earmark-arrow-down', |
| 'ethernet', 'asterisk', 'key', |
| 'hdd'], |
| menu_icon="house-fill", |
| default_index=0, |
| ) |
| |
|
|
|
|
| |
| |
| |
| |
| |
| |
| |
| if main_navbar=="Magic Sheet": |
| magic_sheet_uk() |
|
|
| if main_navbar=="Text Elements": |
| text_elements() |
| |
| if main_navbar=="Write and Magic": |
| write_and_magic() |
| |
| if main_navbar=="Data Elements": |
| data_elements() |
| |
| if main_navbar=="Chart Elements": |
| chart_elements() |
| |
| if main_navbar=="Input Widgtes": |
| input_widgtes() |
| |
| if main_navbar=="Media Elements": |
| media_elements() |
| |
| if main_navbar=="Layouts and Containers": |
| layouts_and_containers() |
| |
| if main_navbar=="Chat Elements": |
| chat_elements() |
| |
| if main_navbar=="Status Elements": |
| status_elements() |
| |
| if main_navbar=="Control Flow": |
| control_flow() |
| |
| if main_navbar=="Utilities": |
| utilities() |
| |
| if main_navbar=="Mutate Charts": |
| mutate_charts() |
| |
| if main_navbar=="State Management": |
| state_management() |
| |
| if main_navbar=="Performance": |
| performance() |
| |
| if main_navbar=="Personalization": |
| personalization() |
| |
| if main_navbar=="Connections and Databases": |
| connections_and_databases() |
| |
| if main_navbar=="App Menu": |
| app_menu() |
| |
| if main_navbar=="Button Behavior and Examples": |
| button_behavior_and_examples() |
| |
| if main_navbar=="Caching": |
| caching() |
| |
| if main_navbar=="Command Line Options,": |
| command_line_options() |
| |
| if main_navbar=="Configuration": |
| configuration() |
| |
| if main_navbar=="Theming": |
| theming() |
| |
| if main_navbar=="Connecting To Data": |
| connecting_to_data() |
| |
| if main_navbar=="Dataframes": |
| dataframes() |
| |
| if main_navbar=="Forms": |
| forms() |
| |
| if main_navbar=="Add Statefulness to Apps": |
| add_statefulness_to_apps() |
| |
| if main_navbar=="Widget Behavior": |
| widget_behavior() |
| |
| if main_navbar=="Working With Timezones": |
| working_with_timezones() |
| |
| if main_navbar=="Static File Serving": |
| static_file_serving() |
| |
| if main_navbar=="Https Support": |
| https_support() |
| |
| if main_navbar=="Secrects Management": |
| secrects_management() |
| |
| if main_navbar=="Security Reminders": |
| security_reminders() |
| |
| if main_navbar=="Connect to Data Sources": |
| connect_to_data_sources() |
| |
| |
| |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|