From 2c2e3b0597684156e194e0a77875e7cbc03c51f7 Mon Sep 17 00:00:00 2001 From: anthony-melin Date: Sun, 26 Jul 2026 15:15:23 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20entrypoint=20class?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/elironwars/entrypoints.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/elironwars/entrypoints.py diff --git a/src/elironwars/entrypoints.py b/src/elironwars/entrypoints.py new file mode 100644 index 0000000..4278e02 --- /dev/null +++ b/src/elironwars/entrypoints.py @@ -0,0 +1,18 @@ +import logging +from importlib.metadata import entry_points + +logger = logging.getLogger(__name__) + + +class Entrypoints: + + def __init__(self): + self.ui = entry_points(group='elironwars.ui') + + def load_ui(self, ui): + logger.info('Loading ui %s', ui) + try: + ui_class = self.ui[ui].load() + return ui_class() + except KeyError: + logger.critical('Unable to load ui %s', ui)