src files
This commit is contained in:
parent
8acdc3f2a7
commit
cf94545cad
3
src/__init__.py
Normal file
3
src/__init__.py
Normal file
@ -0,0 +1,3 @@
|
||||
"""Code Editor package."""
|
||||
|
||||
__version__ = "0.1.0"
|
83
src/main.py
Normal file
83
src/main.py
Normal file
@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""Main module for the codeeditor application."""
|
||||
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import streamlit as st
|
||||
|
||||
from codeeditor.chat_manager import ChatManager
|
||||
from codeeditor.execution_engine import ExecutionEngine
|
||||
from codeeditor.file_manager import FileManager
|
||||
from codeeditor.search_manager import SearchManager
|
||||
from codeeditor.ui_components import setup_ui
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
||||
handlers=[logging.StreamHandler(sys.stdout)],
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def main():
|
||||
"""Execute the main entry point for the application."""
|
||||
# Initialize session state for storing app state
|
||||
if "file_manager" not in st.session_state:
|
||||
# Start with an empty directory by default
|
||||
empty_dir = ""
|
||||
st.session_state.file_manager = FileManager(
|
||||
Path(empty_dir) if empty_dir else Path.cwd()
|
||||
)
|
||||
|
||||
if "workspace_path" not in st.session_state:
|
||||
st.session_state.workspace_path = ""
|
||||
|
||||
if "chat_manager" not in st.session_state:
|
||||
st.session_state.chat_manager = ChatManager()
|
||||
|
||||
if "execution_engine" not in st.session_state:
|
||||
st.session_state.execution_engine = ExecutionEngine()
|
||||
|
||||
if "search_manager" not in st.session_state:
|
||||
st.session_state.search_manager = SearchManager()
|
||||
|
||||
if "current_file" not in st.session_state:
|
||||
st.session_state.current_file = None
|
||||
|
||||
if "expanded_folders" not in st.session_state:
|
||||
st.session_state.expanded_folders = set()
|
||||
|
||||
# Initialize UI dialog state variables
|
||||
if "show_new_file_dialog" not in st.session_state:
|
||||
st.session_state.show_new_file_dialog = False
|
||||
|
||||
if "show_new_folder_dialog" not in st.session_state:
|
||||
st.session_state.show_new_folder_dialog = False
|
||||
|
||||
# Initialize file filter
|
||||
if "file_filter" not in st.session_state:
|
||||
st.session_state.file_filter = "All Files"
|
||||
|
||||
# Initialize recent projects (for future use)
|
||||
if "recent_projects" not in st.session_state:
|
||||
st.session_state.recent_projects = []
|
||||
|
||||
# Initialize chat input clear flag
|
||||
if "clear_chat_input" not in st.session_state:
|
||||
st.session_state.clear_chat_input = False
|
||||
|
||||
# Ensure chat_history is synchronized with chat_manager
|
||||
st.session_state.chat_history = st.session_state.chat_manager.get_history()
|
||||
|
||||
# Setup the UI components
|
||||
setup_ui()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
17
src/streamlit_app.py
Normal file
17
src/streamlit_app.py
Normal file
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""Streamlit entry point for the codeeditor application."""
|
||||
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
# Add the src directory to the Python path
|
||||
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
|
||||
|
||||
# Import the main function from main.py
|
||||
from main import main
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
x
Reference in New Issue
Block a user