diff --git a/src/toolManager/gui_fixed.py b/src/toolManager/gui_fixed.py index 1e96f00101..00edd569b3 100644 --- a/src/toolManager/gui_fixed.py +++ b/src/toolManager/gui_fixed.py @@ -16,20 +16,20 @@ import logging PYTHON = sys.executable -SYSTEM = platform.system() -IS_WINDOWS = SYSTEM == "Windows" -IS_LINUX = SYSTEM == "Linux" +from pathlib import Path +from constants import IS_WINDOWS, IS_LINUX +from paths import get_toolmanager_root -import os -BASE_DIR = os.path.dirname(os.path.abspath(__file__)) +BASE_DIR = get_toolmanager_root() if IS_WINDOWS: - BACKEND = os.path.join(BASE_DIR, "tool_manager_windows.py") + BACKEND = BASE_DIR / "tool_manager_windows.py" elif IS_LINUX: - BACKEND = os.path.join(BASE_DIR, "tool_manager_linux.py") + BACKEND = BASE_DIR / "tool_manager_linux.py" else: - BACKEND = os.path.join(os.path.dirname(os.path.abspath(__file__)), "tool_manager_windows.py") + BACKEND = BASE_DIR / "tool_manager_windows.py" +BACKEND = str(BACKEND) TOOLS = { "esim": { "versions": ["latest", "2.4", "2.3", "2.2"], diff --git a/src/toolManager/main.py b/src/toolManager/main.py index e005821de0..86c079d1c2 100644 --- a/src/toolManager/main.py +++ b/src/toolManager/main.py @@ -18,32 +18,41 @@ except ImportError: pass # Will handle gracefully later if missing +try: + from registry import ( + get_tool_label, + get_tool_versions, + get_default_version, + get_supported_tools, + ) +except ImportError: + from .registry import ( + get_tool_label, + get_tool_versions, + get_default_version, + get_supported_tools, + ) + # ==================== CONFIG ==================== -BASE_DIR = Path(__file__).resolve().parent -INFO_JSON = BASE_DIR / "information.json" -FULL_GUI = BASE_DIR / "gui_fixed.py" +try: + from paths import ( + get_toolmanager_root, + get_install_state_path, + ) +except ImportError: + from .paths import ( + get_toolmanager_root, + get_install_state_path, + ) + +BASE_DIR = get_toolmanager_root() +INFO_JSON = get_install_state_path() +FULL_GUI = BASE_DIR / "gui_fixed.py" PYTHON = sys.executable ANALOG_TOOLS = ["esim", "kicad", "ngspice"] DIGITAL_TOOLS = ["esim", "kicad", "ngspice", "ghdl", "verilator", "llvm"] - -TOOL_LABELS = { - "esim": "eSim", - "kicad": "KiCad", - "ngspice": "Ngspice", - "ghdl": "GHDL", - "verilator": "Verilator", - "llvm": "LLVM", -} - -TOOL_VERSIONS = { - "esim": "2.4", - "kicad": "latest", - "ngspice": "latest", - "ghdl": "latest", - "verilator": "latest", - "llvm": "latest", -} +VISIBLE_TOOLS = [tool for tool in get_supported_tools() if tool in DIGITAL_TOOLS] def is_admin(): try: @@ -66,7 +75,7 @@ def relaunch_as_admin(): ) def load_installed_versions(): - versions = {k: "Not installed" for k in TOOL_LABELS} + versions = {k: "Not installed" for k in VISIBLE_TOOLS} try: if INFO_JSON.exists(): with open(INFO_JSON) as f: @@ -100,7 +109,7 @@ def run(self): backend = str(BASE_DIR / "tool_manager_windows.py") for tool, version in self.tools: self.progress.emit( - f"Installing {TOOL_LABELS.get(tool, tool)} {version}..." + f"Installing {get_tool_label(tool)} {version}..." ) try: proc = subprocess.Popen( @@ -219,7 +228,8 @@ def _create_status_panel(self): lbl.setStyleSheet("color: #666; background: transparent;") layout.addWidget(lbl) - for key, label in TOOL_LABELS.items(): + for key in VISIBLE_TOOLS: + label = get_tool_label(key) ver = self.installed_versions.get(key, "Not installed") if ver != "Not installed": text = (f"● {label} " @@ -478,7 +488,7 @@ def _create_about_tab(self): title.setStyleSheet("color: #0056b3; margin-bottom: 5px;") layout.addWidget(title) - info_text = """ + info_text = f"""
Key Features:
• Install analog or digital simulation packages
@@ -486,9 +496,10 @@ def _create_about_tab(self):
• Uninstall packages selectively and Integrated with eSim GUI
Supported Packages:
- • KiCad: 6.0.11, 7.0.11, 8.0.9
- • Ngspice: 35, 36, 37, 38, 39, 40, 41, 42, 43
- • GHDL: 3.0.0, 4.0.0, 4.1.0, nightly and Verilator: 4.228, 5.020, 5.026, 5.030