[Idle-dev] KeyConfig, KeyBinding and other related issues.
saimadhavheblikar at gmail.com
Sat Jun 14 08:52:04 CEST 2014
On 13 June 2014 22:09, Terry Reedy <tjreedy at udel.edu> wrote:
> On 6/13/2014 7:45 AM, Saimadhav Heblikar wrote:
>> On 13 June 2014 16:58, Tal Einat <taleinat at gmail.com> wrote:
>>> On Fri, Jun 13, 2014 at 2:22 PM, Saimadhav Heblikar
>>> <saimadhavheblikar at gmail.com> wrote:
>>>> Just a heads up to both: I am writing a keyseq validator method.
>>>> It currently works for over 800 permutations of ['Shift', 'Control',
>>>> 'Alt', 'Meta', 'Key-a', 'Key-A', 'Up', 'Key-Up', 'a', 'A']. It works
>>>> for permutations of length 2 and 3. Beyond that its not worth it IMO.
>>>> I am currently trying to integrate it with test_configuration.py and
>>>> catching permutations i missed out.
> We do not need 'permutations', as least not for validating in canonical form. Basic mode produces Control? Alt? Shift? in that order. The regex for that is trivial. If Tk accepts in *any* order, the regex is only slightly more complicated.
My thinking was to use the validator method across IDLE(in tests,
validating key config before IDLE starts and of course in the key
binding dialog KeyOk method)
If we need it only for the dialog, then I will extract those regex's only.
>>>> I post this, so that we dont duplicate work. I hope it to be ready by
>>>> the end of the day.(UTC +5.5)
>>> What is the method you are using?
>> Regex. It is not something elegant. The permutations are coded in.(Not
>> all 800+ obviously, but around 15-20 general ones.).
> Whether specific combination (unordered) and permutation (ordered) must be coded in depends of the grammer Tk uses. See comment on next post.
>> The only advantage is it can be used without creating a new Tk instance.
> I am not sure I get this.
Referring to http://bugs.python.org/file25226/windows_caps_lock.patch
by Roger Serwy. In the patch, a live Tk object is used to validate
On 14 June 2014 04:21, Tal Einat <taleinat at gmail.com> wrote:
> In the meantime, Saimadhav, can you explain why you decided to use
> regexps instead of the straightforward approach of splitting by '-'
> and checking the pieces?
As mentioned above, I understood that the method would be used in many
places, not only KeyBindingDialog. So I wanted it work under all
Why regex and splitting by '-'?
No particular reason. I had a feeling splitting method could get
messy. But if its for a small set that the validity method is going to
be required for, splitting method is better.
More information about the IDLE-dev