Exemple #1
0
    def parseFile(self, s):
        fichierBeerXML = s
        try:
            self.arbre = ET.parse(fichierBeerXML)
            presentation = self.arbre.find('.//RECIPE')  # noqa
            fermentables = self.arbre.findall('.//FERMENTABLE')
            hops = self.arbre.findall('.//HOP')
            levures = self.arbre.findall('.//YEAST')
            misc = self.arbre.findall('.//MISC')

            for element in hops:
                ImportBase.addHop(Hop.parse(element))
            for element in fermentables:
                ImportBase.addFermentable(Fermentable.parse(element))
            for element in misc:
                ImportBase.addMisc(Misc.parse(element))
            for element in levures:
                ImportBase.addYeast(Yeast.parse(element))
        except:
            self.warningFile()

        self.hopsNum = len(hops)
        self.fermNum = len(fermentables)
        self.miscNum = len(misc)
        self.yeastNum = len(levures)

        self.info()
Exemple #2
0
    def ajouter(self):
        y = Yeast()
        y.name = self.ui.lineEditNom.text()
        y.labo = self.ui.lineEditLabo.text()
        y.productId = self.ui.lineEditID.text()
        y.attenuation = self.ui.spinBoxAtten.value()

        if self.ui.comboBoxForme.currentIndex() is 0:
            y.form = 'Liquid'
        elif self.ui.comboBoxForme.currentIndex() is 1:
            y.form = 'Dry'
        elif self.ui.comboBoxForme.currentIndex() is 2:
            y.form = 'Slant'
        elif self.ui.comboBoxForme.currentIndex() is 3:
            y.form = 'Culture'
        else:
            y.form = 'Dry'

        ImportBase.addYeast(y)
        self.setModel()