This repository has been archived by the owner on May 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEditor.py
82 lines (76 loc) · 4.32 KB
/
Editor.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
73
74
75
76
77
78
79
80
81
82
<<<<<<< HEAD
from GUI import *
from tkinter.scrolledtext import*
class Editor(GUI):
def __init__(self, patient, dimensions='800x1400'):
super().__init__(dimensions, title=patient.name + ' info')
self.patient = patient
self.addField = Button(self.context,text="Add field",command=self.add_field).grid(row=0,column=2)
self.delete = Button(self.context,text="Delete from records").grid(row=1,column=2)
self.labels = []
self.entries = []
for i in range(len(patient.attributeIndex)):
self.labels.append(Label(self.context,text=patient.attributeIndex[i]+": ").grid(row=i,column=0))
if patient.attributeIndex[i] == 'Schedule' or patient.attributeIndex[i] == 'Current Medicines' or patient.attributeIndex[i] == 'Medical History':
self.entries.append(ScrolledText(self.context, height=1).grid(row=i,column=1))
else:
self.entries.append(Entry(self.context,textvariable=StringVar(self.context,value=patient.valuesIndex[i])).grid(row=i,column=1))
def add(self,field,screen):
self.patient.assert_attribute(field)
self.labels.append(Label(self.context,text=field+": ").grid(row=len(self.patient.attributeIndex)-1,column=0))
self.entries.append(Entry(self.context,textvariable=StringVar(self.context,value=self.patient.valuesIndex[len(self.patient.attributeIndex)-1])).grid(row=len(self.patient.attributeIndex)-1,column=1))
self.addField.destroy()
screen.destroy()
def add_field(self):
add_screen = Tk()
add_screen.title("New Field")
field_label = Label(add_screen, text="Field Name: ")
field_label.grid(row=0, column=0)
field = Entry(add_screen)
field.grid(row=0, column=1)
submit = Button(add_screen, text="submit", command=lambda: self.add(field.get(),add_screen))
submit.grid(row=0, column=2)
add_screen.mainloop()
def save(self):
for i in range(len(patient.attributeIndex)):
patient.change_attribute(patient.attributeIndex[i],entries[i].get())
<<<<<<< HEAD
=======
=======
from GUI import *
from tkinter.scrolledtext import*
class Editor(GUI):
def __init__(self, patient, dimensions='800x1400'):
super().__init__(dimensions, title=patient.name + ' info')
self.patient = patient
self.addField = Button(self.context,text="Add field",command=self.add_field).grid(row=len(patient.attributeIndex),column=1)
self.labels = []
self.entries = []
for i in range(len(patient.attributeIndex)):
self.labels.append(Label(self.context,text=patient.attributeIndex[i]+": ").grid(row=i,column=0))
if patient.attributeIndex[i] == 'Schedule' or patient.attributeIndex[i] == 'Current Medicines' or patient.attributeIndex[i] == 'Medical History':
self.entries.append(ScrolledText(self.context, height=1).grid(row=i,column=1))
else:
self.entries.append(Entry(self.context,textvariable=StringVar(self.context,value=patient.valuesIndex[i])).grid(row=i,column=1))
def add(self,field,screen):
self.patient.assert_attribute(field)
self.labels.append(Label(self.context,text=field+": ").grid(row=len(self.patient.attributeIndex)-1,column=0))
self.entries.append(Entry(self.context,textvariable=StringVar(self.context,value=self.patient.valuesIndex[len(self.patient.attributeIndex)-1])).grid(row=len(self.patient.attributeIndex)-1,column=1))
self.addField.destroy()
self.addField = Button(self.context,text="Add field",command=self.add_field).grid(row=len(self.patient.attributeIndex),column=1)
screen.destroy()
def add_field(self):
add_screen = Tk()
add_screen.title("New Field")
field_label = Label(add_screen, text="Field Name: ")
field_label.grid(row=0, column=0)
field = Entry(add_screen)
field.grid(row=0, column=1)
submit = Button(add_screen, text="submit", command=lambda: self.add(field.get(),add_screen))
submit.grid(row=0, column=2)
add_screen.mainloop()
def save(self):
for i in range(len(patient.attributeIndex)):
patient.change_attribute(patient.attributeIndex[i],entries[i].get())
>>>>>>> 031e54b813f23e08f7b4095995c85d6a99e57163
>>>>>>> 95730461f44ad139054e7a4fb9c58f48bf3acdba