ccbogel / QualCoder

Qualitative data analysis for text, images, audio, video. Cross platform. Python 3.10 or newer and PyQt6.
https://qualcoder.wordpress.com/
GNU Lesser General Public License v3.0
374 stars 85 forks source link

Ideas for Improved Usability II #931

Closed kaixxx closed 2 months ago

kaixxx commented 2 months ago

As discussed here: https://github.com/ccbogel/QualCoder/issues/928 Continuation of: https://github.com/ccbogel/QualCoder/pull/929

The new error dialog looks like this:

The 'Copy' button copies the error message and traceback to the clipboard for easy reporting.

One importand thing to consider: sys.excepthook is a global hook for the current instance of the python interpretor. It only needs to be set once for the whole app. This is now triggered by the line qt_exception_hook = UncaughtHook() in main.py, right after setting up the logger. ALL other assignments to sys.excepthook in the whole app must to be removed. Otherwise, the new error handling routine would be overwritten by these old methods. For the basic concept see: https://timlehr.com/2018/01/python-exception-hooks-with-qt-message-box/index.html I can remove the old exception_handlers but wanted to get your approval before making such a widespread change to the current codebase.

For the time beeing, I have only replaced the exception_handler in main.py. To test this, you can follow these steps:

Final note: I've also added a small script called 'rebuild_ui.py' that I use to automatically recompile the UI-files after making changes in Qt Designer. You can ignore it if you want.

ccbogel commented 2 months ago

@kaixxx yes ok. One thing I am thinking is that the full traceback error should go to the log file. Usually having the short immediate error is fine, but there are times when the full track is useful to see the preceding steps that initiated the error.