Made interpreter switching working again
@@ -57,7 +57,9 @@ class Runner:
self._check_alloc_console()
def start(self):
+ try:
self.reset_backend()
+ finally:
self._poll_vm_messages()
def _init_commands(self):
@@ -302,10 +304,8 @@ class Runner:
because event_generate across threads is not reliable
http://www.thecodingforums.com/threads/more-on-tk-event_generate-and-threads.359615/
"""
- if self._proxy is None:
- return
-
- while True:
+ try:
+ while self._proxy is not None:
msg = self._proxy.fetch_next_message()
if not msg:
break
@@ -315,6 +315,9 @@ class Runner:
# message_context shows the state where corresponding command was sent
# Now we got the response and we're return to that state
self._set_state(msg["command_context"])
+ elif msg["message_type"] == "ToplevelResult":
+ # some ToplevelResult-s don't have command_context
+ self._set_state("waiting_toplevel_command")
elif msg["message_type"] == "InputRequest":
self._set_state("waiting_input")
else:
@@ -331,6 +334,7 @@ class Runner:
get_workbench().update()
+ finally:
get_workbench().after(50, self._poll_vm_messages)
def reset_backend(self):
