def _move_win(self, direction): if self.cur is not None: try: index = util.clamp2(self.cur + direction.num, self.n_items()) util.swap(self.windows, self.cur, index) self.cur = index except IndexError: util.debug("Bad index for moving window")
def close_win(self): if self.cur is not None: try: del self.windows[self.cur] self.cur = util.clamp2(self.cur - 1, self.n_items()) if self.windows == []: self.cur = None except IndexError: util.debug("Bad index removing window from stack")