def save_func(self): print("in save_func") global entry_passwd_var6 global entry_speciality_val entry_passwd_var6 = self.entry_password_settingsui.get() entry_speciality_val = self.entry_speciality_settingsui.get() input_uname = self.controller.app_data["Username"].get() input_pwd = self.controller.app_data["password"].get() speciality_val = self.controller.app_data["speciality"].get() path_val = self.controller.app_data["doc_path"].get() if cs.check_empty(entry_passwd_var6) is True: entry_passwd_var6 = input_pwd else: entry_passwd_var6 = self.entry_password_settingsui.get() if cs.check_empty(entry_speciality_val) is True: entry_speciality_val = speciality_val else: entry_speciality_val = self.entry_speciality_settingsui.get() ciphertext_input = cs.encrypt(entry_passwd_var6) created_settings_file = cs.write_doc_settings(input_uname, ciphertext_input, entry_speciality_val, path_val) if cs.file_existence(created_settings_file) is True: self.controller.app_data["password"].set(entry_passwd_var6) self.controller.app_data["speciality"].set(entry_speciality_val) print("settings saved file name " + created_settings_file) messagebox.showinfo("Save Successful", "New Settings are Updated Successfully ") else: messagebox.showerror("Update Failed", "New Settings are not Updated!! Please try again later")
def addpatient_func(self): print("in add patient") patientnameval = self.entry_patient_name.get() if cs.check_empty(patientnameval) is False: doc_uname = self.controller.app_data["Username"].get() path_val = self.controller.app_data["doc_path"].get() patient_dir = cs.create_dir(doc_uname, patientnameval, False) print("patient dir is ", patient_dir) patients_file = cs.write_patient_settings(patientnameval, "abc", "abc", "abc", "abc", "abc", patient_dir) plist_fname = cs.write_plist_file(patientnameval, path_val) if cs.file_existence(plist_fname): print("patient added to file") self.controller.app_data["patient_name"].set(patientnameval) self.controller.app_data["patient_path"].set(patient_dir) self.controller.app_data["in_file_p"].set(patients_file) self.entry_patient_name.delete(0, tk.END) self.controller.show_frame("PatientsForm") else: print("patient name not added to list") else: messagebox.showerror("Empty Field", "Please fill the patients name ")
def save_func(self): print("in save_func") valp = self.entry_app1.get() print(valp) print(cs.check_empty(self.entry_app1.get())) if cs.check_empty(self.entry_app1.get()) is True: print("fields are empty") messagebox.showerror("Empty Fields", "Please fill all the fields") else: patient_name = self.controller.app_data["ch_patient"].get() p_path = self.controller.app_data["doc_path"].get() path = p_path + "/" + patient_name if cs.check_empty(entry_app_var1) is False and cs.check_empty(entry_app_var2) is False and cs.check_empty( entry_app_var3) is False and cs.check_empty(entry_app_var4) is False and cs.check_empty( entry_app_var5) is False: patients_setting_file = cs.write_patient_settings(patient_name, entry_app_var1, entry_app_var2, entry_app_var3, entry_app_var4, entry_app_var5, path) else: messagebox.showerror("Empty Fields", "Please fill all the fields") if cs.file_existence(patients_setting_file) is True: self.controller.app_data["app_1"].set(entry_app_var1) self.controller.app_data["app_2"].set(entry_app_var2) self.controller.app_data["app_3"].set(entry_app_var3) self.controller.app_data["app_4"].set(entry_app_var4) self.controller.app_data["app_5"].set(entry_app_var5) print("settings saved file " + patients_setting_file) messagebox.showinfo("Save Succesful", "New Settings are Updated Successfully ") else: messagebox.showerror("Update Failed", "New Settings are not Updated!! Please try again later")
def runapp_func(self): print("In the run app func") patient_name_data = self.patient_name.get() # patient_name_data = patient_name_data.split() # self.controller.app_data["ch_patient"].set(patient_name_data[0]) path = self.controller.app_data["doc_path"].get() filename_patient = path + "/" + patient_name_data + "/" + patient_name_data + ".json" if cs.check_empty(patient_name_data) is True: messagebox.showerror("Patient not selected", "Please select the patient") elif cs.file_existence(filename_patient) is False: messagebox.showerror("Not a valid Patient", "Please select valid patient") else : p_name = patient_name_data p_path = self.controller.app_data["doc_path"].get() in_file_p = p_path + "/" + p_name + "/" + p_name + ".json" # print(in_file_p) input_patient_data = cs.read_settings(in_file_p) for data_file in input_patient_data['Settings']: app1_dbf = data_file['app1'] app2_dbf = data_file['app2'] app3_dbf = data_file['app3'] app4_dbf = data_file['app4'] app5_dbf = data_file['app5']
def login_func(self): input_uname = self.entry_username.get() input_pwd = self.entry_password.get() in_file = input_uname + ".json" path = cs.get_path() in_file = path + "/" + input_uname + "/" + in_file if cs.file_existence(in_file) is False: print("file does not exist so login fail") messagebox.showerror("Login Fail", "User does not Exist") self.entry_username.delete(0, tk.END) self.entry_password.delete(0, tk.END) else: self.controller.app_data["Username"].set(input_uname) self.controller.app_data["in_file"].set(in_file) self.controller.app_data["password"].set(input_pwd) updated_path_val = path + "/" + input_uname self.controller.app_data["doc_path"].set(updated_path_val) input_data = cs.read_settings(in_file) for data_file in input_data['Settings']: red_pwd = data_file['password'] red_unm = data_file['name'] if cs.check_unm(red_unm, input_uname) is True and cs.check_pswd(red_pwd, input_pwd) is True: print("login success") self.controller.app_data["speciality"].set(data_file['speciality']) self.controller.show_frame("DashboardForm") print("on DashboardForm1") else: messagebox.showerror("Login error", "Incorrect Credentials") input_uname = self.entry_username.delete(0, tk.END) input_pwd = self.entry_password.delete(0, tk.END)
def modview_func(self): # patient_name_data = self.patient_name.get() # patient_name_data = patient_name_data.split() patient_modview = self.patient_name.get() self.controller.app_data["ch_patient"].set(patient_modview) path = self.controller.app_data["doc_path"].get() filename_patient = path + "/" + patient_modview + "/" + patient_modview + ".json" print(filename_patient) if cs.file_existence(filename_patient) is False: messagebox.showerror("Not a valid Patient", "Please select valid patient") elif cs.check_empty(patient_modview) is False: self.controller.show_frame("ModViewForm") else: messagebox.showerror("Empty Field", "Please Select a Patient")
def select_patient_func(self): path = self.controller.app_data["doc_path"].get() fname = path + "/" + "plist.txt" if cs.file_existence(fname) == False: messagebox.showerror("Patient List Empty", "Please add the patient") else : p_data = cs.read_plist_file(path) self.patient_text = tk.Text(self) self.patient_text.insert(tk.END, p_data) self.patient_text.place(x=300, y=40,height=130,width=130) self.patientlist_title.place(x=300, y=20) self.patient_name.place(x=100, y=40) self.modifyviewbtn.place(x=100, y=100) self.runappbtn.place(x=100, y=160)
def register_func(self): print("in register_func") uname_val = self.entry_username.get() pwd_val = self.entry_password.get() pwd_re_val = self.entry_password_reenter.get() speciality_val = self.entry_speciality.get() if cs.check_empty(pwd_re_val) is True: messagebox.showerror("Empty Credentials", "Please fill all the fields") elif pwd_re_val != pwd_val: messagebox.showerror("Password do not match", "Please enter same password") else: in_file = uname_val + ".json" ciphertext_input = cs.encrypt(pwd_val) path = cs.create_dir(uname_val, 'abc', True) print("path register = ", path) in_file = path + "/" + in_file if cs.file_existence(in_file) is False: print("file does not exist so write settings") if cs.check_empty(uname_val) is False and cs.check_empty(pwd_val) is False: created_settings_file = cs.write_doc_settings(uname_val, ciphertext_input, speciality_val, path) print("register successful file created " + created_settings_file) messagebox.showinfo("Register Succesful", "Please set app preferences in settings") self.entry_username.delete(0, tk.END) self.entry_password.delete(0, tk.END) self.entry_password_reenter.delete(0, tk.END) self.entry_speciality.delete(0, tk.END) else: messagebox.showerror("Empty Credentials", "Please fill all the fields") else: input_data = cs.read_settings(in_file) for settings_data_file in input_data['Settings']: if settings_data_file['name'] == uname_val: print("data exist! you cannot re-register") messagebox.showerror("Error", "User Already Exists!! You cannot Re-Register") break