Commit a97ff419 authored by Thomas Vincent's avatar Thomas Vincent

change column header

parent aa550cc9
......@@ -41,10 +41,8 @@ class RootNode(Node):
def __init__(self, *args, **kwargs):
super(RootNode, self).__init__(*args, **kwargs)
for colIdx in range(len(self.ColumnNames)):
self._setDataInternal(colIdx,
self.ColumnNames[colIdx],
Qt.Qt.DisplayRole)
for index, name in enumerate(self.ColumnNames):
self._setDataInternal(index, name, Qt.Qt.DisplayRole)
class Model(Qt.QAbstractItemModel):
......@@ -56,9 +54,9 @@ class Model(Qt.QAbstractItemModel):
sigRowsRemoved = Qt.Signal(object, int, int)
def __init__(self, parent=None):
def __init__(self, parent=None, **kwargs):
super(Model, self).__init__(parent)
self.__root = self.RootNode(nodeName='__root__', model=self)
self.__root = self.RootNode(nodeName='__root__', model=self, **kwargs)
self.__root.sigInternalDataChanged.connect(self.__internalDataChanged)
def columnsWithDelegates(self):
......
......@@ -90,7 +90,8 @@ class FitView(Qt.QMainWindow):
treeDock = Qt.QDockWidget()
self.__model = FitModel()
columns = [name.capitalize() for name in self.__axis_names]
self.__model = FitModel(columnNames=['Param'] + columns)
rootNode = FitH5Node(fitItem.fitFile)
self.__model.appendGroup(rootNode)
......
......@@ -261,7 +261,11 @@ class FitRootNode(RootNode):
"""
Root node for the FitModel
"""
ColumnNames = ['Param', 'Qx', 'Qy', 'Qz']
ColumnNames = ['', '', '', ''] # Needed for init
def __init__(self, *args, **kwargs):
self.ColumnNames = list(kwargs.pop('columnNames'))
super(FitRootNode, self).__init__(*args, **kwargs)
class FitModel(Model):
......@@ -271,6 +275,9 @@ class FitModel(Model):
RootNode = FitRootNode
ColumnsWithDelegates = [1, 2, 3]
def __init__(self, columnNames, parent=None):
super(FitModel, self).__init__(parent, columnNames=columnNames)
def mimeData(self, indexes):
if len(indexes) > 1:
raise ValueError('Drag&Drop of more than one item is not'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment