'Setup and draw bannerwin and logwin.
If `resize`, don\'t create new windows, just adapt size. This
function should be invoked with CursesUtils.locked().'

def setupwindows(self, resize=False):

    (self.height, self.width) = self.stdscr.getmaxyx()
    self.logheight = ((self.height - len(self.accframes)) - 1)
    if resize:
        if curses.is_term_resized(self.height, self.width):
            curses.resizeterm(self.height, self.width)
        self.bannerwin.resize(1, self.width)
        self.logwin.resize(self.logheight, self.width)
        self.stdscr.clear()
        self.stdscr.noutrefresh()
    else:
        self.bannerwin = curses.newwin(1, self.width, 0, 0)
        self.logwin = curses.newwin(self.logheight, self.width, 1, 0)
    self.draw_bannerwin()
    self.logwin.idlok(True)
    self.logwin.scrollok(True)
    self.draw_logwin()
    self.accounts = reversed(sorted(self.accframes.keys()))
    pos = (self.height - 1)
    index = 0
    self.hotkeys = []
    for account in self.accounts:
        acc_win = curses.newwin(1, self.width, pos, 0)
        self.accframes[account].setwindow(acc_win, index)
        self.hotkeys.append(account)
        index += 1
        pos -= 1
    curses.doupdate()
