fix(bec_widgets): give Label/Details room and drop Added-at column in queue table
All 9 columns previously shared equal Stretch width, squeezing the two free-text columns (Label, command-step Details) down to the same width as short fixed-content ones like Type or Exp (s). Short columns now auto-fit their content; Label and Details stretch to fill what's left and left-align instead of centering. Also drops the Added-at column -- that value is still available via the row tooltip added earlier. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1007,21 +1007,20 @@ class TomoQueueDialog(QDialog):
|
||||
vbox = QVBoxLayout(self)
|
||||
vbox.setSpacing(6)
|
||||
|
||||
self._table = QTableWidget(0, 9)
|
||||
self._table = QTableWidget(0, 8)
|
||||
self._table.setHorizontalHeaderLabels(
|
||||
[
|
||||
"#",
|
||||
"Label",
|
||||
"Status",
|
||||
"Type",
|
||||
"Projections",
|
||||
"Exp (s)",
|
||||
"Step (µm)",
|
||||
"Details",
|
||||
"Added at",
|
||||
]
|
||||
["#", "Label", "Status", "Type", "Projections", "Exp (s)", "Step (µm)", "Details"]
|
||||
)
|
||||
self._table.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeMode.Stretch)
|
||||
# Short, fixed-content columns auto-fit to their text; Label and
|
||||
# Details -- the two that can hold long text (a custom label, or a
|
||||
# multi-step command summary) -- stretch to fill the remaining width
|
||||
# instead of being squeezed to the same share as "Type" or "Exp (s)".
|
||||
# "Added at" was dropped as a column; it's still in the row tooltip.
|
||||
header = self._table.horizontalHeader()
|
||||
for col in (0, 2, 3, 4, 5, 6):
|
||||
header.setSectionResizeMode(col, QHeaderView.ResizeMode.ResizeToContents)
|
||||
header.setSectionResizeMode(1, QHeaderView.ResizeMode.Stretch)
|
||||
header.setSectionResizeMode(7, QHeaderView.ResizeMode.Stretch)
|
||||
self._table.setSelectionBehavior(QTableWidget.SelectionBehavior.SelectRows)
|
||||
self._table.setEditTriggers(QTableWidget.EditTrigger.NoEditTriggers)
|
||||
self._table.itemSelectionChanged.connect(self._update_sort_buttons)
|
||||
@@ -1080,7 +1079,6 @@ class TomoQueueDialog(QDialog):
|
||||
"",
|
||||
"",
|
||||
_format_command_summary(job),
|
||||
job.get("added_at", ""),
|
||||
]
|
||||
else:
|
||||
params = job.get("params", {})
|
||||
@@ -1093,12 +1091,19 @@ class TomoQueueDialog(QDialog):
|
||||
_fmt_num(params.get("tomo_countingtime")),
|
||||
_fmt_num(params.get("tomo_shellstep")),
|
||||
"",
|
||||
job.get("added_at", ""),
|
||||
]
|
||||
tooltip = _job_tooltip(job)
|
||||
for col, text in enumerate(cells):
|
||||
item = QTableWidgetItem(text)
|
||||
item.setTextAlignment(Qt.AlignmentFlag.AlignCenter)
|
||||
# Label/Details are now wide, free-text columns -- left-align
|
||||
# them like normal text instead of centering, which reads
|
||||
# oddly once there's room on both sides.
|
||||
if col in (1, 7):
|
||||
item.setTextAlignment(
|
||||
Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignVCenter
|
||||
)
|
||||
else:
|
||||
item.setTextAlignment(Qt.AlignmentFlag.AlignCenter)
|
||||
if col == 2:
|
||||
item.setForeground(_color_from_hex(color))
|
||||
item.setToolTip(tooltip)
|
||||
|
||||
Reference in New Issue
Block a user