Draw the current tab content
(self)
| 164 | pass |
| 165 | |
| 166 | def _draw_current_tab(self): |
| 167 | """Draw the current tab content""" |
| 168 | height, width = self.stdscr.getmaxyx() |
| 169 | tab = self.tabs[self.current_tab] |
| 170 | |
| 171 | # Calculate tab bar height |
| 172 | tab_bar_height = self._get_tab_bar_height() |
| 173 | start_y = tab_bar_height + 1 |
| 174 | |
| 175 | # Clear content area |
| 176 | for y in range(start_y, height - 1): |
| 177 | try: |
| 178 | self.stdscr.addstr(y, 0, " " * width) |
| 179 | except: |
| 180 | pass |
| 181 | |
| 182 | y = start_y |
| 183 | |
| 184 | # Draw description if exists |
| 185 | if tab['description']: |
| 186 | desc_lines = self._wrap_text(tab['description'], width - 4) |
| 187 | for line in desc_lines[:2]: # Limit to 2 lines |
| 188 | try: |
| 189 | self.stdscr.attron(curses.color_pair(5)) |
| 190 | self.stdscr.addstr(y, 2, line) |
| 191 | self.stdscr.attroff(curses.color_pair(5)) |
| 192 | y += 1 |
| 193 | except: |
| 194 | pass |
| 195 | y += 1 |
| 196 | |
| 197 | # Draw options |
| 198 | visible_start = self.scroll_offset |
| 199 | visible_end = visible_start + (height - y - 2) |
| 200 | |
| 201 | for i, option in enumerate(tab['options'][visible_start:visible_end], visible_start): |
| 202 | if y >= height - 2: |
| 203 | break |
| 204 | |
| 205 | is_selected = (i == self.current_field) |
| 206 | |
| 207 | # Draw label |
| 208 | label = option['label'][:25].ljust(25) |
| 209 | try: |
| 210 | if is_selected: |
| 211 | self.stdscr.attron(curses.color_pair(4) | curses.A_BOLD) |
| 212 | else: |
| 213 | self.stdscr.attron(curses.color_pair(7)) |
| 214 | |
| 215 | self.stdscr.addstr(y, 2, label) |
| 216 | |
| 217 | if is_selected: |
| 218 | self.stdscr.attroff(curses.color_pair(4) | curses.A_BOLD) |
| 219 | else: |
| 220 | self.stdscr.attroff(curses.color_pair(7)) |
| 221 | except: |
| 222 | pass |
| 223 |
no test coverage detected