Skip to content

[fix] METEOR GUI: closing "Create or load project" window causes error#3303

Merged
pieleric merged 1 commit intodelmic:masterfrom
pieleric:fix-meteor-gui-closing-create-or-load-project-window-causes-error
Jan 6, 2026
Merged

[fix] METEOR GUI: closing "Create or load project" window causes error#3303
pieleric merged 1 commit intodelmic:masterfrom
pieleric:fix-meteor-gui-closing-create-or-load-project-window-causes-error

Conversation

@pieleric
Copy link
Copy Markdown
Member

@pieleric pieleric commented Dec 16, 2025

The initial window only allows to create or load... but if you press
Alt+F4 on Ubuntu 24.04, you can still close the window. We could re-open
it, but let's make it a hidden shortcut that the suggested new project name
is fine, and automatically create a directory.

This avoids such error:

2025-12-15 18:37:27,928 ERROR   main:422:       Traceback (most recent call last):
  File "/home/piel/.local/lib/python3.12/site-packages/wx/core.py", line 3425, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/piel/development/odemis/src/odemis/gui/cont/tabs/tab_bar_controller.py", line 102, in _on_tab_change
    tab.Show()
  File "/home/piel/development/odemis/src/odemis/gui/cont/tabs/cryo_chamber_tab.py", line 1032, in Show
    if ret:
       ^^^
UnboundLocalError: cannot access local variable 'ret' where it is not associated with a value

The initial window only allows to create or load... but if you press
Alt+F4 on Ubuntu 24.04, you can still close the window. We could re-open
it, but let's make it a hidden shortcut that the suggested new project name
is fine, and automatically create a directory.

This avoids such error:
2025-12-15 18:37:27,928 ERROR   main:422:       Traceback (most recent call last):
  File "/home/piel/.local/lib/python3.12/site-packages/wx/core.py", line 3425, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/piel/development/odemis/src/odemis/gui/cont/tabs/tab_bar_controller.py", line 102, in _on_tab_change
    tab.Show()
  File "/home/piel/development/odemis/src/odemis/gui/cont/tabs/cryo_chamber_tab.py", line 1032, in Show
    if ret:
       ^^^
UnboundLocalError: cannot access local variable 'ret' where it is not associated with a value
Copy link
Copy Markdown

Copilot AI left a comment

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 fixes a bug where closing the "Create or load project" dialog window (e.g., via Alt+F4) causes an UnboundLocalError because the variable ret was never assigned a value before being checked. The fix adds an else clause to handle dialog closure by automatically creating a new project directory with the suggested name.

  • Added else clause to handle dialog closure (lines 1030-1033)
  • Automatically creates new project directory when dialog is closed
  • Sets ret = True to break out of the while loop and continue execution

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/odemis/gui/cont/tabs/cryo_chamber_tab.py
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 16, 2025

📝 Walkthrough

Walkthrough

The CryoChamberTab.Show method now auto-creates a new project directory when the project dialog is closed without selection (neither Load nor Create button clicked). Previously, closing the dialog would dismiss it without triggering any project creation. The method now calls _create_new_dir() and sets ret = True to proceed through the post-creation workflow when this dismissal occurs.

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main fix: handling Alt+F4 closure of the project creation/loading dialog to prevent an UnboundLocalError.
Description check ✅ Passed The description clearly explains the issue, the error traceback, and the solution of auto-creating a project directory when the dialog is closed.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/odemis/gui/cont/tabs/cryo_chamber_tab.py (1)

1031-1031: Improve comment professionalism.

The comment "The user cannot be bothered" has a slightly dismissive tone. Consider rephrasing for clarity and professionalism.

-                    # The user cannot be bothered => create a new project automatically
+                    # Dialog was closed without selection; auto-create a default project
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3596130 and 43e7f00.

📒 Files selected for processing (1)
  • src/odemis/gui/cont/tabs/cryo_chamber_tab.py (1 hunks)
🧰 Additional context used
🪛 GitHub Actions: Linting
src/odemis/gui/cont/tabs/cryo_chamber_tab.py

[error] 1-1: PNG metadata check failed: file contains forbidden metadata chunks.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: CodeQL analysis (python)
  • GitHub Check: Agent
  • GitHub Check: build (ubuntu-22.04)
  • GitHub Check: build (ubuntu-24.04)

Comment thread src/odemis/gui/cont/tabs/cryo_chamber_tab.py
@pieleric pieleric merged commit 0075544 into delmic:master Jan 6, 2026
11 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.

4 participants