299 """ |
299 """ |
300 if pos < 0 or pos > self.__size: |
300 if pos < 0 or pos > self.__size: |
301 # position is out of range, do nothing |
301 # position is out of range, do nothing |
302 return False |
302 return False |
303 |
303 |
304 if pos == self.__size: |
304 chunkIdx = ( |
305 chunkIdx = self.__getChunkIndex(pos - 1) |
305 self.__getChunkIndex(pos - 1) |
306 else: |
306 if pos == self.__size else |
307 chunkIdx = self.__getChunkIndex(pos) |
307 self.__getChunkIndex(pos) |
|
308 ) |
308 chunk = self.__chunks[chunkIdx] |
309 chunk = self.__chunks[chunkIdx] |
309 posInChunk = pos - chunk.absPos |
310 posInChunk = pos - chunk.absPos |
310 chunk.data.insert(posInChunk, data) |
311 chunk.data.insert(posInChunk, data) |
311 chunk.dataChanged.insert(posInChunk, 1) |
312 chunk.dataChanged.insert(posInChunk, 1) |
312 for idx in range(chunkIdx + 1, len(self.__chunks)): |
313 for idx in range(chunkIdx + 1, len(self.__chunks)): |