Backed out changeset <1989>. 5_2_x

Sun, 12 Aug 2012 13:20:29 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 12 Aug 2012 13:20:29 +0200
branch
5_2_x
changeset 1997
e7627587db30
parent 1995
11f09fe72991
child 1998
7fc24c26f58f

Backed out changeset <1989>.

Debugger/BreakPointModel.py file | annotate | diff | comparison | revisions
Debugger/BreakPointViewer.py file | annotate | diff | comparison | revisions
QScintilla/Editor.py file | annotate | diff | comparison | revisions
--- a/Debugger/BreakPointModel.py	Mon Jul 02 19:55:18 2012 +0200
+++ b/Debugger/BreakPointModel.py	Sun Aug 12 13:20:29 2012 +0200
@@ -62,7 +62,7 @@
         else:
             return 0
     
-    def data(self, index, role=Qt.DisplayRole):
+    def data(self, index, role):
         """
         Public method to get the requested data.
         
@@ -91,25 +91,6 @@
         
         return None
     
-    def setData(self, index, value, role=Qt.EditRole):
-        """
-        Public method to change data in the model.
-        
-        @param index index of the changed data (QModelIndex)
-        @param value value of the changed data
-        @param role role of the changed data (Qt.ItemDataRole)
-        @return flag indicating success (boolean)
-        """
-        if not index.isValid() or \
-           index.column() >= len(self.header) or \
-           index.row() >= len(self.breakpoints):
-            return False
-        
-        self.dataAboutToBeChanged.emit(index, index)
-        self.breakpoints[index.row()][index.column()] = value
-        self.dataChanged.emit(index, index)
-        return True
-    
     def flags(self, index):
         """
         Public method to get item flags.
--- a/Debugger/BreakPointViewer.py	Mon Jul 02 19:55:18 2012 +0200
+++ b/Debugger/BreakPointViewer.py	Sun Aug 12 13:20:29 2012 +0200
@@ -65,7 +65,6 @@
         self.__model = model
         
         self.sortingModel = QSortFilterProxyModel()
-        self.sortingModel.setDynamicSortFilter(True)
         self.sortingModel.setSourceModel(self.__model)
         super().setModel(self.sortingModel)
         
--- a/QScintilla/Editor.py	Mon Jul 02 19:55:18 2012 +0200
+++ b/QScintilla/Editor.py	Sun Aug 12 13:20:29 2012 +0200
@@ -397,7 +397,7 @@
             self.__changeBreakPoints)
         self.breakpointModel.rowsInserted.connect(
             self.__addBreakPoints)
-        self.SCN_MODIFIED.connect(self.__modified)
+        self.linesChanged.connect(self.__linesChanged)
         
         # establish connection to some ViewManager action groups
         self.addActions(self.vm.editorActGrp.actions())
@@ -1802,37 +1802,26 @@
     ## Breakpoint handling methods below
     ############################################################################
 
-    def __modified(self, pos, mtype, text, length, linesAdded, line, foldNow, foldPrev,
-                     token, annotationLinesAdded):
-        """
-        Private method to handle changes of the number of lines.
-        
-        @param pos start position of change (integer)
-        @param mtype flags identifying the change (integer)
-        @param text text that is given to the Undo system (string)
-        @param length length of the change (integer)
-        @param linesAdded number of added/deleted lines (integer)
-        @param line line number of a fold level or marker change (integer)
-        @param foldNow new fold level (integer)
-        @param foldPrev previous fold level (integer)
-        @param token ???
-        @param annotationLinesAdded number of added/deleted annotation lines (integer)
-        """
-        if mtype & (self.SC_MOD_INSERTTEXT | self.SC_MOD_DELETETEXT) and \
-           linesAdded != 0:
-            if self.breaks:
-                bps = []    # list of breakpoints
-                for handle, (ln, cond, temp, enabled, ignorecount) in self.breaks.items():
-                    line = self.markerLine(handle) + 1
-                    if ln != line:
-                        bps.append((ln, line))
-                        self.breaks[handle] = (line, cond, temp, enabled, ignorecount)
-                self.inLinesChanged = True
-                for ln, line in sorted(bps, reverse=linesAdded > 0):
-                    index1 = self.breakpointModel.getBreakPointIndex(self.fileName, ln)
-                    index2 = self.breakpointModel.index(index1.row(), 1)
-                    self.breakpointModel.setData(index2, line)
-                self.inLinesChanged = False
+    def __linesChanged(self):
+        """
+        Private method to track text changes.
+        
+        This method checks, if lines have been inserted or removed in order to
+        update the breakpoints.
+        """
+        if self.breaks:
+            bps = []    # list of breakpoints
+            for handle, (ln, cond, temp, enabled, ignorecount) in self.breaks.items():
+                line = self.markerLine(handle) + 1
+                bps.append((ln, line, (cond, temp, enabled, ignorecount)))
+                self.markerDeleteHandle(handle)
+            self.breaks = {}
+            self.inLinesChanged = True
+            for bp in bps:
+                index = self.breakpointModel.getBreakPointIndex(self.fileName, bp[0])
+                self.breakpointModel.setBreakPointByIndex(index,
+                    self.fileName, bp[1], bp[2])
+            self.inLinesChanged = False
         
     def __restoreBreakpoints(self):
         """
@@ -1862,8 +1851,7 @@
         
         @param indexes indexes of changed breakpoints.
         """
-        if not self.inLinesChanged:
-            self.__addBreakPoints(QModelIndex(), startIndex.row(), endIndex.row())
+        self.__addBreakPoints(QModelIndex(), startIndex.row(), endIndex.row())
         
     def __breakPointDataAboutToBeChanged(self, startIndex, endIndex):
         """

eric ide

mercurial