(cfg: Dict)
| 1744 | |
| 1745 | |
| 1746 | def action_programs_install(cfg: Dict) -> None: |
| 1747 | distro = pick_or_install_system_for_programs(cfg) |
| 1748 | if not distro: |
| 1749 | print(tr(cfg, "invalid")) |
| 1750 | pause(cfg) |
| 1751 | return |
| 1752 | |
| 1753 | ensure_system_entry(cfg, distro) |
| 1754 | installed_pids = set(list_installed_programs(cfg, distro)) |
| 1755 | |
| 1756 | # --- Browser / filter menu so we can have a very large catalog without spamming the terminal |
| 1757 | print("\n" + tr(cfg, "programs_browser_title")) |
| 1758 | items = T[cfg.get("language","en")].get("programs_browser_menu", [ |
| 1759 | "Show ALL programs", |
| 1760 | "Pick a category", |
| 1761 | "Search by name", |
| 1762 | "Install custom package (type any package name)", |
| 1763 | "Back" |
| 1764 | ]) |
| 1765 | for i, item in enumerate(items, 1): |
| 1766 | print(f" {i}) {item}") |
| 1767 | |
| 1768 | choice = input("\n" + tr(cfg, "choose")).strip() |
| 1769 | |
| 1770 | if choice == "5": |
| 1771 | return |
| 1772 | |
| 1773 | if choice == "4": |
| 1774 | pkg_prompt = tr(cfg, "programs_custom_prompt") |
| 1775 | pkg = input(pkg_prompt).strip() |
| 1776 | install_custom_package(cfg, distro, pkg) |
| 1777 | pause(cfg) |
| 1778 | return |
| 1779 | |
| 1780 | view = list(PROGRAMS) |
| 1781 | |
| 1782 | if choice == "2": |
| 1783 | # category |
| 1784 | cats = sorted({p.get("cat","Other") for p in PROGRAMS}) |
| 1785 | print("\n" + tr(cfg, "programs_pick_category")) |
| 1786 | for i, c in enumerate(cats, 1): |
| 1787 | print(f" {i}) {c}") |
| 1788 | raw = input("\n" + tr(cfg, "choose")).strip() |
| 1789 | try: |
| 1790 | idx = int(raw) |
| 1791 | if not (1 <= idx <= len(cats)): |
| 1792 | raise ValueError |
| 1793 | cat = cats[idx - 1] |
| 1794 | view = [p for p in PROGRAMS if p.get("cat","Other") == cat] |
| 1795 | except Exception: |
| 1796 | print(tr(cfg, "invalid")) |
| 1797 | pause(cfg) |
| 1798 | return |
| 1799 | |
| 1800 | elif choice == "3": |
| 1801 | q = input(tr(cfg, "programs_search_prompt")).strip().lower() |
| 1802 | if q: |
| 1803 | def _match(p): |
no test coverage detected