ViewManager/ViewManager.py

branch
maintenance
changeset 5948
6f958d5765f4
parent 5742
dc9cd8059221
child 5949
22657f04f332
equal deleted inserted replaced
5937:cc296ba99a3f 5948:6f958d5765f4
1376 """ left of the cursor.</p>""" 1376 """ left of the cursor.</p>"""
1377 )) 1377 ))
1378 self.calltipsAct.triggered.connect(self.__editShowCallTips) 1378 self.calltipsAct.triggered.connect(self.__editShowCallTips)
1379 self.editActions.append(self.calltipsAct) 1379 self.editActions.append(self.calltipsAct)
1380 1380
1381 self.codeInfoAct = E5Action(
1382 QCoreApplication.translate('ViewManager', 'Code Info'),
1383 UI.PixmapCache.getIcon("codeDocuViewer.png"),
1384 QCoreApplication.translate('ViewManager', 'Code Info'),
1385 QKeySequence(QCoreApplication.translate(
1386 'ViewManager', "Ctrl+Alt+I", "Edit|Code Info")),
1387 0,
1388 self.editActGrp, 'vm_edit_codeinfo')
1389 self.codeInfoAct.setStatusTip(QCoreApplication.translate(
1390 'ViewManager', 'Show Code Info'))
1391 self.codeInfoAct.setWhatsThis(QCoreApplication.translate(
1392 'ViewManager',
1393 """<b>Code Info</b>"""
1394 """<p>Show code information based on the cursor position.</p>"""
1395 ))
1396 self.codeInfoAct.triggered.connect(self.__editShowCodeInfo)
1397 self.editActions.append(self.codeInfoAct)
1398
1381 self.sortAct = E5Action( 1399 self.sortAct = E5Action(
1382 QCoreApplication.translate('ViewManager', 'Sort'), 1400 QCoreApplication.translate('ViewManager', 'Sort'),
1383 QCoreApplication.translate('ViewManager', 'Sort'), 1401 QCoreApplication.translate('ViewManager', 'Sort'),
1384 QKeySequence(QCoreApplication.translate( 1402 QKeySequence(QCoreApplication.translate(
1385 'ViewManager', "Ctrl+Alt+S", "Edit|Sort")), 1403 'ViewManager', "Ctrl+Alt+S", "Edit|Sort")),
2750 menu.addAction(self.editLowerCaseAct) 2768 menu.addAction(self.editLowerCaseAct)
2751 menu.addAction(self.sortAct) 2769 menu.addAction(self.sortAct)
2752 menu.addSeparator() 2770 menu.addSeparator()
2753 menu.addMenu(autocompletionMenu) 2771 menu.addMenu(autocompletionMenu)
2754 menu.addAction(self.calltipsAct) 2772 menu.addAction(self.calltipsAct)
2773 menu.addAction(self.codeInfoAct)
2755 menu.addSeparator() 2774 menu.addSeparator()
2756 menu.addMenu(searchMenu) 2775 menu.addMenu(searchMenu)
2757 menu.addSeparator() 2776 menu.addSeparator()
2758 menu.addAction(self.gotoAct) 2777 menu.addAction(self.gotoAct)
2759 menu.addAction(self.gotoBraceAct) 2778 menu.addAction(self.gotoBraceAct)
5430 def __editShowCallTips(self): 5449 def __editShowCallTips(self):
5431 """ 5450 """
5432 Private method to handle the calltips action. 5451 Private method to handle the calltips action.
5433 """ 5452 """
5434 self.activeWindow().callTip() 5453 self.activeWindow().callTip()
5454
5455 def __editShowCodeInfo(self):
5456 """
5457 Private method to handle the code info action.
5458 """
5459 self.showEditorInfo(self.activeWindow())
5435 5460
5436 ################################################################## 5461 ##################################################################
5437 ## Below are the action and utility methods for the search menu 5462 ## Below are the action and utility methods for the search menu
5438 ################################################################## 5463 ##################################################################
5439 5464
6575 self.autoCompleteFromAPIsAct.setEnabled(False) 6600 self.autoCompleteFromAPIsAct.setEnabled(False)
6576 self.autoCompleteFromAllAct.setEnabled(False) 6601 self.autoCompleteFromAllAct.setEnabled(False)
6577 self.autoCompleteAct.setEnabled( 6602 self.autoCompleteAct.setEnabled(
6578 editor.canProvideDynamicAutoCompletion()) 6603 editor.canProvideDynamicAutoCompletion())
6579 self.calltipsAct.setEnabled(editor.canProvideCallTipps()) 6604 self.calltipsAct.setEnabled(editor.canProvideCallTipps())
6605 self.codeInfoAct.setEnabled(self.__isEditorInfoSupportedEd(editor))
6580 6606
6581 if editor.isPyFile() or editor.isRubyFile(): 6607 if editor.isPyFile() or editor.isRubyFile():
6582 self.gotoPreviousDefAct.setEnabled(True) 6608 self.gotoPreviousDefAct.setEnabled(True)
6583 self.gotoNextDefAct.setEnabled(True) 6609 self.gotoNextDefAct.setEnabled(True)
6584 else: 6610 else:
6780 """ 6806 """
6781 editor = self.activeWindow() 6807 editor = self.activeWindow()
6782 if editor: 6808 if editor:
6783 editor.sortLines() 6809 editor.sortLines()
6784 6810
6811 def showEditorInfo(self, editor):
6812 """
6813 Public method to show some information for a given editor.
6814
6815 @param editor editor to show information text for
6816 @type Editor
6817 """
6818 self.ui.documentationViewer().showInfo(editor)
6819
6820 def isEditorInfoSupported(self, language):
6821 """
6822 Public method to check, if a language is supported by the
6823 documentation viewer.
6824
6825 @param language editor programming language to check
6826 @type str
6827 @return flag indicating the support status
6828 @rtype bool
6829 """
6830 return self.ui.documentationViewer().isSupportedLanguage(language)
6831
6832 def __isEditorInfoSupportedEd(self, editor):
6833 """
6834 Private method to check, if an editor is supported by the
6835 documentation viewer.
6836
6837 @param editor reference to the editor to check for
6838 @type Editor
6839 @return flag indicating the support status
6840 @rtype bool
6841 """
6842 language = editor.getLanguage()
6843 return self.isEditorInfoSupported(language)
6844
6785 ################################################################## 6845 ##################################################################
6786 ## Below are protected utility methods 6846 ## Below are protected utility methods
6787 ################################################################## 6847 ##################################################################
6788 6848
6789 def _getOpenStartDir(self): 6849 def _getOpenStartDir(self):

eric ide

mercurial