mirror of
https://github.com/curly60e/pyblock.git
synced 2026-08-13 12:33:15 +02:00
New clock/ package replaces the old design() polling loop with a flicker-free ANSI cursor-positioned renderer. Features include: countdown timer, epoch/halving progress bar, fee rate indicator, hashrate sparkline, matrix mining animation, odometer digit transition, heartbeat pulse, zen mode, UTC time display, fireworks on milestone blocks, generative hash art, and configurable sound modes. All features are toggleable via Settings → D (Clock Display Settings). Also fixes hardcoded config paths in menuSelection(), menuSelectionLN(), and TUI startup to use the cfg singleton instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
44 lines
1 KiB
Python
44 lines
1 KiB
Python
"""Enhanced block clock for PyBLOCK.
|
|
|
|
Entry point: run_clock(mode, path, settings_clock)
|
|
"""
|
|
|
|
import time
|
|
import sys
|
|
|
|
from . import animations
|
|
from .data import ClockData
|
|
from .renderer import Layout
|
|
|
|
|
|
def run_clock(mode, path, settings_clock):
|
|
"""Main clock loop with partial screen updates.
|
|
|
|
mode: 'local', 'remote', or 'lite'
|
|
path: dict with bitcoincli, ip_port, rpcuser, rpcpass
|
|
settings_clock: dict from pyblocksettingsClock.conf
|
|
"""
|
|
data = ClockData(mode, path)
|
|
layout = Layout(settings_clock)
|
|
|
|
try:
|
|
# Initial full fetch and render
|
|
data.refresh()
|
|
layout.render_full(data)
|
|
|
|
while True:
|
|
time.sleep(2)
|
|
|
|
changed = data.poll()
|
|
|
|
if 'block_height' in changed:
|
|
layout.on_new_block(data, animations)
|
|
else:
|
|
# Update dynamic elements
|
|
layout.update_countdown(data)
|
|
layout.heartbeat(data)
|
|
|
|
except KeyboardInterrupt:
|
|
pass
|
|
finally:
|
|
layout.cleanup()
|