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