#!/usr/bin/python3.11 -s

import argparse

if __name__ == "__main__":
    parser = argparse.ArgumentParser(prog="Douane Configurator", add_help=False)
    parser.add_argument('-h', '--help', action='help',
                        default=argparse.SUPPRESS,
                        help='Show this help message and exit.')
    parser.add_argument('-i', '--install-autostart', action='store_true',
                        help='Install the autostart file')
    parser.add_argument('-r', '--remove-autostart', action='store_true',
                        help='Remove the autostart file')
    args = parser.parse_args()

    if args.install_autostart:
        from douane.autostart import Autostart
        Autostart().install()
    elif args.remove_autostart:
        from douane.autostart import Autostart
        Autostart().uninstall()
    else:
        import gi
        gi.require_version('Gtk', '3.0')
        from gi.repository import Gtk, GLib, Gdk
        from douane.gui.mainwindow import MainWindow
        MainWindow()

        GLib.threads_init()
        Gdk.threads_init()
        Gdk.threads_enter()
        Gtk.main()
        Gdk.threads_leave()
