Fixed a little issue with subclassing BrowserModel.

Tue, 23 Apr 2013 19:13:45 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 23 Apr 2013 19:13:45 +0200
changeset 2613
0799eea6feba
parent 2610
4d07b423ec22
child 2614
9c49b4419ea7

Fixed a little issue with subclassing BrowserModel.

APIs/Python3/eric5.api file | annotate | diff | comparison | revisions
Documentation/Source/eric5.UI.BrowserModel.html file | annotate | diff | comparison | revisions
Project/ProjectBrowserModel.py file | annotate | diff | comparison | revisions
UI/BrowserModel.py file | annotate | diff | comparison | revisions
--- a/APIs/Python3/eric5.api	Mon Apr 22 20:26:20 2013 +0200
+++ b/APIs/Python3/eric5.api	Tue Apr 23 19:13:45 2013 +0200
@@ -7510,7 +7510,7 @@
 eric5.UI.BrowserModel.BrowserModel.removeToplevelDir?4(index)
 eric5.UI.BrowserModel.BrowserModel.rowCount?4(parent=QModelIndex())
 eric5.UI.BrowserModel.BrowserModel.saveToplevelDirs?4()
-eric5.UI.BrowserModel.BrowserModel?1(parent=None)
+eric5.UI.BrowserModel.BrowserModel?1(parent=None, nopopulate=False)
 eric5.UI.BrowserModel.BrowserSysPathItem?1(parent)
 eric5.UI.BrowserSortFilterProxyModel.BrowserSortFilterProxyModel.filterAcceptsRow?4(source_row, source_parent)
 eric5.UI.BrowserSortFilterProxyModel.BrowserSortFilterProxyModel.hasChildren?4(parent=QModelIndex())
--- a/Documentation/Source/eric5.UI.BrowserModel.html	Mon Apr 22 20:26:20 2013 +0200
+++ b/Documentation/Source/eric5.UI.BrowserModel.html	Tue Apr 23 19:13:45 2013 +0200
@@ -1398,13 +1398,16 @@
 </table>
 <a NAME="BrowserModel.__init__" ID="BrowserModel.__init__"></a>
 <h4>BrowserModel (Constructor)</h4>
-<b>BrowserModel</b>(<i>parent=None</i>)
+<b>BrowserModel</b>(<i>parent=None, nopopulate=False</i>)
 <p>
         Constructor
 </p><dl>
 <dt><i>parent</i></dt>
 <dd>
 reference to parent object (QObject)
+</dd><dt><i>nopopulate=</i></dt>
+<dd>
+flag indicating to not populate the model (boolean)
 </dd>
 </dl><a NAME="BrowserModel.__populateModel" ID="BrowserModel.__populateModel"></a>
 <h4>BrowserModel.__populateModel</h4>
--- a/Project/ProjectBrowserModel.py	Mon Apr 22 20:26:20 2013 +0200
+++ b/Project/ProjectBrowserModel.py	Tue Apr 23 19:13:45 2013 +0200
@@ -221,7 +221,7 @@
         
         @param parent reference to parent object (Project.Project)
         """
-        super().__init__(parent)
+        super().__init__(parent, nopopulate=True)
         
         rootData = self.trUtf8("Name")
         self.rootItem = BrowserItem(None, rootData)
--- a/UI/BrowserModel.py	Mon Apr 22 20:26:20 2013 +0200
+++ b/UI/BrowserModel.py	Tue Apr 23 19:13:45 2013 +0200
@@ -33,23 +33,25 @@
     """
     Class implementing the browser model.
     """
-    def __init__(self, parent=None):
+    def __init__(self, parent=None, nopopulate=False):
         """
         Constructor
         
         @param parent reference to parent object (QObject)
+        @keyparam nopopulate flag indicating to not populate the model (boolean)
         """
         super().__init__(parent)
         
-        rootData = QApplication.translate("BrowserModel", "Name")
-        self.rootItem = BrowserItem(None, rootData)
-        
         self.progDir = None
         self.watchedItems = {}
         self.watcher = QFileSystemWatcher(self)
         self.watcher.directoryChanged.connect(self.directoryChanged)
         
-        self.__populateModel()
+        if not nopopulate:
+            rootData = QApplication.translate("BrowserModel", "Name")
+            self.rootItem = BrowserItem(None, rootData)
+            
+            self.__populateModel()
     
     def columnCount(self, parent=QModelIndex()):
         """

eric ide

mercurial