Exemple #1
0
    def mount_chatbox(self, executor, channel):
        yield from asyncio.gather(
            loop.run_in_executor(executor, self.store.load_channel, channel),
            loop.run_in_executor(executor, self.store.load_messages, channel))
        messages = self.render_messages(self.store.state.messages)
        header = self.render_chatbox_header()
        self._loading = False
        self.sidebar.select_channel(channel)
        self.message_box = MessageBox(
            user=self.store.state.auth['user'],
            is_read_only=self.store.state.channel.get('is_read_only', False))
        self.chatbox = ChatBox(messages, header, self.message_box,
                               self.urwid_loop)
        urwid.connect_signal(self.chatbox, 'set_insert_mode',
                             self.set_insert_mode)
        urwid.connect_signal(self.chatbox, 'mark_read', self.handle_mark_read)
        urwid.connect_signal(self.chatbox, 'open_quick_switcher',
                             self.open_quick_switcher)
        urwid.connect_signal(self.chatbox, 'open_set_snooze',
                             self.open_set_snooze)

        urwid.connect_signal(self.message_box.prompt_widget, 'submit_message',
                             self.submit_message)
        urwid.connect_signal(self.message_box.prompt_widget,
                             'go_to_last_message', self.go_to_last_message)

        self.real_time_task = loop.create_task(self.start_real_time())
Exemple #2
0
 def mount_chatbox(self, executor, channel):
     yield from asyncio.gather(
         loop.run_in_executor(executor, self.store.load_channel, channel),
         loop.run_in_executor(executor, self.store.load_messages, channel))
     messages = self.render_messages(self.store.state.messages)
     header = self.render_chatbox_header()
     self._loading = False
     self.sidebar.select_channel(channel)
     self.message_box = MessageBox(
         user=self.store.state.auth['user'],
         is_read_only=self.store.state.channel.get('is_read_only', False))
     self.chatbox = ChatBox(messages, header, self.message_box)
     urwid.connect_signal(self.message_box.prompt_widget, 'submit_message',
                          self.submit_message)
     self.real_time_task = loop.create_task(self.start_real_time())