|
|
|
|
@ -86,6 +86,13 @@ class TTk(TTkWidget):
|
|
|
|
|
'paintExecuted') |
|
|
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs): |
|
|
|
|
# If the "TERMTK_FILE_LOG" env variable is defined |
|
|
|
|
# logs are saved in the file identified by this variable |
|
|
|
|
# i.e. |
|
|
|
|
# TERMTK_FILE_LOG=session.log python3 demo/demo.py |
|
|
|
|
if ('TERMTK_FILE_LOG' in os.environ and (_logFile := os.environ['TERMTK_FILE_LOG'])): |
|
|
|
|
TTkLog.use_default_file_logging(_logFile) |
|
|
|
|
|
|
|
|
|
self.paintExecuted = pyTTkSignal() |
|
|
|
|
super().__init__(*args, **kwargs) |
|
|
|
|
self._termMouse = True |
|
|
|
|
@ -307,7 +314,16 @@ class TTk(TTkWidget):
|
|
|
|
|
# TODO: Restart threads |
|
|
|
|
# TODO: Redraw the screen |
|
|
|
|
|
|
|
|
|
def _SIGINT(self, signum, frame): |
|
|
|
|
def _SIGINT(self, signum, fraTERMTK_STACKTRACEme): |
|
|
|
|
# If the "TERMTK_STACKTRACE" env variable is defined |
|
|
|
|
# a stacktrace file is generated once CTRL+C is pressed |
|
|
|
|
# i.e. |
|
|
|
|
# TERMTK_STACKTRACE=stacktracetxt python3 demo/demo.py |
|
|
|
|
if ('TERMTK_STACKTRACE' in os.environ and (_stacktraceFile := os.environ['TERMTK_STACKTRACE'])): |
|
|
|
|
with open(_stacktraceFile,'w') as f: |
|
|
|
|
import faulthandler |
|
|
|
|
faulthandler.dump_traceback(f) |
|
|
|
|
|
|
|
|
|
TTkLog.debug("Captured SIGINT <CTRL-C>") |
|
|
|
|
# Deregister the handler |
|
|
|
|
# so CTRL-C can be redirected to the default handler if the app does not exit |
|
|
|
|
|