From c4908ede5ec6e472f406cc6fd303f083b13925ae Mon Sep 17 00:00:00 2001
From: Wojciech Wojnowski <wojciech.wojnowski@pg.edu.pl>
Date: Mon, 22 Jun 2020 08:22:34 +0000
Subject: [PATCH] Added the "Cite As" file menu item

---
 AGREE.py | 45 ++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 42 insertions(+), 3 deletions(-)

diff --git a/AGREE.py b/AGREE.py
index e422ff7..3903393 100644
--- a/AGREE.py
+++ b/AGREE.py
@@ -79,7 +79,7 @@ def popup_bonus():
     def callback(event):
         webbrowser.open_new(event.widget.cget("text"))
 
-    popup_label1 = Label(win, text='v. 0.4 2020', justify=LEFT)
+    popup_label1 = Label(win, text='v. 0.5 2020', justify=LEFT)
     popup_label1.grid(row=0, column=0, padx=8, pady=8)
 
     popup_label2 = Label(win, text=r'https://git.pg.edu.pl/p174235/AGREE', fg='blue', cursor='hand2', justify=LEFT)
@@ -94,6 +94,42 @@ def popup_bonus():
     popup_button = Button(win, text="Close", command=win.destroy)
     popup_button.grid(row=3, column=0, padx=8, pady=8)
 
+# create the popup window with citing information:
+def cite_as():
+    win = Toplevel()
+    win.wm_title('Cite As')
+    win.iconbitmap('icon_eTk_icon.ico')
+
+    def callback(event):
+        webbrowser.open_new(event.widget.cget("text"))
+
+    cite_label1 = Label(win, text="If you are using the AGREE calculator in your research, please cite: \n"
+                 "Pena-Pereira F., Wojnowski W., Tobiszewski M., AGREE – Analytical GREEnness metric approach and software,\n"
+                                  " Analytical Chemistry (2020), DOI: 10.1021/acs.analchem.0c01887", justify=LEFT)
+    cite_label1.grid(row=0, column=0, padx=8, pady=8)
+
+    cite_label2 = Label(win, text=r'https://doi.org/10.1021/acs.analchem.0c01887', fg='blue', cursor='hand2', justify=LEFT)
+    cite_label2.grid(row=1, column=0, padx=8, pady=8)
+    cite_label2.bind('<Button-1>', callback)
+
+    cite_label3 = Label(win, text='BibTeX entry:', justify=LEFT)
+    cite_label3.grid(row=2, column=0, padx=8, pady=8)
+
+    cite_label4 = Label(win,
+                         text='@article{AC:penapereira2020a,\n'
+                              'author = {Pena-Pereira Francisco and Wojnowski Wojciech and Tobiszewski Marek},\n'
+                              'title = {AGREE – Analytical GREEnness metric approach and software},\n'
+                              'journal = {Analytical Chemistry},\n'
+                              'year = {2020},\n'
+                              'url = http://doi.org/10.1021/acs.analchem.0c01887\n'
+                              '}',
+                         wraplength=500, justify=LEFT, bg='white')
+
+    cite_label4.grid(row=3, column=0, padx=8, pady=8)
+
+    cite_button = Button(win, text="Close", command=win.destroy)
+    cite_button.grid(row=4, column=0, padx=8, pady=8)
+
 
 # connect a float in range 0.0 : 1.0 to a colour in a spectrum from red to yellow to green (256 discrete colour values):
 def colorMapper(value):
@@ -199,13 +235,16 @@ menu = Menu(root)
 root.config(menu=menu)
 
 FileMenu = Menu(menu)
+AboutMenu = Menu(menu)
 
 # add drop-down functionality:
 menu.add_cascade(label='File', menu=FileMenu)
-FileMenu.add_command(label='Info', command=popup_bonus)
-FileMenu.add_separator()
+menu.add_cascade(label='About', menu=AboutMenu)
+AboutMenu.add_command(label='Info', command=popup_bonus)
+# FileMenu.add_separator()
 FileMenu.add_command(label='Save image', command=saveImage)
 
+AboutMenu.add_command(label='How to Cite', command=cite_as)
 
 # ******** Statusbar *************
 def createStatusBar():
-- 
GitLab