Hi all, I'm close to finishing an initial version of a search bar for IDLE which implements incremental searching.
I'm writing it as an IDLE extension, so that it can be turned on or off by each user as he likes, through the extensions config. For this I need a way to hook onto EditorWindow's find_event(), find_again_event(), ... methods. An extension's constructor receives the EditorWindow instance, so overriding the methods is easy. However, EditorWindow binds its methods to events in its constructor, so overriding an instance's methods doesn't change the method called by the event binding mechanism. English translation - overriding doesn't work, I need to rebind the relevant events to new functions/methods. Solutions: 1) Rebind the events to new handlers in the extension's constructor Ugly? Code duplication... 2) Bind all events to a virtual handler, which calls the instance's currently bound appropriate method Cleaner but more complex, this is actually duplicating the functionality of the event binding mechanism! I was leaning towards 2 but am now thinking 1 is better, since it's simpler and more consistent. Any thoughts on this? Any other, better solutions? - Tal
_______________________________________________ IDLE-dev mailing list [email protected] http://mail.python.org/mailman/listinfo/idle-dev
