def __init__(self, config): self._loading = False self.config = config self.quick_switcher = None self.set_snooze_widget = None self.workspaces = list(config['workspaces'].items()) self.store = Store(self.workspaces, self.config) Store.instance = self.store urwid.set_encoding('UTF-8') sidebar = LoadingSideBar() chatbox = LoadingChatBox('Everything is terrible!') palette = themes.get(config['theme'], themes['default']) custom_loop = SclackEventLoop(loop=loop) custom_loop.set_exception_handler(self._exception_handler) if len(self.workspaces) <= 1: self.workspaces_line = None else: self.workspaces_line = Workspaces(self.workspaces) self.columns = urwid.Columns([ ('fixed', config['sidebar']['width'], urwid.AttrWrap(sidebar, 'sidebar')), urwid.AttrWrap(chatbox, 'chatbox') ]) self._body = urwid.Frame(self.columns, header=self.workspaces_line) self.urwid_loop = urwid.MainLoop( self._body, palette=palette, event_loop=custom_loop, unhandled_input=self.unhandled_input ) self.configure_screen(self.urwid_loop.screen) self.last_keypress = (0, None)
def __init__(self, config): self.config = config self.store = Store(config['token'], self.config) Store.instance = self.store urwid.set_encoding('UTF-8') sidebar = LoadingSideBar() chatbox = LoadingChatBox('Everything is terrible!') palette = themes.get(config['theme'], themes['default']) self.columns = urwid.Columns([('fixed', config['sidebar']['width'], urwid.AttrWrap(sidebar, 'sidebar')), urwid.AttrWrap(chatbox, 'chatbox')]) self.urwid_loop = urwid.MainLoop( urwid.Frame(self.columns), palette=palette, event_loop=urwid.AsyncioEventLoop(loop=loop), unhandled_input=self.unhandled_input) self.configure_screen(self.urwid_loop.screen)
def __init__(self, config): self.config = config self.workspaces = list(config['workspaces'].items()) self.store = Store(self.workspaces, self.config) Store.instance = self.store urwid.set_encoding('UTF-8') sidebar = LoadingSideBar() chatbox = LoadingChatBox('Everything is terrible!') palette = themes.get(config['theme'], themes['default']) if len(self.workspaces) <= 1: self.workspaces_line = None else: self.workspaces_line = Workspaces(self.workspaces) self.columns = urwid.Columns([('fixed', config['sidebar']['width'], urwid.AttrWrap(sidebar, 'sidebar')), urwid.AttrWrap(chatbox, 'chatbox')]) self.urwid_loop = urwid.MainLoop(urwid.Frame( self.columns, header=self.workspaces_line), palette=palette, event_loop=SclackEventLoop(loop=loop), unhandled_input=self.unhandled_input) self.configure_screen(self.urwid_loop.screen)