Fixed an issue, where the selection of the current file in the project viewer jumped to the wrong entry, when the file was saved.

Fri, 07 Jan 2011 16:41:49 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 07 Jan 2011 16:41:49 +0100
changeset 828
1161da54aeb8
parent 826
2e3e2055e715
child 829
b3280ade94a6

Fixed an issue, where the selection of the current file in the project viewer jumped to the wrong entry, when the file was saved.

Project/ProjectBaseBrowser.py file | annotate | diff | comparison | revisions
--- a/Project/ProjectBaseBrowser.py	Fri Jan 07 15:52:50 2011 +0100
+++ b/Project/ProjectBaseBrowser.py	Fri Jan 07 16:41:49 2011 +0100
@@ -547,18 +547,21 @@
         if sindex.isValid():
             index = self.model().mapFromSource(sindex)
             if index.isValid():
-                childIndex = self.indexBelow(index)
-                while childIndex.isValid():
-                    if not childIndex.isValid() or childIndex.parent() == index.parent():
-                        break
-                    itm = self.model().item(childIndex)
-                    if itm is not None:
-                        itemData = itm.data(0)
-                        if self.currentItemName and self.currentItemName == itemData:
-                            self._selectSingleItem(childIndex)
-                        if itemData in self.expandedNames:
-                            self.setExpanded(childIndex, True)
-                    childIndex = self.indexBelow(childIndex)
+                if self.isExpanded(index):
+                    childIndex = self.indexBelow(index)
+                    while childIndex.isValid():
+                        if not childIndex.isValid() or childIndex.parent() == index.parent():
+                            break
+                        itm = self.model().item(childIndex)
+                        if itm is not None:
+                            itemData = itm.data(0)
+                            if self.currentItemName and self.currentItemName == itemData:
+                                self._selectSingleItem(childIndex)
+                            if itemData in self.expandedNames:
+                                self.setExpanded(childIndex, True)
+                        childIndex = self.indexBelow(childIndex)
+                else:
+                    self._selectSingleItem(index)
                 self.expandedNames = []
         self.currentItemName = None
         QApplication.restoreOverrideCursor()
@@ -638,4 +641,4 @@
         """
         Protected method to open the configuration dialog.
         """
-        e5App().getObject("UserInterface").showPreferences("projectBrowserPage")
\ No newline at end of file
+        e5App().getObject("UserInterface").showPreferences("projectBrowserPage")

eric ide

mercurial