--- a/eric7/Project/ProjectOthersBrowser.py Fri Jan 07 20:25:38 2022 +0100 +++ b/eric7/Project/ProjectOthersBrowser.py Sat Jan 08 19:00:42 2022 +0100 @@ -73,6 +73,8 @@ self.tr('Open in Hex Editor'), self._openHexEditor) self.editPixmapAct = self.menu.addAction( self.tr('Open in Icon Editor'), self._editPixmap) + self.openInEditorAct = self.menu.addAction( + self.tr('Open in Editor'), self._openFileInEditor) self.menu.addSeparator() self.mimeTypeAct = self.menu.addAction( self.tr('Show Mime-Type'), self.__showMimeType) @@ -206,10 +208,11 @@ @param menu Reference to the popup menu (QPopupMenu) """ + itm = self.model().item(self.currentIndex()) + if self.project.vcs is None: for act in self.menuActions: act.setEnabled(True) - itm = self.model().item(self.currentIndex()) if isinstance( itm, (ProjectBrowserSimpleDirectoryItem, @@ -219,6 +222,8 @@ else: self.vcsHelper.showContextMenu(menu, self.menuActions) + self.openInEditorAct.setVisible(itm.isSvgFile()) + def _editPixmap(self): """ Protected slot to handle the open in icon editor popup menu entry. @@ -261,7 +266,20 @@ self.sourceFile.emit(itm.fileName()) else: QDesktopServices.openUrl(QUrl(itm.fileName())) + + def _openFileInEditor(self): + """ + Private slot to handle the Open in Editor menu action. + """ + itmList = self.getSelectedItems() + for itm in itmList: + if ( + isinstance(itm, ProjectBrowserFileItem) and + Utilities.MimeTypes.isTextFile(itm.fileName()) + ): + self.sourceFile.emit(itm.fileName()) + def __showMimeType(self): """ Private slot to show the mime type of the selected entry.