diff --git a/AGREEmip_app.py b/AGREEmip_app.py index 7ea9a51f9dd9e529c98d01dad0289094e7ab44dd..245e0bbc9c9cea7878c22f7a67d7ccff8e009041 100644 --- a/AGREEmip_app.py +++ b/AGREEmip_app.py @@ -24,7 +24,7 @@ import numpy as np # start the main app root = tk.Tk() -root.title('AGREEmip - Analytical Greenness Metric for MIPs') +root.title('AGREEmip - Analytical Greenness Metric for MIPs [v. 0.9 - Beta for review]') root.geometry('800x490') root.iconbitmap('AGREEmip_icon.ico') @@ -226,11 +226,10 @@ def call_info_popup(): text = ttk.Label(win_frame, text='If you use AGREEmip, please cite:', wraplength=280, justify='left') text.grid(column=0, row=0, padx=8, pady=8, sticky='w') text2 = tk.Text(win_frame, width=50, height=5, wrap='word', bg=colors['background']) - citation = 'Author 1, Author 2 ..., AGREEmip - Analytical Greenness Metric' \ - ' for MIPs, Journal Name (2024), doi.org/10.0000/0000000000' + citation = 'Author 1, Author 2 ..., AGREEmip â the analytical greenness assessment tool for molecularly imprinted polymers synthesis, Journal Name (2024), doi.org/10.0000/0000000000' text2.grid(column=0, row=1, padx=8, pady=8, sticky='w') text2.insert(tk.END, citation) - text3 = ttk.Label(win_frame, text='Most recent version of the source code can be found at:', wraplength=320, justify='left') + text3 = ttk.Label(win_frame, text='The most recent version of the source code can be found at:', wraplength=320, justify='left') text3.grid(column=0, row=2, padx=8, pady=8, sticky='w') text4 = tk.Text(win_frame, width=50, height=1, wrap='word', bg=colors['background']) source_link = 'git.pg.edu.pl/p174235/agreemip' @@ -456,7 +455,7 @@ def calculate_sum(tab_index): if tab_index < len(tabs_items_states): tab_items_state = tabs_items_states[tab_index] total = sum(item_state['item']['value'] for item_state in tab_items_state if item_state['var'].get() == 1) - print("Total value of selected items for tab", tab_index, ":", total) + print("Total value of selected items for tab", tab_index + 1, ":", total) return total else: print("Invalid tab index") @@ -573,7 +572,7 @@ class Report: self.pdf.set_margins(left=25, top=20) self.tabs = tabs self.criteria = criteria - plt.savefig('temp_figure.png', bbox_inches='tight') + plt.savefig('temp_figure.png', bbox_inches='tight', dpi=300) # insert image (image, x, y, width): self.pdf.image('temp_figure.png', 107, 10, 80) # delete the temp file from drive: @@ -614,7 +613,13 @@ class Report: self.pdf.cell(12, 12, number, border=1, align='C') self.pdf.set_fill_color(240, 240, 240) self.pdf.set_font('Helvetica', 'B', 10) - self.pdf.cell(120, 6, tabs.title, border=1, ln=2, align='L', fill=True) + + if isinstance(tabs, str): + caption = tabs + else: + caption = tabs.title + + self.pdf.cell(120, 6, caption, border=1, ln=2, align='L', fill=True) self.pdf.set_font('Helvetica', '', 8) self.pdf.cell(120, 6, text, border=1, ln=0, align='L', fill=False) self.pdf.set_font('Helvetica', '', 10) @@ -631,7 +636,7 @@ class Report: self.pdf.cell(12, 12, str(criterion.radiovar.get()), border=1, fill=True, align='C') self.pdf.ln(15) - create_report_field('1.', self.tabs[0], self.criteria[0], + create_report_field('1.', 'Removal of polymerization inhibitors', self.criteria[0], ('Waste generation: ' + self.criteria[0].optionvar.get())) create_report_field('2.', self.tabs[1], self.criteria[1], @@ -650,7 +655,7 @@ class Report: ('Total mass of other reagents, adjuvants, or carriers: ' + self.criteria[5].valuevar.get() + ' [g]')) create_report_field('7.', self.tabs[6], self.criteria[6], - ('Total mass of reagents used in core/particles preparation, surface modification, or both: ' + self.criteria[6].valuevar.get() + ' [g]')) + ('Mass of reagents used in core/particles preparation, surface modification, or both: ' + self.criteria[6].valuevar.get() + ' [g]')) create_report_field('8.', self.tabs[7], self.criteria[7], ('Initiator: ' + self.criteria[7].optionvar.get())) @@ -733,8 +738,8 @@ tabs_items_states = [] Populate the tabs ''' # --------------------------- TAB1 --------------------------- -tab1 = Tab(tab_no='1 ', title='Preparation of polymerization reaction substrates - removal of polymerization inhibitors', - text1='Assessment of the consequences of removal of polymerization inhibitor from polymerization mixture. This can be done with solid and/or liquid waste generation, or without any resulting waste.', +tab1 = Tab(tab_no='1 ', title='Removal of polymerization inhibitors', + text1='Assessment of the consequences of removal of polymerization inhibitor from polymerization reagents. This can be done with solid and/or liquid waste generation, or without any resulting waste.', text2='Waste generation:', criterion=criteria[0]) # create a frame to pack the entry into in order to get a border for the entry: @@ -761,7 +766,7 @@ dropdown1.grid(column=0, row=3, padx=8, pady=8, sticky='w') # --------------------------- TAB2 --------------------------- tab2 = Tab(tab_no='2 ', title='Functional monomer', - text1='Duis semper turpis ipsum, pretium venenatis mauris ultricies sit amet.', + text1='Assess the risk associated with the functional monomer component of the polymerization mixture.', text2='Select the relevant hazard statements:', criterion=criteria[1]) @@ -799,7 +804,7 @@ ttk.Button(tab2.frame, text='Set', command=calc_crit_2, width=8).grid(column=0, # --------------------------- TAB3 --------------------------- tab3 = Tab(tab_no='3 ', title='Template', - text1='Duis semper turpis ipsum, pretium venenatis mauris ultricies sit amet.', + text1='Assess the risk associated with the template component of the polymerization mixture.', text2='Select the relevant hazard statements:', criterion=criteria[2]) @@ -836,7 +841,7 @@ ttk.Button(tab3.frame, text='Set', command=calc_crit_3, width=8).grid(column=0, # --------------------------- TAB4 --------------------------- tab4 = Tab(tab_no='4 ', title='Cross-linking agent', - text1='Duis semper turpis ipsum, pretium venenatis mauris ultricies sit amet.', + text1='Assess the risk associated with the cross-linking agent component of the polymerization mixture.', text2='Select the relevant hazard statements:', criterion=criteria[3]) @@ -870,8 +875,8 @@ ttk.Button(tab4.frame, text='Set', command=calc_crit_4, width=8).grid(column=0, # --------------------------- TAB5 --------------------------- -tab5 = Tab(tab_no='5 ', title='Porogen / solvent', - text1='Duis semper turpis ipsum, pretium venenatis mauris ultricies sit amet.', +tab5 = Tab(tab_no='5 ', title='Porogen/solvent', + text1='Assess the risk associated with the porogen/solvent component of the polymerization mixture.', text2='Select the relevant hazard statements:', criterion=criteria[4]) @@ -906,7 +911,7 @@ ttk.Button(tab5.frame, text='Set', command=calc_crit_5, width=8).grid(column=0, # --------------------------- TAB6 --------------------------- tab6 = Tab(tab_no='6 ', title='Other reagents, adjuvants, or carriers', - text1='Duis semper turpis ipsum, pretium venenatis mauris ultricies sit amet.', + text1='Assess the risk associated with other reagents, adjuvants, or carriers in the polymerization mixture.', text2='Select the relevant hazard statements:', criterion=criteria[5]) @@ -940,8 +945,8 @@ ttk.Button(tab6.frame, text='Set', command=calc_crit_6, width=8).grid(column=0, # --------------------------- TAB7 --------------------------- -tab7 = Tab(tab_no='7 ', title='Core / particles preparation and surface modification', - text1='Duis semper turpis ipsum, pretium venenatis mauris ultricies sit amet.', +tab7 = Tab(tab_no='7 ', title='Core/particles preparation and surface modification', + text1='Assess the risk associated with core/particles preparation and surface modification.', text2='Select the relevant hazard statements:', criterion=criteria[6]) @@ -976,7 +981,7 @@ ttk.Button(tab7.frame, text='Set', command=calc_crit_7, width=8).grid(column=0, # --------------------------- TAB8 --------------------------- tab8 = Tab(tab_no='8 ', title='Polymerisation initiation', - text1='Lorem ipsum dolor sit amet.', + text1='The polymerisation reaction can be initiated in several ways, some more problematic than others.', text2='Select the initiator:', criterion=criteria[7]) # create a frame to pack the entry into in order to get a border for the entry: @@ -1006,19 +1011,20 @@ dropdown8.grid(column=0, row=3, padx=8, pady=8, sticky='w') # --------------------------- TAB9 --------------------------- tab9 = Tab(tab_no='9 ', title='Size of polymer particles', - text1='Lorem ipsum dolor sit amet.', + text1='The size of the sorbent grain impacts the greenness of the system.', text2='Select the sorbent grain size:', criterion=criteria[8]) # create a frame to pack the entry into in order to get a border for the entry: f9 = tk.Frame(tab9.frame, border=2, background=colors['accent']) f9.grid(column=0, row=3, padx=8, pady=8, sticky='w') -tab9_choices = {'In-situ polymerisation': 1.0, - '> 1000 nm': 0.8, - '100-1000 nm': 0.6, - '10-100 nm': 0.4, - 'Carbon dots': 0.2, - 'Quantum dots': 0.1, +tab9_choices = {'Macro-MIPs': 1.0, + '> 1000 nm': 0.9, + '100-1000 nm': 0.8, + 'Âľm (obtained after crushing and sieving)': 0.6, + '10-100 nm': 0.5, + 'Carbon dots': 0.4, + 'Quantum dots': 0.2, } dropdown9 = ttk.OptionMenu(tab9.frame, criteria[8].optionvar, criteria[8].optionvar.get(), *tab9_choices.keys(), @@ -1037,7 +1043,7 @@ dropdown9.grid(column=0, row=3, padx=8, pady=8, sticky='w') # --------------------------- TAB10 --------------------------- tab10 = Tab(tab_no='10', title='Template elution solvent', - text1='Duis semper turpis ipsum, pretium venenatis mauris ultricies sit amet.', + text1='Assess the risk associated with template elution/removal.', text2='Select the relevant hazard statements:', criterion=criteria[9]) @@ -1069,7 +1075,7 @@ ttk.Button(tab10.frame, text='Set', command=calc_crit_10, width=8).grid(column=0 # --------------------------- TAB11 --------------------------- tab11 = Tab(tab_no='11', title='Template elution technique', - text1='Lorem ipsum dolor sit amet.', + text1='Assess the impact of the selected template elution/removal technique.', text2='Select the relevant elution technique:', criterion=criteria[10]) # create a frame to pack the entry into in order to get a border for the entry: @@ -1098,7 +1104,7 @@ dropdown11.grid(column=0, row=3, padx=8, pady=8, sticky='w') # --------------------------- TAB12 --------------------------- tab12 = Tab(tab_no='12', title='Final product reusability', - text1='Lorem ipsum dolor sit amet.', + text1='End product reusability is desirable.', text2='How many times can the final product be reused?', criterion=criteria[11]) # create a frame to pack the entry into in order to get a border for the entry: @@ -1110,8 +1116,8 @@ tab12_choices = {'Reused > 10 times': 1.0, 'Single use': 0.0, } -dropdown12 = ttk.OptionMenu(tab12.frame, criteria[11].optionvar, criteria[11].optionvar.get(), *tab11_choices.keys(), - command=lambda x: change_dropdown(criteria[11], tab11_choices)) +dropdown12 = ttk.OptionMenu(tab12.frame, criteria[11].optionvar, criteria[11].optionvar.get(), *tab12_choices.keys(), + command=lambda x: change_dropdown(criteria[11], tab12_choices)) # the ttk style for OptionMenu does not include a style for the tk dropdown menu, # so this has to be configured separately: dropdown12['menu'].config(background=colors['background'],