1463 """ the selection ignoring leading and trailing whitespace.</p>""" |
1463 """ the selection ignoring leading and trailing whitespace.</p>""" |
1464 )) |
1464 )) |
1465 self.sortAct.triggered.connect(self.__editSortSelectedLines) |
1465 self.sortAct.triggered.connect(self.__editSortSelectedLines) |
1466 self.editActions.append(self.sortAct) |
1466 self.editActions.append(self.sortAct) |
1467 |
1467 |
|
1468 self.docstringAct = E5Action( |
|
1469 QCoreApplication.translate('ViewManager', 'Generate Docstring'), |
|
1470 QCoreApplication.translate('ViewManager', 'Generate Docstring'), |
|
1471 QKeySequence(QCoreApplication.translate( |
|
1472 'ViewManager', "Ctrl+Alt+D", "Edit|Generate Docstring")), |
|
1473 0, |
|
1474 self.editActGrp, 'vm_edit_generate_docstring') |
|
1475 self.docstringAct.setStatusTip(QCoreApplication.translate( |
|
1476 'ViewManager', |
|
1477 'Generate a docstring for the current function/method')) |
|
1478 self.docstringAct.setWhatsThis(QCoreApplication.translate( |
|
1479 'ViewManager', |
|
1480 """<b>Generate Docstring</b>""" |
|
1481 """<p>Generate a docstring for the current function/method if""" |
|
1482 """ the cursor is placed on the line starting the function""" |
|
1483 """ definition or on the line thereafter. The docstring is""" |
|
1484 """ inserted at the appropriate position and the cursor is""" |
|
1485 """ placed at the end of the description line.</p>""" |
|
1486 )) |
|
1487 self.docstringAct.triggered.connect(self.__editInsertDocstring) |
|
1488 self.editActions.append(self.docstringAct) |
|
1489 |
1468 self.editActGrp.setEnabled(False) |
1490 self.editActGrp.setEnabled(False) |
1469 self.copyActGrp.setEnabled(False) |
1491 self.copyActGrp.setEnabled(False) |
1470 |
1492 |
1471 #################################################################### |
1493 #################################################################### |
1472 ## Below follow the actions for QScintilla standard commands. |
1494 ## Below follow the actions for QScintilla standard commands. |
2802 menu.addAction(self.commentAct) |
2824 menu.addAction(self.commentAct) |
2803 menu.addAction(self.uncommentAct) |
2825 menu.addAction(self.uncommentAct) |
2804 menu.addAction(self.toggleCommentAct) |
2826 menu.addAction(self.toggleCommentAct) |
2805 menu.addAction(self.streamCommentAct) |
2827 menu.addAction(self.streamCommentAct) |
2806 menu.addAction(self.boxCommentAct) |
2828 menu.addAction(self.boxCommentAct) |
|
2829 menu.addSeparator() |
|
2830 menu.addAction(self.docstringAct) |
2807 menu.addSeparator() |
2831 menu.addSeparator() |
2808 menu.addAction(self.editUpperCaseAct) |
2832 menu.addAction(self.editUpperCaseAct) |
2809 menu.addAction(self.editLowerCaseAct) |
2833 menu.addAction(self.editLowerCaseAct) |
2810 menu.addAction(self.sortAct) |
2834 menu.addAction(self.sortAct) |
2811 menu.addSeparator() |
2835 menu.addSeparator() |
6625 """ could not be written.</p>""" |
6649 """ could not be written.</p>""" |
6626 """<p>Reason: {1}</p>""").format( |
6650 """<p>Reason: {1}</p>""").format( |
6627 dictionaryFile, str(err))) |
6651 dictionaryFile, str(err))) |
6628 return |
6652 return |
6629 |
6653 |
6630 if self.ui.notificationsEnabled(): |
6654 self.ui.showNotification( |
6631 self.ui.showNotification( |
6655 UI.PixmapCache.getPixmap("spellchecking48"), |
6632 UI.PixmapCache.getPixmap("spellchecking48"), |
6656 QCoreApplication.translate( |
6633 QCoreApplication.translate( |
6657 'ViewManager', "Edit Spelling Dictionary"), |
6634 'ViewManager', "Edit Spelling Dictionary"), |
6658 QCoreApplication.translate( |
6635 QCoreApplication.translate( |
6659 'ViewManager', |
6636 'ViewManager', |
6660 "The spelling dictionary was saved successfully.")) |
6637 "The spelling dictionary was saved successfully.")) |
|
6638 |
6661 |
6639 ################################################################## |
6662 ################################################################## |
6640 ## Below are general utility methods |
6663 ## Below are general utility methods |
6641 ################################################################## |
6664 ################################################################## |
6642 |
6665 |
7096 """ |
7119 """ |
7097 editor = self.activeWindow() |
7120 editor = self.activeWindow() |
7098 if editor: |
7121 if editor: |
7099 editor.sortLines() |
7122 editor.sortLines() |
7100 |
7123 |
|
7124 def __editInsertDocstring(self): |
|
7125 """ |
|
7126 Private method to insert a docstring. |
|
7127 """ |
|
7128 editor = self.activeWindow() |
|
7129 if editor: |
|
7130 editor.insertDocstring() |
|
7131 |
7101 def showEditorInfo(self, editor): |
7132 def showEditorInfo(self, editor): |
7102 """ |
7133 """ |
7103 Public method to show some information for a given editor. |
7134 Public method to show some information for a given editor. |
7104 |
7135 |
7105 @param editor editor to show information text for |
7136 @param editor editor to show information text for |