Hello!
There is a QT project. It includes several services and all sorts of constants, flags and states that are used throughout the project.
For global access to a single entry point to all properties, I did this:
Please provide strong reasons why this is a bad idea.
There is a QT project. It includes several services and all sorts of constants, flags and states that are used throughout the project.
For global access to a single entry point to all properties, I did this:
import sys import builtins import asyncio from asyncqt import QEventLoop from PySide2 import QtWidgets import core import logger def main(): logger.info('<Your app is running PID:{}>'.format( QtWidgets.QApplication.applicationPid())) qApp = QtWidgets.QApplication(sys.argv) loop = QEventLoop(qApp) asyncio.set_event_loop(loop) try: builtins.Core = core.Core(qApp) loop.create_task(Core.Run()) except Exception as e: logger.critical("ERROR [INIT]: {}".format(e)) sys.exit() try: loop.run_forever() except Exception as e: logger.exception(e) loop.close()Now I have access to all the necessary components from anywhere in the project through the Core variable.
Please provide strong reasons why this is a bad idea.