eric6/Project/ProjectBrowserModel.py

changeset 8243
cc717c2ae956
parent 8235
78e6d29eb773
child 8259
2bbec88047dd
equal deleted inserted replaced
8242:aa713ac50c0d 8243:cc717c2ae956
7 Module implementing the browser model. 7 Module implementing the browser model.
8 """ 8 """
9 9
10 import os 10 import os
11 import re 11 import re
12 import contextlib
12 13
13 from PyQt5.QtCore import QDir, QModelIndex, pyqtSignal, QFileSystemWatcher, Qt 14 from PyQt5.QtCore import QDir, QModelIndex, pyqtSignal, QFileSystemWatcher, Qt
14 from PyQt5.QtGui import QColor 15 from PyQt5.QtGui import QColor
15 16
16 from UI.BrowserModel import ( 17 from UI.BrowserModel import (
643 if itm.isLazyPopulated() and autoPopulate: 644 if itm.isLazyPopulated() and autoPopulate:
644 self.populateItem(itm) 645 self.populateItem(itm)
645 else: 646 else:
646 break 647 break
647 for child in itm.children(): 648 for child in itm.children():
648 try: 649 with contextlib.suppress(AttributeError):
649 start, end = child.boundaries() 650 start, end = child.boundaries()
650 if end == -1: 651 if end == -1:
651 end = 1000000 # assume end of file 652 end = 1000000 # assume end of file
652 if start <= lineno <= end: 653 if start <= lineno <= end:
653 itm = child 654 itm = child
654 break 655 break
655 except AttributeError:
656 pass
657 else: 656 else:
658 itm = None 657 itm = None
659 if itm: 658 if itm:
660 olditem = itm 659 olditem = itm
661 index = self.createIndex(olditem.row(), 0, olditem) 660 index = self.createIndex(olditem.row(), 0, olditem)

eric ide

mercurial