Skip to content

Commit

Permalink
Fixes #3
Browse files Browse the repository at this point in the history
  • Loading branch information
jimbob88 committed Mar 26, 2019
1 parent aef94e7 commit 881b131
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions beer_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def __init__(self, master=None):
data = [line.strip().split('\t') for line in f]
for water_chem in data:
name = water_chem[0]
time = water_chem[1]
time = float(water_chem[1]) if water_chem[1] != 'N/A' else water_chem[1]
water_chem_type = water_chem[2]
brew_data.water_chemistry_additions[name] = {'Values': {'Type': water_chem_type}}
if time != 'N/A': brew_data.water_chemistry_additions[name]['Values']['Time'] = time
Expand Down Expand Up @@ -1333,7 +1333,7 @@ def create_html(self):

start += '<table style="width:800px"><tr><th>Hop Variety</th><th>Type</th><th>Alpha</th><th>Time</th><th>lb:oz</th><th>Grams</th><th>Ratio</th></tr>'
#temp_hop = [*self.hops] + [{'Name': addition, 'Values': brew_data.water_chemistry_additions[addition]['Values']} if brew_data.water_chemistry_additions[addition]['Values']['Type'] == 'Hop' else None for addition in self.sixth_tab.added_additions]
temp_hop = self.hops
temp_hop = self.hops[:]
for addition in self.sixth_tab.added_additions:
try:
if brew_data.water_chemistry_additions[addition]['Values']['Type'] == 'Hop':
Expand Down Expand Up @@ -1558,7 +1558,7 @@ def save_file(self, file):
percentage = hop['Values']['Percent']
f.write('hop\xa7{name}\t{type}\t{alpha}\t{ibu}\t{grams}\t{time}\t{percentage}\n'.format(name=hop['Name'], type=hop_type, alpha=alpha, ibu=ibu, grams=grams, time=time, percentage=percentage))
for addition in self.sixth_tab.added_additions:
all_chem = brew_data.water_chemistry_additions
all_chem = dict(brew_data.water_chemistry_additions)
all_chem.update(brew_data.yeast_data)
name = addition
addition_type = all_chem[name]
Expand All @@ -1579,7 +1579,7 @@ def save_file(self, file):
# 'Values': {'Type': 'Whole', 'Alpha': 12.7, 'Time': 0.0, 'Util': 0.0, 'ibu': 0.0, 'lb:oz': (0.0,0.0), 'Grams': 0.0, 'Percent': 0.0}
f.write('hop\xa7{name}\t{data}\n'.format(name=hop['Name'], data=hop['Values']))
for addition in self.sixth_tab.added_additions:
all_chem = {key: value for key, value in brew_data.water_chemistry_additions.items()}
all_chem = dict(brew_data.water_chemistry_additions)
all_chem.update(brew_data.yeast_data)
name = addition
addition_type = all_chem[name]
Expand Down
10 changes: 5 additions & 5 deletions beer_engine2.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import tkFileDialog as filedialog
import tkMessageBox as messagebox
import sys
import brew_data2 as brew_data
import brew_data
import platform
import math
import codecs
Expand Down Expand Up @@ -120,7 +120,7 @@ def __init__(self, master=None):
data = [line.strip().split(u'\t') for line in f]
for water_chem in data:
name = water_chem[0]
time = water_chem[1]
time = float(water_chem[1]) if water_chem[1] != u'N/A' else water_chem[1]
water_chem_type = water_chem[2]
brew_data.water_chemistry_additions[name] = {u'Values': {u'Type': water_chem_type}}
if time != u'N/A': brew_data.water_chemistry_additions[name][u'Values'][u'Time'] = time
Expand Down Expand Up @@ -1332,7 +1332,7 @@ def create_html(self):

start += u'<table style="width:800px"><tr><th>Hop Variety</th><th>Type</th><th>Alpha</th><th>Time</th><th>lb:oz</th><th>Grams</th><th>Ratio</th></tr>'
#temp_hop = [*self.hops] + [{'Name': addition, 'Values': brew_data.water_chemistry_additions[addition]['Values']} if brew_data.water_chemistry_additions[addition]['Values']['Type'] == 'Hop' else None for addition in self.sixth_tab.added_additions]
temp_hop = self.hops
temp_hop = self.hops[:]
for addition in self.sixth_tab.added_additions:
try:
if brew_data.water_chemistry_additions[addition][u'Values'][u'Type'] == u'Hop':
Expand Down Expand Up @@ -1557,7 +1557,7 @@ def save_file(self, file):
percentage = hop[u'Values'][u'Percent']
f.write(u'hop\xa7{name}\t{type}\t{alpha}\t{ibu}\t{grams}\t{time}\t{percentage}\n'.format(name=hop[u'Name'], type=hop_type, alpha=alpha, ibu=ibu, grams=grams, time=time, percentage=percentage))
for addition in self.sixth_tab.added_additions:
all_chem = brew_data.water_chemistry_additions
all_chem = dict(brew_data.water_chemistry_additions)
all_chem.update(brew_data.yeast_data)
name = addition
addition_type = all_chem[name]
Expand All @@ -1578,7 +1578,7 @@ def save_file(self, file):
# 'Values': {'Type': 'Whole', 'Alpha': 12.7, 'Time': 0.0, 'Util': 0.0, 'ibu': 0.0, 'lb:oz': (0.0,0.0), 'Grams': 0.0, 'Percent': 0.0}
f.write(u'hop\xa7{name}\t{data}\n'.format(name=hop[u'Name'], data=hop[u'Values']))
for addition in self.sixth_tab.added_additions:
all_chem = dict((key, value) for key, value in brew_data.water_chemistry_additions.items())
all_chem = dict(brew_data.water_chemistry_additions)
all_chem.update(brew_data.yeast_data)
name = addition
addition_type = all_chem[name]
Expand Down

0 comments on commit 881b131

Please sign in to comment.