-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcitationcheck.py
72 lines (65 loc) · 3.41 KB
/
citationcheck.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
###############################################################################################
###############################################################################################
# /************ CitationCheck ************/ #
# v1.0 #
###############################################################################################
###############################################################################################
from platform import system
from multiprocessing import freeze_support
import cc_upperframe
import cc_lowerframe
from tkinter import PhotoImage
from customtkinter import CTkInputDialog
from customtkinter import CTkFont
from customtkinter import CTk
from customtkinter import set_appearance_mode
from customtkinter import set_default_color_theme
from json import load
from json import dump
from re import search
###############################################################################################
##################################### MAINAPP #####################################
###############################################################################################
class App(CTk):
def __init__(self):
super().__init__()
set_appearance_mode("System")
set_default_color_theme("dark-blue")
self.geometry("800x600")
self.title("CheckCitation")
if system() == 'Windows':
self.iconbitmap('assets/logo.ico')
else:
icon_cc = PhotoImage(file='assets/logo.png')
self.iconphoto(False, icon_cc)
self.grid_rowconfigure(0, weight=1)
self.grid_rowconfigure(1, weight=1)
self.grid_rowconfigure(2, weight=1)
self.grid_rowconfigure(3, weight=1)
self.grid_rowconfigure(4, weight=0)
self.grid_columnconfigure(0, weight=1)
self.upperframe = cc_upperframe.UpperFrame(master=self)
self.upperframe.grid(row=0, column=0, padx=0, pady=0, rowspan=4, sticky="news")
self.lowerframe = cc_lowerframe.LowerFrame(master=self, height=10)
self.lowerframe.grid(row=4, column=0, padx=0, pady=0, sticky="new")
content_dict = {}
with open('assets/cc_email.json') as email_file:
content_dict = load(email_file)
if content_dict == {}:
dialog = CTkInputDialog(text="Please type in your email address:", title="Email address", button_fg_color="#bf0041", button_hover_color="#8d0433", button_text_color="black", font=CTkFont(family='times new roman 16 bold', size=17, weight="bold"))
email = dialog.get_input()
if email == "" or (search(r"^\S+@\S+\.\S+$", email) is None):
email = "[email protected]"
content_dict = {
'email': email
}
with open("assets/cc_email.json", mode="w", encoding="utf-8") as email_file:
dump(content_dict, email_file)
if __name__ == "__main__":
if system() == 'Windows':
freeze_support()
app = App()
app.mainloop()
###############################################################################################
##################################### MAINAPP #####################################
###############################################################################################