Galaxie EveLoop 0.1.5 documentation


Navigation:   | Index   | Search   | Top   | Up   |
Table of Content: |

© Copyright 2021-2024, Galaxie EveLoop Team all right reserved.

Top » Module code » glxeveloop.loop.handle_events

Source code for glxeveloop.loop.handle_events

import logging
from threading import Thread
from queue import Queue
from glxeveloop.hooks import Hooks


[docs] class HandleEvents: debug: bool hooks: Hooks queue: Queue
[docs] def handle_event(self): event = None handler_list = [] try: while not self.queue.empty(): event = self.queue.get() if self.hooks.dispatch: if hasattr(self, "debug") and self.debug: logging.debug( "%s", f"{self.__class__.__name__}.handle_event ({event[0]}, {event[1]}) to {self.hooks.dispatch}", ) handler_list.append( Thread(target=self.hooks.dispatch(event[0], event[1])) ) for handler in handler_list: handler.start() for handler in handler_list: handler.join() except KeyError as the_error: # pragma: no cover # Permit to have error logs about unknown event logging.error( "%s", f"{self.__class__.__name__}._handle_event(): KeyError:{the_error} event:{event}", )

Top » Module code » glxeveloop.loop.handle_events

© Copyright 2021-2024, Galaxie EveLoop Team all right reserved.
This page is licensed under the GNU General Public License v3 or later (GPLv3+).
Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
See History and License for more information.

Last updated on None.
Created using Sphinx 7.3.7.