Skip to content

Commit e748509

Browse files
committed
Make terminal dashboard use all of the log area (not just 10 items)
1 parent 6f06d06 commit e748509

1 file changed

Lines changed: 34 additions & 19 deletions

File tree

instagram_monitor.py

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,37 @@ def _startup_sigint_handler(signum, frame):
934934
FLASK_AVAILABLE = False
935935

936936

937+
class DynamicLog:
938+
def __init__(self, activities):
939+
self.activities = activities
940+
941+
def __rich_console__(self, console, options):
942+
log_entries = options.max_height
943+
text = Text()
944+
if not self.activities:
945+
text.append("Waiting for activity...", style="dim italic")
946+
else:
947+
for act in reversed(self.activities[:log_entries]):
948+
text.append(f"{act['time']} ", style="dim")
949+
text.append(f"{act['message']}\n")
950+
yield text
951+
952+
953+
import io
954+
class _FilteredStderr(io.TextIOBase):
955+
def __init__(self, original):
956+
self._original = original
957+
def write(self, s):
958+
if not s or not s.strip():
959+
return len(s) if s else 0
960+
if HIDE_403_ERRORS:
961+
if "403" in s:
962+
return len(s)
963+
return self._original.write(s)
964+
def flush(self):
965+
self._original.flush()
966+
967+
937968
# Locates installed data files (wheel / pip)
938969
def _locate_installed_dist_file(target_filename: str) -> Optional[str]:
939970
try:
@@ -5473,16 +5504,7 @@ def generate_user_dashboard(target_data):
54735504

54745505
# Activity Log Panel (Latest at bottom)
54755506
activities = DASHBOARD_DATA.get('activities', [])
5476-
log_text = Text()
5477-
if not activities:
5478-
log_text.append("Waiting for activity...", style="dim italic")
5479-
else:
5480-
# Show last 10 activities, latest at bottom
5481-
for act in reversed(activities[:10]):
5482-
log_text.append(f"{act['time']} ", style="dim")
5483-
log_text.append(f"{act['message']}\n")
5484-
5485-
log_panel = Panel(log_text, title="Live Activity Log", box=box.ROUNDED, border_style="yellow")
5507+
log_panel = Panel(DynamicLog(activities), title="Live Activity Log", box=box.ROUNDED, border_style="yellow")
54865508

54875509
# Last Fetched Panel
54885510
last_fetched_text = Text()
@@ -5592,7 +5614,7 @@ def append_update_entry(update, fallback_user):
55925614
Layout(header_panel, size=3),
55935615
Layout(stats_panel, size=3),
55945616
Layout(name="main", ratio=1),
5595-
Layout(log_panel, size=12)
5617+
Layout(log_panel, ratio=1),
55965618
)
55975619
layout["main"].split_row(
55985620
Layout(table, ratio=4),
@@ -5709,14 +5731,7 @@ def generate_config_dashboard(target_data, config_data):
57095731

57105732
# Activity Log Panel (Latest at bottom)
57115733
activities = DASHBOARD_DATA.get('activities', [])
5712-
log_text = Text()
5713-
if not activities:
5714-
log_text.append("Waiting for activity...", style="dim italic")
5715-
else:
5716-
for act in reversed(activities[:8]):
5717-
log_text.append(f"{act['time']} ", style="dim")
5718-
log_text.append(f"{act['message']}\n")
5719-
log_panel = Panel(log_text, title="Live Activity Log", box=box.ROUNDED, border_style="yellow")
5734+
log_panel = Panel(DynamicLog(activities), title="Live Activity Log", box=box.ROUNDED, border_style="yellow")
57205735

57215736
# Actions panel
57225737
mode_btn_text = Text()

0 commit comments

Comments
 (0)