Skip to content

Equalize dock zone sizes on startup#265

Open
xiao-1011 wants to merge 7 commits intoSpikeInterface:mainfrom
xiao-1011:feature/equalize-dock-sizes
Open

Equalize dock zone sizes on startup#265
xiao-1011 wants to merge 7 commits intoSpikeInterface:mainfrom
xiao-1011:feature/equalize-dock-sizes

Conversation

@xiao-1011
Copy link
Copy Markdown
Contributor

Summary

  • Dock widgets created by splitDockWidget() have uneven default sizes, causing zones that span multiple slots to be disproportionately larger than their neighbors
  • Added a showEvent hook in QtMainWindow that calls resizeDocks() with equal weights for all visible docks in both horizontal and vertical orientations
  • Uses QApplication.processEvents() to flush pending layout events before resizing, ensuring the window geometry is finalized — no arbitrary timer delay needed
  • Runs only once on first show via a _splitters_equalized guard

Test plan

  • Open the GUI with a layout where some zones are empty (e.g. zone2 = []) and verify all populated zones start with proportional sizes
  • Open with the default layout preset and verify zones are evenly sized
  • Minimize and restore the window — verify the equalization does not re-trigger
  • Test with different layout presets (default, legacy, unit_focus)

🤖 Generated with Claude Code

xiao-1011 and others added 5 commits April 10, 2026 17:00
`get_visible_unit_ids()` returned a direct reference to the internal
`_visible_unit_ids` list. Callers that snapshot the list before and after
`set_unit_visibility()` to detect changes were comparing the same mutated
object, so the comparison always found no difference and never triggered
`notify_unit_visibility_changed()`.

Return a copy instead so before/after comparisons work correctly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…copy

Fix unit visibility change not propagating to other views
Dock widgets created by splitDockWidget() have uneven default sizes.
Add a showEvent hook that calls resizeDocks() with equal weights after
the window is visible, so all zones start proportionally sized.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace QTimer.singleShot(100ms) hack with QApplication.processEvents()
to flush pending layout events synchronously before calling resizeDocks.
Deterministic and avoids arbitrary delay.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
def get_visible_unit_ids(self):
"""Get list of visible unit_ids"""
return self._visible_unit_ids
return list(self._visible_unit_ids)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why this ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this was to fix #264 unit visibility propagation issue. I should have restored this line since these 2 issues are independent :)

@samuelgarcia
Copy link
Copy Markdown
Member

thank you for this.

@chrishalcrow
Copy link
Copy Markdown
Member

Hi @xiao-1011 , I'm not sure this is doing what it's meant to do.

Here my is initial window on main:

Screenshot 2026-04-15 at 16 29 43

and on this branch:

Screenshot 2026-04-15 at 16 30 03

Do you have local runs that equalise the docks?

xiao-1011 and others added 2 commits April 15, 2026 19:51
Replace synchronous processEvents() + resizeDocks() with a deferred
QTimer.singleShot(0) call. On macOS, the Cocoa window system performs
a layout pass after Qt's showEvent, overwriting sizes set synchronously.
The deferred call ensures resizeDocks runs after the native layout completes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@xiao-1011
Copy link
Copy Markdown
Contributor Author

Hi @chrishalcrow , thanks for checking! It seems to be a macos specific issue. Original PR works on Windows 11 and Ubuntu 24.04. The branch should now work on macos (at least on my macbook) hopefully. Can you give it a try?

@chrishalcrow
Copy link
Copy Markdown
Member

chrishalcrow commented Apr 16, 2026

Wow beautiful!!

Screenshot 2026-04-16 at 10 37 04

(not the unit, but the GUI!)

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.

3 participants