Project/ProjectBaseBrowser.py

changeset 3600
7d17c492ab95
parent 3484
645c12de6b0c
child 3601
236578b22511
diff -r 37fdb72a2388 -r 7d17c492ab95 Project/ProjectBaseBrowser.py
--- a/Project/ProjectBaseBrowser.py	Wed May 21 18:47:56 2014 +0200
+++ b/Project/ProjectBaseBrowser.py	Wed May 21 19:45:39 2014 +0200
@@ -566,6 +566,31 @@
             filter=[ProjectBrowserSimpleDirectoryItem,
                     ProjectBrowserDirectoryItem])
         
+    def getExpandedItemNames(self):
+        """
+        Public method to get the file/directory names of all expanded items.
+        
+        @return list of expanded items names (list of string)
+        """
+        # step 1: find the top most index
+        childIndex = self.currentIndex()
+        if not childIndex.isValid():
+            return []
+        
+        while childIndex.isValid():
+            topIndex = childIndex
+            childIndex = self.indexAbove(childIndex)
+        
+        # step 2: get names of expanded items
+        expandedNames = []
+        childIndex = topIndex
+        while childIndex.isValid():
+            if self.isExpanded(childIndex):
+                expandedNames.append(
+                    self.model().item(childIndex).name())
+            childIndex = self.indexBelow(childIndex)
+        return expandedNames
+        
     def _prepareRepopulateItem(self, name):
         """
         Protected slot to handle the prepareRepopulateItem signal.

eric ide

mercurial