Update app.py
Browse files
app.py
CHANGED
@@ -640,6 +640,24 @@ def saved_documentation_page():
|
|
640 |
|
641 |
|
642 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
643 |
def project_view_page():
|
644 |
# Sidebar with logout and return buttons
|
645 |
st.sidebar.image("SimplifAI Logo Long.jpeg", use_container_width=True)
|
@@ -700,27 +718,9 @@ def project_view_page():
|
|
700 |
if "show_file_structure" not in st.session_state:
|
701 |
st.session_state.show_file_structure = False
|
702 |
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
items = sorted(os.listdir(folder_path)) # Sort items for consistent display
|
707 |
-
st.write(f"{prefix}{os.path.basename(folder_path)}/") # Show the folder name
|
708 |
-
|
709 |
-
for item in items:
|
710 |
-
item_path = os.path.join(folder_path, item)
|
711 |
-
if os.path.isdir(item_path):
|
712 |
-
# Recursively display sub-folders
|
713 |
-
display_folder_contents(item_path, prefix=prefix + " ")
|
714 |
-
else:
|
715 |
-
# Display files with an indented structure
|
716 |
-
st.write(f"{prefix} {item}")
|
717 |
-
except Exception as e:
|
718 |
-
st.error(f"Error displaying folder contents: {e}")
|
719 |
-
|
720 |
-
# Example usage in your `project_view_page` function:
|
721 |
-
if st.session_state.show_file_structure:
|
722 |
-
st.write("File structure:")
|
723 |
-
display_folder_contents(project_folder)
|
724 |
|
725 |
|
726 |
|
|
|
640 |
|
641 |
|
642 |
|
643 |
+
def display_folder_contents(folder_path, prefix=""):
|
644 |
+
"""Recursively lists the contents of a folder in a bash 'ls -R'-like style."""
|
645 |
+
try:
|
646 |
+
items = sorted(os.listdir(folder_path)) # Sort items for consistent display
|
647 |
+
st.write(f"{prefix}{os.path.basename(folder_path)}/") # Show the folder name
|
648 |
+
|
649 |
+
for item in items:
|
650 |
+
item_path = os.path.join(folder_path, item)
|
651 |
+
if os.path.isdir(item_path):
|
652 |
+
# Recursively display sub-folders
|
653 |
+
display_folder_contents(item_path, prefix=prefix + " ")
|
654 |
+
else:
|
655 |
+
# Display files with an indented structure
|
656 |
+
st.write(f"{prefix} {item}")
|
657 |
+
except Exception as e:
|
658 |
+
st.error(f"Error displaying folder contents: {e}")
|
659 |
+
|
660 |
+
|
661 |
def project_view_page():
|
662 |
# Sidebar with logout and return buttons
|
663 |
st.sidebar.image("SimplifAI Logo Long.jpeg", use_container_width=True)
|
|
|
718 |
if "show_file_structure" not in st.session_state:
|
719 |
st.session_state.show_file_structure = False
|
720 |
|
721 |
+
if st.session_state.show_file_structure:
|
722 |
+
st.write("File structure:")
|
723 |
+
display_folder_contents(project_folder)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
724 |
|
725 |
|
726 |
|