Skip to content

Conversation

@MHendricks
Copy link
Member

@MHendricks MHendricks commented Dec 6, 2025

When writing to the console, check if more than X seconds have passed from the last refresh triggered by a write and force a display update if so. This only updates the consoles and does not call QApplication.processEvents.

This attempts to only update the PrEditor consoles without calling QApplication.processEvents() for every update. However if the application looses focus it would eventually stop updating so after 5 seconds it will call processEvents unless that preference is disabled. You can control how often a print will trigger a refresh in the preferences. It defaults to 0.2 seconds which provides a near real time updating without excessively redrawing the consoles.

Also adds pythonw.exe protection to the recent If an error happens processing excepthook/console write it to stderr commit. If running in pythonw.exe sys.__stderr__ is None which gets written to stdout causing recursive attempts to write. This change now prevents those writes and will require generating the error using python.exe.

Checklist

  • I have read the CONTRIBUTING.md document
  • I formatted my changes with black
  • I linted my changes with flake8
  • I have added documentation regarding my changes where necessary
  • Any pre-existing tests continue to pass
  • Additional tests were made covering my changes

Types of Changes

  • Bugfix (change that fixes an issue)
  • New Feature (change that adds functionality)
  • Documentation Update (if none of the other choices apply)

Demo

j1G4hIJi5u.mp4
  1. Shows updating enabled every 0.2 seconds showing near real time output.
  2. Shows limiting updates to every 5 seconds to further reduce any performance hits caused by many updating the UI.
  3. Shows disabling the new feature entirely.
  4. Shows that if no prints are used Qt won't be automatically updated.

On windows, if using pythonw.exe these streams are set to None. If you try
to print to None it will write to `sys.stdout` which causes recursion.
The intent of these calls is to write to the host shell when errors happen
processing a normal PrEditor write so the problem can be debugged.

If you run into that issue when using pythonw.exe you will need to switch
to python.exe to see the debug output.
@MHendricks MHendricks force-pushed the mikeh/blocking_refresh branch from 9c1ca27 to 32f840e Compare December 9, 2025 01:59
When writing to the console, check if more than X seconds have passed from
the last refresh triggered by a write and force a display update if so.
This only updates the consoles and does not call QApplication.processEvents.
@MHendricks MHendricks force-pushed the mikeh/blocking_refresh branch from 32f840e to 07ca56d Compare December 9, 2025 02:07
@MHendricks MHendricks marked this pull request as ready for review December 9, 2025 02:28
@MHendricks MHendricks merged commit 07ca56d into main Dec 12, 2025
17 checks passed
@MHendricks MHendricks deleted the mikeh/blocking_refresh branch December 12, 2025 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants