| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
An invalid color in a user highlight theme crashed the Settings dialog. Now it is ignored with a warning and the default color is used instead.
|
Tests / Windows / Build and test (Win32, switch-case) (pull_request)Failing after 18m |
Sorry, something went wrong.
There was a problem hiding this comment.
check_theme_color and its test should be in config.py, along with other config checking code, and invoked as part of the config checking process. The error messages should by added to the file_load_error_error message rather than sent to stderr to, usually, be lost.
pyshell itself would not need to be touched. EDIT I otherwise like this.
In the long run, all error messages after tkinter is successfully loaded should be sent to a new error message window (outwin or text window) that does not block continuation and that allows a user to save or print and that remains until a user deletes it.
Sorry, something went wrong.
|
When you're done making the requested changes, leave the comment: I have made the requested changes; please review again. |
Sorry, something went wrong.
|
Done. The check is now IdleConf.check_highlight(root) in config.py, and the invalid colors are reported together with unreadable files by config_error_message(root), which replaces file_load_error_message(). Since colors can only be checked with Tk, loading (on import) and checking (after the root is created) are two stages, so pyshell.main() still has to pass the root, but that is the only change there. I have made the requested changes; please review again |
Sorry, something went wrong.
|
Thanks for making the requested changes! @terryjreedy: please review the changes made to this pull request. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
A typo in a color in ~/.idlerc/config-highlight.cfg, such as keyword-foreground = bpo-00224, crashed the Settings dialog with TclError: unknown color name "bpo-00224" when the Highlights page painted its sample, so the theme could not be fixed from the GUI. Editor windows did not crash only because WidgetRedirector silently swallows TclError, leaving the element uncolored without any warning.
Colors can only be validated by Tk, so the check is done in pyshell.main() right after the root is created and before any window uses the theme. check_theme_colors() validates every color of every user theme with winfo_rgb(), prints a warning for each invalid one (in the style of #152747) and removes it from the loaded configuration, so that GetThemeDict() supplies the default color instead. The user file is not modified until the settings are saved.
Missing theme elements were already handled by GetThemeDict().
🤖 Generated with Claude Code