Files
stormirc/stormirc
2025-11-11 01:02:38 -05:00

67 lines
1.7 KiB
Python
Executable File

#!/usr/bin/env python3
"""StormIRC - Accessible IRC Client."""
import sys
import argparse
import logging
from pathlib import Path
# Add the project root to the path
project_root = Path(__file__).parent
sys.path.insert(0, str(project_root))
from src.ui.main_window import MainWindow
from PySide6.QtWidgets import QApplication
from PySide6.QtCore import Qt
def setup_logging(debug=False):
"""Set up logging configuration."""
if debug:
log_file = project_root / "stormirc.log"
logging.basicConfig(
level=logging.DEBUG,
format='[%(levelname)s] %(name)s: %(message)s [%(asctime)s]',
datefmt='%a %b %d %I:%M:%S %p %Z %Y',
handlers=[
logging.FileHandler(log_file),
logging.StreamHandler(sys.stdout)
]
)
logging.info(f"Debug logging enabled, writing to {log_file}")
else:
logging.basicConfig(
level=logging.WARNING,
format='%(levelname)s: %(message)s'
)
def main():
"""Main entry point for StormIRC."""
parser = argparse.ArgumentParser(description="StormIRC - Accessible IRC Client")
parser.add_argument('-d', '--debug', action='store_true',
help='Enable debug logging to stormirc.log')
args = parser.parse_args()
setup_logging(args.debug)
# Enable high DPI scaling
QApplication.setHighDpiScaleFactorRoundingPolicy(
Qt.HighDpiScaleFactorRoundingPolicy.PassThrough
)
app = QApplication(sys.argv)
app.setApplicationName("StormIRC")
app.setOrganizationName("Stormux")
# Create and show main window
window = MainWindow()
window.show()
sys.exit(app.exec())
if __name__ == "__main__":
main()