bowser/main.py
Benedikt Willi f1e4957e70 Initial commit: Setup Bowser educational web browser
- Added README.md with project description, building instructions, and development milestones.
- Created the project structure with directories for source code, assets, and tests.
- Implemented a basic entry point in main.py with argument parsing and logging configuration.
- Developed preliminary browser orchestration in browser.py, including tab management and navigation.
- Established a GTK-based UI framework in chrome.py, integrating key UI components including the address bar and navigation buttons.
- Incorporated HTTP request handling in http.py, with enhanced logging of requests and responses.
- Added initial assets: logo and images for browser UI.
- Configured dependencies in pyproject.toml for development and runtime environments.
- Initialized version control with uv.lock for dependency management.
2026-01-09 13:31:48 +01:00

40 lines
1 KiB
Python

"""Entry point for Bowser browser."""
import argparse
import logging
from src.browser.browser import Browser
def _parse_args():
parser = argparse.ArgumentParser(prog="bowser", description="Bowser educational browser")
parser.add_argument("url", nargs="?", default="https://example.com", help="URL to open")
parser.add_argument("--debug", action="store_true", help="Enable debug output (alias for --log-level=DEBUG)")
parser.add_argument(
"--log-level",
choices=["ERROR", "WARNING", "INFO", "DEBUG"],
default="INFO",
help="Set logging level",
)
return parser.parse_args()
def _configure_logging(args):
level = logging.DEBUG if args.debug else getattr(logging, args.log_level)
logging.basicConfig(
level=level,
format="%(asctime)s %(name)s %(levelname)s: %(message)s",
datefmt="%H:%M:%S",
)
def main():
args = _parse_args()
_configure_logging(args)
browser = Browser()
browser.new_tab(args.url)
browser.run()
if __name__ == "__main__":
main()