Added the 'Code Formatting' to the directory context menu of the sources browser as well. eric7

Mon, 11 Jul 2022 17:56:42 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 11 Jul 2022 17:56:42 +0200
branch
eric7
changeset 9217
0c34da0d7b76
parent 9216
e89083501ce3
child 9218
71cf3979a6c9

Added the 'Code Formatting' to the directory context menu of the sources browser as well.

src/eric7/Project/ProjectSourcesBrowser.py file | annotate | diff | comparison | revisions
--- a/src/eric7/Project/ProjectSourcesBrowser.py	Mon Jul 11 17:38:38 2022 +0200
+++ b/src/eric7/Project/ProjectSourcesBrowser.py	Mon Jul 11 17:56:42 2022 +0200
@@ -304,6 +304,7 @@
         self.dirMenu.addSeparator()
         act = self.dirMenu.addMenu(self.graphicsMenu)
         self.dirMenu.addMenu(self.checksMenu)
+        self.dirMenu.addMenu(self.formattingMenu)
         self.dirMenu.addSeparator()
         self.dirMenu.addAction(
             self.tr('Copy Path to Clipboard'), self._copyToClipboard)
@@ -1229,6 +1230,15 @@
             )
             if itm.isPython3File()
         ]
+        if not files:
+            # called for a directory
+            itm = self.model().item(self.currentIndex())
+            dirName = itm.dirName()
+            files = [
+                f
+                for f in self.project.getProjectFiles("SOURCES", normalized=True)
+                if f.startswith(dirName)
+            ]
         
         if ericApp().getObject("ViewManager").checkAllDirty():
             dlg = BlackConfigurationDialog(withProject=True)

eric ide

mercurial