Skip to content

Conversation

@MHendricks
Copy link
Member

This is a major refactoring of the preference files and workbox tabs. It also adds the new OutputConsole widget with a refactoring of the Console. These changes are drastic enough to warrant a major version up.

This Pull request merges all changes from the main2.0 branch into the main branch.

What's Changed

Warning: Preference saving has been re-worked. It will automatically migrate
to the new setup so you won't lose your current workbox tab contents. However
if you want to switch back to the 1.X release see "Reverting to v1.X prefs" below.

  • Overhaul workbox tabs
    • Support linking tabs to files. You can edit these files in an external editor and the tab will be updated automatically.
    • Support backing up workbox files, with ability to scroll forward and backward thru previous versions. Only workboxes / prefs with changes are saved.
    • Add Recently Closed Workbox menu and add auto-cleanup
    • Colorize tabs indicating state (with toolTips)
    • Support auto-sync between multiple instances of PrEditor in same core
    • Support updating prefs args / values based on json file
    • Enforce unique tab names
  • Preference changes
    • Moved most of the preferences from the various menus into a single dialog accessed via Options -> Preferences menu.
    • Console code highlighting is now optional
  • Created preditor.gui.output_console.OutputConsole, a widget for showing select python output.
    • Optionally shows stdout
    • Optionally shows stderr
    • Optionally shows filtered logging messages
    • Optionally shows tracebacks(if you don't want to show all of stderr)
    • See example implementation in /examples/output_console.py
  • Font resizing and consistency improvements
  • The QScintilla workbox now supports inserting text separators.
  • Include json file name if encountering errors parsing PrEditor json files. This api can be used via preditor.utils.Json.
  • Added preditor.utils.call_stack providing decorators that log the input and return of functions indenting for recursive calls.
  • Better handling of errors raised by PrEditor's internal error handling code. This shouldn't affect normal users, but makes it easier to debug issues with PrEditor's internal error handling. The output will be written to sys.__stderr__ (ie. the console) for debugging.
  • Update Sublime Text default editor path
  • Added PyQt5/6 QtDesigner support exposing OutputConsole and ConsolePrEdit.
  • Improved text file encoding detection. It now assumes utf-8 unless that generates errors.
  • Many other code improvements
Reverting to v1.X prefs

In the rare case that you must revert to older Preditor (v1.X), you will only
see the workboxes you had when you updated to PrEditor v2.0. When you switch
back to v2.0 again, you still may only see those same workboxes. This can be
fixed with these steps, which in summary is to replace preditor_pref.json
with one of the backups of that file.

  • Options Menu > Preferences
  • In the Prefs files on disk section, click Browse. An Explorer window opens.
  • Close PrEditor
  • Go into the prefs_bak folder
  • Sort by name or by date, so most recent files are at the top
  • Look for a backup that is at least slightly larger than recent ones. If they are all the same size, go with the latest one.
  • Copy that into the parent directory (ie PrEditor)
  • Remove preditor_pref.json
  • Rename the preditor_pref<timestamp>.json file you copied, so it is preditor_pref.json
  • Restart PrEditor. Check if it has all your workboxes.
  • If it still isn't correct, do a little sleuthing or trial and error to find the correct backup to use.

Source Pull Requests

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)

macevhicz and others added 30 commits November 17, 2025 16:42
- Supporting linking files
- Support backing up workbox files, with ability to scroll forward and
  backward thru previous versions. Only workboxes / prefs with changes
  are saved
- Colorize tabs indicating state (with toolTips)
- Support auto-sync between multiple instances of PrEditor in same core
- Support updating prefs args / values based on json file
- Enforce unique tab names
- Uniform font / gui font keyboard modifiers
- Remove QRegExp (deprecated, QRegularExpression not supported byQt.py)
- Identifier classes now subclass py3 enums
- update attr check name
- Add copy filename context menu item
- Better linked file comparisons by with `pathlib.Path` instances (ie
  remove `as_posix()`
- Cleanup doc strings
- Don't set a workboxes tab_widget, always get it dynamically
- Handle Reload messageboxes better
Running in Houdini, the tab bar draws poorly, so remove overriding
paintEvent, and instead use setTabTextColor and setTabTextToolTip. This
means updating colors must be triggered, it doesn't come for free as in
paintEvent.
- Simplify Options and Preferences layouts
- Add Prompt on Linked File Change option (you will get visual clues
    even if this is turned off)
- Better handling of deleted / renamed linked files
- Handful of other small fixes
Add new methods:
- connectSignals
- createActions
- setIcons
- startFileSystemMonitor
Code highlighting is the slowest aspect of outputting text to the console.
If long output is expected, considering disabling code highlighting.
Ask the user if they want to reset prefs if unable to parse preditor_pref.json.
macevhicz and others added 28 commits November 26, 2025 15:25
This helps when developing for the stream or console classes if you
cause an exception you might get no traceback printed to debug otherwise.
Also ensure that it writes unix newlines on windows
Restore StreamHandlerHelper removed in previous commit by moving it
into the more appropriate location of stream.install_to_std.
- This allows them to write their messages even if they wouldn't normally.
- Also remove legacy unused outputPipe. Instead add a callback to preditor.active.
This prevents all instances of the class sharing the same variable if
modified without using the setter.
- Consolidate truncate code under preditor.utils.Truncate.
- Move result printing into the Console class inside executeString.
Instead of stdout/err redirection. This can be configured using QtDesigner.
This improves the QtDesigner plugin behavior
This logs the inputs and return of the decorated function
This prevents cases where the hand cursor override gets stuck on if the
mouse is quickly moved to another widget. It also seems to be processed faster.
1. Assume its encoded as utf-8 unless that causes an encoding error
2. Switch from chardet to charset-normalizer for encoding detection if otherwise detected

Add a testing framework to verify that character encoding is resolved correctly.
@MHendricks MHendricks merged commit 44ec69d into main Dec 5, 2025
17 checks passed
@MHendricks MHendricks deleted the main2.0 branch December 5, 2025 22:39
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.

3 participants