QScintilla/Editor.py

branch
maintenance
changeset 6206
a02b03b7bfec
parent 6166
bace7fb85a01
parent 6188
5a6ae3be31e6
child 6273
0daf79d65080
diff -r ad8ed15f90e5 -r a02b03b7bfec QScintilla/Editor.py
--- a/QScintilla/Editor.py	Sun Mar 04 14:55:23 2018 +0100
+++ b/QScintilla/Editor.py	Mon Apr 02 12:04:18 2018 +0200
@@ -2174,12 +2174,12 @@
         Note: This doesn't clear the breakpoint in the debugger,
         it just deletes it from the editor internal list of breakpoints.
         
-        @param line linenumber of the breakpoint (integer)
+        @param line line number of the breakpoint (integer)
         """
         if self.inLinesChanged:
             return
         
-        for handle, (ln, _, _, _, _) in list(self.breaks.items()):
+        for handle in self.breaks:
             if self.markerLine(handle) == line - 1:
                 break
         else:
@@ -2218,7 +2218,7 @@
         @param line line number of the breakpoint (integer)
         @param temporary flag indicating a temporary breakpoint (boolean)
         """
-        for handle, (ln, _, _, _, _) in list(self.breaks.items()):
+        for handle in self.breaks:
             if self.markerLine(handle) == line - 1:
                 # delete breakpoint or toggle it to the next state
                 index = self.breakpointModel.getBreakPointIndex(
@@ -2253,16 +2253,13 @@
         
         @param line line number of the breakpoint (integer)
         """
-        for handle, (ln, cond, temp, enabled, ignorecount) in \
-                self.breaks.items():
+        for handle in self.breaks:
             if self.markerLine(handle) == line - 1:
+                index = self.breakpointModel.getBreakPointIndex(
+                    self.fileName, line)
+                self.breakpointModel.setBreakPointEnabledByIndex(
+                    index, not self.breaks[handle][3])
                 break
-        else:
-            # no breakpoint found on that line
-            return
-        
-        index = self.breakpointModel.getBreakPointIndex(self.fileName, line)
-        self.breakpointModel.setBreakPointEnabledByIndex(index, not enabled)
         
     def curLineHasBreakpoint(self):
         """
@@ -2340,28 +2337,25 @@
             self.line = line - 1
         if self.line < 0:
             self.line, index = self.getCursorPosition()
-        found = False
-        for handle, (ln, cond, temp, enabled, ignorecount) in \
-                self.breaks.items():
+        
+        for handle in self.breaks:
             if self.markerLine(handle) == self.line:
-                found = True
-                break
-        
-        if found:
-            index = self.breakpointModel.getBreakPointIndex(self.fileName, ln)
-            if not index.isValid():
-                return
-            
-            from Debugger.EditBreakpointDialog import EditBreakpointDialog
-            dlg = EditBreakpointDialog(
-                (self.fileName, ln),
-                (cond, temp, enabled, ignorecount),
-                self.condHistory, self, modal=True)
-            if dlg.exec_() == QDialog.Accepted:
-                cond, temp, enabled, ignorecount = dlg.getData()
-                self.breakpointModel.setBreakPointByIndex(
-                    index, self.fileName, ln,
-                    (cond, temp, enabled, ignorecount))
+                ln, cond, temp, enabled, ignorecount = self.breaks[handle]
+                index = self.breakpointModel.getBreakPointIndex(self.fileName,
+                                                                ln)
+                if not index.isValid():
+                    return
+                
+                from Debugger.EditBreakpointDialog import EditBreakpointDialog
+                dlg = EditBreakpointDialog(
+                    (self.fileName, ln),
+                    (cond, temp, enabled, ignorecount),
+                    self.condHistory, self, modal=True)
+                if dlg.exec_() == QDialog.Accepted:
+                    cond, temp, enabled, ignorecount = dlg.getData()
+                    self.breakpointModel.setBreakPointByIndex(
+                        index, self.fileName, ln,
+                        (cond, temp, enabled, ignorecount))
         
         self.line = -1
         
@@ -2413,7 +2407,7 @@
         @param fileName name of the file (string)
         """
         idxList = []
-        for handle, (ln, _, _, _, _) in list(self.breaks.items()):
+        for (ln, _, _, _, _) in self.breaks.values():
             index = self.breakpointModel.getBreakPointIndex(fileName, ln)
             if index.isValid():
                 idxList.append(index)
@@ -2771,7 +2765,7 @@
         newL = self.__lastSavedText.splitlines()
         matcher = difflib.SequenceMatcher(None, oldL, newL)
         
-        for token, i1, i2, j1, j2 in matcher.get_opcodes():
+        for token, _, _, j1, j2 in matcher.get_opcodes():
             if token in ["insert", "replace"]:
                 for lineNo in range(j1, j2):
                     self.markerAdd(lineNo, self.__changeMarkerSaved)
@@ -2782,7 +2776,7 @@
         newL = self.text().splitlines()
         matcher = difflib.SequenceMatcher(None, oldL, newL)
         
-        for token, i1, i2, j1, j2 in matcher.get_opcodes():
+        for token, _, _, j1, j2 in matcher.get_opcodes():
             if token in ["insert", "replace"]:
                 for lineNo in range(j1, j2):
                     self.markerAdd(lineNo, self.__changeMarkerUnsaved)
@@ -2804,7 +2798,7 @@
         newL = self.__lastSavedText.splitlines()
         matcher = difflib.SequenceMatcher(None, oldL, newL)
         
-        for token, i1, i2, j1, j2 in matcher.get_opcodes():
+        for token, _, _, j1, j2 in matcher.get_opcodes():
             if token in ["insert", "replace"]:
                 for lineNo in range(j1, j2):
                     self.markerAdd(lineNo, self.__changeMarkerSaved)
@@ -5698,7 +5692,7 @@
             self.toggleSyntaxError(lineno, col, True, msg)
         
         warnings = problems.get('warnings', [])
-        for _fn, lineno, col, code, msg in warnings:
+        for _fn, lineno, col, _code, msg in warnings:
             self.toggleWarning(lineno, col, True, msg)
         
         self.updateVerticalScrollBar()

eric ide

mercurial