826 self.pasteAct.triggered[()].connect(self.__editPaste) |
826 self.pasteAct.triggered[()].connect(self.__editPaste) |
827 self.editActions.append(self.pasteAct) |
827 self.editActions.append(self.pasteAct) |
828 |
828 |
829 self.deleteAct = E5Action(QApplication.translate('ViewManager', 'Clear'), |
829 self.deleteAct = E5Action(QApplication.translate('ViewManager', 'Clear'), |
830 UI.PixmapCache.getIcon("editDelete.png"), |
830 UI.PixmapCache.getIcon("editDelete.png"), |
831 QApplication.translate('ViewManager', 'Cl&ear'), |
831 QApplication.translate('ViewManager', 'Clear'), |
832 QKeySequence(QApplication.translate('ViewManager', |
832 QKeySequence(QApplication.translate('ViewManager', |
833 "Alt+Shift+C", "Edit|Clear")), |
833 "Alt+Shift+C", "Edit|Clear")), |
834 0, |
834 0, |
835 self.copyActGrp, 'vm_edit_clear') |
835 self.copyActGrp, 'vm_edit_clear') |
836 self.deleteAct.setStatusTip(QApplication.translate('ViewManager', |
836 self.deleteAct.setStatusTip(QApplication.translate('ViewManager', |
2089 """<b>Goto Brace</b>""" |
2092 """<b>Goto Brace</b>""" |
2090 """<p>Go to the matching brace in the current editor.</p>""" |
2093 """<p>Go to the matching brace in the current editor.</p>""" |
2091 )) |
2094 )) |
2092 self.gotoBraceAct.triggered[()].connect(self.__gotoBrace) |
2095 self.gotoBraceAct.triggered[()].connect(self.__gotoBrace) |
2093 self.searchActions.append(self.gotoBraceAct) |
2096 self.searchActions.append(self.gotoBraceAct) |
|
2097 |
|
2098 self.gotoLastEditAct = E5Action( |
|
2099 QApplication.translate('ViewManager', 'Goto Last Edit Location'), |
|
2100 UI.PixmapCache.getIcon("gotoLastEditPosition.png"), |
|
2101 QApplication.translate('ViewManager', 'Goto Last &Edit Location'), |
|
2102 QKeySequence(QApplication.translate('ViewManager', |
|
2103 "Ctrl+Shift+G", "Search|Goto Last Edit Location")), |
|
2104 0, |
|
2105 self.searchActGrp, 'vm_search_goto_last_edit_location') |
|
2106 self.gotoLastEditAct.setStatusTip( |
|
2107 QApplication.translate('ViewManager', 'Goto Last Edit Location')) |
|
2108 self.gotoLastEditAct.setWhatsThis(QApplication.translate('ViewManager', |
|
2109 """<b>Goto Last Edit Location</b>""" |
|
2110 """<p>Go to the location of the last edit in the current editor.</p>""" |
|
2111 )) |
|
2112 self.gotoLastEditAct.triggered[()].connect(self.__gotoLastEditPosition) |
|
2113 self.searchActions.append(self.gotoLastEditAct) |
|
2114 |
|
2115 self.gotoPreviousDefAct = E5Action( |
|
2116 QApplication.translate('ViewManager', 'Goto Previous Method or Class'), |
|
2117 QApplication.translate('ViewManager', 'Goto Previous Method or Class'), |
|
2118 QKeySequence(QApplication.translate('ViewManager', |
|
2119 "Ctrl+Shift+Up", "Search|Goto Previous Method or Class")), |
|
2120 0, |
|
2121 self.searchActGrp, 'vm_search_goto_previous_method_or_class') |
|
2122 self.gotoPreviousDefAct.setStatusTip( |
|
2123 QApplication.translate('ViewManager', |
|
2124 'Go to the previous method or class definition')) |
|
2125 self.gotoPreviousDefAct.setWhatsThis(QApplication.translate('ViewManager', |
|
2126 """<b>Goto Previous Method or Class</b>""" |
|
2127 """<p>Goes to the line of the previous method or class definition""" |
|
2128 """ and highlights the name.</p>""" |
|
2129 )) |
|
2130 self.gotoPreviousDefAct.triggered[()].connect(self.__gotoPreviousMethodClass) |
|
2131 self.searchActions.append(self.gotoPreviousDefAct) |
|
2132 |
|
2133 self.gotoNextDefAct = E5Action( |
|
2134 QApplication.translate('ViewManager', 'Goto Next Method or Class'), |
|
2135 QApplication.translate('ViewManager', 'Goto Next Method or Class'), |
|
2136 QKeySequence(QApplication.translate('ViewManager', |
|
2137 "Ctrl+Shift+Down", "Search|Goto Next Method or Class")), |
|
2138 0, |
|
2139 self.searchActGrp, 'vm_search_goto_next_method_or_class') |
|
2140 self.gotoNextDefAct.setStatusTip( |
|
2141 QApplication.translate('ViewManager', |
|
2142 'Go to the next method or class definition')) |
|
2143 self.gotoNextDefAct.setWhatsThis(QApplication.translate('ViewManager', |
|
2144 """<b>Goto Next Method or Class</b>""" |
|
2145 """<p>Goes to the line of the next method or class definition""" |
|
2146 """ and highlights the name.</p>""" |
|
2147 )) |
|
2148 self.gotoNextDefAct.triggered[()].connect(self.__gotoNextMethodClass) |
|
2149 self.searchActions.append(self.gotoNextDefAct) |
2094 |
2150 |
2095 self.searchActGrp.setEnabled(False) |
2151 self.searchActGrp.setEnabled(False) |
2096 |
2152 |
2097 self.searchFilesAct = E5Action(QApplication.translate('ViewManager', |
2153 self.searchFilesAct = E5Action(QApplication.translate('ViewManager', |
2098 'Search in Files'), |
2154 'Search in Files'), |
2206 tb.addAction(self.searchPrevAct) |
2262 tb.addAction(self.searchPrevAct) |
2207 tb.addSeparator() |
2263 tb.addSeparator() |
2208 tb.addAction(self.searchClearMarkersAct) |
2264 tb.addAction(self.searchClearMarkersAct) |
2209 tb.addSeparator() |
2265 tb.addSeparator() |
2210 tb.addAction(self.searchFilesAct) |
2266 tb.addAction(self.searchFilesAct) |
|
2267 tb.addSeparator() |
|
2268 tb.addAction(self.gotoLastEditAct) |
2211 |
2269 |
2212 tb.setAllowedAreas(Qt.ToolBarAreas(Qt.TopToolBarArea | Qt.BottomToolBarArea)) |
2270 tb.setAllowedAreas(Qt.ToolBarAreas(Qt.TopToolBarArea | Qt.BottomToolBarArea)) |
2213 |
2271 |
2214 toolbarManager.addToolBar(qtb, qtb.windowTitle()) |
2272 toolbarManager.addToolBar(qtb, qtb.windowTitle()) |
2215 toolbarManager.addToolBar(tb, tb.windowTitle()) |
2273 toolbarManager.addToolBar(tb, tb.windowTitle()) |
3154 editor.languageChanged.connect(self.__editorConfigChanged) |
3212 editor.languageChanged.connect(self.__editorConfigChanged) |
3155 editor.eolChanged.connect(self.__editorConfigChanged) |
3213 editor.eolChanged.connect(self.__editorConfigChanged) |
3156 editor.encodingChanged.connect(self.__editorConfigChanged) |
3214 editor.encodingChanged.connect(self.__editorConfigChanged) |
3157 editor.selectionChanged.connect(self.searchDlg.selectionChanged) |
3215 editor.selectionChanged.connect(self.searchDlg.selectionChanged) |
3158 editor.selectionChanged.connect(self.replaceDlg.selectionChanged) |
3216 editor.selectionChanged.connect(self.replaceDlg.selectionChanged) |
|
3217 editor.lastEditPositionAvailable.connect(self.__lastEditPositionAvailable) |
3159 |
3218 |
3160 def newEditorView(self, fn, caller, filetype=""): |
3219 def newEditorView(self, fn, caller, filetype=""): |
3161 """ |
3220 """ |
3162 Public method to create a new editor displaying the given document. |
3221 Public method to create a new editor displaying the given document. |
3163 |
3222 |
4148 """ |
4207 """ |
4149 Private method to handle the goto brace action. |
4208 Private method to handle the goto brace action. |
4150 """ |
4209 """ |
4151 self.activeWindow().moveToMatchingBrace() |
4210 self.activeWindow().moveToMatchingBrace() |
4152 |
4211 |
|
4212 def __gotoLastEditPosition(self): |
|
4213 """ |
|
4214 Private method to move the cursor to the last edit position. |
|
4215 """ |
|
4216 self.activeWindow().gotoLastEditPosition() |
|
4217 |
|
4218 def __lastEditPositionAvailable(self): |
|
4219 """ |
|
4220 Private slot to handle the lastEditPositionAvailable signal of an editor. |
|
4221 """ |
|
4222 self.gotoLastEditAct.setEnabled(True) |
|
4223 |
|
4224 def __gotoNextMethodClass(self): |
|
4225 """ |
|
4226 Private slot to go to the next Python/Ruby method or class definition. |
|
4227 """ |
|
4228 self.activeWindow().gotoMethodClass(False) |
|
4229 |
|
4230 def __gotoPreviousMethodClass(self): |
|
4231 """ |
|
4232 Private slot to go to the previous Python/Ruby method or class definition. |
|
4233 """ |
|
4234 self.activeWindow().gotoMethodClass(True) |
|
4235 |
4153 def __searchFiles(self): |
4236 def __searchFiles(self): |
4154 """ |
4237 """ |
4155 Private method to handle the search in files action. |
4238 Private method to handle the search in files action. |
4156 """ |
4239 """ |
4157 self.ui.findFilesDialog.show(self.textForFind()) |
4240 self.ui.findFilesDialog.show(self.textForFind()) |
4648 self.saveAct.setEnabled(editor.isModified()) |
4731 self.saveAct.setEnabled(editor.isModified()) |
4649 self.revertAct.setEnabled(editor.isModified()) |
4732 self.revertAct.setEnabled(editor.isModified()) |
4650 |
4733 |
4651 self.undoAct.setEnabled(editor.isUndoAvailable()) |
4734 self.undoAct.setEnabled(editor.isUndoAvailable()) |
4652 self.redoAct.setEnabled(editor.isRedoAvailable()) |
4735 self.redoAct.setEnabled(editor.isRedoAvailable()) |
|
4736 self.gotoLastEditAct.setEnabled(editor.isLastEditPositionAvailable()) |
4653 |
4737 |
4654 lex = editor.getLexer() |
4738 lex = editor.getLexer() |
4655 if lex is not None: |
4739 if lex is not None: |
4656 self.commentAct.setEnabled(lex.canBlockComment()) |
4740 self.commentAct.setEnabled(lex.canBlockComment()) |
4657 self.uncommentAct.setEnabled(lex.canBlockComment()) |
4741 self.uncommentAct.setEnabled(lex.canBlockComment()) |
4705 if editor.canAutoCompleteFromAPIs(): |
4789 if editor.canAutoCompleteFromAPIs(): |
4706 self.autoCompleteFromAPIsAct.setEnabled(True) |
4790 self.autoCompleteFromAPIsAct.setEnabled(True) |
4707 else: |
4791 else: |
4708 self.autoCompleteFromAPIsAct.setEnabled(False) |
4792 self.autoCompleteFromAPIsAct.setEnabled(False) |
4709 |
4793 |
|
4794 if editor.isPy3File() or editor.isPy2File() or editor.isRubyFile(): |
|
4795 self.gotoPreviousDefAct.setEnabled(True) |
|
4796 self.gotoNextDefAct.setEnabled(True) |
|
4797 else: |
|
4798 self.gotoPreviousDefAct.setEnabled(False) |
|
4799 self.gotoNextDefAct.setEnabled(False) |
|
4800 |
4710 if setSb: |
4801 if setSb: |
4711 line, pos = editor.getCursorPosition() |
4802 line, pos = editor.getCursorPosition() |
4712 enc = editor.getEncoding() |
4803 enc = editor.getEncoding() |
4713 lang = editor.getLanguage() |
4804 lang = editor.getLanguage() |
4714 eol = editor.getEolIndicator() |
4805 eol = editor.getEolIndicator() |
4850 line, pos = editor.getCursorPosition() |
4941 line, pos = editor.getCursorPosition() |
4851 enc = editor.getEncoding() |
4942 enc = editor.getEncoding() |
4852 lang = editor.getLanguage() |
4943 lang = editor.getLanguage() |
4853 eol = editor.getEolIndicator() |
4944 eol = editor.getEolIndicator() |
4854 self.__setSbFile(fn, line + 1, pos, encoding=enc, language=lang, eol=eol) |
4945 self.__setSbFile(fn, line + 1, pos, encoding=enc, language=lang, eol=eol) |
|
4946 self._checkActions(editor, False) |
4855 |
4947 |
4856 ################################################################## |
4948 ################################################################## |
4857 ## Below are protected utility methods |
4949 ## Below are protected utility methods |
4858 ################################################################## |
4950 ################################################################## |
4859 |
4951 |