Skip to content

refactor - #621

Open
Akanksha-020 wants to merge 3 commits into
FOSSEE:feature/tool-manager-integrationfrom
Akanksha-020:akanksha-refactor
Open

refactor#621
Akanksha-020 wants to merge 3 commits into
FOSSEE:feature/tool-manager-integrationfrom
Akanksha-020:akanksha-refactor

Conversation

@Akanksha-020

Copy link
Copy Markdown

Related Issues

Purpose

Remove duplicated tool label and version metadata from the Tool Manager UI code and make the existing registry the single source of truth for tool names, supported versions, and default install versions

Approach

[registry.py] now exposes small helper functions for label, version, and default-version lookup. [main.py] no longer keeps separate hardcoded label/version maps; it reads tool names and install defaults from the registry, and the About tab now renders supported versions directly from registry data. [updater_gui.py] now builds its available-version list from the registry instead of maintaining a second hardcoded copy, while keeping the existing script mapping unchanged.

Copilot AI lite review requested due to automatic review settings August 8, 2026 14:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the Tool Manager UI to remove duplicated tool label/version/default-version metadata and instead use registry.py as the single source of truth for these values.

Changes:

  • Added registry helper accessors (get_tool_label, get_tool_versions, get_default_version) and updated UI code to use them.
  • Updated the main Tool Manager UI to derive visible tools, labels, and default install versions from the registry.
  • Refactored path handling to use paths.py helpers and pathlib.Path for toolManager root/state paths.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/toolManager/updater_gui.py Replaced hardcoded available-version lists with registry-derived versions for the updater UI.
src/toolManager/tool_manager_windows.py Minor refactor to avoid duplicated MSYS2_PATH assignment.
src/toolManager/registry.py Added helper functions to centralize label/version/default-version lookups.
src/toolManager/main.py Removed hardcoded tool label/version maps; now pulls labels/versions/defaults and tool lists from registry and uses paths helpers.
src/toolManager/gui_fixed.py Refactored backend path construction to use paths.py and Path instead of os.path.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/toolManager/updater_gui.py
Comment thread src/toolManager/main.py Outdated
Comment thread src/toolManager/gui_fixed.py
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Suppressed comments (4)

src/toolManager/updater_gui.py:109

  • The registry version lists currently don’t match what the updater scripts accept. For example, update-kicad-final.sh only supports 6.0.11/7.0.11/8.0.9, but the registry’s kicad versions are latest, 9, 8, 7, 6; selecting latest or 9 here will cause the script to exit with “Invalid KiCad version specified”. Similar mismatches exist for GHDL and Verilator script-supported versions. Either make registry versions platform/script-aware or update the scripts to accept the registry’s versions before wiring the GUI to get_tool_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)

src/toolManager/updater_gui.py:109

  • self.available_versions is populated only when get_tool_metadata() returns a spec. The UI later indexes self.available_versions[package_name] for all four packages, so any missing metadata will raise a KeyError during UI construction. Initialize defaults for the expected labels (or use .get(..., [])) so the window can still render even if registry data is missing/incomplete.
        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)

src/toolManager/gui_fixed.py:23

  • This file still contains a hardcoded TOOLS dictionary with per-tool version lists (and other tool metadata) even though the PR description says the registry should be the single source of truth for tool names/versions/defaults. Consider migrating gui_fixed.py to read tool metadata from registry.py (or explicitly documenting why this UI remains separate), otherwise version updates must be duplicated in multiple places.
from constants import IS_WINDOWS, IS_LINUX
from paths import get_toolmanager_root

BASE_DIR = get_toolmanager_root()

src/toolManager/gui_fixed.py:21

  • Path is imported but never used after switching BASE_DIR to get_toolmanager_root(). Removing the unused import avoids lint noise and keeps the module header minimal.
PYTHON     = sys.executable
from pathlib import Path
from constants import IS_WINDOWS, IS_LINUX
from paths import get_toolmanager_root

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants