Skip to content

fix: a figure with no window manager no longer raises when graphics blocks set the window title - #266

Merged
petercorke merged 1 commit into
mainfrom
fix/graphics-window-title-guard
Nov 16, 2026
Merged

petercorke merged 1 commit into
mainfrom
fix/graphics-window-title-guard

Conversation

@petercorke

Copy link
Copy Markdown
Owner

Closes #114.

graphics_block.py set the figure's window title with f.canvas.manager.set_window_title(...) in two places (the first figure, and later untiled ones). On a backend with no window manager, canvas.manager is None, so that raised AttributeError. It now calls spatialmath.base.set_window_title(fig, title), which does nothing and returns False for such a figure. That function is in spatialmath-python 1.1.19 (rai-opensource/spatialmath-python#263), which is already bdsim's minimum version, so there is no dependency change.

Tested

  • New test test_create_figure_without_window_manager makes pyplot figures whose canvas.manager is None and calls create_figure() for the first and a later figure. It fails without the change ('NoneType' object has no attribute 'set_window_title') and passes with it.
  • Full suite in a clean venv with spatialmath-python 1.1.19 from PyPI: 1246 passed. The two failures are bdedit print tests, which need the bdedit extra's Qt packages that venv lacks.
  • ruff, ruff format and mypy are clean on both files.

Note for contributors with an editable spatialmath-python checkout: it needs to be at 1.1.19 or later, or import bdsim fails on the new import.

🤖 Generated with Claude Code

…locks set the window title

graphics_block set the title with f.canvas.manager.set_window_title(...) in two
places. A figure on a backend that has no window manager has canvas.manager None,
so that raised AttributeError. Use spatialmath.base.set_window_title, which does
nothing and returns False for such a figure (spatialmath-python 1.1.19, already the
minimum version). The test fails without the change.

Closes #114

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@codacy-production

codacy-production Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

🟢 Coverage 100.00% diff coverage

Metric Results
Coverage variation Report missing for f7058b31
Diff coverage ✅ 100.00% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (f7058b3) Report Missing Report Missing Report Missing
Head commit (1681558) 6121 5133 83.86%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#266) 3 3 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

1 Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@codecov

codecov Bot commented Nov 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.85%. Comparing base (4c5e904) to head (1681558).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #266   +/-   ##
=======================================
  Coverage   83.85%   83.85%           
=======================================
  Files          26       26           
  Lines        6120     6121    +1     
=======================================
+ Hits         5132     5133    +1     
  Misses        988      988           

☔ 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.

@petercorke
petercorke merged commit e8ddf2b into main Nov 16, 2026
26 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 16, 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.

graphics_block: guard window titles with spatialmath.base.set_window_title once released (SMTB #263)

1 participant