395 self.__breakPointDataAboutToBeChanged) |
395 self.__breakPointDataAboutToBeChanged) |
396 self.breakpointModel.dataChanged.connect( |
396 self.breakpointModel.dataChanged.connect( |
397 self.__changeBreakPoints) |
397 self.__changeBreakPoints) |
398 self.breakpointModel.rowsInserted.connect( |
398 self.breakpointModel.rowsInserted.connect( |
399 self.__addBreakPoints) |
399 self.__addBreakPoints) |
400 self.linesChanged.connect(self.__linesChanged) |
400 self.SCN_MODIFIED.connect(self.__modified) |
401 |
401 |
402 # establish connection to some ViewManager action groups |
402 # establish connection to some ViewManager action groups |
403 self.addActions(self.vm.editorActGrp.actions()) |
403 self.addActions(self.vm.editorActGrp.actions()) |
404 self.addActions(self.vm.editActGrp.actions()) |
404 self.addActions(self.vm.editActGrp.actions()) |
405 self.addActions(self.vm.copyActGrp.actions()) |
405 self.addActions(self.vm.copyActGrp.actions()) |
1800 |
1800 |
1801 ############################################################################ |
1801 ############################################################################ |
1802 ## Breakpoint handling methods below |
1802 ## Breakpoint handling methods below |
1803 ############################################################################ |
1803 ############################################################################ |
1804 |
1804 |
1805 def __linesChanged(self): |
1805 def __modified(self, pos, mtype, text, length, linesAdded, line, foldNow, foldPrev, |
1806 """ |
1806 token, annotationLinesAdded): |
1807 Private method to track text changes. |
1807 """ |
1808 |
1808 Private method to handle changes of the number of lines. |
1809 This method checks, if lines have been inserted or removed in order to |
1809 |
1810 update the breakpoints. |
1810 @param pos start position of change (integer) |
1811 """ |
1811 @param mtype flags identifying the change (integer) |
1812 if self.breaks: |
1812 @param text text that is given to the Undo system (string) |
1813 bps = [] # list of breakpoints |
1813 @param length length of the change (integer) |
1814 for handle, (ln, cond, temp, enabled, ignorecount) in self.breaks.items(): |
1814 @param linesAdded number of added/deleted lines (integer) |
1815 line = self.markerLine(handle) + 1 |
1815 @param line line number of a fold level or marker change (integer) |
1816 bps.append((ln, line, (cond, temp, enabled, ignorecount))) |
1816 @param foldNow new fold level (integer) |
1817 self.markerDeleteHandle(handle) |
1817 @param foldPrev previous fold level (integer) |
1818 self.breaks = {} |
1818 @param token ??? |
1819 self.inLinesChanged = True |
1819 @param annotationLinesAdded number of added/deleted annotation lines (integer) |
1820 for bp in bps: |
1820 """ |
1821 index = self.breakpointModel.getBreakPointIndex(self.fileName, bp[0]) |
1821 if mtype & (self.SC_MOD_INSERTTEXT | self.SC_MOD_DELETETEXT) and \ |
1822 self.breakpointModel.setBreakPointByIndex(index, |
1822 linesAdded != 0: |
1823 self.fileName, bp[1], bp[2]) |
1823 if self.breaks: |
1824 self.inLinesChanged = False |
1824 bps = [] # list of breakpoints |
|
1825 for handle, (ln, cond, temp, enabled, ignorecount) in self.breaks.items(): |
|
1826 line = self.markerLine(handle) + 1 |
|
1827 if ln != line: |
|
1828 bps.append((ln, line)) |
|
1829 self.breaks[handle] = (line, cond, temp, enabled, ignorecount) |
|
1830 self.inLinesChanged = True |
|
1831 for ln, line in sorted(bps, reverse=linesAdded > 0): |
|
1832 index1 = self.breakpointModel.getBreakPointIndex(self.fileName, ln) |
|
1833 index2 = self.breakpointModel.index(index1.row(), 1) |
|
1834 self.breakpointModel.setData(index2, line) |
|
1835 self.inLinesChanged = False |
1825 |
1836 |
1826 def __restoreBreakpoints(self): |
1837 def __restoreBreakpoints(self): |
1827 """ |
1838 """ |
1828 Private method to restore the breakpoints. |
1839 Private method to restore the breakpoints. |
1829 """ |
1840 """ |
1849 """ |
1860 """ |
1850 Private slot to set changed breakpoints. |
1861 Private slot to set changed breakpoints. |
1851 |
1862 |
1852 @param indexes indexes of changed breakpoints. |
1863 @param indexes indexes of changed breakpoints. |
1853 """ |
1864 """ |
1854 self.__addBreakPoints(QModelIndex(), startIndex.row(), endIndex.row()) |
1865 if not self.inLinesChanged: |
|
1866 self.__addBreakPoints(QModelIndex(), startIndex.row(), endIndex.row()) |
1855 |
1867 |
1856 def __breakPointDataAboutToBeChanged(self, startIndex, endIndex): |
1868 def __breakPointDataAboutToBeChanged(self, startIndex, endIndex): |
1857 """ |
1869 """ |
1858 Private slot to handle the dataAboutToBeChanged signal of the breakpoint model. |
1870 Private slot to handle the dataAboutToBeChanged signal of the breakpoint model. |
1859 |
1871 |