diff --git a/fmpy/gui/TableDialog.py b/fmpy/gui/TableDialog.py
index ba50a8d1..a207ff6c 100644
--- a/fmpy/gui/TableDialog.py
+++ b/fmpy/gui/TableDialog.py
@@ -1,5 +1,5 @@
from PySide6.QtCore import Qt, QAbstractTableModel, QModelIndex
-from PySide6.QtGui import QFont, QIcon
+from PySide6.QtGui import QFont, QIcon, QGuiApplication
from PySide6.QtWidgets import QDialog, QHeaderView
import pyqtgraph as pg
import numpy as np
@@ -14,7 +14,7 @@ class TableModel(QAbstractTableModel):
def __init__(self, size, data, startValues, parent=None):
super(TableModel, self).__init__(parent)
self.size = size
- self.data = data
+ self._data = data
self.startValues = startValues
self.boldFont = QFont()
self.boldFont.setBold(True)
@@ -50,7 +50,7 @@ def data(self, index, role=Qt.DisplayRole):
return None
subs = self.ind2sub(index)
- sv = self.data[subs]
+ sv = self._data[subs]
if role == Qt.DisplayRole or role == Qt.EditRole:
if sv.name in self.startValues:
@@ -68,7 +68,7 @@ def data(self, index, role=Qt.DisplayRole):
def setData(self, index, value, role):
subs = self.ind2sub(index)
- sv = self.data[subs]
+ sv = self._data[subs]
if value:
self.startValues[sv.name] = value
@@ -124,7 +124,7 @@ def __init__(self, modelVariables, variable, startValues, parent=None):
variable_name = variable_name[:i]
for sv in self.modelVariables:
- if sv.name.startswith(variable_name):
+ if sv.name.startswith(variable_name + '['):
i = sv.name.rfind('[')
subs = sv.name[i+1:-1]
subs = subs.split(',')
@@ -195,6 +195,15 @@ def updatePlot(self):
else:
data[subs] = np.nan
+ color_scheme = QGuiApplication.styleHints().colorScheme()
+
+ if color_scheme == Qt.ColorScheme.Dark:
+ self.ui.graphicsView.setBackground(None)
+ pg.setConfigOptions(foreground='w')
+ else:
+ self.ui.graphicsView.setBackground('w')
+ pg.setConfigOptions(foreground='k')
+
self.ui.graphicsView.clear()
plot = self.ui.graphicsView.addPlot()
plot.showGrid(x=True, y=True, alpha=0.25)
diff --git a/fmpy/gui/forms/TableDialog.ui b/fmpy/gui/forms/TableDialog.ui
index 08c56501..5f24cf58 100644
--- a/fmpy/gui/forms/TableDialog.ui
+++ b/fmpy/gui/forms/TableDialog.ui
@@ -10,70 +10,6 @@
561
-
-
-
-
-
-
- 255
- 255
- 255
-
-
-
-
-
-
- 255
- 255
- 255
-
-
-
-
-
-
-
-
- 255
- 255
- 255
-
-
-
-
-
-
- 255
- 255
- 255
-
-
-
-
-
-
-
-
- 255
- 255
- 255
-
-
-
-
-
-
- 255
- 255
- 255
-
-
-
-
-
-
15
@@ -86,11 +22,11 @@
}
- Qt::Horizontal
+ Qt::Orientation::Horizontal
- QFrame::NoFrame
+ QFrame::Shape::NoFrame
@@ -101,7 +37,7 @@
- QFrame::NoFrame
+ QFrame::Shape::NoFrame
@@ -162,7 +98,7 @@
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -185,10 +121,10 @@
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
- QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+ QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok