From 7b926faab3dcd52e45fc1b4b24f955a4dcf66959 Mon Sep 17 00:00:00 2001 From: Christian Kolset Date: Wed, 3 Jun 2026 15:05:36 -0600 Subject: Add drag-and-snap tiling layout canvas to Plot Builder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace layout radio buttons (Stacked/Side-by-Side/Grid) with a visual LayoutCanvas widget. Pane tiles snap to grid cells on drag-drop; dropping on an occupied cell swaps positions. Ghost highlight shows snap target during drag. - PaneSpec gains row/col fields (None = unassigned; backward compat preserved) - LayoutConfig gains "free" mode; strip_chart reads explicit positions - PaneBlock loses ▲▼ move buttons; reordering is canvas-only - QSS entries added for layoutTile, layoutTileDragging, layoutCanvasBar Co-Authored-By: Claude Sonnet 4.6 --- ui/strip_chart.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'ui/strip_chart.py') diff --git a/ui/strip_chart.py b/ui/strip_chart.py index 523102d..d855038 100644 --- a/ui/strip_chart.py +++ b/ui/strip_chart.py @@ -95,12 +95,14 @@ class StripChartWidget(QWidget): n = len(cfg.panes) # Determine row/col for each pane - if cfg.layout_mode == "sidebyside": + if cfg.layout_mode == "free": + positions = [(spec.row or 0, spec.col or 0) for spec in cfg.panes] + elif cfg.layout_mode == "sidebyside": positions = [(0, c) for c in range(n)] elif cfg.layout_mode == "grid": cols = max(1, cfg.grid_cols) positions = [(i // cols, i % cols) for i in range(n)] - else: # stacked + else: # stacked (legacy default) positions = [(r, 0) for r in range(n)] ref_plot = None @@ -112,7 +114,7 @@ class StripChartWidget(QWidget): plot.getAxis("left").setStyle(tickFont=mf) plot.getAxis("bottom").setStyle(tickFont=mf) - # Hide bottom axis labels for all but bottom row in stacked + # Hide bottom axis labels for non-bottom panes in stacked legacy mode if cfg.layout_mode == "stacked" and idx < n - 1: plot.getAxis("bottom").setStyle(showValues=False) plot.getAxis("bottom").setHeight(0) @@ -133,10 +135,9 @@ class StripChartWidget(QWidget): else: plot.enableAutoRange(axis="y") - # Set column stretch (relative weight) + # Apply weight to row and column stretch self._gw.ci.layout.setColumnStretchFactor(col, spec.weight) - if cfg.layout_mode == "stacked": - self._gw.ci.layout.setRowStretchFactor(row, spec.weight) + self._gw.ci.layout.setRowStretchFactor(row, spec.weight) for tr in spec.traces: if not tr.visible: continue -- cgit v1.2.3