UI/BrowserModel.py

changeset 3039
8dd0165d805d
parent 3034
7ce719013078
child 3060
5883ce99ee12
child 3160
209a07d7e401
equal deleted inserted replaced
3038:7fe9a53280bd 3039:8dd0165d805d
83 if role == Qt.DisplayRole: 83 if role == Qt.DisplayRole:
84 item = index.internalPointer() 84 item = index.internalPointer()
85 if index.column() < item.columnCount(): 85 if index.column() < item.columnCount():
86 return item.data(index.column()) 86 return item.data(index.column())
87 elif index.column() == item.columnCount() and \ 87 elif index.column() == item.columnCount() and \
88 index.column() < self.columnCount(self.parent(index)): 88 index.column() < self.columnCount(self.parent(index)):
89 # This is for the case where an item under a multi-column 89 # This is for the case where an item under a multi-column
90 # parent doesn't have a value for all the columns 90 # parent doesn't have a value for all the columns
91 return "" 91 return ""
92 elif role == Qt.DecorationRole: 92 elif role == Qt.DecorationRole:
93 if index.column() == 0: 93 if index.column() == 0:
572 pass 572 pass
573 if "@@Coding@@" in keys: 573 if "@@Coding@@" in keys:
574 node = BrowserCodingItem( 574 node = BrowserCodingItem(
575 parentItem, 575 parentItem,
576 QApplication.translate("BrowserModel", "Coding: {0}") 576 QApplication.translate("BrowserModel", "Coding: {0}")
577 .format(dict["@@Coding@@"].coding)) 577 .format(dict["@@Coding@@"].coding))
578 self._addItem(node, parentItem) 578 self._addItem(node, parentItem)
579 if "@@Globals@@" in keys: 579 if "@@Globals@@" in keys:
580 node = BrowserClassAttributesItem( 580 node = BrowserClassAttributesItem(
581 parentItem, 581 parentItem,
582 dict["@@Globals@@"].globals, 582 dict["@@Globals@@"].globals,
1105 Public method to check, if this file is a Python script. 1105 Public method to check, if this file is a Python script.
1106 1106
1107 @return flag indicating a Python file (boolean) 1107 @return flag indicating a Python file (boolean)
1108 """ 1108 """
1109 return self.fileext in Preferences.getPython("PythonExtensions") or \ 1109 return self.fileext in Preferences.getPython("PythonExtensions") or \
1110 (self.fileext == "" and self.sourceLanguage in ["Python", 1110 (self.fileext == "" and
1111 "Python2"]) 1111 self.sourceLanguage in ["Python", "Python2"])
1112 1112
1113 def isPython3File(self): 1113 def isPython3File(self):
1114 """ 1114 """
1115 Public method to check, if this file is a Python3 script. 1115 Public method to check, if this file is a Python3 script.
1116 1116
1117 @return flag indicating a Python file (boolean) 1117 @return flag indicating a Python file (boolean)
1118 """ 1118 """
1119 return self.fileext in Preferences.getPython("Python3Extensions") or \ 1119 return self.fileext in Preferences.getPython("Python3Extensions") or \
1120 (self.fileext == "" and self.sourceLanguage == "Python3") 1120 (self.fileext == "" and self.sourceLanguage == "Python3")
1121 1121
1122 def isRubyFile(self): 1122 def isRubyFile(self):
1123 """ 1123 """
1124 Public method to check, if this file is a Ruby script. 1124 Public method to check, if this file is a Ruby script.
1125 1125
1126 @return flag indicating a Ruby file (boolean) 1126 @return flag indicating a Ruby file (boolean)
1127 """ 1127 """
1128 return self.fileext == '.rb' or \ 1128 return self.fileext == '.rb' or \
1129 (self.fileext == "" and self.sourceLanguage == "Ruby") 1129 (self.fileext == "" and self.sourceLanguage == "Ruby")
1130 1130
1131 def isDesignerFile(self): 1131 def isDesignerFile(self):
1132 """ 1132 """
1133 Public method to check, if this file is a Qt-Designer file. 1133 Public method to check, if this file is a Qt-Designer file.
1134 1134
1205 Public method to check, if this file is a D file. 1205 Public method to check, if this file is a D file.
1206 1206
1207 @return flag indicating a D file (boolean) 1207 @return flag indicating a D file (boolean)
1208 """ 1208 """
1209 return self.fileext in ['.d', '.di'] or \ 1209 return self.fileext in ['.d', '.di'] or \
1210 (self.fileext == "" and self.sourceLanguage == "D") 1210 (self.fileext == "" and self.sourceLanguage == "D")
1211 1211
1212 def lessThan(self, other, column, order): 1212 def lessThan(self, other, column, order):
1213 """ 1213 """
1214 Public method to check, if the item is less than the other one. 1214 Public method to check, if the item is less than the other one.
1215 1215
1296 else: 1296 else:
1297 self.icon = UI.PixmapCache.getIcon("class.png") 1297 self.icon = UI.PixmapCache.getIcon("class.png")
1298 if self._classObject and \ 1298 if self._classObject and \
1299 (self._classObject.methods or 1299 (self._classObject.methods or
1300 self._classObject.classes or 1300 self._classObject.classes or
1301 self._classObject.attributes): 1301 self._classObject.attributes):
1302 self._populated = False 1302 self._populated = False
1303 self._lazyPopulation = True 1303 self._lazyPopulation = True
1304 1304
1305 def fileName(self): 1305 def fileName(self):
1306 """ 1306 """
1387 self._filename = filename 1387 self._filename = filename
1388 if self._functionObject.modifier == \ 1388 if self._functionObject.modifier == \
1389 Utilities.ClassBrowsers.ClbrBaseClasses.Function.Static: 1389 Utilities.ClassBrowsers.ClbrBaseClasses.Function.Static:
1390 self.icon = UI.PixmapCache.getIcon("method_static.png") 1390 self.icon = UI.PixmapCache.getIcon("method_static.png")
1391 elif self._functionObject.modifier == \ 1391 elif self._functionObject.modifier == \
1392 Utilities.ClassBrowsers.ClbrBaseClasses.Function.Class: 1392 Utilities.ClassBrowsers.ClbrBaseClasses.Function.Class:
1393 self.icon = UI.PixmapCache.getIcon("method_class.png") 1393 self.icon = UI.PixmapCache.getIcon("method_class.png")
1394 elif self._functionObject.isPrivate(): 1394 elif self._functionObject.isPrivate():
1395 self.icon = UI.PixmapCache.getIcon("method_private.png") 1395 self.icon = UI.PixmapCache.getIcon("method_private.png")
1396 elif self._functionObject.isProtected(): 1396 elif self._functionObject.isProtected():
1397 self.icon = UI.PixmapCache.getIcon("method_protected.png") 1397 self.icon = UI.PixmapCache.getIcon("method_protected.png")
1526 @return true, if this item is less than other (boolean) 1526 @return true, if this item is less than other (boolean)
1527 """ 1527 """
1528 if issubclass(other.__class__, BrowserCodingItem): 1528 if issubclass(other.__class__, BrowserCodingItem):
1529 return order == Qt.DescendingOrder 1529 return order == Qt.DescendingOrder
1530 elif issubclass(other.__class__, BrowserClassItem) or \ 1530 elif issubclass(other.__class__, BrowserClassItem) or \
1531 issubclass(other.__class__, BrowserMethodItem): 1531 issubclass(other.__class__, BrowserMethodItem):
1532 return order == Qt.AscendingOrder 1532 return order == Qt.AscendingOrder
1533 1533
1534 return BrowserItem.lessThan(self, other, column, order) 1534 return BrowserItem.lessThan(self, other, column, order)
1535 1535
1536 1536

eric ide

mercurial