eric6/QScintilla/Editor.py

changeset 7759
51aa6c6b66f7
parent 7749
285855999b4e
child 7771
787a6b3f8c9f
equal deleted inserted replaced
7758:dd54d33d21d2 7759:51aa6c6b66f7
2462 from Debugger.EditBreakpointDialog import EditBreakpointDialog 2462 from Debugger.EditBreakpointDialog import EditBreakpointDialog
2463 dlg = EditBreakpointDialog( 2463 dlg = EditBreakpointDialog(
2464 (self.fileName, ln), 2464 (self.fileName, ln),
2465 (cond, temp, enabled, ignorecount), 2465 (cond, temp, enabled, ignorecount),
2466 self.condHistory, self, modal=True) 2466 self.condHistory, self, modal=True)
2467 if dlg.exec_() == QDialog.Accepted: 2467 if dlg.exec() == QDialog.Accepted:
2468 cond, temp, enabled, ignorecount = dlg.getData() 2468 cond, temp, enabled, ignorecount = dlg.getData()
2469 self.breakpointModel.setBreakPointByIndex( 2469 self.breakpointModel.setBreakPointByIndex(
2470 index, self.fileName, ln, 2470 index, self.fileName, ln,
2471 (cond, temp, enabled, ignorecount)) 2471 (cond, temp, enabled, ignorecount))
2472 break 2472 break
2655 printer = Printer(mode=QPrinter.HighResolution) 2655 printer = Printer(mode=QPrinter.HighResolution)
2656 sb = e5App().getObject("UserInterface").statusBar() 2656 sb = e5App().getObject("UserInterface").statusBar()
2657 printDialog = QPrintDialog(printer, self) 2657 printDialog = QPrintDialog(printer, self)
2658 if self.hasSelectedText(): 2658 if self.hasSelectedText():
2659 printDialog.setOption(QAbstractPrintDialog.PrintSelection, True) 2659 printDialog.setOption(QAbstractPrintDialog.PrintSelection, True)
2660 if printDialog.exec_() == QDialog.Accepted: 2660 if printDialog.exec() == QDialog.Accepted:
2661 sb.showMessage(self.tr('Printing...')) 2661 sb.showMessage(self.tr('Printing...'))
2662 QApplication.processEvents() 2662 QApplication.processEvents()
2663 fn = self.getFileName() 2663 fn = self.getFileName()
2664 if fn is not None: 2664 if fn is not None:
2665 printer.setDocName(os.path.basename(fn)) 2665 printer.setDocName(os.path.basename(fn))
2696 printer.setDocName(os.path.basename(fn)) 2696 printer.setDocName(os.path.basename(fn))
2697 else: 2697 else:
2698 printer.setDocName(self.noName) 2698 printer.setDocName(self.noName)
2699 preview = QPrintPreviewDialog(printer, self) 2699 preview = QPrintPreviewDialog(printer, self)
2700 preview.paintRequested.connect(self.__printPreview) 2700 preview.paintRequested.connect(self.__printPreview)
2701 preview.exec_() 2701 preview.exec()
2702 2702
2703 def __printPreview(self, printer): 2703 def __printPreview(self, printer):
2704 """ 2704 """
2705 Private slot to generate a print preview. 2705 Private slot to generate a print preview.
2706 2706
7418 Private method to handle the Add localized resource context menu 7418 Private method to handle the Add localized resource context menu
7419 action. 7419 action.
7420 """ 7420 """
7421 from Project.AddLanguageDialog import AddLanguageDialog 7421 from Project.AddLanguageDialog import AddLanguageDialog
7422 dlg = AddLanguageDialog(self) 7422 dlg = AddLanguageDialog(self)
7423 if dlg.exec_() == QDialog.Accepted: 7423 if dlg.exec() == QDialog.Accepted:
7424 lang = dlg.getSelectedLanguage() 7424 lang = dlg.getSelectedLanguage()
7425 line, index = self.getCursorPosition() 7425 line, index = self.getCursorPosition()
7426 self.insert('<qresource lang="{0}">\n</qresource>\n'.format(lang)) 7426 self.insert('<qresource lang="{0}">\n</qresource>\n'.format(lang))
7427 self.setCursorPosition(line + 2, index) 7427 self.setCursorPosition(line + 2, index)
7428 7428
7788 """ 7788 """
7789 if self.spell: 7789 if self.spell:
7790 cline, cindex = self.getCursorPosition() 7790 cline, cindex = self.getCursorPosition()
7791 from .SpellCheckingDialog import SpellCheckingDialog 7791 from .SpellCheckingDialog import SpellCheckingDialog
7792 dlg = SpellCheckingDialog(self.spell, 0, self.length(), self) 7792 dlg = SpellCheckingDialog(self.spell, 0, self.length(), self)
7793 dlg.exec_() 7793 dlg.exec()
7794 self.setCursorPosition(cline, cindex) 7794 self.setCursorPosition(cline, cindex)
7795 if Preferences.getEditor("AutoSpellCheckingEnabled"): 7795 if Preferences.getEditor("AutoSpellCheckingEnabled"):
7796 self.spell.checkDocumentIncrementally() 7796 self.spell.checkDocumentIncrementally()
7797 7797
7798 def __checkSpellingSelection(self): 7798 def __checkSpellingSelection(self):
7802 from .SpellCheckingDialog import SpellCheckingDialog 7802 from .SpellCheckingDialog import SpellCheckingDialog
7803 sline, sindex, eline, eindex = self.getSelection() 7803 sline, sindex, eline, eindex = self.getSelection()
7804 startPos = self.positionFromLineIndex(sline, sindex) 7804 startPos = self.positionFromLineIndex(sline, sindex)
7805 endPos = self.positionFromLineIndex(eline, eindex) 7805 endPos = self.positionFromLineIndex(eline, eindex)
7806 dlg = SpellCheckingDialog(self.spell, startPos, endPos, self) 7806 dlg = SpellCheckingDialog(self.spell, startPos, endPos, self)
7807 dlg.exec_() 7807 dlg.exec()
7808 7808
7809 def __checkSpellingWord(self): 7809 def __checkSpellingWord(self):
7810 """ 7810 """
7811 Private slot to check the word below the spelling context menu. 7811 Private slot to check the word below the spelling context menu.
7812 """ 7812 """
7814 line, index = self.lineIndexFromPosition(self.spellingMenuPos) 7814 line, index = self.lineIndexFromPosition(self.spellingMenuPos)
7815 wordStart, wordEnd = self.getWordBoundaries(line, index) 7815 wordStart, wordEnd = self.getWordBoundaries(line, index)
7816 wordStartPos = self.positionFromLineIndex(line, wordStart) 7816 wordStartPos = self.positionFromLineIndex(line, wordStart)
7817 wordEndPos = self.positionFromLineIndex(line, wordEnd) 7817 wordEndPos = self.positionFromLineIndex(line, wordEnd)
7818 dlg = SpellCheckingDialog(self.spell, wordStartPos, wordEndPos, self) 7818 dlg = SpellCheckingDialog(self.spell, wordStartPos, wordEndPos, self)
7819 dlg.exec_() 7819 dlg.exec()
7820 7820
7821 def __showContextMenuSpelling(self): 7821 def __showContextMenuSpelling(self):
7822 """ 7822 """
7823 Private slot to set up the spelling menu before it is shown. 7823 Private slot to set up the spelling menu before it is shown.
7824 """ 7824 """
8229 if not self.selectionIsRectangle(): 8229 if not self.selectionIsRectangle():
8230 return 8230 return
8231 8231
8232 from .SortOptionsDialog import SortOptionsDialog 8232 from .SortOptionsDialog import SortOptionsDialog
8233 dlg = SortOptionsDialog() 8233 dlg = SortOptionsDialog()
8234 if dlg.exec_() == QDialog.Accepted: 8234 if dlg.exec() == QDialog.Accepted:
8235 ascending, alnum, caseSensitive = dlg.getData() 8235 ascending, alnum, caseSensitive = dlg.getData()
8236 origStartLine, origStartIndex, origEndLine, origEndIndex = ( 8236 origStartLine, origStartIndex, origEndLine, origEndIndex = (
8237 self.getRectangularSelection() 8237 self.getRectangularSelection()
8238 ) 8238 )
8239 # convert to upper-left to lower-right 8239 # convert to upper-left to lower-right

eric ide

mercurial