diff --git a/predix.py b/predix.py index 84aad627..ee204b73 100755 --- a/predix.py +++ b/predix.py @@ -48,6 +48,35 @@ def fin_quant(path=None, step_n=None, loop_n=None, all_duration=None, checkout=T from rdagent.app.qlib_rd_loop.quant import main main(path=path, step_n=step_n, loop_n=loop_n, all_duration=all_duration, checkout=checkout) +def start_cli_dashboard_standalone(): + """ + Startet CLI Dashboard in einem SEPARATEN Terminal-Fenster. + """ + import subprocess + + # Dashboard Script in neuem Terminal starten + dashboard_script = Path(__file__).parent / "rdagent" / "log" / "ui" / "predix_dashboard.py" + + # Versuche verschiedene Terminal-Emulatoren + terminal_commands = [ + ["gnome-terminal", "--", "python", str(dashboard_script)], + ["konsole", "-e", "python", str(dashboard_script)], + ["xterm", "-e", "python", str(dashboard_script)], + ["tilix", "-e", "python", str(dashboard_script)], + ] + + for cmd in terminal_commands: + try: + subprocess.Popen(cmd, start_new_session=True) + console.print(f"[bold green]✓ Dashboard in neuem Terminal-Fenster gestartet[/bold green]") + return True + except FileNotFoundError: + continue + + console.print("[yellow]⚠ Kein unterstütztes Terminal gefunden. Verwende Web Dashboard (-d) statt CLI.[/yellow]") + return False + + def main(): import argparse @@ -57,8 +86,8 @@ def main(): epilog=""" Examples: python predix.py fin_quant # Normal starten - python predix.py fin_quant -d # Web Dashboard - python predix.py fin_quant -c # CLI Dashboard + python predix.py fin_quant -d # Web Dashboard (empfohlen!) + python predix.py fin_quant -c # CLI Dashboard (separates Terminal) python predix.py fin_quant -d -c # Beide Dashboards python predix.py fin_quant --dashboard-port 5001 # Custom Port """ @@ -75,7 +104,7 @@ Examples: fq_parser.add_argument('--checkout', action='store_true', default=True, help='Checkout') fq_parser.add_argument('--no-checkout', action='store_false', dest='checkout', help='No checkout') fq_parser.add_argument('-d', '--with-dashboard', action='store_true', help='Start web dashboard') - fq_parser.add_argument('-c', '--cli-dashboard', action='store_true', help='Start CLI dashboard') + fq_parser.add_argument('-c', '--cli-dashboard', action='store_true', help='Start CLI dashboard in new terminal') fq_parser.add_argument('--dashboard-port', type=int, default=5000, help='Dashboard port') args = parser.parse_args() @@ -86,14 +115,15 @@ Examples: dashboard_thread = threading.Thread(target=start_web_dashboard, args=(args.dashboard_port,), daemon=True) dashboard_thread.start() time.sleep(2) + console.print(f"[bold green]✓ Web Dashboard gestartet: http://localhost:{args.dashboard_port}/dashboard.html[/bold green]") - # Start CLI Dashboard wenn gewünscht + # Start CLI Dashboard in SEPARATEM Terminal wenn gewünscht if args.cli_dashboard: - cli_thread = threading.Thread(target=start_cli_dashboard, daemon=True) - cli_thread.start() + start_cli_dashboard_standalone() time.sleep(1) # Fin Quant starten + console.print("\n[bold cyan]Starting fin_quant...[/bold cyan]\n") fin_quant( path=args.path, step_n=args.step_n,