def valueChanged(self): self.step = MashStep() self.step.name = self.ui.lineEditStepName.text() if self.ui.comboBoxStepType.currentIndex() is 0: self.step.type = self.tr('''Infusion''') elif self.ui.comboBoxStepType.currentIndex() is 1: self.step.type = self.tr('''Temperature''') elif self.ui.comboBoxStepType.currentIndex() is 2: self.step.type = self.tr('''Decoction''') self.step.time = self.ui.doubleSpinBoxStepTime.value() self.step.temp = self.ui.doubleSpinBoxStepTemp.value() self.stepVol = 0
def importBeerXMLMashStep(data): mashStep = MashStep() for child in data: if 'NAME' == child.tag: mashStep.name = child.text if 'VERSION' == child.tag: mashStep.version = int(child.text) if 'TYPE' == child.tag: if 'Infusion' == child.text: mashStep.type = model.constants.MASH_STEP_INFUSION elif 'Temperature' == child.text: mashStep.type = model.constants.MASH_STEP_TEMPERATURE elif 'Decoction' == child.text: mashStep.type = model.constants.MASH_STEP_DECOCTION if 'STEP_TIME' == child.tag: mashStep.time = "%.0f" % float(child.text) if 'STEP_TEMP' == child.tag: mashStep.temp = "%.1f" % float(child.text) if 'INFUSE_AMOUNT' == child.tag: mashStep.infuseAmount = float(child.text) return mashStep
def importBSMXMashStep(data): mashStep = MashStep() mashStep.name = data.find('F_MS_NAME').text bsmx_step_type = { '0': model.constants.MASH_STEP_INFUSION, '1': model.constants.MASH_STEP_DECOCTION, '2': model.constants.MASH_STEP_TEMPERATURE } mashStep.type = bsmx_step_type.get( data.find('F_MS_TYPE').text, model.constants.MASH_STEP_INFUSION) mashStep.time = "%.0f" % float(data.find('F_MS_STEP_TIME').text) mashStep.temp = "%.1f" % farenheit_to_celsius( float(data.find('F_MS_STEP_TEMP').text)) mashStep.infuseAmount = bsmx_volume_conversion( float(data.find('F_MS_TUN_VOL').text)) return mashStep
def addStep(self): index = self.listWidgetMashProfiles.currentRow() selected_mash = ImportBase().listeMashes[index] i = self.listWidgetSteps.currentRow() step = MashStep() step.name = 'Nouveau palier' step.type = 'Infusion' step.time = '0' step.temp = '0' step.vol = '0' selected_mash.listeSteps.append(step) self.listWidgetMashProfiles.setCurrentRow(index) self.seeMash() self.stepDetails() self.listWidgetMashProfiles.setCurrentRow(index)
def importBSMXMashStep(data): mashStep = MashStep() mashStep.name = data.find('F_MS_NAME').text bsmx_step_type = { '0': model.constants.MASH_STEP_INFUSION, '1': model.constants.MASH_STEP_DECOCTION, '2': model.constants.MASH_STEP_TEMPERATURE } mashStep.type = bsmx_step_type.get(data.find('F_MS_TYPE').text, model.constants.MASH_STEP_INFUSION) mashStep.time = "%.0f" % float(data.find('F_MS_STEP_TIME').text) mashStep.temp = "%.1f" % farenheit_to_celsius(float(data.find('F_MS_STEP_TEMP').text)) mashStep.infuseAmount = bsmx_volume_conversion(float(data.find('F_MS_TUN_VOL').text)) return mashStep
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 importDictRecipe(dic): logger.debug("Start parsing dict") recipe = Recipe() recipe.path = dic['path'] recipe.name = dic['name'] recipe.brewer = dic['brewer'] recipe.style = dic['style'] if dic['type'] == "All Grain": recipe.type = RECIPE_TYPE_ALL_GRAIN elif dic['type'] == "Extract": recipe.type = RECIPE_TYPE_EXTRACT elif recipe.type == "Partial Mash": recipe.type = RECIPE_TYPE_PARTIAL_MASH recipe.volume = dic['volume'] recipe.boil = dic['boilTime'] recipe.efficiency = dic['efficiency'] for hop_dic in dic['hops']: hop = Hop() hop.name = hop_dic['name'] if hop_dic['form'] == "Pellet": hop.form = HOP_FORM_PELLET elif hop_dic['form'] == "Leaf": hop.form = HOP_FORM_LEAF elif hop_dic['form'] == "Plug": hop.form = HOP_FORM_PLUG hop.alpha = hop_dic['alpha'] hop.use = hop_dic['use'] hop.time = hop_dic['time'] hop.amount = hop_dic['amount'] recipe.listeHops.append(hop) for f_dic in dic['fermentables']: f = Fermentable() f.name = f_dic['name'] f.type = f_dic['type'] f.fyield = f_dic['fyield'] f.color = f_dic['color'] f.amount = f_dic['amount'] if f_dic['afterBoil'] == 'TRUE': f.useAfterBoil = True else: f.useAfterBoil = False f.recommendMash = f_dic['recoMash'] recipe.listeFermentables.append(f) for y_dic in dic['yeasts']: y = Yeast() y.name = y_dic['name'] y.productId = y_dic['product_id'] y.labo = y_dic['labo'] y.form = y_dic['form'] y.attenuation = y_dic['attenuation'] recipe.listeYeasts.append(y) for m_dic in dic['miscs']: m = Misc() m.name = m_dic['name'] m.amount = m_dic['amount'] m.type = m_dic['type'] m.use = m_dic['use'] m.time = m_dic['time'] recipe.listeMiscs.append(m) mash_dic = dic['mashProfile'] recipe.mash.name = mash_dic['name'] recipe.mash.ph = mash_dic['ph'] recipe.mash.spargeTemp = mash_dic['sparge'] recipe.mash.tunTemp = mash_dic['tunTemp'] for s_dic in mash_dic['steps']: s = MashStep() s.name = s_dic['name'] s.time = s_dic['time'] s.temp = s_dic['temp'] s.type = s_dic['type'] recipe.listeMashSteps.append(s) recipe.recipeNotes = dic['notes'] return recipe