A belated brag

6 views
Skip to first unread message

Edward K. Ream

unread,
Apr 29, 2026, 2:27:14 PM (2 days ago) Apr 29
to leo-editor
Yesterday was a golden programming day. Everything I did just worked. I had intended, first thing this morning, to brag about PR #4646. But life intervened, hehe.

Anyway, this PR:

- Eliminates several evil faux helpers, thereby simplifying all of Leo's command handlers.
- Eliminates the confusion between event.w and event.widget. The event.widget ivar is gone!! That is, LeoKeyEvent.__init__ sets only the event.w ivar.

Both these simplifications are significant milestones in Leo's codebase. They will be worth all the effort, and more.

Edward

Edward K. Ream

unread,
Apr 29, 2026, 2:53:45 PM (2 days ago) Apr 29
to leo-editor
On Wednesday, April 29, 2026 at 1:27:14 PM UTC-5 Edward K. Ream wrote:

> Yesterday was a golden programming day. Everything I did just worked.

And there were other benefits:

There is no need for x.widget_name. It's a faux helper. Perhaps "faux wrapper" is a better term. Recent work shows that Leo's Qt code can just test x.objectName! This seems like a nit, but it isn't.

Recent work shows that the console gui does call LeoKeyEvent.__init__, but only with w as a QTextMixin object. As you can see from PR #4649 (the latest bug fix PR), the test for  QTextMixin is done early, so later complications and tests should have no effect on the console gui. In other words,  the LeoKeyEvent class is a perfect wrapper class for keystrokes!

Yes, LeoKeyEvent.__init__ will differ between PRs #4649 and  PR #4646, but the resulting merge conflict should be easy to manage. More positively, PR #4646 has been guiding my thinking while fixing the immediate bugs.

Edward
Reply all
Reply to author
Forward
0 new messages