Skip to content

Several hours of revisions and linting - #52

Open
rjsdotorg wants to merge 11 commits into
ianBBB:masterfrom
rjsdotorg:master
Open

Several hours of revisions and linting#52
rjsdotorg wants to merge 11 commits into
ianBBB:masterfrom
rjsdotorg:master

Conversation

@rjsdotorg

Copy link
Copy Markdown

Tested Windows 10, Py3.8

rjsdotorg added 11 commits May 5, 2026 11:20
Apply multiple Python 3 compatibility updates and runtime hardening across the codebase. Key changes include using inspect.currentframe(), safer trace checks (getattr on trace_is_on), and switching to importlib for dynamic imports. Replaced execfile/exec patterns with exec(compile(...)) and updated print() calls to Python 3 syntax; updated profiling/run invocation to use runctx and a compiled exec statement. Improved exception handling and message extraction in PythonInterpreter, added typing/cast hints and safer attribute access, and minor whitespace/formatting cleanup. Bumped wx_version_max and updated saved Config/Explorer.msw.cfg entries (modulecount, openfiles, recentfiles).
Install file-backed crash diagnostics and improve runtime robustness across the project. Key changes:

- Boa.py: enable faulthandler to log crashes to boa-fault.log, add a global excepthook that logs to stderr and the log file, install combined excepthook with existing Utils.wxPyExceptHook, and add OnExceptionInMainLoop to surface wx main-loop exceptions.
- Explorers/FileExplorer.py: use context managers for file IO, correctly distinguish binary vs text modes, and consistently use UTF-8 encoding when reading/writing strings.
- Companions/ContainerCompanions.py: normalize StatusBar field widths to ensure at least one field (avoid wx assertion), various whitespace/formatting cleanups.
- Views/Designer.py: add robust detection for dead wx objects (Phoenix compatibility) and fix lookup bugs; small formatting fixes.
- Views/InspectableViews.py: handle no-argument properties/methods, improve exception handling when evaluating property expressions, fix several indexing/name bugs, and miscellaneous whitespace/formatting cleanup.
- Views/StyledTextCtrls.py: fix marker definitions formatting and update cursor handling to use wx.Cursor objects (wxPython 4 compatibility), remove stray debug prints.
- Models/PythonEditorModels.py: add fileModes metadata for module models.
- Examples/advanced/FramePanels/wxFrame1.py and Config/Explorer.msw.cfg: update example IDs/sizes and explorer recent-files/modulecount adjustments.
- Add test_parse.py and test_parse_out.txt to exercise parsing of generated GUI code and include boa-fault.log with captured diagnostics entries.

Also includes many small formatting/whitespace fixes throughout files. These changes improve diagnostics, prevent silent failures/crashes, and make file and wx compatibility more robust.
Clean up and standardize module docstrings and comments across the codebase (trim whitespace, fix punctuation/casing and unify triple-quote usage). Add more detailed docstrings and parameter/return notes in Editor.py for several methods. Update Config/Explorer.msw.cfg recent file entries. Add runtime log file (boa-fault.log) and test output (test_parse_out.txt). Mostly cosmetic and documentation changes across many ExternalLib, Plug-ins, Examples, Models and Views files.
Add a .vscode/settings.json and apply numerous static type / lint fixes across the codebase: add pyright/type: ignore pragmas, insert many `# type: ignore[...]` comments, and add a few light typing annotations. Introduce getSelectionIndex helper in DebuggerControls to normalize selection handling. Adjust imports for bcrtl.activex usage and make small refactors (setattr for sys.boa_ide, minor formatting/whitespace cleanups, and a few defensive ignores for wx/trace/sys attributes). These changes are non-functional and intended to improve static analysis and cleanup warnings.
Refactor wx imports to use 'import wx.adv' for compatibility; enable wx.html2 import in Palette. Clean up whitespace and trailing spaces, wrap long list lines, and normalize SetSize calls. Update ID creation calls (NewIdRef usages) and make ControlSizeFrame.__init__ accept selection=None. Update Config/Explorer.msw.cfg (modulecount, clear openfiles, set activepage) and append new session entries to boa-fault.log. These are small housekeeping and compatibility fixes to reduce lint issues and restore expected defaults.
Multiple fixes to improve Python 3 and wx compatibility and harden runtime behavior:

- .vscode: disable type checking and expand excluded folders.
- Fix a logic bug in ContainerCompanions and make bitmap/pen hatch fallback to safer wx attributes.
- Make ListCompanions robust when wx.grid is missing; guard grid-related properties and register components conditionally; simplify handledConstrParams replacement.
- Normalize identifier listing and ascii usage in KeyDefsDlg (string.ascii_letters) and tidy id generation formatting.
- LanguageSelectDlg: tidy formatting, ensure icon loading converts bitmap->icon when needed, minor sizing and spacing fixes.
- ModRunner: replace deprecated os.popen3 usage with subprocess, improve exception handling and process I/O in PopenModuleRunner.
- Palette: ensure icons/bitmaps are handled safely, safer toolbar tool creation, guard attribute access, and use wx.Size where appropriate.
- ProcessProgressDlg: id formatting and pass empty args to TestProcessRunner; minor test fix.
- ArtProviderBrowser: small formatting cleanup and id generation fix; import basestring from Cython (preserved change).
- RTTI: import FunctionType/MethodType/BuiltinFunctionType and fix setter invocation for ReApplyRoute.
- RunCyclops: adapt instance filtering for Python 3, set sys.cyclops via setattr, tidy whitespace.
- Search: fix ProgressDialog.Update handling, ensure maxval >=1, return continue status and use wx.Size for frame.
- Updated boa-fault.log with new session entry.
- makepydialog: guard import of win32com makepy/selecttlb, handle absence with messages, UI handler and image handler compatibility, and use wx.Size and safer DemoApp init.
- wxCompat: provide compatibility aliases using getattr, robust fallback for crunch_data.
- wxPopen: guard Bind calls, and avoid passing handler as parent to wx.Process (pass None) to prevent issues.

Overall these changes modernize code paths, replace deprecated APIs, add fallbacks for optional modules and different wx versions, and fix several runtime bugs to improve portability and stability.
Add Companions/PhoenixCompanions.py to register wxPython Phoenix controls and non-visual utilities on the palette (creates a 'Phoenix' page and ensures 'Utilities (Data)' exists). PaletteMapping.py now imports the new PhoenixCompanions module and contains minor whitespace cleanup. Update Config/Explorer.msw.cfg modulecount. boa-fault.log was updated with recent session entries and a traceback showing a KeyError related to the palette page (captured during testing/import). The Phoenix component registrations are guarded by try/except to handle optional build modules.
Bring numerous modules up-to-date for Python 3 / wxPython Phoenix and improve file handling and debugger RPCs.

Key changes:
- Migrate xmlrpc usage to xmlrpc.client and modernize transport/auth (RemoteClient/RemoteServer/ChildProcessClient/ChildProcessServer).
- Simplify/debug server startup and set worker threads as daemon; keep a two-token startup line for compatibility.
- Make file I/O BOM-tolerant and consistently save/read UTF-8 without BOM (FileExplorer + Utils usage).
- Add a standard file-open dialog and separate Boa-aware open in Editor; adjust menu/toolbar bindings.
- Fix wx Phoenix compatibility (About: use numeric IDs for wxp HTML controls, guard missing controls during startup).
- Apply Python 3 syntax fixes across ExternalLib (print(), exec(), base64 handling) and remove unused imports.
- Expand .gitignore with common Python, IDE and environment entries.
- Update Config files (Explorer.msw.cfg, helpfrm.cfg) and Changes.txt notes; add TestArea/bom_temp_frame.py.
- Miscellaneous whitespace, comment and minor refactors across multiple modules for clarity and py3 compliance.

These edits are intended to improve cross-version compatibility, robustness of I/O, and reliability of the debugger and UI startup.
Introduce modern packaging files and release helpers: add pyproject.toml (setuptools build backend, project metadata, deps, entry points, dynamic version), setup.py (legacy install support and package_data rules), and MANIFEST.in to include package data. Add release.ps1 and upload-testpypi.ps1 PowerShell helpers for building, checking (twine) and uploading artifacts, plus PACKAGING.md with step-by-step release instructions. Remove legacy test artifacts test_parse.py and test_parse_out.txt.
Corrected a typo in `pyparsing` (`string.ascii_letters`) that would break alpha token definitions. In `wx25upgrade`, fixed the parse action target (`imp.setParseAction(...)`) and replaced `Or(map(...))` with an explicit literal list for Python 3 compatibility. The diff also includes incidental local workspace/config and fault log updates.
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.

1 participant