638 |
638 |
639 @param interpreter interpreter of the debug client (string) |
639 @param interpreter interpreter of the debug client (string) |
640 """ |
640 """ |
641 self.__model.interpreterChanged(interpreter) |
641 self.__model.interpreterChanged(interpreter) |
642 |
642 |
643 def wantedItem(self, itm, filter=None): |
643 def wantedItem(self, itm, filterList=None): |
644 """ |
644 """ |
645 Public method to check type of an item. |
645 Public method to check type of an item. |
646 |
646 |
647 @param itm the item to check (BrowserItem) |
647 @param itm the item to check (BrowserItem) |
648 @param filter list of classes to check against |
648 @param filterList list of classes to check against |
649 @return flag indicating item is a valid type (boolean) |
649 @return flag indicating item is a valid type (boolean) |
650 """ |
650 """ |
651 if filter is None: |
651 if filterList is None: |
652 filter = self.selectedItemsFilter |
652 filterList = self.selectedItemsFilter |
653 for typ in filter: |
653 for typ in filterList: |
654 if isinstance(itm, typ): |
654 if isinstance(itm, typ): |
655 return True |
655 return True |
656 return False |
656 return False |
657 |
657 |
658 def getSelectedItems(self, filter=None): |
658 def getSelectedItems(self, filterList=None): |
659 """ |
659 """ |
660 Public method to get the selected items. |
660 Public method to get the selected items. |
661 |
661 |
662 @param filter list of classes to check against |
662 @param filterList list of classes to check against |
663 @return list of selected items (list of BroweserItem) |
663 @return list of selected items (list of BroweserItem) |
664 """ |
664 """ |
665 selectedItems = [] |
665 selectedItems = [] |
666 indexes = self.selectedIndexes() |
666 indexes = self.selectedIndexes() |
667 for index in indexes: |
667 for index in indexes: |
668 if index.column() == 0: |
668 if index.column() == 0: |
669 itm = self.model().item(index) |
669 itm = self.model().item(index) |
670 if self.wantedItem(itm, filter): |
670 if self.wantedItem(itm, filterList): |
671 selectedItems.append(itm) |
671 selectedItems.append(itm) |
672 return selectedItems |
672 return selectedItems |
673 |
673 |
674 def getSelectedItemsCount(self, filter=None): |
674 def getSelectedItemsCount(self, filterList=None): |
675 """ |
675 """ |
676 Public method to get the count of items selected. |
676 Public method to get the count of items selected. |
677 |
677 |
678 @param filter list of classes to check against |
678 @param filterList list of classes to check against |
679 @return count of items selected (integer) |
679 @return count of items selected (integer) |
680 """ |
680 """ |
681 count = 0 |
681 count = 0 |
682 indexes = self.selectedIndexes() |
682 indexes = self.selectedIndexes() |
683 for index in indexes: |
683 for index in indexes: |
684 if index.column() == 0: |
684 if index.column() == 0: |
685 itm = self.model().item(index) |
685 itm = self.model().item(index) |
686 if self.wantedItem(itm, filter): |
686 if self.wantedItem(itm, filterList): |
687 count += 1 |
687 count += 1 |
688 return count |
688 return count |
689 |
689 |
690 def getSelectedItemsCountCategorized(self, filter=None): |
690 def getSelectedItemsCountCategorized(self, filterList=None): |
691 """ |
691 """ |
692 Public method to get a categorized count of selected items. |
692 Public method to get a categorized count of selected items. |
693 |
693 |
694 @param filter list of classes to check against |
694 @param filterList list of classes to check against |
695 @return a dictionary containing the counts of items belonging |
695 @return a dictionary containing the counts of items belonging |
696 to the individual filter classes. The keys of the dictionary |
696 to the individual filter classes. The keys of the dictionary |
697 are the string representation of the classes given in the |
697 are the string representation of the classes given in the |
698 filter (i.e. str(filterClass)). The dictionary contains |
698 filter (i.e. str(filterClass)). The dictionary contains |
699 an additional entry with key "sum", that stores the sum of |
699 an additional entry with key "sum", that stores the sum of |
700 all selected entries fulfilling the filter criteria. |
700 all selected entries fulfilling the filter criteria. |
701 """ |
701 """ |
702 if filter is None: |
702 if filterList is None: |
703 filter = self.selectedItemsFilter |
703 filterList = self.selectedItemsFilter |
704 categories = {} |
704 categories = {} |
705 categories["sum"] = 0 |
705 categories["sum"] = 0 |
706 for typ in filter: |
706 for typ in filterList: |
707 categories[str(typ)] = 0 |
707 categories[str(typ)] = 0 |
708 |
708 |
709 indexes = self.selectedIndexes() |
709 indexes = self.selectedIndexes() |
710 for index in indexes: |
710 for index in indexes: |
711 if index.column() == 0: |
711 if index.column() == 0: |
712 itm = self.model().item(index) |
712 itm = self.model().item(index) |
713 for typ in filter: |
713 for typ in filterList: |
714 if isinstance(itm, typ): |
714 if isinstance(itm, typ): |
715 categories["sum"] += 1 |
715 categories["sum"] += 1 |
716 categories[str(typ)] += 1 |
716 categories[str(typ)] += 1 |
717 |
717 |
718 return categories |
718 return categories |