eric6/Project/ProjectBrowserSortFilterProxyModel.py

changeset 8243
cc717c2ae956
parent 7923
91e843545d9a
equal deleted inserted replaced
8242:aa713ac50c0d 8243:cc717c2ae956
4 # 4 #
5 5
6 """ 6 """
7 Module implementing the browser sort filter proxy model. 7 Module implementing the browser sort filter proxy model.
8 """ 8 """
9
10 import contextlib
9 11
10 from UI.BrowserSortFilterProxyModel import BrowserSortFilterProxyModel 12 from UI.BrowserSortFilterProxyModel import BrowserSortFilterProxyModel
11 from .ProjectBrowserModel import ProjectBrowserSourceType 13 from .ProjectBrowserModel import ProjectBrowserSourceType
12 14
13 import Preferences 15 import Preferences
43 """ 45 """
44 sindex = self.sourceModel().index(source_row, 0, source_parent) 46 sindex = self.sourceModel().index(source_row, 0, source_parent)
45 if not sindex.isValid(): 47 if not sindex.isValid():
46 return False 48 return False
47 sitem = self.sourceModel().item(sindex) 49 sitem = self.sourceModel().item(sindex)
48 try: 50 with contextlib.suppress(AttributeError):
49 if self.__filterType not in sitem.getProjectTypes(): 51 if self.__filterType not in sitem.getProjectTypes():
50 return False 52 return False
51 if ( 53 if (
52 self.hideGeneratedForms and 54 self.hideGeneratedForms and
53 self.__filterType == ProjectBrowserSourceType and 55 self.__filterType == ProjectBrowserSourceType and
54 sitem.data(0).startswith("Ui_") 56 sitem.data(0).startswith("Ui_")
55 ): 57 ):
56 return False 58 return False
57 except AttributeError:
58 pass
59 59
60 if self.hideNonPublic: 60 if self.hideNonPublic:
61 return sitem.isPublic() 61 return sitem.isPublic()
62 else: 62 else:
63 return True 63 return True

eric ide

mercurial