src/eric7/QScintilla/Editor.py

branch
eric7
changeset 9436
731d146193e2
parent 9432
e2445fa08533
child 9442
906485dcd210
child 9453
e5065dde905d
equal deleted inserted replaced
9435:15992d83352b 9436:731d146193e2
53 from eric7.EricGui import EricPixmapCache 53 from eric7.EricGui import EricPixmapCache
54 54
55 from eric7.UI import PythonDisViewer 55 from eric7.UI import PythonDisViewer
56 56
57 from eric7.CodeFormatting.BlackFormattingAction import BlackFormattingAction 57 from eric7.CodeFormatting.BlackFormattingAction import BlackFormattingAction
58 from eric7.CodeFormatting.BlackUtilities import aboutBlack
58 59
59 EditorAutoCompletionListID = 1 60 EditorAutoCompletionListID = 1
60 TemplateCompletionListID = 2 61 TemplateCompletionListID = 2
61 ReferencesListID = 3 62 ReferencesListID = 3
62 63
1043 @return reference to the generated menu 1044 @return reference to the generated menu
1044 @rtype QMenu 1045 @rtype QMenu
1045 """ 1046 """
1046 menu = QMenu(self.tr("Code Formatting")) 1047 menu = QMenu(self.tr("Code Formatting"))
1047 1048
1049 act = menu.addAction(self.tr("Black"), aboutBlack)
1050 font = act.font()
1051 font.setBold(True)
1052 act.setFont(font)
1048 menu.addAction( 1053 menu.addAction(
1049 self.tr("Format Code"), 1054 self.tr("Format Code"),
1050 lambda: self.__performFormatWithBlack(BlackFormattingAction.Format), 1055 lambda: self.__performFormatWithBlack(BlackFormattingAction.Format),
1051 ) 1056 )
1052 menu.addAction( 1057 menu.addAction(
7823 else selectedText.lower() 7828 else selectedText.lower()
7824 ) 7829 )
7825 self.replaceSelectedText(replacementText) 7830 self.replaceSelectedText(replacementText)
7826 endIndex = ( 7831 endIndex = (
7827 startIndex + len(replacementText) 7832 startIndex + len(replacementText)
7828 if len(replacementText.splitlines()) <= 1 else 7833 if len(replacementText.splitlines()) <= 1
7829 len(replacementText.splitlines()[-1]) 7834 else len(replacementText.splitlines()[-1])
7830 ) 7835 )
7831 self.setSelection(startLine, startIndex, endLine, endIndex) 7836 self.setSelection(startLine, startIndex, endLine, endIndex)
7832 return 7837 return
7833 7838
7834 super().editorCommand(cmd) 7839 super().editorCommand(cmd)

eric ide

mercurial