Beispiel #1
0
    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")
Beispiel #2
0
    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")
Beispiel #3
0
    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 ")
Beispiel #4
0
    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']
Beispiel #5
0
    def reload_app_func(self):
        self.label_uname_display.config(text=self.controller.app_data["Username"].get())

        varchck = self.entry_speciality_settingsui.get()
        if cs.check_empty(varchck) is True:
            self.entry_speciality_settingsui.insert(0, self.controller.app_data["speciality"].get())
        else :
            self.entry_speciality_settingsui.delete(0, tk.END)
            self.entry_speciality_settingsui.insert(0, self.controller.app_data["speciality"].get())
Beispiel #6
0
    def reload_app_func(self):
        print("in reload func")
        self.label_patient_name.config(text=self.controller.app_data["patient_name"].get())
        varchck = self.entry_app1.get()

        in_file_p = self.controller.app_data["in_file_p"].get()
        input_data = cs.read_settings(in_file_p)
        for data_file in input_data['Settings']:
            if cs.check_empty(varchck) is True:
                self.entry_app1.insert(0, data_file['app1'])
                self.entry_app2.insert(0, data_file['app2'])
                self.entry_app3.insert(0, data_file['app3'])
                self.entry_app4.insert(0, data_file['app4'])
                self.entry_app5.insert(0, data_file['app5'])
Beispiel #7
0
    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
Beispiel #8
0
    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")