compact_automation: making a simplified view for autoamtion.

This commit is contained in:
appleb_m
2026-06-09 11:20:29 +02:00
parent 376375673b
commit 46d76a5e0e
4 changed files with 286 additions and 20 deletions
+10 -9
View File
@@ -43,28 +43,28 @@ class SampleQueueSpreadsheet(QAbstractTableModel):
def data(self, index, role=None):
if role == Qt.ItemDataRole.DisplayRole:
return get_entry(self.samples[index.row()], index.column())
elif role == Qt.ItemDataRole.TextAlignmentRole: # Align text to center
elif role == Qt.ItemDataRole.TextAlignmentRole:
return Qt.AlignmentFlag.AlignCenter
elif role == Qt.ItemDataRole.BackgroundRole:
if index.row() == 0:
if self.__running:
return QBrush(QColor(255, 102, 0)) # Fluorescent orange
return QBrush(QColor(255, 102, 0))
else:
return QBrush(QColor(114, 159, 207)) # Dark blue
return QBrush(QColor(255, 255, 255)) # White
return None # For other roles, return None
return QBrush(QColor(114, 159, 207))
return QBrush(QColor(255, 255, 255))
return None
def headerData(self, section, orientation, role=None):
if role == Qt.ItemDataRole.DisplayRole:
if orientation == Qt.Orientation.Horizontal: # Column header
if orientation == Qt.Orientation.Horizontal:
return self.header[section] if self.header else f"Column {section + 1}"
if orientation == Qt.Orientation.Vertical: # Row header
return str(section + 1) # Row numbers start from 1
if orientation == Qt.Orientation.Vertical:
return str(section + 1)
return None
def updateData(self, samples: list[SampleShortInfo],):
self.beginResetModel()
self.samples = samples
self.samples = list(samples)
self.endResetModel()
def mimeTypes(self):
@@ -107,6 +107,7 @@ class SampleQueueSpreadsheet(QAbstractTableModel):
def set_running(self, running: bool):
self.__running = running
self.layoutChanged.emit()
def remove_sample(self, db_id: int):
self.beginResetModel()