55 lines
1.8 KiB
Python
55 lines
1.8 KiB
Python
# dependencyanalyzer/__main__.py
|
|
import logging
|
|
import os
|
|
import sys
|
|
import tkinter as tk
|
|
from pathlib import Path
|
|
|
|
# Use absolute import assuming 'dependencyanalyzer' is runnable with `python -m`
|
|
try:
|
|
# --- MODIFIED IMPORT ---
|
|
# We now import the GUI module and the new core package.
|
|
from dependencyanalyzer import gui
|
|
from dependencyanalyzer import core # This still works to access the package
|
|
# --- END MODIFIED IMPORT ---
|
|
except ImportError:
|
|
# Fallback for running __main__.py directly during development
|
|
print(
|
|
"Running __main__.py directly, attempting relative imports...", file=sys.stderr
|
|
)
|
|
# --- MODIFIED IMPORT (FALLBACK) ---
|
|
from gui import DependencyAnalyzerApp
|
|
import core
|
|
# --- END MODIFIED IMPORT (FALLBACK) ---
|
|
|
|
|
|
def setup_logging():
|
|
"""Configures root logger for the application."""
|
|
log_level_str = os.environ.get("DEP_ANALYZER_LOG_LEVEL", "INFO").upper()
|
|
log_level = getattr(logging, log_level_str, logging.INFO)
|
|
|
|
log_format = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
|
|
|
# Use force=True on Python 3.8+ to ensure handlers are replaced
|
|
kwargs = {"force": True} if sys.version_info >= (3, 8) else {}
|
|
|
|
logging.basicConfig(level=log_level, format=log_format, stream=sys.stdout, **kwargs) # type: ignore
|
|
|
|
logging.info(f"Root logger configured. Level: {logging.getLevelName(log_level)}")
|
|
|
|
|
|
def main():
|
|
"""Main function to launch the Dependency Analyzer application."""
|
|
setup_logging() # Configure logging first
|
|
|
|
root = tk.Tk()
|
|
root.minsize(width=800, height=700)
|
|
# --- MODIFIED CLASS NAME ---
|
|
# The class is now accessed via the imported gui module
|
|
app = gui.DependencyAnalyzerApp(master=root)
|
|
# --- END MODIFIED CLASS NAME ---
|
|
app.mainloop()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main() |