Draw the tab bar
(self)
| 118 | return y |
| 119 | |
| 120 | def _draw_tabs(self): |
| 121 | """Draw the tab bar""" |
| 122 | height, width = self.stdscr.getmaxyx() |
| 123 | y = 1 |
| 124 | x = 0 |
| 125 | |
| 126 | for i, tab in enumerate(self.tabs): |
| 127 | tab_text = " %s " % tab['title'] |
| 128 | |
| 129 | # Check if tab exceeds width, wrap to next line |
| 130 | if x + len(tab_text) >= width: |
| 131 | y += 1 |
| 132 | x = 0 |
| 133 | # Stop if we've used too many lines |
| 134 | if y >= 3: |
| 135 | break |
| 136 | |
| 137 | if i == self.current_tab: |
| 138 | self.stdscr.attron(curses.color_pair(2) | curses.A_BOLD) |
| 139 | else: |
| 140 | self.stdscr.attron(curses.color_pair(3)) |
| 141 | |
| 142 | try: |
| 143 | self.stdscr.addstr(y, x, tab_text) |
| 144 | except: |
| 145 | pass |
| 146 | |
| 147 | if i == self.current_tab: |
| 148 | self.stdscr.attroff(curses.color_pair(2) | curses.A_BOLD) |
| 149 | else: |
| 150 | self.stdscr.attroff(curses.color_pair(3)) |
| 151 | |
| 152 | x += len(tab_text) + 1 |
| 153 | |
| 154 | def _draw_footer(self): |
| 155 | """Draw the footer with help text""" |