UI/BrowserModel.py

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

eric ide

mercurial