55 QLineEdit, |
55 QLineEdit, |
56 QMenu, |
56 QMenu, |
57 QToolTip, |
57 QToolTip, |
58 ) |
58 ) |
59 |
59 |
60 from eric7 import EricUtilities, Globals, Preferences, Utilities |
60 from eric7 import EricUtilities, Preferences, Utilities |
61 from eric7.CodeFormatting.BlackFormattingAction import BlackFormattingAction |
61 from eric7.CodeFormatting.BlackFormattingAction import BlackFormattingAction |
62 from eric7.CodeFormatting.BlackUtilities import aboutBlack |
62 from eric7.CodeFormatting.BlackUtilities import aboutBlack |
63 from eric7.CodeFormatting.IsortFormattingAction import IsortFormattingAction |
63 from eric7.CodeFormatting.IsortFormattingAction import IsortFormattingAction |
64 from eric7.CodeFormatting.IsortUtilities import aboutIsort |
64 from eric7.CodeFormatting.IsortUtilities import aboutIsort |
65 from eric7.EricGui import EricPixmapCache |
65 from eric7.EricGui import EricPixmapCache |
7393 conflictMarkerLines = [] |
7397 conflictMarkerLines = [] |
7394 |
7398 |
7395 regExp = re.compile( |
7399 regExp = re.compile( |
7396 "|".join(Editor.VcsConflictMarkerLineRegExpList), re.MULTILINE |
7400 "|".join(Editor.VcsConflictMarkerLineRegExpList), re.MULTILINE |
7397 ) |
7401 ) |
7398 matches = [m for m in regExp.finditer(self.text())] |
7402 matches = list(regExp.finditer(self.text())) |
7399 for match in matches: |
7403 for match in matches: |
7400 line, _ = self.lineIndexFromPosition(match.start()) |
7404 line, _ = self.lineIndexFromPosition(match.start()) |
7401 conflictMarkerLines.append(line) |
7405 conflictMarkerLines.append(line) |
7402 |
7406 |
7403 return conflictMarkerLines |
7407 return conflictMarkerLines |
7862 |
7866 |
7863 def macroLoad(self): |
7867 def macroLoad(self): |
7864 """ |
7868 """ |
7865 Public method to load a macro from a file. |
7869 Public method to load a macro from a file. |
7866 """ |
7870 """ |
7867 configDir = Globals.getConfigDir() |
7871 configDir = EricUtilities.getConfigDir() |
7868 fname = EricFileDialog.getOpenFileName( |
7872 fname = EricFileDialog.getOpenFileName( |
7869 self, |
7873 self, |
7870 self.tr("Load macro file"), |
7874 self.tr("Load macro file"), |
7871 configDir, |
7875 configDir, |
7872 self.tr("Macro files (*.macro)"), |
7876 self.tr("Macro files (*.macro)"), |
7901 |
7905 |
7902 def macroSave(self): |
7906 def macroSave(self): |
7903 """ |
7907 """ |
7904 Public method to save a macro to a file. |
7908 Public method to save a macro to a file. |
7905 """ |
7909 """ |
7906 configDir = Globals.getConfigDir() |
7910 configDir = EricUtilities.getConfigDir() |
7907 |
7911 |
7908 name, ok = self.__getMacroName() |
7912 name, ok = self.__getMacroName() |
7909 if not ok or not name: |
7913 if not ok or not name: |
7910 return # user abort |
7914 return # user abort |
7911 |
7915 |
9629 wordEndPos = self.positionFromLineIndex(line, wordEnd) |
9633 wordEndPos = self.positionFromLineIndex(line, wordEnd) |
9630 |
9634 |
9631 regExp = re.compile(r"\b{0}\b".format(word)) |
9635 regExp = re.compile(r"\b{0}\b".format(word)) |
9632 startPos = wordEndPos if forward else wordStartPos |
9636 startPos = wordEndPos if forward else wordStartPos |
9633 |
9637 |
9634 matches = [m for m in regExp.finditer(self.text())] |
9638 matches = list(regExp.finditer(self.text())) |
9635 if matches: |
9639 if matches: |
9636 if forward: |
9640 if forward: |
9637 matchesAfter = [m for m in matches if m.start() >= startPos] |
9641 matchesAfter = [m for m in matches if m.start() >= startPos] |
9638 if matchesAfter: |
9642 if matchesAfter: |
9639 match = matchesAfter[0] |
9643 match = matchesAfter[0] |