Ejemplo n.º 1
0
 def appendEmptyRow(self) -> bool:
     row = self.rowCount()
     # Create a dummy entry
     f = FrameModel()
     f.name = _EMPTY_ROW_NAME
     self.beginInsertRows(QModelIndex(), row, row)
     self.__workbench.append(f)
     self.__nameToIndex[f.name] = row
     self.endInsertRows()
     self.emptyRowInserted.emit(self.index(row, 0, QModelIndex()))
     return True
Ejemplo n.º 2
0
 def setDataframeByName(self, name: str, value: d.Frame) -> bool:
     listPos: int = self.__nameToIndex.get(name, None)
     if listPos is not None:
         # Name already exists
         if self.__workbench[listPos].frame is value:
             return False
         frame_model = self.getDataframeModelByIndex(listPos)
         # This will reset any view currently showing the frame
         frame_model.setFrame(value)
         self.__workbench[listPos] = frame_model
         # nameToIndex is already updated (no change)
         # dataChanged is not emitted because the frame name has not changed
     else:
         # Name does not exists, so add as a new row
         row = self.rowCount()
         f = FrameModel(None, value)  # No parent is set
         f.name = name
         self.beginInsertRows(QModelIndex(), row, row)
         self.__workbench.append(f)
         self.__nameToIndex[name] = row
         self.endInsertRows()
     return True