/
Ingresosinpmw.py
232 lines (180 loc) · 9.17 KB
/
Ingresosinpmw.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# -*- coding: cp1252 -*-
import Pmw
import VentanaExtra
import ventanaEditarPaciente
import editRadio
import editAntecedentes
from SearchCriteria import *
from patronesRecurrentes import filtrarPaciente
from librerias.querys.queryList import *
from DatosRadio import vistaRadio
from modeloAntecedentes import vistaAntecedentes
class Demo:
def __init__(self, parent):
self.currentIdRadio = None
self.parent = parent
self.parent.wm_title("Ingreso de datos")
Pmw.aboutversion('1.0')
Pmw.aboutcopyright('Copyright UchileDB\nAll rights reserved')
Pmw.aboutcontact(
'Contacto :\n' +
' Informacion de contacto\n' +
' Phone: +995096669\n' +
' email: andreslago5@hotmail.com\n' +
' email: jjatjenkins1@gmail.com\n' +
' aferral and argorthas'
)
self.about = Pmw.AboutDialog(parent, applicationname = 'Interfaz grafica base de datos Radiografias Uchile')
self.about.withdraw()
#################################################
# Create the Balloon for this toplevel.
self.balloon = Pmw.Balloon(parent)
# Create and install the MenuBar.
menuBar = Pmw.MainMenuBar(parent,
balloon = self.balloon)
parent.configure(menu = menuBar)
self.menuBar = menuBar
# Add some buttons to the MainMenuBar.
menuBar.addmenu('Create', 'Close this window or exit')
menuBar.addmenuitem('Create', 'command', 'Exit the application',
command = self.createVentanaPaciente,
label = 'Paciente')
menuBar.addmenu('Edit','asd')
menuBar.addmenuitem('Edit', 'command', 'Delete the current selection',
command = lambda: self.newWindow("Medicamento",
queryAddMedicamento,queryDeleteMedicamento,
queryUpdateMedicamento,queryListaMedicamento,
self.actualizaListas),
label = 'Medicamento')
menuBar.addmenuitem('Edit', 'command', 'Delete the current selection',
command = lambda: self.newWindow("Alergia",queryAddAlergia,
queryDeleteAlergia,
queryUpdateAlergia,
queryListaAlergia,
self.actualizaListas),
label = 'Alergia')
menuBar.addmenuitem('Edit', 'command', 'Delete the current selection',
command = lambda: self.newWindow("Droga",queryAddDroga,
queryDeleteDroga,
queryUpdateDroga,
queryListaDroga,
self.actualizaListas),
label = 'Droga')
menuBar.addmenuitem('Edit', 'separator')
menuBar.addmenuitem('Edit', 'command', 'Delete the current selection',
command = self.editRadio,
label = 'Radio')
menuBar.addmenuitem('Edit', 'command', 'Delete the current selection',
command = self.editAntecedentes,
label = 'Antecedentes')
menuBar.addmenuitem('Edit', 'separator')
menuBar.addmenuitem('Edit', 'command', 'Delete the current selection',
command = lambda: self.newWindow("Procedencia",
queryAddProce,queryDeleteProce,
queryUpdateProce,queryListaProce,
self.actualizaListas),
label = 'Procedencia')
menuBar.addmenuitem('Edit', 'command', 'Delete the current selection',
command = lambda: self.newWindow("Zona",
queryAddZona,queryDeleteZona,
queryUpdateZona,queryListaZona,
self.actualizaListas),
label = 'Zona')
menuBar.addmenuitem('Edit', 'command', 'Delete the current selection',
command = lambda: self.newWindow("Tipo",
queryAddTipo,queryDeleteTipo,
queryUpdateTipo,queryListaTipo,
self.actualizaListas),
label = 'Tipo')
menuBar.addmenuitem('Edit', 'separator')
menuBar.addmenuitem('Edit', 'command', 'Delete the current selection',
command = lambda: self.newWindow("Tipo",
queryAddEnfermedad,queryDeleteEnfermedad,
queryUpdateEnfermedad,queryListaEnfermedad,
self.actualizaListas),
label = 'Enfermedad')
menuBar.addmenu('Help', 'Set user preferences')
menuBar.addmenuitem('Help', 'command', 'Set general preferences',
command = self.execute,
label = 'About')
#############################################################################
# Create and pack the NoteBook.
self.notebook = Pmw.NoteBook(parent)
self.notebook.pack(fill = 'both', expand = 1, padx = 10, pady = 10)
# Add the "Gemeral" page to the notebook.
self.page = self.notebook.add('General')
self.notebook.tab('General').focus_set()
# Create the "Paciente" contents of the page.
self.group = Pmw.Group(self.page, tag_text = 'Filtrar personas por RUT :')
self.group.pack()
Label(self.group.interior(),
text = 'RUT sin codigo ver:').grid(row=0,column=0,sticky=W, padx=5, pady=5)
self.runentry = Entry(self.group.interior())
self.runentry.grid(row=0,column=1,sticky=W, padx=5, pady=5)
# Create the "Radiografia" contents of the page.
self.group1 = Pmw.Group(self.page, tag_text = 'Radiografia \nTodos los campos son obligatorios')
self.group1.pack()
#---------------Aqui estan las radiografias------------------------------
self.vistaRadio = vistaRadio(self.group1)
#Button "Filtro"
Button(self.group.interior(),text="Filtrar",command= lambda: filtrarPaciente(
self.runentry,self.vistaRadio.getWidget('PacienteCombo'),None)
).grid(row=0,column=2,sticky=W, padx=5, pady=5)
#Aqui van los antecedentes y la nueva pagina
# Add another page
self.page1 = self.notebook.add('Antecedentes')
self.groupAntecedentes = Pmw.Group(self.page1, tag_text = 'Antecedentes')
self.groupAntecedentes.pack(fill = 'both', expand = 1, padx = 10, pady = 10)
#---------------Aqui estan los antecedentes ------------------------------
self.vistaAntece = vistaAntecedentes(self.groupAntecedentes)
self.notebook.setnaturalsize()
self.statusValue = StringVar()
self.statusValue.set("Status:")
self.status = Label(parent,textvariable=self.statusValue).pack()
# Create and pack the ButtonBox.
b = Button(parent, text="Crear", command=self.crearRadiografia)
b.pack(padx = 10, pady = 10,side=RIGHT)
b = Button(parent, text="Borrar campos", command=self.clean)
b.pack(padx = 10, pady = 10,side=RIGHT)
self.actualizaListas()
def getCurrentIdRadio(self):
return self.currentIdRadio
def setCurrentIdRadio(self,newId):
self.currentIdRadio = newId
def clean(self):
self.vistaRadio.clean()
pass
def crearRadiografia(self):
#Creacion de Radiografia segun su modelo de datos
try:
self.setCurrentIdRadio(self.vistaRadio.crearRadio())
#-------Comienza agregar antecedentes
self.vistaAntece.createFromId(self.getCurrentIdRadio())
except Exception,e:
print str(e)
def actualizaListas(self): #Actualiza enfermedades, medicamentos, alergias, procedencias
#Actualiza datos que consiernen a radiografia
self.vistaRadio.update()
#Actualiza listas de antecedentes
self.vistaAntece.update()
pass
def newWindow(self, tipo, queryAdd, queryDelet, queryEdit, queryLista,updateFunction):
t = Tkinter.Toplevel(self.parent)
ventana = VentanaExtra.Demo(t,tipo, queryAdd, queryDelet, queryEdit,queryLista,updateFunction)
pass
def execute(self):
self.about.show()
####################################################
def createVentanaPaciente(self):
t = Tkinter.Toplevel(self.parent)
ventana = ventanaEditarPaciente.Demo(t)
pass
def editAntecedentes(self):
t = Tkinter.Toplevel(self.parent)
ventana = editAntecedentes.Demo(t)
pass
def editRadio(self):
t = Tkinter.Toplevel(self.parent)
ventana = editRadio.Demo(t)
pass
#####################################################