Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions negpy/desktop/view/sidebar/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,9 @@ def _init_ui(self) -> None:

layout.addWidget(self.library_section)
layout.addWidget(self.frames_section)
# Absorbs the surplus when every section is collapsed — otherwise Qt spreads it
# into the gaps between the rows above. Stretch 0 leaves an open section its share.
layout.addStretch(0)
self._rebalance_sections()

# Applied after list_view exists — the filter prunes selection against the view.
Expand Down
13 changes: 13 additions & 0 deletions tests/test_session_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,19 @@ def test_a_collapsed_section_keeps_only_its_header(panel):
assert browser.layout().stretch(browser.layout().indexOf(browser.frames_section)) > 0


def test_collapsing_both_sections_keeps_the_panel_top_aligned(panel, qapp):
"""With nothing expanded the leftover height must not spread into the gaps (#754)."""
browser = panel.file_browser
browser.library_section.toggle_button.setChecked(False)
browser.frames_section.toggle_button.setChecked(False)

browser.resize(300, 900)
browser.show()
qapp.processEvents()

assert browser.frames_section.y() < 200 # ~115 stacked, ~707 spread


def test_expanding_a_section_gives_it_back_a_share(panel):
browser = panel.file_browser
browser.frames_section.toggle_button.setChecked(False)
Expand Down
Loading