diff --git a/mesongui.py b/mesongui.py index b5a97d6e5..ee3858348 100755 --- a/mesongui.py +++ b/mesongui.py @@ -30,7 +30,11 @@ class PathModel(QAbstractItemModel): 'mandir', 'localedir'] def flags(self, index): - return PyQt5.QtCore.Qt.ItemIsSelectable | PyQt5.QtCore.Qt.ItemIsEnabled + if index.column() == 1: + editable = PyQt5.QtCore.Qt.ItemIsEditable + else: + editable= 0 + return PyQt5.QtCore.Qt.ItemIsSelectable | PyQt5.QtCore.Qt.ItemIsEnabled | editable def rowCount(self, index): if index.isValid(): @@ -45,6 +49,16 @@ class PathModel(QAbstractItemModel): return QVariant('Path') return QVariant('Type') + def setData(self, index, value, role): + if role != PyQt5.QtCore.Qt.EditRole: + return False + row = index.row() + column = index.column() + s = str(value) + setattr(self.coredata, self.attr_name[row], s) + self.dataChanged.emit(self.createIndex(row, column), self.createIndex(row, column)) + return True + def data(self, index, role): if role != PyQt5.QtCore.Qt.DisplayRole: return QVariant()