From 6322ce0a3f849dfc60325fa964cef66f3c17fd26 Mon Sep 17 00:00:00 2001
From: Wojciech Wojnowski <wojciech.wojnowski@pg.edu.pl>
Date: Tue, 7 Dec 2021 20:57:59 +0000
Subject: [PATCH] Update main.py

---
 main.py | 52 +++++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 39 insertions(+), 13 deletions(-)

diff --git a/main.py b/main.py
index 4c65892..0d8904b 100644
--- a/main.py
+++ b/main.py
@@ -1,6 +1,5 @@
 '''
 W.Wojnowski 2021
-wojciech.wojnowski@pg.edu.pl
 '''
 # imports:
 import tkinter as tk
@@ -157,6 +156,7 @@ def call_info_popup():
     win = tk.Toplevel()
     win_frame = tk.Frame(win, width=500, background=colors['foreground'])
     win_frame.pack()
+    win.iconbitmap('AGREEPrep_icon.ico')
     win.wm_title('About and citation info')
     title = ttk.Label(win_frame, text='Some title', font=('TkDefaultFont', 10, 'bold'), justify='left')
     title.grid(column=0, row=0, padx=8, pady=8, sticky='w')
@@ -165,9 +165,6 @@ def call_info_popup():
                                      'https://git.pg.edu.pl/p174235/agreeprep', wraplength=280, justify='left')
     text.grid(column=0, row=1, padx=8, pady=8, sticky='w')
 
-    cite_button = ttk.Button(win_frame, text="Close", command=win.destroy)
-    cite_button.grid(row=4, column=0, padx=8, pady=8)
-
 
 def save_image():
     ftypes = [('PNG file', '.png'), ('SVG file', '.svg'), ('All files', '*')]
@@ -188,9 +185,9 @@ def reset_scores():
     criteria[1].radiovar.set(5)
     criteria[2].radiovar.set(2)
     criteria[3].radiovar.set(4)
-    criteria[4].radiovar.set(1)
+    criteria[4].radiovar.set(2)
     criteria[5].radiovar.set(3)
-    criteria[6].radiovar.set(1)
+    criteria[6].radiovar.set(2)
     criteria[7].radiovar.set(4)
     criteria[8].radiovar.set(2)
     criteria[9].radiovar.set(3)
@@ -324,9 +321,9 @@ criteria[0].radiovar.set(1)
 criteria[1].radiovar.set(5)
 criteria[2].radiovar.set(2)
 criteria[3].radiovar.set(4)
-criteria[4].radiovar.set(1)
+criteria[4].radiovar.set(2)
 criteria[5].radiovar.set(3)
-criteria[6].radiovar.set(1)
+criteria[6].radiovar.set(2)
 criteria[7].radiovar.set(4)
 criteria[8].radiovar.set(2)
 criteria[9].radiovar.set(3)
@@ -529,7 +526,7 @@ class Report:
 
         create_report_field('8.', self.tabs[7], self.criteria[7],
                             ('Approximate energy consumption per analysis [W]: ' +
-                            self.criteria[7].valuevar.get()))
+                             self.criteria[7].valuevar.get()))
 
         create_report_field('9.', self.tabs[8], self.criteria[8],
                             (self.criteria[8].optionvar.get()))
@@ -552,13 +549,43 @@ Populate the tabs
 # --------------------------- TAB1 ---------------------------
 tab1 = Tab(tab_no='1', title='Sample preparation placement',
            text1='Procedures that avoid excessive sample transportation and '
-                 'apply sample preparation that is integrated in analytical procedure are favoured',
+                 'apply sample preparation that is integrated in analytical procedure are favoured.',
            text2='Sample preparation placement:', criterion=criteria[0])
+
+# create a clickable question mark label that opens a separate mini info page:
+label_tab1 = ttk.Label(tab1.frame, text='❓', cursor="hand2", foreground=colors['accent'])
+label_tab1.grid(column=0, row=2, padx=170, pady=8, sticky='w')
+
+
+def call_tab1_popup():
+    win_tab1 = tk.Toplevel()
+    win_tab1_frame = tk.Frame(win_tab1, width=800, background=colors['foreground'])
+    win_tab1_frame.pack()
+    win_tab1.wm_title('Sample preparation placement')
+    win_tab1.iconbitmap('AGREEPrep_icon.ico')
+    text = ttk.Label(win_tab1_frame, text='•    In-line/In situ – sample preparation is carried out in the \n'
+                                          '      investigated object. It usually integrates sampling and sample \n'
+                                          '      preparation. Good examples can be in-vivo SPME application or \n'
+                                          '      the use of passive samplers; \n'
+                                          '•    On-line/In situ – sample preparation is performed in situ, \n'
+                                          '      sampling and sample preparation are performed in the same \n'
+                                          '      place using permanently installed devices with the overall \n'
+                                          '      operation being typically fully automated; \n'
+                                          '•    On site – sample preparation is performed on site, with the \n'
+                                          '      sample preparation device being brought to the sampling site; \n'
+                                          '•    Ex situ – sample preparation is performed in the laboratory \n'
+                                          '      after sample collection and transportation.',
+                     wraplength=400, justify='left')
+    text.grid(column=0, row=1, padx=8, pady=8, sticky='w')
+
+
+label_tab1.bind("<Button-1>", lambda e: call_tab1_popup())
+
 # create a frame to pack the entry into in order to get a border for the entry:
 f1 = tk.Frame(tab1.frame, border=2, background=colors['accent'])
 f1.grid(column=0, row=3, padx=8, pady=8, sticky='w')
 
-tab1_choices = {'In-line': 1.0, 'On-line': 0.66, 'At-line': 0.33, 'Off-line': 0.0}
+tab1_choices = {'In-line/In situ': 1.0, 'On-line/In situ': 0.66, 'On site': 0.33, 'Ex situ': 0.0}
 dropdown1 = ttk.OptionMenu(tab1.frame, criteria[0].optionvar, criteria[0].optionvar.get(), *tab1_choices.keys(),
                            command=lambda x: change_dropdown(criteria[0], tab1_choices))
 # the ttk style for OptionMenu does not include a style for the tk dropdown menu,
@@ -624,7 +651,7 @@ tab3_choices = {'Only sustainable and renewable materials are used several times
                 '50-75% of reagents and materials are sustainable or renewable and can only be used once': 0.50,
                 '25-50% of reagents and materials are sustainable or renewable': 0.25,
                 '< 25% of reagents and materials are sustainable or renewable and can only be used once': 0,
-                'Materials are not sustainable or renewable and are used several times': 0.5,}
+                'Materials are not sustainable or renewable and are used several times': 0.5, }
 dropdown3 = ttk.OptionMenu(tab3.frame, criteria[2].optionvar, criteria[2].optionvar.get(), *tab3_choices.keys(),
                            command=lambda x: change_dropdown(criteria[2], tab3_choices))
 # the ttk style for OptionMenu does not include a style for the tk dropdown menu,
@@ -732,7 +759,6 @@ def calc_crit_6(event=None):
     create_plot()
 
 
-
 entry6.bind('<Return>', calc_crit_6)
 ttk.Button(tab6.frame, text='Set', command=calc_crit_6, width=8).grid(column=0, row=3, padx=80, pady=8, sticky='w')
 
-- 
GitLab