Dashboard layout for 480x222 landscape.
(self)
| 494 | # ------------------------------------------------------------------ |
| 495 | |
| 496 | def draw_dashboard(self): |
| 497 | """Dashboard layout for 480x222 landscape.""" |
| 498 | self.pager.clear(self.DARK_BG) |
| 499 | self._draw_screen_header("RAGNAR") |
| 500 | |
| 501 | # Layout: left panel (stats + status), right panel (character + comment) |
| 502 | left_w = 300 |
| 503 | right_x = left_w + 4 |
| 504 | right_w = self.width - right_x - 2 |
| 505 | y = 26 |
| 506 | |
| 507 | # Status bar (full width) |
| 508 | status = self.shared_data.ragnarorch_status or "IDLE" |
| 509 | status2 = self.shared_data.ragnarstatustext2 or "" |
| 510 | status_color = self.GREEN if "IDLE" in status else self.CYAN |
| 511 | if "Bruteforce" in status: |
| 512 | status_color = self.RED |
| 513 | elif "Steal" in status: |
| 514 | status_color = self.YELLOW |
| 515 | |
| 516 | self.pager.fill_rect(2, y, self.width - 4, 20, self.CARD_BG) |
| 517 | self.pager.draw_ttf(8, y + 2, status[:30], status_color, self.font_arial, 13) |
| 518 | tw = self.pager.ttf_width(status2[:30], self.font_arial, 11) |
| 519 | self.pager.draw_ttf(self.width - tw - 8, y + 4, status2[:30], self.GRAY, self.font_arial, 11) |
| 520 | y += 24 |
| 521 | |
| 522 | # Stats grid: 6 cards in 2 rows x 3 cols (left panel) |
| 523 | card_w = (left_w - 12) // 3 |
| 524 | card_h = 34 |
| 525 | gap = 3 |
| 526 | stats = [ |
| 527 | (self.shared_data.targetnbr, "TRGT", self.GREEN), |
| 528 | (self.shared_data.portnbr, "PORT", self.CYAN), |
| 529 | (self.shared_data.vulnnbr, "VULN", self.RED), |
| 530 | (self.shared_data.crednbr, "CRED", self.YELLOW), |
| 531 | (self.shared_data.zombiesnbr, "ZOMB", self.PURPLE), |
| 532 | (self.shared_data.datanbr, "DATA", self.ORANGE), |
| 533 | ] |
| 534 | |
| 535 | for i, (val, label, color) in enumerate(stats): |
| 536 | col = i % 3 |
| 537 | row = i // 3 |
| 538 | cx = 4 + col * (card_w + gap) |
| 539 | cy = y + row * (card_h + gap) |
| 540 | self._draw_stat_card(cx, cy, card_w, card_h, val, label, color) |
| 541 | |
| 542 | # Level bar below stats |
| 543 | stats_bottom = y + 2 * (card_h + gap) + 2 |
| 544 | level = self.shared_data.levelnbr |
| 545 | coins = self.shared_data.coinnbr |
| 546 | ppl = self.shared_data.points_per_level if hasattr(self.shared_data, 'points_per_level') else 200 |
| 547 | progress = (coins % ppl) / ppl if ppl > 0 else 0 |
| 548 | |
| 549 | self.pager.draw_ttf(6, stats_bottom, f"Lvl {level}", self.PURPLE, self.font_arial, 12) |
| 550 | self.pager.draw_ttf(60, stats_bottom, f"{coins}pts", self.GRAY, self.font_arial, 11) |
| 551 | bar_x = 120 |
| 552 | bar_y = stats_bottom + 4 |
| 553 | bar_w = left_w - bar_x - 6 |
no test coverage detected