Skip to content

enh: add a button for removing segmentation models from the list (#11) - #23

Merged
paulmueller merged 2 commits into
DC-analysis:mainfrom
paulmueller-agent:remove-torch-model
Nov 26, 2026
Merged

paulmueller merged 2 commits into
DC-analysis:mainfrom
paulmueller-agent:remove-torch-model

Conversation

@paulmueller-agent

Copy link
Copy Markdown

Closes #11.

Changes

  • New "-" button next to "+" in the machine-learning model row (ui/main_window.ui, regenerated main_window_ui.py with ui/run_uic.sh; only the new button changes). It is enabled whenever models are listed.
  • on_torch_model_remove removes the selected model from the list. The model file itself is not deleted.
  • ChipStream remembers the directories of added models (segm/torch_model_files) and lists all *.dcnm files in them at startup. To keep a removed model hidden in the next session, its path is stored in the new setting segm/torch_model_files_removed (removed when empty) and filtered out at startup. I chose this over storing individual model files, because it leaves the existing setting (and dcnum's search paths for finding models by name) unchanged.
  • Adding a removed model again with "+" lists it again (it is dropped from the removed list).
  • Adding the same model twice no longer creates a duplicate entry (QComboBox.findData does not compare pathlib.Path by value, so the paths are compared explicitly).
  • When the last model is removed, the list shows "No models available" and the "?" and "-" buttons are disabled.

Tests

test_gui_segm_torch_model_remove: adding a model twice lists it once; removing it takes it out of the list and stores it in the setting without deleting the file; a new ChipStream window (new session) does not list it; adding it again lists it again. It restores the original segm/torch_model_files_removed value (the GUI tests use the real user settings). It fails on main and passes with the change. test_gui_basic, test_gui_set_pixel_size and test_gui_basins[True] pass (offscreen).

Lint

lint-compare against main: ruff 0 → 0, pyright 1.1.408 0 → 0, flake8 clean.

🤖 Generated with Claude Code

…analysis#11)

The "-" button next to "+" removes the selected model from the model
list. The model file is not deleted. Since ChipStream remembers the
directories of model files (and lists all models in them), removed
models are stored in the setting "segm/torch_model_files_removed" so
that they stay hidden in the next session. Adding a removed model
again with "+" lists it again. Adding the same model twice no longer
creates a duplicate entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.84211% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.41%. Comparing base (f6eaee1) to head (f6ea949).

Files with missing lines Patch % Lines
chipstream/gui/main_window.py 84.37% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #23      +/-   ##
==========================================
+ Coverage   78.22%   78.41%   +0.19%     
==========================================
  Files          20       20              
  Lines        1428     1464      +36     
==========================================
+ Hits         1117     1148      +31     
- Misses        311      316       +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Other GUI tests add the same test model (same file name) from other
temporary directories, so counting models by name failed in CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@paulmueller
paulmueller merged commit e78c84e into DC-analysis:main Nov 26, 2026
8 checks passed
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.

Allow to remove segmentation model (e.g. with minus button)

2 participants