eric6/Project/ProjectBrowserModel.py

changeset 8235
78e6d29eb773
parent 8222
5994b80b8760
child 8243
cc717c2ae956
equal deleted inserted replaced
8234:fcb6b4b96274 8235:78e6d29eb773
436 436
437 self.inRefresh = True 437 self.inRefresh = True
438 for key in keys: 438 for key in keys:
439 # Show the entry in bold in the others browser to make it more 439 # Show the entry in bold in the others browser to make it more
440 # distinguishable 440 # distinguishable
441 if key == "OTHERS": 441 bold = key == "OTHERS"
442 bold = True 442 sourceLanguage = (
443 else: 443 self.project.getProjectLanguage() if key == "SOURCES" else ""
444 bold = False 444 )
445
446 if key == "SOURCES":
447 sourceLanguage = self.project.getProjectLanguage()
448 else:
449 sourceLanguage = ""
450 445
451 for fn in self.project.pdata[key]: 446 for fn in self.project.pdata[key]:
452 fname = os.path.join(self.project.ppath, fn) 447 fname = os.path.join(self.project.ppath, fn)
453 parentItem, dt = self.findParentItemByName( 448 parentItem, dt = self.findParentItemByName(
454 self.projectBrowserTypes[key], fn) 449 self.projectBrowserTypes[key], fn)
549 @param name name of the new item (string) 544 @param name name of the new item (string)
550 @param additionalTypeStrings names of additional types (list of string) 545 @param additionalTypeStrings names of additional types (list of string)
551 """ 546 """
552 # Show the entry in bold in the others browser to make it more 547 # Show the entry in bold in the others browser to make it more
553 # distinguishable 548 # distinguishable
554 if typeString == "OTHERS": 549 bold = typeString == "OTHERS"
555 bold = True
556 else:
557 bold = False
558 550
559 fname = os.path.join(self.project.ppath, name) 551 fname = os.path.join(self.project.ppath, name)
560 parentItem, dt = self.findParentItemByName( 552 parentItem, dt = self.findParentItemByName(
561 self.projectBrowserTypes[typeString], name) 553 self.projectBrowserTypes[typeString], name)
562 if parentItem == self.rootItem: 554 if parentItem == self.rootItem:
625 617
626 @param name name of the item (string) 618 @param name name of the item (string)
627 @return index of the item found (QModelIndex) 619 @return index of the item found (QModelIndex)
628 """ 620 """
629 itm = self.findItem(name) 621 itm = self.findItem(name)
630 if itm is None: 622 index = self.createIndex(itm.row(), 0, itm) if itm else QModelIndex()
631 index = QModelIndex()
632 else:
633 index = self.createIndex(itm.row(), 0, itm)
634 return index 623 return index
635 624
636 def itemIndexByNameAndLine(self, name, lineno): 625 def itemIndexByNameAndLine(self, name, lineno):
637 """ 626 """
638 Public method to find an item's index given its name. 627 Public method to find an item's index given its name.

eric ide

mercurial