Beispiel #1
0
 def flags(self, index=QtCore.QModelIndex()):
     column = self.Columns(index.column())
     if column in [self.Columns.X, self.Columns.Y]:
         if self.is_point_complete(self._points[index.row()]):
             return QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled
         return QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsEditable
     if column == self.Columns.IMAGE:
         return QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled
Beispiel #2
0
 def append_point(self, point=(None, None, 1.0), image=None, noflush=False):
     self.beginInsertRows(QtCore.QModelIndex(), len(self._points),
                          len(self._points))
     self._points.append(list(point))
     self._images.append(image)
     self.endInsertRows()
     if self.is_point_complete(point) and not noflush:
         self.flush_file()
Beispiel #3
0
 def columnCount(self, parent=QtCore.QModelIndex()):
     # noinspection PyTypeChecker
     return len(self.Columns)
Beispiel #4
0
 def rowCount(self, parent=QtCore.QModelIndex()):
     return len(self._points)
Beispiel #5
0
 def parent(self, index):
     return QtCore.QModelIndex()
Beispiel #6
0
 def index(self, row, column, parent=QtCore.QModelIndex()):
     return self.createIndex(row, column)
Beispiel #7
0
 def remove_point(self, index):
     self.beginRemoveRows(QtCore.QModelIndex(), index, index)
     self._points.pop(index)
     self._images.pop(index)
     self.endRemoveRows()
     self.flush_file()