예제 #1
0
 def applyfilters(self, variables, filterscs):
     '''
     This method applies the filters to the files by taking in the two list, one of which contains
     the files checked to apply, the other one contains the filters checked to apply, and this
     method will change the state string accordingly
     '''
     if GUI.fileObj == []:
         for thefile in GUI.fileName:
             GUI.fileObj.append(Document(thefile))
         for D in GUI.fileObj:
             D.generateWhole()
     elif len(GUI.fileObj) != len(GUI.fileName):
         lengthD = len(GUI.fileName) - len(GUI.fileObj)
         for i in range(lengthD)[::-1]:
             GUI.fileObj.append(Document(GUI.fileName[-(1 + i)]))
             GUI.fileObj[-1].generateWhole()
     empty = True
     for i in range(len(variables)):
         if variables[i].get() == 1:
             dofil = TextFilter(GUI.fileObj[i])
             dofil.apply([
                 self.filters[j]
                 for j in range(len(filterscs)) if filterscs[j].get() == 1
             ], GUI.fileObj[i])
             empty = False
     if empty == True:
         self.sti = 'Nothing applied'
     else:
         self.sti = 'Successfully applied'
     self.sti_text.set(self.sti)
예제 #2
0
 def applyFilter(self,method):
     '''Adds filter to list of filter methods if the button pressed is not "Apply Filter". If the button is Apply Filter,
         then the list of filters will subsequently be applied to the documents.'''
     if method == "apply filters":
         for doc in self.fileL:
             newtext = TextFilter(doc.fileName, self.filtL)
             newtext.apply()
             doc.doc = newtext.doc
     else:
         if method not in self.filtL:
             self.filtL.append(str(method))
예제 #3
0
 def applyPredFilt(self, file):
     newtext = TextFilter(file.fileName, self.filtL)
     newtext.apply()
     file.doc = newtext.doc
     return file