def valueChanged(self): self.mash = Mash() self.mash.name = self.ui.lineEditName.text() self.mash.ph = self.ui.doubleSpinBoxPh.value() self.mash.grainTemp = 0 self.mash.tunTemp = 0 self.mash.spargeTemp = self.ui.doubleSpinBoxSpargeT.value()
def mashComboChanged(self): self.brewdayLock = 0 try: i = self.comboBoxMashProfiles.currentIndex() self.currentMash = ImportBase().listeMashes[i] except: self.currentMash = self.currentRecipeMash if i == -1: self.currentMash = Mash() self.recipe.mash = self.currentMash
def importBSMXMash(data): mash = Mash() mash.name = data.find('F_MH_NAME').text mash.grainTemp = "%.2f" % farenheit_to_celsius( float(data.find('F_MH_GRAIN_TEMP').text)) mash.tunTemp = "%.2f" % farenheit_to_celsius( float(data.find('F_MH_TUN_TEMP').text)) mash.spargeTemp = "%.2f" % farenheit_to_celsius( float(data.find('F_MH_SPARGE_TEMP').text)) mash.ph = "%.1f" % float(data.find('F_MH_PH').text) mashSteps = data.find('steps').find('Data').findall('MashStep') for step in mashSteps: mash.listeSteps.append(importBSMXMashStep(step)) return mash
def __init__(self): self.path = "" self.name = "" self.brewer = "" self.type = model.constants.RECIPE_TYPE_ALL_GRAIN self.volume = 0.0 self.efficiency = 0.0 self.boil = 0.0 self.recipeNotes = "" self.style = "" self.mash = Mash() self.listeFermentables = list() self.listeHops = list() self.listeYeasts = list() self.listeMiscs = list() self.listeMashSteps = list()
def importBSMXMash(data): mash = Mash() mash.name = data.find('F_MH_NAME').text mash.grainTemp = "%.2f" % farenheit_to_celsius(float(data.find('F_MH_GRAIN_TEMP').text)) mash.tunTemp = "%.2f" % farenheit_to_celsius(float(data.find('F_MH_TUN_TEMP').text)) mash.spargeTemp = "%.2f" % farenheit_to_celsius(float(data.find('F_MH_SPARGE_TEMP').text)) mash.ph = "%.1f" % float(data.find('F_MH_PH').text) mashSteps = data.find('steps').find('Data').findall('MashStep') for step in mashSteps: mash.listeSteps.append(importBSMXMashStep(step)) return mash
def addMash(self): new_mash = Mash() new_mash.name = 'Nouveau profil' new_mash.grainTemp = '0' new_mash.tunTemp = '0' new_mash.spargeTemp = '78' new_mash.ph = 5.4 new_step = MashStep() new_step.name = 'Nouveau Palier' new_step.type = 'Infusion' new_step.time = '0' new_step.temp = '0' new_mash.listeSteps.append(new_step) ImportBase().listeMashes.append(new_mash) self.seeMash() self.listWidgetMashProfiles.setCurrentRow( len(ImportBase().listeMashes) - 1)
def importBeerXMLMash(data): mash = Mash() for child in data: if 'NAME' == child.tag: mash.name = child.text if 'GRAIN_TEMP' == child.tag: mash.grainTemp = child.text if 'TUN_TEMP' == child.tag: mash.tunTemp = child.text if 'SPARGE_TEMP' == child.tag: mash.spargeTemp = "%.1f" % float(child.text) if 'PH' == child.tag: mash.ph = "%.1f" % float(child.text) mashStep = data.findall('.//MASH_STEP') for element in mashStep: mash.listeSteps.append(importBeerXMLMashStep(element)) return mash
def importBeerXMLMash(data): mash = Mash() for child in data: if 'NAME' == child.tag: mash.name = child.text if 'GRAIN_TEMP' == child.tag: mash.grainTemp = child.text if 'TUN_TEMP' == child.tag: mash.tunTemp = child.text if 'SPARGE_TEMP' == child.tag: mash.spargeTemp = "%.1f" % float(child.text) if 'PH' == child.tag : mash.ph = "%.1f" % float(child.text) mashStep = data.findall('.//MASH_STEP') for element in mashStep: mash.listeSteps.append(importBeerXMLMashStep(element)) return mash
def __init__(self): logger.debug("Import %s", database_file) fichierBeerXML = database_file self.arbre = ET.parse(fichierBeerXML) presentation = self.arbre.find('.//RECIPE') fermentables = self.arbre.findall('.//FERMENTABLE') hops = self.arbre.findall('.//HOP') levures = self.arbre.findall('.//YEAST') misc = self.arbre.findall('.//MISC') self.listeFermentables = list() self.listeHops = list() self.listeYeasts = list() self.listeMiscs = list() # Ingredient fermentescibles for element in fermentables: self.listeFermentables.append(Fermentable.parse(element)) self.listeFermentables = sorted(self.listeFermentables, key=attrgetter('name')) logger.debug("%s fermentables in database, using %s bytes in memory", len(self.listeFermentables), sys.getsizeof(self.listeFermentables)) # Houblons for element in hops: self.listeHops.append(Hop.parse(element)) self.listeHops = sorted(self.listeHops, key=attrgetter('name')) logger.debug("%s hops in database, using %s bytes in memory", len(self.listeHops), sys.getsizeof(self.listeHops)) # Levures for element in levures: self.listeYeasts.append(Yeast.parse(element)) self.listeYeasts = sorted(self.listeYeasts, key=attrgetter('name')) logger.debug("%s yeasts in database, using %s bytes in memory", len(self.listeYeasts), sys.getsizeof(self.listeYeasts)) # Ingredients divers for element in misc: self.listeMiscs.append(Misc.parse(element)) self.listeMiscs = sorted(self.listeMiscs, key=attrgetter('name')) logger.debug("%s miscs in database, using %s bytes in memory", len(self.listeMiscs), sys.getsizeof(self.listeMiscs)) logger.debug("Import %s terminé", database_file) # Import Mash file logger.debug("Import %s", mash_file) arbre = ET.parse(mash_file) mash = arbre.findall('.//MASH') self.listeMashes = list() for element in mash: self.listeMashes.append(Mash.parse(element)) logger.debug("%s mash in database, using %s bytes in memory", len(self.listeMashes), sys.getsizeof(self.listeMashes)) logger.debug("Import %s terminé", mash_file)