Terry J. Reedy added the comment:

The patch does two things.

1. It replaces the existing direct rebinding of messagebox functions as 
methods, such as
    self.showerror = tkMessageBox.showerror
with binding of a double wrapping of the functions. The middle layer is useless 
and only serves to allow use of the decorator syntax. The 'old-fashioned' 
method of wrapping by function call should be used.
    self.showerror = _tk_dialog_wrapper(tkMessageBox.showerror)
A single customized wrapping for the existing bindings seems like it might be a 
good idea.

I do not understand the 'motivation' (of the existing and revised method 
bindings) of making Idle extensions 'cross-IDE'. How so? What IDEs other than 
Idle are we concerned with?

The patch replaces both parent=self.text and master=self.text in current calls 
with parent=self.text in the wrapper. This seems to assume that parent==master 
in these contexts. I gather that this is nearly always the case.
( http://mail.python.org/pipermail/tutor/2010-June/076550.html
based on Grayson's book) But I wonder if the choice could ever make a 
difference.

2. Currently, EditorWindow methods sometimes call a message function as a 
message module attribute and sometimes as one of the EditorWindow method. The 
patch makes these calls consistently be methods calls (to the wrappers). It 
also changes call in classes that are EditorWindow subclasses or containers. 
(askokcancel is addded to EditorWindow for patches to some of these other 
classes.)

My current Idle concern is testing. The current inconsistency in EditorWindow 
is not good for that, so I will want to fix that one way or the other in any 
case. For automated non-gui testing, the message functions (or the message 
module) need to be replaced with mocks that a) save the args somewhere where 
they can be later retrieved and b) return without graphics system and user 
interaction. For modules with non-editor classes, this means monkey-patching 
the module. (I have done this once for one test.) I will experiment with also 
monkey-patching editor windows.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue2053>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to