Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/toolManager/gui_fixed.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
71 changes: 41 additions & 30 deletions src/toolManager/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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"<span style='color:#28a745;'>●</span> {label} "
Expand Down Expand Up @@ -478,17 +488,18 @@ def _create_about_tab(self):
title.setStyleSheet("color: #0056b3; margin-bottom: 5px;")
layout.addWidget(title)

info_text = """
info_text = f"""
<div style='font-family: "Segoe UI", sans-serif; font-size: 10.5pt; color: #333; line-height: 1.5;'>
<p><b>Key Features:</b><br>
<span style='color: #555;'>• Install analog or digital simulation packages<br>
• Update individual package versions<br>
• Uninstall packages selectively and Integrated with eSim GUI</span></p>

<p><b>Supported Packages:</b><br>
<span style='color: #555;'>• KiCad: 6.0.11, 7.0.11, 8.0.9<br>
• Ngspice: 35, 36, 37, 38, 39, 40, 41, 42, 43<br>
• GHDL: 3.0.0, 4.0.0, 4.1.0, nightly and Verilator: 4.228, 5.020, 5.026, 5.030</span></p>
<span style='color: #555;'>• KiCad: {", ".join(get_tool_versions("kicad"))}<br>
• Ngspice: {", ".join(get_tool_versions("ngspice"))}<br>
• GHDL: {", ".join(get_tool_versions("ghdl"))}<br>
• Verilator: {", ".join(get_tool_versions("verilator"))}</span></p>
</div>
"""

Expand Down Expand Up @@ -544,7 +555,7 @@ def _install_analog(self):
)
if reply == QMessageBox.StandardButton.Yes:
self._run_install(
[(t, TOOL_VERSIONS[t]) for t in ANALOG_TOOLS],
[(t, get_default_version(t)) for t in ANALOG_TOOLS],
"Analog Mode"
)

Expand All @@ -561,7 +572,7 @@ def _install_digital(self):
)
if reply == QMessageBox.StandardButton.Yes:
self._run_install(
[(t, TOOL_VERSIONS[t]) for t in DIGITAL_TOOLS],
[(t, get_default_version(t)) for t in DIGITAL_TOOLS],
"Digital Mode"
)

Expand Down
18 changes: 18 additions & 0 deletions src/toolManager/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,24 @@ def get_supported_tools() -> List[str]:
return list(TOOLS.keys())


def get_tool_label(tool_id: str) -> str:
"""Return the display label for a tool."""
tool = get_tool_metadata(tool_id)
return tool.label if tool else tool_id


def get_tool_versions(tool_id: str) -> List[str]:
"""Return supported versions for a tool."""
tool = get_tool_metadata(tool_id)
return tool.versions if tool else []


def get_default_version(tool_id: str) -> str:
"""Return the default version for a tool."""
tool = get_tool_metadata(tool_id)
return tool.default_version if tool else "latest"


def is_tool_supported(tool_id: str) -> bool:
"""Checks if a tool is supported by the registry."""
return tool_id in TOOLS
Expand Down
4 changes: 2 additions & 2 deletions src/toolManager/tool_manager_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
WIN_NGSPICE_PATHS, WIN_LLVM_PATHS, get_msys2_bash,
get_msys2_mingw_bin, get_msys2_mingw_root
)

MSYS2_PATH = DEFAULT_MSYS2_PATH
if sys.platform == "win32":
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='ignore')
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8', errors='ignore')
Expand All @@ -34,7 +34,7 @@
STATE_FILE = BASE_DIR / "information.json"
BASE_DIR.mkdir(parents=True, exist_ok=True)

MSYS2_PATH = DEFAULT_MSYS2_PATH


DOWNLOAD_DIR = BASE_DIR / "Download"
DOWNLOAD_DIR.mkdir(parents=True, exist_ok=True)
Expand Down
17 changes: 10 additions & 7 deletions src/toolManager/updater_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
from PyQt6.QtCore import Qt, QThread, pyqtSignal
from PyQt6.QtGui import QFont

try:
from registry import get_tool_metadata, get_tool_versions
except ImportError:
from .registry import get_tool_metadata, get_tool_versions

class InstallerThread(QThread):
progress = pyqtSignal(str, int)
log_output = pyqtSignal(str) # NEW: For terminal output
Expand Down Expand Up @@ -97,13 +102,11 @@ class PackageUpdaterWindow(QMainWindow):
def __init__(self):
super().__init__()
self.installed_versions = {}

self.available_versions = {
'KiCad': ['6.0.11', '7.0.11', '8.0.9'],
'Ngspice': ['35', '36', '37', '38', '39', '40', '41', '42', '43'], # ALL VERSIONS!
'GHDL': ['3.0.0', '4.0.0', '4.1.0', 'nightly'],
'Verilator': ['4.228', '5.020', '5.026', '5.030']
}
self.available_versions = {}
for tool_id in ('kicad', 'ngspice', 'ghdl', 'verilator'):
metadata = get_tool_metadata(tool_id)
if metadata:
self.available_versions[metadata.label] = get_tool_versions(tool_id)
Comment thread
Akanksha-020 marked this conversation as resolved.
self.script_mapping = {
'KiCad': 'update-kicad-final.sh',
'Ngspice': 'nghdl/update-ngspice-final.sh', # Correct path!
Expand Down