| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent cb74f11 commit eb94d34
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -372,14 +372,18 @@ def clean_up_current_line_for_exit(self): | |||
| 372 | 372 | def process_event(self, e): | |
| 373 | 373 | """Returns True if shutting down, otherwise returns None. | |
| 374 | 374 | Mostly mutates state of Repl object""" | |
| 375 | - # event names uses here are curses compatible, or the full names | ||
| 376 | - # for a full list of what should have pretty names, see curtsies.events.CURSES_TABLE | ||
| 375 | + # for a full list of what should have pretty names, try python -m curtsies.events | ||
| 377 | 376 | ||
| 378 | - if not isinstance(e, events.Event): | ||
| 377 | + logger.debug("processing event %r", e) | ||
| 378 | + if isinstance(e, events.Event): | ||
| 379 | + return self.proccess_control_event(e) | ||
| 380 | + else: | ||
| 379 | 381 | self.last_events.append(e) | |
| 380 | 382 | self.last_events.pop(0) | |
| 383 | + return self.process_key_event(e) | ||
| 384 | + | ||
| 385 | + def proccess_control_event(self, e): | ||
| 381 | 386 | ||
| 382 | - logger.debug("processing event %r", e) | ||
| 383 | 387 | if isinstance(e, events.RefreshRequestEvent): | |
| 384 | 388 | if e.when != 'now': | |
| 385 | 389 | pass # This is a scheduled refresh - it's really just a refresh (so nop) | |
@@ -388,6 +392,7 @@ def process_event(self, e): | |||
| 388 | 392 | else: | |
| 389 | 393 | assert self.coderunner.code_is_waiting | |
| 390 | 394 | self.run_code_and_maybe_finish() | |
| 395 | + | ||
| 391 | 396 | elif self.status_bar.has_focus: | |
| 392 | 397 | return self.status_bar.process_event(e) | |
| 393 | 398 | ||
@@ -419,6 +424,17 @@ def process_event(self, e): | |||
| 419 | 424 | self.update_completion() | |
| 420 | 425 | self.status_bar.message('Reloaded at ' + time.strftime('%H:%M:%S') + ' because ' + ' & '.join(e.files_modified) + ' modified') | |
| 421 | 426 | ||
| 427 | + else: | ||
| 428 | + raise ValueError("don't know how to handle this event type: %r" % e) | ||
| 429 | + | ||
| 430 | + def process_key_event(self, e): | ||
| 431 | + | ||
| 432 | + if self.status_bar.has_focus: | ||
| 433 | + return self.status_bar.process_event(e) | ||
| 434 | + | ||
| 435 | + elif self.stdin.has_focus: | ||
| 436 | + return self.stdin.process_event(e) | ||
| 437 | + | ||
| 422 | 438 | elif e in key_dispatch[self.config.toggle_file_watch_key]: | |
| 423 | 439 | if self.watcher: | |
| 424 | 440 | msg = "Auto-reloading active, watching for file changes..." | |
| Back | FazBrowse Home | New Git URL |
0 commit comments