added button to go back to main page. default files work.

This commit is contained in:
zinph
2020-01-26 19:09:52 -05:00
parent 1c84b966db
commit e99c4150fa
3 changed files with 24 additions and 5 deletions

View File

@@ -214,7 +214,6 @@ class SIME:
When total compound is 1000000 or library size, this function will be called When total compound is 1000000 or library size, this function will be called
to write compounds to file. to write compounds to file.
''' '''
print(compound_list)
file_temp = self.smile_file_name + '_'+str(file_counter)+'.smiles' # attempts to split files because they get too large. Name of the first file will be "file_" + this variable file_temp = self.smile_file_name + '_'+str(file_counter)+'.smiles' # attempts to split files because they get too large. Name of the first file will be "file_" + this variable
with open(file_temp,'a+') as file_handler: with open(file_temp,'a+') as file_handler:
file_handler.write('\n'.join(compound_list)) file_handler.write('\n'.join(compound_list))

View File

@@ -23,6 +23,10 @@ app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
def main_page(): def main_page():
return render_template('index.html') return render_template('index.html')
@app.route('/success')
def success_page(duration):
return render_template('success.html', duration=duration)
@app.route('/collect_data',methods=['POST']) @app.route('/collect_data',methods=['POST'])
def collect_data(): def collect_data():
form_data = request.form form_data = request.form
@@ -73,11 +77,8 @@ def collect_data():
start_time = time.time() start_time = time.time()
sample.generate_templates_withExtendersNSugars(smile) sample.generate_templates_withExtendersNSugars(smile)
duration = convert_time(time.time()-start_time) duration = convert_time(time.time()-start_time)
f'Time Elapsed for Enumeration: {duration}'
return f'''Time Elapsed for Enumeration: {duration}. return success_page(duration)
Your chemical libraries have been generated.
Please check in LIBRARIES folder. The resulting files for info and smiles should be there.'''
#return form_data, form_files #return form_data, form_files
def convert_time(second): def convert_time(second):

19
templates/success.html Normal file
View File

@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<p>
Time Elapsed for Enumeration: {{duration}}.<br>
Your chemical libraries have been generated.<br>
Please check in LIBRARIES folder. The resulting files for info and smiles should be there.
</p>
<form class="" action="{{url_for('main_page')}}" method="get">
<input type="submit" name="" value="Go back to Main Page">
</form>
<!-- <button type="submit" name="button" onclick="{{url_for('main_page')}}" value="Go to Main Menu"></button> -->
</body>
</html>