Validity check on user's 'basic' keybinding selection. Doesn't check the string produced by the advanced dialog because 'modifiers' isn't set.
(self, keys)
| 234 | return |
| 235 | |
| 236 | def keys_ok(self, keys): |
| 237 | """Validity check on user's 'basic' keybinding selection. |
| 238 | |
| 239 | Doesn't check the string produced by the advanced dialog because |
| 240 | 'modifiers' isn't set. |
| 241 | """ |
| 242 | final_key = self.list_keys_final.get('anchor') |
| 243 | modifiers = self.get_modifiers() |
| 244 | title = self.keyerror_title |
| 245 | key_sequences = [key for keylist in self.current_key_sequences |
| 246 | for key in keylist] |
| 247 | if not keys.endswith('>'): |
| 248 | self.showerror(title, parent=self, |
| 249 | message='Missing the final Key') |
| 250 | elif (not modifiers |
| 251 | and final_key not in FUNCTION_KEYS + MOVE_KEYS): |
| 252 | self.showerror(title=title, parent=self, |
| 253 | message='No modifier key(s) specified.') |
| 254 | elif (modifiers == ['Shift']) \ |
| 255 | and (final_key not in |
| 256 | FUNCTION_KEYS + MOVE_KEYS + ('Tab', 'Space')): |
| 257 | msg = 'The shift modifier by itself may not be used with'\ |
| 258 | ' this key symbol.' |
| 259 | self.showerror(title=title, parent=self, message=msg) |
| 260 | elif keys in key_sequences: |
| 261 | msg = 'This key combination is already in use.' |
| 262 | self.showerror(title=title, parent=self, message=msg) |
| 263 | else: |
| 264 | return True |
| 265 | return False |
| 266 | |
| 267 | def bind_ok(self, keys): |
| 268 | "Return True if Tcl accepts the new keys else show message." |