Project: added support for the '--exclude' option of pylupdate6. eric7

Thu, 27 May 2021 17:40:23 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 27 May 2021 17:40:23 +0200
branch
eric7
changeset 8383
c090300126df
parent 8382
28f7ef365d1b
child 8384
b5c064649b49

Project: added support for the '--exclude' option of pylupdate6.

eric7/Project/Project.py file | annotate | diff | comparison | revisions
eric7/Project/ProjectTranslationsBrowser.py file | annotate | diff | comparison | revisions
--- a/eric7/Project/Project.py	Wed May 26 17:26:12 2021 +0200
+++ b/eric7/Project/Project.py	Thu May 27 17:40:23 2021 +0200
@@ -2858,8 +2858,8 @@
         the given association type.
         
         @param associationType type of the association (one of FORMS,
-            INTERFACES, OTHERS, PROTOCOLS, RESOURCES, SOURCES or
-            TRANSLATIONS)
+            INTERFACES, OTHERS, PROTOCOLS, RESOURCES, SOURCES,
+            TRANSLATIONS or __IGNORE__)
         @type str
         @return list of file patterns for the given type
         @rtype list of str
@@ -2899,7 +2899,17 @@
         
         # return empty string to signal to use the global setting
         return ""
-        
+    
+    def getIgnorePatterns(self):
+        """
+        Public method to get the list of file name patterns for files to be
+        ignored.
+        
+        @return list of ignore file name patterns
+        @rtype list of str
+        """
+        return self.getFiletypeAssociations("__IGNORE__")
+    
     @pyqtSlot()
     @pyqtSlot(str)
     def openProject(self, fn=None, restoreSession=True, reopen=False):
--- a/eric7/Project/ProjectTranslationsBrowser.py	Wed May 26 17:26:12 2021 +0200
+++ b/eric7/Project/ProjectTranslationsBrowser.py	Thu May 27 17:40:23 2021 +0200
@@ -1066,6 +1066,11 @@
                     self.tr("""No translation files (*.ts) selected."""))
                 return
             
+            excludePatterns = [
+                pat for pat in self.project.getIgnorePatterns()
+                if pat.endswith((".py", ".ui"))
+            ]
+            
             QGuiApplication.setOverrideCursor(
                 QCursor(Qt.CursorShape.WaitCursor))
             QGuiApplication.processEvents(
@@ -1074,7 +1079,10 @@
             for lang in langs:
                 proc = QProcess()
                 args = []
-
+                
+                for pattern in excludePatterns:
+                    args += ["--exclude", pattern]
+                
                 if noobsolete:
                     args.append('--no-obsolete')
                 

eric ide

mercurial