MainWindow: Checker: Minor change and fixes.

This commit is contained in:
Pierre-Antoine Rouby committed 2024-03-27 09:57:53 +01:00
1 parent 9d9a8a7ced
commit e7e1582836
5 files changed
+87 -94

No files matched your search

+41 -38
View File
@@ -79,6 +79,47 @@ class TabTableModel(PamhyrTableModel):
def _setup_lst(self):
self._lst = self._opt_data
def data(self, index, role):
row = index.row()
column = index.column()
if role == Qt.ForegroundRole:
if self._headers[column] == "type":
return QVariant()
color = Qt.gray
status, _ = self.compute_status(row, column)
if status is STATUS.OK:
color = Qt.green
elif status is STATUS.WARNING:
color = QColor("orange")
elif status is STATUS.ERROR:
color = Qt.red
return QBrush(color)
if role == Qt.ItemDataRole.DisplayRole:
if self._headers[column] == "type":
return self.module_display_name(self._opt_data[row])
value = "UNKNOWN"
status, _ = self.compute_status(row, column)
if status is STATUS.OK:
value = "OK"
elif status is STATUS.WARNING:
value = "WARNING"
elif status is STATUS.ERROR:
value = "ERROR"
return value
return QVariant()
def module_display_name(self, module):
return Modules.modelling_display_name()[module]
def get_checkers(self, row, column):
module = self._opt_data[row]
solver = self._headers[column]
@@ -121,41 +162,3 @@ class TabTableModel(PamhyrTableModel):
logger.debug(f"Checkers: {row}, {column}: {checkers_status} {status}")
return status, checkers_status
def data(self, index, role):
row = index.row()
column = index.column()
if role == Qt.ForegroundRole:
if self._headers[column] == "type":
return QVariant()
color = Qt.gray
status, _ = self.compute_status(row, column)
if status is STATUS.OK:
color = Qt.green
elif status is STATUS.WARNING:
color = QColor("orange")
elif status is STATUS.ERROR:
color = Qt.red
return QBrush(color)
if role == Qt.ItemDataRole.DisplayRole:
if self._headers[column] == "type":
return str(self._opt_data[row])
value = "UNKNOWN"
status, _ = self.compute_status(row, column)
if status is STATUS.OK:
value = "OK"
elif status is STATUS.WARNING:
value = "WARNING"
elif status is STATUS.ERROR:
value = "ERROR"
return value
return QVariant()