(self, event)
| 321 | self.hide_window() |
| 322 | |
| 323 | def keypress_event(self, event): |
| 324 | if not self.is_active(): |
| 325 | return None |
| 326 | keysym = event.keysym |
| 327 | if hasattr(event, "mc_state"): |
| 328 | state = event.mc_state |
| 329 | else: |
| 330 | state = 0 |
| 331 | if keysym != "Tab": |
| 332 | self.lastkey_was_tab = False |
| 333 | if (len(keysym) == 1 or keysym in ("underscore", "BackSpace") |
| 334 | or (self.mode == FILES and keysym in |
| 335 | ("period", "minus"))) \ |
| 336 | and not (state & ~MC_SHIFT): |
| 337 | # Normal editing of text |
| 338 | if len(keysym) == 1: |
| 339 | self._change_start(self.start + keysym) |
| 340 | elif keysym == "underscore": |
| 341 | self._change_start(self.start + '_') |
| 342 | elif keysym == "period": |
| 343 | self._change_start(self.start + '.') |
| 344 | elif keysym == "minus": |
| 345 | self._change_start(self.start + '-') |
| 346 | else: |
| 347 | # keysym == "BackSpace" |
| 348 | if len(self.start) == 0: |
| 349 | self.hide_window() |
| 350 | return None |
| 351 | self._change_start(self.start[:-1]) |
| 352 | self.lasttypedstart = self.start |
| 353 | self.listbox.select_clear(0, int(self.listbox.curselection()[0])) |
| 354 | self.listbox.select_set(self._binary_search(self.start)) |
| 355 | self._selection_changed() |
| 356 | return "break" |
| 357 | |
| 358 | elif keysym == "Return": |
| 359 | self.complete() |
| 360 | self.hide_window() |
| 361 | return 'break' |
| 362 | |
| 363 | elif (self.mode == ATTRS and keysym in |
| 364 | ("period", "space", "parenleft", "parenright", "bracketleft", |
| 365 | "bracketright")) or \ |
| 366 | (self.mode == FILES and keysym in |
| 367 | ("slash", "backslash", "quotedbl", "apostrophe")) \ |
| 368 | and not (state & ~MC_SHIFT): |
| 369 | # If start is a prefix of the selection, but is not '' when |
| 370 | # completing file names, put the whole |
| 371 | # selected completion. Anyway, close the list. |
| 372 | cursel = int(self.listbox.curselection()[0]) |
| 373 | if self.completions[cursel][:len(self.start)] == self.start \ |
| 374 | and (self.mode == ATTRS or self.start): |
| 375 | self._change_start(self.completions[cursel]) |
| 376 | self.hide_window() |
| 377 | return None |
| 378 | |
| 379 | elif keysym in ("Home", "End", "Prior", "Next", "Up", "Down") and \ |
| 380 | not state: |
nothing calls this directly
no test coverage detected