move controller connect to popup dialog

This commit is contained in:
ykcheungab
2026-09-24 21:36:24 +08:00
parent 4dad413d29
commit 6effe74172
13 changed files with 773 additions and 99 deletions
+96 -17
View File
@@ -132,28 +132,30 @@ def main() -> int:
for key in window.workspace.page_keys():
window.workspace.set_current_key(key)
app.processEvents()
oversize = []
for child in _visible_descendants(window):
if _inside_scroll_area(child):
continue # a rail's content is meant to exceed its viewport
parent = child.parentWidget()
if parent is None or not parent.isVisible():
continue
geometry = child.geometry()
if (
geometry.width() > parent.width() + 1
or geometry.height() > parent.height() + 1
):
oversize.append(
f"{type(child).__name__} {geometry.width()}x{geometry.height()}"
f" > {parent.width()}x{parent.height()}"
)
checker.that(
not oversize, f"{theme} {width}x{height} tab={key}: {oversize}"
not _overflowing(window),
f"{theme} {width}x{height} tab={key}: {_overflowing(window)}",
)
window.workspace.set_current_key("axes")
print(f" {width}x{height}: every tab fits")
# The device setup is a separate top-level window now, so the sweep has
# to be run over it as well: a dialog whose own controls do not fit is
# exactly the defect the sweep exists for, one window further out.
window._show_device_setup() # noqa: SLF001 - the documented entry point
app.processEvents()
for tab in ("connection", "bus"):
window.device_setup.select_tab(tab)
app.processEvents()
checker.that(
not _overflowing(window.device_setup),
f"{theme} {width}x{height} setup tab={tab}: "
f"{_overflowing(window.device_setup)}",
)
window.device_setup.close()
app.processEvents()
print(f" {width}x{height}: the device setup fits")
# ---- the permanent shell ----------------------------------------
checker.that(
window.workspace.page_keys()
@@ -243,6 +245,58 @@ def main() -> int:
window.left_rail.widget() is window.rail_content,
"the setup rail is not scrollable",
)
# The rail carries what is read while working. Connection and bus
# initialisation moved into the device-setup dialog: back in the rail they
# pushed the axis readout below the fold.
rail_children = {
type(child).__name__ for child in window.rail_content.findChildren(object)
}
checker.that(
"AxisReadoutPanel" in rail_children,
f"the axis readout is not in the rail: {sorted(rail_children)}",
)
checker.that(
"BusDataPanel" in rail_children,
"the bus-data monitor is not in the rail",
)
checker.that(
"ConnectionPanel" not in rail_children and "BusPanel" not in rail_children,
f"a start-up panel is still in the rail: {sorted(rail_children)}",
)
checker.that(
not window.device_setup.isVisible(),
"the device setup is open before anyone asked for it",
)
checker.that(
window.device_setup.connection_panel is window.connection_panel
and window.device_setup.bus_panel is window.bus_panel,
"the window's panel references are not the ones in the dialog",
)
# Three ways in, all of them the operator's, all landing on one method.
window.status_strip.setup_button.click()
app.processEvents()
checker.that(
window.device_setup.isVisible(),
"the setup button did not open the device setup",
)
window.device_setup.close()
window.status_strip.chip_bus.clicked.emit()
app.processEvents()
checker.that(
window.device_setup.isVisible()
and window.device_setup.current_tab() == "bus",
"the bus chip did not open the bus tab",
)
window.device_setup.close()
window.brand_bar.connectionChipClicked.emit()
app.processEvents()
checker.that(
window.device_setup.isVisible()
and window.device_setup.current_tab() == "connection",
"the brand-bar chip did not open the connection tab",
)
window.device_setup.close()
app.processEvents()
checker.that(
window.run_bar.isVisible(),
"the run bar is not visible",
@@ -415,6 +469,31 @@ def main() -> int:
return checker.report()
def _overflowing(root) -> list[str]:
"""Visible descendants that are larger than the widget that contains them.
Scroll-area content is exempt: a rail's content is meant to exceed its viewport.
Everything else that does not fit its parent is a clipped control.
"""
oversize = []
for child in _visible_descendants(root):
if _inside_scroll_area(child):
continue
parent = child.parentWidget()
if parent is None or not parent.isVisible():
continue
geometry = child.geometry()
if (
geometry.width() > parent.width() + 1
or geometry.height() > parent.height() + 1
):
oversize.append(
f"{type(child).__name__} {geometry.width()}x{geometry.height()}"
f" > {parent.width()}x{parent.height()}"
)
return oversize
def _inside_scroll_area(widget) -> bool:
"""Whether ``widget`` is scroll-area content rather than a laid-out child."""
from PySide6.QtWidgets import QAbstractScrollArea