def buffer_focus(self, buf, redraw=True):
        """focus given :class:`~alot.buffers.Buffer`."""

        # call pre_buffer_focus hook
        prehook = settings.get_hook('pre_buffer_focus')
        if prehook is not None:
            prehook(ui=self, dbm=self.dbman, buf=buf)

        success = False
        if buf not in self.buffers:
            logging.error('tried to focus unknown buffer')
        else:
            if self.current_buffer != buf:
                self.current_buffer = buf
            self.mode = buf.modename
            if isinstance(self.current_buffer, BufferlistBuffer):
                self.current_buffer.rebuild()
            self.update()
            success = True

        # call post_buffer_focus hook
        posthook = settings.get_hook('post_buffer_focus')
        if posthook is not None:
            posthook(ui=self, dbm=self.dbman, buf=buf, success=success)
def buffer_focus ( self , buf , redraw = True ) : prehook = settings . get_hook ( 'pre_buffer_focus' ) if prehook is not None : prehook ( ui = self , dbm = self . dbman , buf = buf ) success = False if buf not in self . buffers : logging . error ( 'tried to focus unknown buffer' ) else : if self . current_buffer != buf : self . current_buffer = buf self . mode = buf . modename if isinstance ( self . current_buffer , BufferlistBuffer ) : self . current_buffer . rebuild ( ) self . update ( ) success = True posthook = settings . get_hook ( 'post_buffer_focus' ) if posthook is not None : posthook ( ui = self , dbm = self . dbman , buf = buf , success = success )
focus given :class:`~alot.buffers.Buffer`.