Skip to content

Fix: default border mutation and head widget title#99

Open
mohitr2111 wants to merge 3 commits intothe-virtual-brain:mainfrom
mohitr2111:fix/default-border-mutation-and-head-widget-title
Open

Fix: default border mutation and head widget title#99
mohitr2111 wants to merge 3 commits intothe-virtual-brain:mainfrom
mohitr2111:fix/default-border-mutation-and-head-widget-title

Conversation

@mohitr2111
Copy link
Copy Markdown

Problem

  1. Shared Layout Mutation: SpaceTimeVisualizerWidget directly modifies the class-level TVBWidget.DEFAULT_BORDER dictionary. This permanently injects a min_width that affects all subsequently instantiated widgets (like HeadWidget or PhasePlaneWidget) for the remainder of the kernel session.

  2. HTML Title Rendering: HeadWidget incorrectly renders its raw class object in the HTML title (<class 'tvbwidgets.ui.head_widget.HeadWidget'>) instead of its class name.

  3. Kwargs Unpacking Error: HeadWidget.init uses *kwargs in its super() call. This unpacks dictionary keys as positional arguments, throwing a TypeError if any extra keyword arguments are passed.

Fix

  1. Layout: Used a shallow copy ({**self.DEFAULT_BORDER}) in SpaceTimeVisualizerWidget to prevent mutating the shared layout dictionary.

  2. Title: Appended .name to the HTML string interpolation in HeadWidget to correctly render the title as HeadWidget.

  3. Kwargs: Replaced *kwargs with **kwargs in HeadWidget.init to properly pass keyword arguments.

Files changed

  • tvbwidgets/ui/spacetime_widget.py — 1 line
  • tvbwidgets/ui/head_widget.py — 2 characters

Test plan

  1. Added 1 regression test in tvbwidgets/tests/test_spacetime_widget.py to ensure layouts aren't mutated.

  2. Added 2 regression tests in tvbwidgets/tests/test_head_widget.py to verify title rendering and kwarg initialization.

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.

1 participant