Пример #1
0
    def __init__(self, title, tabnum=0, title_attr=curses.A_NORMAL):
        self.__scrlines, self.__scrcols = get_term_size()
        self.__tabnum = tabnum
        self.__title = title
        self.__title_attr = title_attr

        # build the tab part
        self.__head = curses.newwin(3, TAB_WIDTH, 0, tabnum * TAB_WIDTH + 1)
        self.__head.border()
        self.__head.addstr(1, 1, title[0:TAB_WIDTH - 3], self.__title_attr)
        self.__head.noutrefresh()

        # build the border around the usable part of the tab space
        self.__tabborder = curses.newwin(self.__scrlines - 2, self.__scrcols, 2, 0)
        self.__tabborder.border()
        self.__tabborder.addch(0,
                               1 + tabnum * TAB_WIDTH,
                               curses.ACS_LRCORNER)
        self.__tabborder.addstr(0,
                                2 + tabnum * TAB_WIDTH,
                                " " * (TAB_WIDTH - 2))
        self.__tabborder.addch(0,
                               2 + tabnum * TAB_WIDTH + TAB_WIDTH - 2,
                               curses.ACS_LLCORNER)
        self.__tabborder.noutrefresh()

        # build the usable part of the tab inside the tab border
        self.__usablewin = curses.newwin(self.__scrlines - 5, self.__scrcols - 2, 3, 1)

        # add the pieces to the frames stack
        self.__frames = [curses.panel.new_panel(self.__head),
                         curses.panel.new_panel(self.__tabborder),
                         curses.panel.new_panel(self.__usablewin)]
Пример #2
0
 def __init__(self):
     lines, cols = get_term_size()
     self.__numtabs = -1  # the number of tabs
     self.__tabs = {}  # a dictionary containing all panels of the tabs window