Skip to content

Start from any folder: load the webcam and optimizer .ui files from the package - #119

Merged
nvladimus merged 1 commit into
mesoSPIM:release/candidate-py312from
thomdehoog:fix/ui-paths-from-package
Oct 9, 2026
Merged

nvladimus merged 1 commit into
mesoSPIM:release/candidate-py312from
thomdehoog:fix/ui-paths-from-package

Conversation

@thomdehoog

Copy link
Copy Markdown

Starting mesoSPIM from the repository root, as AGENTS.md describes (python mesoSPIM/mesoSPIM_Control.py -D), stops during startup:

File "...\mesoSPIM\src\WebcamWindow.py", line 29, in __init__
  loadUi('gui/WebcamWindow.ui', self)
FileNotFoundError: [Errno 2] No such file or directory: 'gui/WebcamWindow.ui'

The webcam window opens at every startup (since 61f2379), and it loads its .ui file relative to the working folder. mesoSPIM_Optimizer does the same for its two .ui files, so it fails the same way when it is opened. Started from mesoSPIM/, both work. That probably also applies to the mesospim-control console script when it's run from another folder.

Change

WebcamWindow and mesoSPIM_Optimizer now find the gui folder from their own file, as the main window does through package_directory. WebcamWindow is built without a parent, so it still works stand-alone. One commit, two files.

Two other loadUi calls with relative paths are left alone. mesoSPIM_CameraWindow.py:69 and mesoSPIM_TileViewWindow.py:32 only use them when the module is run as __main__; inside the app they load from package_directory.

Tests

In demo mode, started from the repository root, mesoSPIM starts and is still running after 60 s, and the demo ETL file loads. Before this change it stopped with the error above. The optimizer window has not been opened by hand yet.

🤖 Generated with Claude Code

https://claude.ai/code/session_01J2m2maCdWtVBtqdqaQi5xV

…es from the package

WebcamWindow and mesoSPIM_Optimizer loaded their .ui files relative to the working folder, so
`python mesoSPIM/mesoSPIM_Control.py -D` from the repository root (as AGENTS.md says) stopped at
startup with FileNotFoundError: 'gui/WebcamWindow.ui'; the webcam window opens at every startup.
The optimizer failed the same way when opened. Both now find the gui folder from their own file,
as the main window does through package_directory, so WebcamWindow still works stand-alone.

Checked in demo mode from the repository root: mesoSPIM starts and runs, and the demo ETL file loads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J2m2maCdWtVBtqdqaQi5xV
@nvladimus
nvladimus merged commit d2f9b4a into mesoSPIM:release/candidate-py312 Oct 9, 2026
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