def initialize(self): """ Initialize the combobox contening all available type of filter and the entry text to choose the value of Q factor """ self.typeCombo = Combobox(self.root, textvariable=self.typeFilter, values=F.values(), width="5") self.typeCombo.grid(row=1,column=self.id, padx=10) self.qText = Entry(self.root, textvariable=self.qFactor, width="5") self.qText.grid(row=2,column=self.id, padx=10, pady=5)
def parse(self): """ Parse the xml file for creation of a list of filters """ self.root = ET.parse(self.filename).getroot() if self.root.tag != 'config' : raise NameError("The root tag must be called 'config'") confElements = self.root.getchildren() if len(self._filters) != 0 : self._filters = [] for element in confElements: if element.tag == 'filters': for filterTag in element.getchildren(): fType = F.get(filterTag.get('type')) if fType is None: continue dicFilt = filterTag.attrib dicFilt.update({"filterFunc":self._instanciateFilter(fType,filterTag.attrib)}) self._filters.append(dicFilt)