feat: add root directory files and interactive module - Add account manager, test files, and interactive GUI module; Update requirements.txt
This commit is contained in:
37
interactive/main.py
Normal file
37
interactive/main.py
Normal file
@@ -0,0 +1,37 @@
|
||||
import logging
|
||||
from pathlib import Path
|
||||
from gui.main_window import MainWindow
|
||||
|
||||
def setup_logging():
|
||||
"""设置日志"""
|
||||
log_dir = Path.home() / ".cursor_switcher" / "logs"
|
||||
log_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
log_file = log_dir / "switcher.log"
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format="%(asctime)s - %(levelname)s - %(message)s",
|
||||
handlers=[
|
||||
logging.FileHandler(log_file, encoding="utf-8"),
|
||||
logging.StreamHandler()
|
||||
]
|
||||
)
|
||||
logging.info("日志系统初始化完成")
|
||||
|
||||
def main():
|
||||
"""主函数"""
|
||||
try:
|
||||
setup_logging()
|
||||
logging.info("启动GUI界面...")
|
||||
window = MainWindow()
|
||||
window.run()
|
||||
except KeyboardInterrupt:
|
||||
logging.info("程序被用户中断")
|
||||
except Exception as e:
|
||||
logging.error(f"程序运行出错: {str(e)}")
|
||||
finally:
|
||||
logging.info("程序退出")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user