Exemple #1
0
 def listCompare(self):
     print 'LIST COMPARE'
     selected = self.lists['selected']
     result = self.lists['result']
     
     lists = []
     for item in selected:
         if item.type != listtype.UNKNOWN:
             if item.type == listtype.PERSON:
                 lst = list_person(item.path)
             elif item.type == listtype.COMPANY:
                 lst = list_company(item.path)
             elif item.type == listtype.MYLIST:
                 lst = list_mylist(item.path)
             lists.append(lst)
     res = []
     compareMode = self.view.modes['list_compare'].get()
     if compareMode == 'intersect':
         res = list_inter(lists)
     elif compareMode == 'differ':
         res = list_diff(lists[0:2])
     elif compareMode == 'union':
         for lst in lists:
             for item in lst:
                 res.append(item)
                 
     result[:] = res
     
     self.uniqResult()
     self.sortResult()
     self.displayResult()
Exemple #2
0
 def list_t(self):
     lists = []
     for item in self.sel_lists:
         if item != None:
             if item[keys.LIST_TYPE] == keys.FTYPE_PERSON:
                 lst = list_person(item['file'])
             if item[keys.LIST_TYPE] == keys.FTYPE_COMPANY:
                 lst = list_company(item['file'])
             if item[keys.LIST_TYPE] == keys.FTYPE_MYLIST:
                 lst = list_mylist(item['file'])
             lists.append(lst)
     res = []
     if (self.compareMode.get() == self.COMPARE_MODES['intersect']):
         res = list_inter(lists)
     elif (self.compareMode.get() == self.COMPARE_MODES['differ']):
         res = list_diff(lists[0:2])
     elif (self.compareMode.get() == self.COMPARE_MODES['union']):
         for lst in lists:
             for item in lst:
                 res.append(item)            
     self.res_list = res
     # print_list(self.res_list)
     self.display_lists()