UI/BrowserModel.py

changeset 2613
0799eea6feba
parent 2409
df3820f08247
child 2677
3d4277929fb3
child 2769
8cbebde7a984
equal deleted inserted replaced
2610:4d07b423ec22 2613:0799eea6feba
31 31
32 class BrowserModel(QAbstractItemModel): 32 class BrowserModel(QAbstractItemModel):
33 """ 33 """
34 Class implementing the browser model. 34 Class implementing the browser model.
35 """ 35 """
36 def __init__(self, parent=None): 36 def __init__(self, parent=None, nopopulate=False):
37 """ 37 """
38 Constructor 38 Constructor
39 39
40 @param parent reference to parent object (QObject) 40 @param parent reference to parent object (QObject)
41 @keyparam nopopulate flag indicating to not populate the model (boolean)
41 """ 42 """
42 super().__init__(parent) 43 super().__init__(parent)
43
44 rootData = QApplication.translate("BrowserModel", "Name")
45 self.rootItem = BrowserItem(None, rootData)
46 44
47 self.progDir = None 45 self.progDir = None
48 self.watchedItems = {} 46 self.watchedItems = {}
49 self.watcher = QFileSystemWatcher(self) 47 self.watcher = QFileSystemWatcher(self)
50 self.watcher.directoryChanged.connect(self.directoryChanged) 48 self.watcher.directoryChanged.connect(self.directoryChanged)
51 49
52 self.__populateModel() 50 if not nopopulate:
51 rootData = QApplication.translate("BrowserModel", "Name")
52 self.rootItem = BrowserItem(None, rootData)
53
54 self.__populateModel()
53 55
54 def columnCount(self, parent=QModelIndex()): 56 def columnCount(self, parent=QModelIndex()):
55 """ 57 """
56 Public method to get the number of columns. 58 Public method to get the number of columns.
57 59

eric ide

mercurial