- Simplified initialization logic in init.py - Consolidated testing_mode assignment - Removed unnecessary else statements - Created UIManager class to handle UI-related tasks - Modularized input frame creation, table frame creation, and graph frame creation - Enhanced edit window creation with better organization and error handling - Updated data management methods to improve clarity and maintainability - Improved logging for better debugging and tracking of application flow
60 lines
1.7 KiB
Bash
Executable File
60 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/bash
|
|
|
|
# Check for .env file and create if it doesn't exist
|
|
if [ ! -f .env ]; then
|
|
echo "Creating .env file..."
|
|
touch .env
|
|
fi
|
|
|
|
# Allow local X server connections
|
|
xhost +local:
|
|
|
|
# Set environment variables
|
|
export DISPLAY=":0" # Default to local display
|
|
# Try to get IP address if hostname -I is available
|
|
if command -v hostname >/dev/null 2>&1; then
|
|
if hostname --help 2>&1 | grep -q -- "-I"; then
|
|
IP=$(hostname -I 2>/dev/null | awk '{print $1}' || echo "")
|
|
if [ -n "$IP" ]; then
|
|
export DISPLAY="$IP:0"
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
export SRC_PATH=$(pwd)
|
|
export IMAGE="thechart:latest"
|
|
export XAUTHORITY=$HOME/.Xauthority
|
|
|
|
echo "Building and running the container..."
|
|
echo "Using DISPLAY=$DISPLAY"
|
|
echo "Using SRC_PATH=$SRC_PATH"
|
|
echo "Using XAUTHORITY=$XAUTHORITY"
|
|
|
|
# Check if debug mode is requested
|
|
if [ "$1" = "debug" ]; then
|
|
echo "Running in debug mode - will open shell instead of running app"
|
|
docker-compose build
|
|
docker run --rm -it \
|
|
-v /tmp/.X11-unix:/tmp/.X11-unix \
|
|
-v ${XAUTHORITY:-$HOME/.Xauthority}:/tmp/.docker.xauth:rw \
|
|
-e DISPLAY=${DISPLAY:-:0} \
|
|
-e XAUTHORITY=/tmp/.docker.xauth \
|
|
${IMAGE} /bin/sh
|
|
else
|
|
# First run with debug to see the container's internal state
|
|
echo "First entering container shell for debugging..."
|
|
docker run --rm -it \
|
|
-v /tmp/.X11-unix:/tmp/.X11-unix \
|
|
-v ${XAUTHORITY:-$HOME/.Xauthority}:/tmp/.docker.xauth:rw \
|
|
-e DISPLAY=${DISPLAY:-:0} \
|
|
-e XAUTHORITY=/tmp/.docker.xauth \
|
|
${IMAGE} /bin/sh
|
|
|
|
# Then continue with normal operation if needed
|
|
echo "Now running the container with docker-compose..."
|
|
docker-compose up --build
|
|
fi
|
|
|
|
# Disallow local X server connections when done
|
|
xhost -local:
|