Skip to content

fix/lmfit-dialog#1112

Open
wyzula-jan wants to merge 3 commits intomainfrom
fix/lmfit-dialog
Open

fix/lmfit-dialog#1112
wyzula-jan wants to merge 3 commits intomainfrom
fix/lmfit-dialog

Conversation

@wyzula-jan
Copy link
Contributor

@wyzula-jan wyzula-jan commented Mar 20, 2026

Description

Fix cpp object deleted bug and optimized horizontal layout variant. Needed for #1105

Related Issues

Copilot AI review requested due to automatic review settings March 20, 2026 16:51
@wyzula-jan wyzula-jan self-assigned this Mar 20, 2026
@wyzula-jan wyzula-jan enabled auto-merge (rebase) March 20, 2026 16:54
Copy link
Contributor

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

Fixes stability issues in the LMFit dialog (notably around “C++ object deleted” scenarios) and improves the compact/horizontal UI variant so it reliably supports the action column.

Changes:

  • Guarded action-button enable/disable logic against deleted Qt objects (using shiboken6.isValid) and pruned invalid button references.
  • Improved state handling when removing the currently displayed curve (clears relevant UI and action state).
  • Updated lmfit_dialog_compact.ui to use a horizontal splitter layout and ensured the parameter tree includes the “Action” column; added a regression test for the compact UI.

Reviewed changes

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

File Description
bec_widgets/widgets/dap/lmfit_dialog/lmfit_dialog.py Adds validity checks for action buttons and improves cleanup when removing displayed curve data.
bec_widgets/widgets/dap/lmfit_dialog/lmfit_dialog_compact.ui Adjusts compact layout (horizontal splitter, margins/sizing) and ensures 4-column param tree with “Action”.
tests/unit_tests/test_lmfit_dialog.py Adds a compact-UI regression test covering curve selection hiding and action button creation.

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

Comment on lines +175 to +179
if self.fit_curve_id == curve_id:
self._fit_curve_id = None
self.action_buttons = {}
self.ui.summary_tree.clear()
self.ui.param_tree.clear()
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

remove_dap_data() sets self._fit_curve_id = None, but fit_curve_id is annotated as returning str and selected_fit is Signal(str). Consider making fit_curve_id explicitly optional (str | None) and/or providing a clear/consistent way to signal that the selection was cleared (e.g., select the next available curve and emit it, or emit a dedicated “cleared” signal) to avoid type/behavior inconsistencies for consumers.

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Mar 20, 2026

Codecov Report

❌ Patch coverage is 20.00000% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...c_widgets/widgets/dap/lmfit_dialog/lmfit_dialog.py 20.00% 10 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

[BUG]: LMFit Dialog plugin crash in designer

2 participants