BulkR/src/__builtins__.py

35 lines
926 B
Python
Raw Permalink Normal View History

2022-02-06 19:34:48 +00:00
# Python imports
2023-01-17 04:47:28 +00:00
import builtins
import threading
2022-02-06 19:34:48 +00:00
from os import path
2023-01-17 04:47:28 +00:00
2022-02-06 19:34:48 +00:00
# Lib imports
# Application imports
2023-01-17 04:47:28 +00:00
from utils.event_system import EventSystem
2022-02-06 19:34:48 +00:00
2023-01-17 04:47:28 +00:00
# NOTE: Threads WILL NOT die with parent's destruction.
def threaded_wrapper(fn):
def wrapper(*args, **kwargs):
threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=False).start()
return wrapper
2023-01-17 04:47:28 +00:00
# NOTE: Threads WILL die with parent's destruction.
def daemon_threaded_wrapper(fn):
def wrapper(*args, **kwargs):
threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=True).start()
return wrapper
2022-02-06 19:34:48 +00:00
# NOTE: Just reminding myself we can add to builtins two different ways...
# __builtins__.update({"event_system": Builtins()})
2022-02-07 01:58:45 +00:00
builtins.app_name = "BulkR"
2023-01-17 04:47:28 +00:00
builtins.USER_HOME = path.expanduser('~')
builtins.event_system = EventSystem()
2022-02-06 19:34:48 +00:00
builtins.debug = False
builtins.trace_debug = False