Fix: default border mutation and head widget title#99
Open
mohitr2111 wants to merge 3 commits intothe-virtual-brain:mainfrom
Open
Fix: default border mutation and head widget title#99mohitr2111 wants to merge 3 commits intothe-virtual-brain:mainfrom
mohitr2111 wants to merge 3 commits intothe-virtual-brain:mainfrom
Conversation
…wargs in super().__init__
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
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.
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.
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
Layout: Used a shallow copy ({**self.DEFAULT_BORDER}) in SpaceTimeVisualizerWidget to prevent mutating the shared layout dictionary.
Title: Appended .name to the HTML string interpolation in HeadWidget to correctly render the title as HeadWidget.
Kwargs: Replaced *kwargs with **kwargs in HeadWidget.init to properly pass keyword arguments.
Files changed
tvbwidgets/ui/spacetime_widget.py— 1 linetvbwidgets/ui/head_widget.py— 2 charactersTest plan
Added 1 regression test in tvbwidgets/tests/test_spacetime_widget.py to ensure layouts aren't mutated.
Added 2 regression tests in tvbwidgets/tests/test_head_widget.py to verify title rendering and kwarg initialization.