diff options
Diffstat (limited to 'alot/ui.py')
-rw-r--r-- | alot/ui.py | 15 |
1 files changed, 6 insertions, 9 deletions
@@ -259,8 +259,7 @@ class UI: clear() logging.debug("cmdline: '%s'", cmdline) if not self._locked: - loop = asyncio.get_event_loop() - loop.create_task(_apply_fire(cmdline)) + self._loop.create_task(_apply_fire(cmdline)) # move keys are always passed elif cmdline in ['move up', 'move down', 'move page up', 'move page down']: @@ -378,7 +377,7 @@ class UI: """ history = history or [] - fut = asyncio.get_event_loop().create_future() + fut = self._loop.create_future() oldroot = self.mainloop.widget def select_or_cancel(text): @@ -424,15 +423,13 @@ class UI: self._passall = True return fut - @staticmethod - def exit(): + def exit(self): """ shuts down user interface without cleaning up. Use a :class:`alot.commands.globals.ExitCommand` for a clean shutdown. """ try: - loop = asyncio.get_event_loop() - loop.stop() + self._loop.stop() except Exception as e: logging.error('Could not stop loop: %s\nShutting down anyway..', str(e)) @@ -586,7 +583,7 @@ class UI: assert cancel is None or cancel in choices.values() assert msg_position in ['left', 'above'] - fut = asyncio.get_event_loop().create_future() # Create a returned future + fut = self._loop.create_future() oldroot = self.mainloop.widget def select_or_cancel(text): @@ -745,7 +742,7 @@ class UI: # it is a SIGINT ? if signum == signal.SIGINT: logging.info('shut down cleanly') - asyncio.ensure_future(self.apply_command(globals.ExitCommand())) + asyncio.create_task(self.apply_command(globals.ExitCommand())) elif signum == signal.SIGUSR1: if isinstance(self.current_buffer, SearchBuffer): self.current_buffer.rebuild() |