<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On 12 June 2014 02:50, Terry Reedy <span dir="ltr"><<a href="mailto:tjreedy@udel.edu" target="_blank">tjreedy@udel.edu</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><br></div><div class="">
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
2) Issue11437: Its hard to explain this issue in short.<br>
</blockquote></blockquote></blockquote>
<br></div>
In long: 12387 is about the config-keys.def that we deliver. 21696 is about testing all the default confix-xyz.defs we deliver. However, that is not enough because users can edit these files (but should not) and more so because they can easily make bad user .defs either with the key dialog or by direct editing. (Indeed, the Basic method prevents making the alpha pairs, discussed above, needed for Windows. Fixing this is a separate issue.) 11437 is about what Idle should do other than closing when it encounters a bad key binding.<br>


<br>
Serwy's patch validate keys when read. There are two sub-issues.<br>
<br>
The patch validates by binding to a temporary Tk() instance and catching the TclException. An alternative is to to developed a parser sufficient to own needs that also gives more specific errors and which can be used with the key dialog. I agree that we should attempt this.<br>


<br></blockquote><div><br></div><div>I detailed how I plan to accomplish in an earlier message.(Please see the tests part in <a href="https://mail.python.org/pipermail/idle-dev/2014-June/003435.html">https://mail.python.org/pipermail/idle-dev/2014-June/003435.html</a>).</div>

<div>Mention any validity test that I have missed.</div><div>The tests will go into test_configuration.py. Could we can run that unittest method, before IDLE starts? If the test fails, provide appropriate error message, as in R. Serwy's patch?</div>

<div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
To work around the fact that Idle "calls GetCurrentKeySet for each loaded extension" and to avoid repeated error messages, the patch tries to save errors that have been reported. The comments indicate that this hack has glitches. I would strongly prefer avoiding the repeated calls.</blockquote>

<div><br></div><div><br></div><div>The repeated calls happen in line 1055</div><div>load_standard_extensions method where it repeatedly calls load_extension method->GetExtensionKeys->GetCurrentKeySet.</div><div><br>

</div><div>One obvious way, is to cache the result(activeKeys) in EditorWindow at startup. Add an optional arg "activeKeys" in the above method chain. I am linking to the diff file here as i could not find an open issue on tracker.</div>

<div><br></div><div><a href="https://gist.github.com/sahutd/474031c15ee0154ef4bc#file-avoid-repeated-calls-diff">https://gist.github.com/sahutd/474031c15ee0154ef4bc#file-avoid-repeated-calls-diff</a><br></div><div><br></div>

<div>Command used to profile:</div><div>./python -m cProfile -s ncalls Lib/idlelib/idle.py >profile.txt && cat profile.txt | grep "configHandler.py" > file.txt<br></div><div><br></div><div>I have also added  before and after profile. Notice that the TOTAL number of calls to methods in configHandler.py ~== the number of calls made to just Get earlier.</div>

<div><br></div><div><a href="https://gist.github.com/sahutd/474031c15ee0154ef4bc#file-profile-before-txt">https://gist.github.com/sahutd/474031c15ee0154ef4bc#file-profile-before-txt</a><br></div><div><a href="https://gist.github.com/sahutd/474031c15ee0154ef4bc#file-profile-after-txt">https://gist.github.com/sahutd/474031c15ee0154ef4bc#file-profile-after-txt</a><br>

</div><div><br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><br>
<br>
>>> Please read the issue<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
at <a href="http://bugs.python.org/issue11437" target="_blank">http://bugs.python.org/<u></u>issue11437</a><br>
Workaround:<br>
This is easy to solve, if we use the solution from issue12387.<br>
</blockquote></blockquote></blockquote>
<br></div>
Completing windows binding pairs in config-keys.def has little to do with this issue.<div class=""><br></div></blockquote><div><br></div><div>I was referring to binding "redundant" and un-used respective shift events to <<do-nothing>>. </div>

<div>But since I did <a href="http://bugs.python.org/issue12387#msg220338">http://bugs.python.org/issue12387#msg220338</a> based on your comments, my workaround is not applicable.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div class="">
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
With the parser method, both "simple" and "advanced" dialogs<br>
</blockquote></blockquote></blockquote>
>>> will be parsed, and we will have a 1-to-1 mapping.<br>
<br></div>
I am not exactly sure what you mean by 1-to-1 mapping in this context. Between what and what?<div class=""><br></div></blockquote><div><br></div><div>For eg, Control Key press + alphabet should not depend on on status of CAPS. </div>

<div>In retrospect, I should have put it as " one to many mapping."</div><div>i.e. </div><div>Control Key press + alphabet -> {Control-Key-x and Control-Key-X}</div><div>But this too, should not apply now.</div>

<div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="">
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
For the case when someone tries to directly "hand-edit" the config<br>
files, with <a href="http://bugs.python.org/issue21696" target="_blank">http://bugs.python.org/<u></u>issue21696</a> and tests for the parser<br>
method in place, we should able to raise an earlier, ideally before<br>
IDLE starts.<br>
</blockquote></blockquote></blockquote>
<br></div>
I don't see how we can do anything between when Idle leaves the factory and when the user starts Idle -- unless the user happens to run the tests.<div class=""><br></div></blockquote><div><br></div><div>Perhaps along the lines of R. Serwy's patch. I described how I intend to do it earlier in this mail.</div>

<div><br></div><div>Regards</div><div>Saimadhav Heblikar</div></div>
</div></div>