##// END OF EJS Templates
mainwindow...
Alexander Valdez -
r255:8e233230da90
parent child
Show More
This diff has been collapsed as it changes many lines, (637 lines changed) Show them Hide them
@@ -1,900 +1,905
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 Module implementing MainWindow.
4 4 #+++++++++++++++++++++INTERFAZ DE USUARIO V1.1++++++++++++++++++++++++#
5 5 """
6 6 from PyQt4.QtGui import QMainWindow
7 7 from PyQt4.QtCore import pyqtSignature
8 8 from PyQt4.QtCore import pyqtSignal
9 9 from PyQt4 import QtCore
10 10 from PyQt4 import QtGui
11 11 from timeconversions import Doy2Date
12 12 from modelProperties import treeModel
13 13 from viewer.ui_unitprocess import Ui_UnitProcess
14 14 from viewer.ui_window import Ui_window
15 15 from viewer.ui_mainwindow import Ui_MainWindow
16 16 from viewer.ui_workspace import Ui_Workspace
17 17 from viewer.ui_initwindow import Ui_InitWindow
18 18
19 19 from controller import Project,ReadUnitConf,ProcUnitConf,OperationConf,ParameterConf
20 20 import os
21 21
22 22
23 23 class MainWindow(QMainWindow, Ui_MainWindow):
24 24 __projObjDict = {}
25 25 __arbolDict = {}
26 26
27 27 """
28 28 Class documentation goes here.
29 29 #*##################VENTANA CUERPO DEL PROGRAMA####################
30 30 """
31 31 def __init__(self, parent = None):
32 32 """
33 33 Constructor
34 34 """
35 35 print "Inicio de Programa Interfaz GrΓ‘fica"
36 36 QMainWindow.__init__(self, parent)
37 37 self.setupUi(self)
38 38
39 39 self.online=0
40 40 self.datatype=0
41 41 self.variableList=[]
42 42
43 43 self.proObjList=[]
44 44 self.idp=0
45 45 self.namep=0
46 46 self.description=0
47 47 self.namepTree=0
48 48 self.valuep=0
49 49
50 50 self.upObjList= []
51 51 self.upn=0
52 52 self.upName=0
53 53 self.upType=0
54 54 self.uporProObjRecover=0
55 55
56 56 self.readUnitConfObjList=[]
57 57
58 58 self.upObjVolList=[]
59 59 self.upobjSpecList=[]
60 60
61 61 self.operObjList=[]
62 62
63 63 self.configProject=None
64 64 self.configUP=None
65 65
66 66 self.controllerObj=None
67 67 self.readUnitConfObj=None
68 68 self.procUnitConfObj0=None
69 69 self.opObj10=None
70 70 self.opObj12=None
71 71
72 72 self.setParam()
73 73
74 #-----------------------------------NEW PROPERTIES-----------------------------------------------#
74 #-----------------------------------NEW PROPERTIES------------------------------------------------#
75 75 QtGui.QToolTip.setFont(QtGui.QFont('SansSerif', 10))
76 76 self.addprojectBtn.setToolTip('Add_New_Project')
77 77 self.addUnitProces.setToolTip('Add_New_Processing_Unit')
78 78
79 #-----------------------------------NEW PROPERTIES-----------------------------------------------#
79 #-----------------------------------NEW PROPERTIES------------------------------------------------#
80 80 self.model = QtGui.QStandardItemModel()
81 81 self.treeView.setModel(self.model)
82 82 self.treeView.clicked.connect(self.clickFunctiontree)
83 83 self.treeView.expandAll()
84 84 #self.treeView.clicked.connect(self.treefunction1)
85 85
86 86 #-----------------------------------BARRA DE MENU-------------------------------------------------#
87 87
88 #----------------------------------- MENU_Project-------------------------------------------------#
88 #----------------------------------- MENU_PROJECT--------------------------------------------------#
89 89
90 90 @pyqtSignature("")
91 91 def on_menuFileAbrirObj_triggered(self):
92 92 """
93 93 METODO CARGA UN ARCHIVO DE CONFIGURACION ANTERIOR
94 94 """
95 95 print "Leer un archivo xml y extraer sus atributos Not implemented yet"
96 96
97 97 @pyqtSignature("")
98 98 def on_menuFileCrearObj_triggered(self):
99 99 """
100 100 CREAR PROJECT,ANADE UN NUEVO PROYECTO, LLAMA AL MÉTODO QUE CONTIENE LAS OPERACION DE CREACION DE PROYECTOS
101 101 Llama al metodo addProject..
102 102 """
103 103 self.addProject()
104 104
105 105 @pyqtSignature("")
106 106 def on_menuFileGuardarObj_clicked(self):
107 107 """
108 108 METODO EJECUTADO CUANDO OCURRE EL EVENTO GUARDAR PROJECTO
109 109 Llama al metodo saveProject.
110 110 """
111 111 self.saveProject()
112 112
113 113 @pyqtSignature("")
114 114 def on_menuFileCerrarObj_clicked(self):
115 115 """
116 116 METODO EJECUTADO CUANDO OCURRE EL EVENTO CERRAR
117 117 Llama al metodo close.
118 118 """
119 119 self.close()
120 120
121 121 #-----------------------------------MENU_RUN----------------------------------------------------#
122 122
123 123 @pyqtSignature("")
124 124 def on_menuRUNStartObj_clicked(self):
125 125 """
126 126 METODO EJECUTADO CUANDO OCURRE EL EVENTO RUN
127 127 Llama al metodo RUN.
128 128 """
129 129 print "Not implemented yet"
130 130
131 131 @pyqtSignature("")
132 132 def on_menuRUNPausaObj_clicked(self):
133 133 """
134 134 METODO EJECUTADO CUANDO OCURRE EL EVENTO PAUSA
135 135 Llama al metodo PAUSA.
136 136 """
137 137 print "Not implemented yet"
138 138
139 139 #-----------------------------------MENU_OPTION-------------------------------------------------#
140 140 @pyqtSignature("")
141 141 def on_menuOptConfigLogfileObj_clicked(self):
142 142 """
143 143 METODO EJECUTADO CUANDO OCURRE EL EVENTO ConfigLog
144 144 Llama al metodo close.
145 145 """
146 146 print "Not implemented yet"
147 147
148 148
149 149 @pyqtSignature("")
150 150 def on_menuOptConfigserverObj_clicked(self):
151 151 """
152 152 METODO EJECUTADO CUANDO OCURRE EL EVENTO Config Server
153 153 Llama al metodo close.
154 154 """
155 155 print "Not implemented yet"
156 #-----------------------------------MENU_HELP--------------------------------------------------#
156 #-----------------------------------MENU_HELP-------------------------------------------------------#
157 157 @pyqtSignature("")
158 158 def on_menuHELPAboutObj_clicked(self):
159 159 """
160 160 METODO EJECUTADO CUANDO OCURRE EL EVENTO HELP
161 161 Llama al metodo close.
162 162 """
163 163 print "Not implemented yet"
164 164
165 165 @pyqtSignature("")
166 166 def on_menuHELPPrfObj_clicked(self):
167 167 """
168 168 METODO EJECUTADO CUANDO OCURRE EL EVENTO HElp
169 169 Llama al metodo close.
170 170 """
171 171 print "Not implemented yet"
172 172
173 173 #-----------------------------------BARRA DE HERRAMIENTAS----------------------------------------#
174 174
175 175 @pyqtSignature("")
176 176 def on_actOpenObj_triggered(self):
177 177 """
178 178 METODO CARGA UN ARCHIVO DE CONFIGURACION ANTERIOR
179 179 """
180 180 print "Leer un archivo xml y extraer sus atributos Not implemented yet"
181 181
182 182 @pyqtSignature("")
183 183 def on_actCreateObj_triggered(self):
184 184 """
185 185 CREAR PROJECT ,ANADE UN NUEVO PROYECTO, LLAMA AL MÉTODO QUE CONTIENE LAS OPERACION DE CREACION DE PROYECTOS
186 186 Llama al metodo addProject.
187 187 """
188 188 self.addProject()
189 189
190 190
191 191 @pyqtSignature("")
192 192 def on_actStopObj_triggered(self):
193 193 """
194 194 METODO EJECUTADO CUANDO OCURRE EL EVENTO PAUSA
195 195 Llama al metodo PAUSA.
196 196 """
197 197 print "Not implemented yet"
198 198
199 199 @pyqtSignature("")
200 200 def on_actPlayObj_triggered(self):
201 201 """
202 202 METODO EJECUTADO CUANDO OCURRE EL EVENTO PAUSA
203 203 Llama al metodo PAUSA.
204 204 """
205 205 print "Not implemented yet"
206 206
207 #-----------------------------------PUSHBUTTON_CREATE PROJECT-----------------------------------#
207 @pyqtSignature("")
208 def on_actSaveObj_triggered(self):
209 """
210 METODO EJECUTADO CUANDO OCURRE EL EVENTO SAVE
211 Llama al metodo SAVE.
212 """
213 self.saveProject()
214
215 #-----------------------------------PUSHBUTTON_CREATE PROJECT----------------------------------#
208 216
209 217 @pyqtSignature("")
210 218 def on_addprojectBtn_clicked(self):
211 219 """
212 220 CREAR PROJECT ,ANADE UN NUEVO PROYECTO, LLAMA AL MÉTODO QUE CONTIENE LAS OPERACION DE CREACION DE PROYECTOS
213 221 Llama al metodo addProject.
214 222 """
215 223 self.addProject()
224
225 #------------------------------------VENTANA CONFIGURACION PROJECT----------------------------#
226
227
228 @pyqtSignature("int")
229 def on_dataTypeCmbBox_activated(self,index):
230 """
231 Metodo que identifica que tipo de dato se va a trabajar VOLTAGE O ESPECTRA
232 """
233 self.dataFormatTxt.setReadOnly(True)
234 if index==0:
235 self.datatype='Voltage'
236 elif index==1:
237 self.datatype='Spectra'
238 else :
239 self.datatype=''
240 self.dataFormatTxt.setReadOnly(False)
241 self.dataFormatTxt.setText(self.datatype)
216 242
217 #-----------------------------------PUSHBUTTON_PROCESSING UNIT PROJECT--------------------------#
218 243 @pyqtSignature("")
219 def on_addUnitProces_clicked(self):
244 def on_dataPathBrowse_clicked(self):
220 245 """
221 CREAR PROCESSING UNI ,ANADE UNA UNIDAD DE PROCESAMIENTO, LLAMA AL MÉTODO addUP QUE CONTIENE LAS OPERACION DE CREACION DE UNIDADES DE PROCESAMIENTO
222 Llama al metodo addUP.
246 OBTENCION DE LA RUTA DE DATOS
223 247 """
224 # print "En este nivel se adiciona una rama de procesamiento, y se le concatena con el id"
225 # self.procUnitConfObj0 = self.controllerObj.addProcUnit(datatype='Voltage', inputId=self.readUnitConfObj.getId())
226 self.addUP()
248 self.dataPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly))
249 self.dataPathTxt.setText(self.dataPath)
250 self.statusDpath=self.existDir(self.dataPath)
251 self.loadDays()
227 252
253 @pyqtSignature("int")
254 def on_starDateCmbBox_activated(self, index):
255 """
256 SELECCION DEL RANGO DE FECHAS -START DATE
257 """
258 var_StopDay_index=self.endDateCmbBox.count() - self.endDateCmbBox.currentIndex()
259 self.endDateCmbBox.clear()
260 for i in self.variableList[index:]:
261 self.endDateCmbBox.addItem(i)
262 self.endDateCmbBox.setCurrentIndex(self.endDateCmbBox.count() - var_StopDay_index)
263 self.getsubList()
264
265 @pyqtSignature("int")
266 def on_endDateCmbBox_activated(self, index):
267 """
268 SELECCION DEL RANGO DE FECHAS-END DATE
269 """
270 var_StartDay_index=self.starDateCmbBox.currentIndex()
271 var_end_index = self.endDateCmbBox.count() - index
272 self.starDateCmbBox.clear()
273 for i in self.variableList[:len(self.variableList) - var_end_index + 1]:
274 self.starDateCmbBox.addItem(i)
275 self.starDateCmbBox.setCurrentIndex(var_StartDay_index)
276 self.getsubList() #Se carga var_sublist[] con el rango de las fechas seleccionadas
277
278 @pyqtSignature("int")
279 def on_readModeCmBox_activated(self, p0):
280 """
281 SELECCION DEL MODO DE LECTURA ON=1, OFF=0
282 """
283 if p0==0:
284 self.online=0
285 elif p0==1:
286 self.online=1
228 287
229 #-----------------------------------PUSHBUTTON_dataOkBtn----------------------------------------#
288 #---------------PUSHBUTTON_dataOkBtn_CONFIGURATION PROJECT--------------------------#
230 289
231 290 @pyqtSignature("")
232 291 def on_dataOkBtn_clicked(self):
233 292 """
234 293 AΓ±ade al Obj XML de Projecto, name,datatype,date,time,readmode,wait,etc, crea el readUnitProcess del archivo xml.
235 294 Prepara la configuraciΓ³n del diΓ‘grama del Arbol del treeView numero 2
236 295 """
237 296 print "En este nivel se pasa el tipo de dato con el que se trabaja,path,startDate,endDate,startTime,endTime,online"
238 297
239 298 projectObj=self.proObjList[int(self.proConfCmbBox.currentIndex())]
240 299 datatype=str(self.dataTypeCmbBox.currentText())
241 300 path=str(self.dataPathTxt.text())
242 301 online=int(self.online)
243 302 starDate=str(self.starDateCmbBox.currentText())
244 303 endDate=str(self.endDateCmbBox.currentText())
245 304
246 305
247 306 self.readUnitConfObj = projectObj.addReadUnit(datatype=datatype,
248 307 path=path,
249 308 startDate=starDate,
250 309 endDate=endDate,
251 310 startTime='06:10:00',
252 311 endTime='23:59:59',
253 312 online=online)
254 313
255 314 self.readUnitConfObjList.append(self.readUnitConfObj)
256 315
257 316 print "self.readUnitConfObj.getId",self.readUnitConfObj.getId(),datatype,path,starDate,endDate,online
258 317
259 318
260 319 self.model_2=treeModel()
261 320
262 321 self.model_2.setParams(name=projectObj.name+str(projectObj.id),
263 322 directorio=path,
264 323 workspace="C:\\WorkspaceGUI",
265 324 remode=str(self.readModeCmBox.currentText()),
266 325 dataformat=datatype,
267 326 date=str(starDate)+"-"+str(endDate),
268 327 initTime='06:10:00',
269 328 endTime='23:59:59',
270 329 timezone="Local" ,
271 330 Summary="test de prueba")
272 331 self.model_2.arbol()
273 332 self.treeView_2.setModel(self.model_2)
274 self.treeView_2.expandAll()
333 self.treeView_2.expandAll()
334
335
336 #-----------------PUSHBUTTON_ADD_PROCESSING UNIT PROJECT------------------#
337 @pyqtSignature("")
338 def on_addUnitProces_clicked(self):
339 """
340 CREAR PROCESSING UNI ,ANADE UNA UNIDAD DE PROCESAMIENTO, LLAMA AL MÉTODO addUP QUE CONTIENE LAS OPERACION DE CREACION DE UNIDADES DE PROCESAMIENTO
341 Llama al metodo addUP.
342 """
343 # print "En este nivel se adiciona una rama de procesamiento, y se le concatena con el id"
344 # self.procUnitConfObj0 = self.controllerObj.addProcUnit(datatype='Voltage', inputId=self.readUnitConfObj.getId())
345 self.addUP()
346
347
348 #-----------------VENTANA CONFIGURACION DE VOLTAGE---------------------------#
349
350 @pyqtSignature("int")
351 def on_selecChannelopVolCEB_stateChanged(self, p0):
352 """
353 Check Box habilita operaciones de SelecciΓ³n de Canales
354 """
355 if p0==2:
356 self.numberChannelopVol.setEnabled(True)
357 upProcessSelect=self.upObjVolList[int(self.addOpUpselec.currentIndex())]
358 opObj10=upProcessSelect.addOperation(name='selectChannels')
359 print opObj10.id
360 self.operObjList.append(opObj10)
361 print " Ingresa seleccion de Canales"
362 if p0==0:
363 print " deshabilitado"
364
365 @pyqtSignature("int")
366 def on_selecHeighopVolCEB_stateChanged(self, p0):
367 """
368 Check Box habilita operaciones de SelecciΓ³n de Alturas
369 """
370 if p0==2:
371 self.lineHeighProfileTxtopVol.setEnabled(True)
372 upProcessSelect=self.upObjVolList[int(self.addOpUpselec.currentIndex())]
373 opObj10=upProcessSelect.addOperation(name='selectHeights')
374 print opObj10.id
375 self.operObjList.append(opObj10)
376 print " Select Type of Profile"
377 if p0==0:
378 print " deshabilitado"
379
380
381 @pyqtSignature("int")
382 def on_profileSelecopVolCEB_stateChanged(self, p0):
383 """
384 Check Box habilita ingreso del rango de Perfiles
385 """
386 if p0==2:
387 self.lineProfileSelecopVolCEB.setEnabled(True)
388 upProcessSelect=self.upObjVolList[int(self.addOpUpselec.currentIndex())]
389 opObj10=upProcessSelect.addOperation(name='ProfileSelector', optype='other')
390 print opObj10.id
391 self.operObjList.append(opObj10)
392 print " Select Type of Profile"
393 if p0==0:
394 print " deshabilitado"
395
396
397 @pyqtSignature("int")
398 def on_coherentIntegrationCEB_stateChanged(self, p0):
399 """
400 Check Box habilita ingresode del numero de Integraciones a realizar
401 """
402 if p0==2:
403 self.numberIntegration.setEnabled(True)
404 upProcessSelect=self.upObjVolList[int(self.addOpUpselec.currentIndex())]
405 opObj10=upProcessSelect.addOperation(name='CohInt', optype='other')
406 print opObj10.id
407 self.operObjList.append(opObj10)
408 print "Choose number of Cohint"
409 if p0==0:
410 print " deshabilitado"
411 self.numberChannelopVol.setEnabled(False)
412
413 #-----------------------PUSHBUTTON_ACCEPT_OPERATION----------------------------#
414
415 @pyqtSignature("")
416 def on_dataopVolOkBtn_clicked(self):
417 """
418 BUSCA EN LA LISTA DE OPERACIONES DEL TIPO VOLTAJE Y LES AΓ‘ADE EL PARAMETRO ADECUADO ESPERANDO LA ACEPTACION DEL USUARIO
419 PARA AGREGARLO AL ARCHIVO DE CONFIGURACION XML
420 """
421 if self.selecChannelopVolCEB.isChecked():
422 for i in self.operObjList:
423 if i.name=='selectChannels':
424 value=self.numberChannelopVol.text()
425 i.addParameter(name='channelList', value=value, format='intlist')
426
427
428 print "channel"
429
430 if self.selecHeighopVolCEB.isChecked():
431 for i in self.operObjList:
432 if i.name=='selectHeights' :
433 value=self.lineHeighProfileTxtopVol.text()
434 valueList=value.split(',')
435 i.addParameter(name='minHei', value=valueList[0], format='float')
436 i.addParameter(name='maxHei', value=valueList[1], format='float')
437
438 print "height"
275 439
276 440
441 if self.selecHeighopVolCEB.isChecked():
442 for i in self.operObjList:
443 if i.name=='ProfileSelector' :
444 value=self.lineProfileSelecopVolCEB.text()
445 i.addParameter(name='ProfileSelector', value=value, format='intlist')
446
447
448
449 if self.coherentIntegrationCEB.isChecked():
450 for i in self.operObjList:
451 if i.name=='CohInt':
452 value=self.numberIntegration.text()
453 i.addParameter(name='n', value=value, format='int')
454
455
456 #-------------------------VENTANA DE CONFIGURACION SPECTRA------------------------#
457
458 @pyqtSignature("int")
459 def on_nFFTPointOpSpecCEB_stateChanged(self, p0):
460 """
461 Habilita la opcion de aΓ±adir el parΓ‘metro nFFTPoints a la Unidad de Procesamiento .
462 """
463 if p0==2:
464 self.valuenFFTPointOpSpec.setEnabled(True)
465 print " nFFTPoint"
466 if p0==0:
467 print " deshabilitado"
468
469 #------------------PUSH_BUTTON_SPECTRA_OK------------------------------------#
470
471 @pyqtSignature("")
472 def on_dataopSpecOkBtn_clicked(self):
473 """
474 AΓ±ade al archivo de configuraciΓ³n el parΓ‘metros nFFTPoints a la UP.
475 """
476 print "AΓ±adimos operaciones Spectra,nchannels,value,format"
477 if self.nFFTPointOpSpecCEB.isChecked():
478 upProcessSelect=self.upobjSpecList[int(self.addOpSpecUpselec.currentIndex())]
479 value=self.valuenFFTPointOpSpec.text()
480 upProcessSelect.addParameter(name='nFFTPoints',value=value,format='int')
481 #---------------------VENTANA DE CONFIGURACION GRAPH SPECTRA------------------#
482
483 @pyqtSignature("int")
484 def on_SpectraPlotGraphCEB_stateChanged(self, p0):
485 """
486 Habilita la opcion de Ploteo Spectra Plot
487 """
488 if p0==2:
489 upProcessSelect=self.upobjSpecList[int(self.addOpSpecUpselec.currentIndex())]
490 opObj10=upProcessSelect.addOperation(name='SpectraPlot',optype='other')
491 print opObj10.id
492 self.operObjList.append(opObj10)
493
494 if p0==0:
495 print " deshabilitado"
496
497 @pyqtSignature("int")
498 def on_CrossSpectraPlotGraphceb_stateChanged(self, p0):
499 """
500 Habilita la opciΓ³n de Ploteo CrossSpectra
501 """
502 if p0==2:
503 upProcessSelect=self.upobjSpecList[int(self.addOpSpecUpselec.currentIndex())]
504 opObj10=upProcessSelect.addOperation(name='CrossSpectraPlot',optype='other')
505 print opObj10.id
506 self.operObjList.append(opObj10)
507 if p0==0:
508 print " deshabilitado"
509
510 @pyqtSignature("int")
511 def on_RTIPlotGraphCEB_stateChanged(self, p0):
512 """
513 Habilita la opciΓ³n de Plote RTIPlot
514 """
515 if p0==2:
516 upProcessSelect=self.upobjSpecList[int(self.addOpSpecUpselec.currentIndex())]
517 opObj10=upProcessSelect.addOperation(name='RTIPlot',optype='other')
518 print opObj10.id
519 self.operObjList.append(opObj10)
520 if p0==0:
521 print " deshabilitado"
522
523 #------------------PUSH_BUTTON_SPECTRA_GRAPH_OK-----------------------------#
524 @pyqtSignature("")
525 def on_dataGraphSpecOkBtn_clicked(self):
526 """
527 HABILITAR DE ACUERDO A LOS CHECKBOX QUE TIPO DE PLOTEOS SE VAN A REALIZAR MUESTRA Y GRABA LAS IMAGENES.
528 """
529 print "Graficar Spec op"
530 if self.SpectraPlotGraphCEB.isChecked():
531 for i in self.operObjList:
532 if i.name=='SpectraPlot':
533 i.addParameter(name='idfigure', value='1', format='int')
534 i.addParameter(name='wintitle', value='SpectraPlot0', format='str')
535 i.addParameter(name='zmin', value='40', format='int')
536 i.addParameter(name='zmax', value='90', format='int')
537 i.addParameter(name='showprofile', value='1', format='int')
538
539 if self.CrossSpectraPlotGraphceb.isChecked():
540 for i in self.operObjList:
541 if i.name=='CrossSpectraPlot' :
542 i.addParameter(name='idfigure', value='2', format='int')
543 i.addParameter(name='wintitle', value='CrossSpectraPlot', format='str')
544 i.addParameter(name='zmin', value='40', format='int')
545 i.addParameter(name='zmax', value='90', format='int')
546
547 if self.RTIPlotGraphCEB.isChecked():
548 for i in self.operObjList:
549 if i.name=='RTIPlot':
550 i.addParameter(name='n', value='2', format='int')
551 i.addParameter(name='overlapping', value='1', format='int')
552
553
277 554 def getNumberofProject(self):
278 555 # for i in self.proObjList:
279 556 # print i
280 557 return self.proObjList
281 558 # for i in self.proObjList:
282 559 # print i
283 560
284 561 def setParam(self):
285 562
286 563 self.tabWidgetProject.setEnabled(False)
287 564 self.dataPathTxt.setText('C:\data')
288 565 self.nameProjectTxt.setText("Test")
289 566 self.numberChannelopVol.setEnabled(False)
290 567 self.lineHeighProfileTxtopVol.setEnabled(False)
291 568 self.numberIntegration.setEnabled(False)
292 569 self.valuenFFTPointOpSpec.setEnabled(False)
293 570 self.lineProfileSelecopVolCEB.setEnabled(False)
294 571
295 572
296 573 def clickFunctiontree(self,index):
297 574 indexclick= index.model().itemFromIndex(index).text()
298 575 #print indexclick
299 576 NumofPro=indexclick[8:10]
300 577 self.valuep=NumofPro
301 578 #print self.valuep
302 579 NameofPro=indexclick[0:7]
303 580 self.namepTree=NameofPro
304 581 #print self.namepTree
305 582
306 583 def addProject(self):
307 584 self.tabWidgetProject.setEnabled(True)
308 585 self.idp += 1
309 586 self.projectObj = Project()
310 587
311 588 id=int(self.idp)
312 589 name=str(self.nameProjectTxt.text())
313 590 desc=str(self.description)
314 591
315 592 self.projectObj.setup(id = id, name=name, description=desc)
316 593
317 594 #self.configProject=Window(self)
318 595 #self.configProject.closed.connect(self.show)
319 596 #self.configProject.show()
320 597 #self.configProject.closed.connect(self.show)
321 598 # self.configProject.saveButton.clicked.connect(self.reciveParameters)
322 599 #self.configProject.closed.connect(self.createProject)
323 600
324 601 def reciveParameters(self):
325 602 self.namep,self.description =self.configProject.almacena()
326 603
327 604 def createProject(self):
328 605
329 606 print "En este nivel se debe crear el proyecto,id,nombre,desc"
330 607 #+++++Creacion del Objeto Controller-XML++++++++++#
331 608 self.idp += 1
332 609 self.controllerObj = Project()
333 610 id=int(self.idp)
334 611 name=str(self.namep)
335 612 desc=str(self.description)
336 613 self.parentItem=self.model.invisibleRootItem()
337 614 self.controllerObj.arbol=QtGui.QStandardItem(QtCore.QString("Project %0").arg(self.idp))
338 615 self.controllerObj.setup(id = id, name=name, description=desc)
339 616 self.parentItem.appendRow(self.controllerObj.arbol)
340 617 self.proObjList.append(self.controllerObj)#+++++++++++++++++++LISTA DE PROYECTO++++++++++++++++++++++++++++#
341 618 self.parentItem=self.controllerObj.arbol
342 619 self.loadProjects()
343 620
344 621 print "Porfavor ingrese los parΓ‘metros de configuracion del Proyecto"
345 622
346 623 def loadProjects(self):
624
347 625 self.proConfCmbBox.clear()
348 626 for i in self.proObjList:
349 627 self.proConfCmbBox.addItem("Project"+str(i.id))
350 628
351 @pyqtSignature("int")
352 def on_dataTypeCmbBox_activated(self,index):
353 self.dataFormatTxt.setReadOnly(True)
354 if index==0:
355 self.datatype='Voltage'
356 elif index==1:
357 self.datatype='Spectra'
358 else :
359 self.datatype=''
360 self.dataFormatTxt.setReadOnly(False)
361 self.dataFormatTxt.setText(self.datatype)
629
362 630
363 631 def existDir(self, var_dir):
364 632 """
365 633 METODO PARA VERIFICAR SI LA RUTA EXISTE-VAR_DIR
366 634 VARIABLE DIRECCION
367 635 """
368 636 if os.path.isdir(var_dir):
369 637 return True
370 638 else:
371 639 self.textEdit.append("Incorrect path:" + str(var_dir))
372 640 return False
373 641
374 642 def loadDays(self):
375 643 """
376 644 METODO PARA CARGAR LOS DIAS
377 645 """
378 646 self.variableList=[]
379 647 self.starDateCmbBox.clear()
380 648 self.endDateCmbBox.clear()
381 649
382 650 Dirlist = os.listdir(self.dataPath)
383 651 Dirlist.sort()
384 652
385 653 for a in range(0, len(Dirlist)):
386 654 fname= Dirlist[a]
387 655 Doy=fname[5:8]
388 656 fname = fname[1:5]
389 657 print fname
390 658 fecha=Doy2Date(int(fname),int(Doy))
391 659 fechaList=fecha.change2date()
392 660 #print fechaList[0]
393 661 Dirlist[a]=fname+"/"+str(fechaList[0])+"/"+str(fechaList[1])
394 662 #+"-"+ fechaList[0]+"-"+fechaList[1]
395 663
396 #---------------AQUI TIENE QUE SER MODIFICADO--------#
664 #---------------AQUI TIENE QUE SER MODIFICADO--------#
397 665
398 666 #Se cargan las listas para seleccionar StartDay y StopDay (QComboBox)
399 667 for i in range(0, (len(Dirlist))):
400 668 self.variableList.append(Dirlist[i])
401 669
402 670 for i in self.variableList:
403 671 self.starDateCmbBox.addItem(i)
404 672 self.endDateCmbBox.addItem(i)
405 673 self.endDateCmbBox.setCurrentIndex(self.starDateCmbBox.count()-1)
406 674
407 self.getsubList()
408 self.dataOkBtn.setEnabled(True)
409
410 def getsubList(self):
411 """
412 OBTIENE EL RANDO DE LAS FECHAS SELECCIONADAS
413 """
414 self.subList=[]
415 for i in self.variableList[self.starDateCmbBox.currentIndex():self.starDateCmbBox.currentIndex() + self.endDateCmbBox.currentIndex()+1]:
416 self.subList.append(i)
417
418 @pyqtSignature("")
419 def on_dataPathBrowse_clicked(self):
420 """
421 OBTENCION DE LA RUTA DE DATOS
422 """
423 self.dataPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly))
424 self.dataPathTxt.setText(self.dataPath)
425 self.statusDpath=self.existDir(self.dataPath)
426 self.loadDays()
427
428 @pyqtSignature("int")
429 def on_starDateCmbBox_activated(self, index):
430 """
431 SELECCION DEL RANGO DE FECHAS -STAR DATE
432 """
433 var_StopDay_index=self.endDateCmbBox.count() - self.endDateCmbBox.currentIndex()
434 self.endDateCmbBox.clear()
435 for i in self.variableList[index:]:
436 self.endDateCmbBox.addItem(i)
437 self.endDateCmbBox.setCurrentIndex(self.endDateCmbBox.count() - var_StopDay_index)
438 self.getsubList()
439
440 @pyqtSignature("int")
441 def on_endDateCmbBox_activated(self, index):
442 """
443 SELECCION DEL RANGO DE FECHAS-END DATE
444 """
445 var_StartDay_index=self.starDateCmbBox.currentIndex()
446 var_end_index = self.endDateCmbBox.count() - index
447 self.starDateCmbBox.clear()
448 for i in self.variableList[:len(self.variableList) - var_end_index + 1]:
449 self.starDateCmbBox.addItem(i)
450 self.starDateCmbBox.setCurrentIndex(var_StartDay_index)
451 self.getsubList() #Se carga var_sublist[] con el rango de las fechas seleccionadas
452
453 @pyqtSignature("int")
454 def on_readModeCmBox_activated(self, p0):
675 self.getsubList()
676 self.dataOkBtn.setEnabled(True)
677
678 def getsubList(self):
455 679 """
456 Slot documentation goes here.
680 OBTIENE EL RANDO DE LAS FECHAS SELECCIONADAS
457 681 """
458 if p0==0:
459 self.online=0
460 elif p0==1:
461 self.online=1
462
463
682 self.subList=[]
683 for i in self.variableList[self.starDateCmbBox.currentIndex():self.starDateCmbBox.currentIndex() + self.endDateCmbBox.currentIndex()+1]:
684 self.subList.append(i)
464 685
465 686 def addUP(self):
466 687
467 688 self.configUP=UnitProcess(self)
468 689 for i in self.proObjList:
469 690 self.configUP.getfromWindowList.append(i)
470 691 #print i
471 692 for i in self.upObjList:
472 693 self.configUP.getfromWindowList.append(i)
473 694 self.configUP.loadTotalList()
474 695 self.configUP.show()
475 696 self.configUP.unitPsavebut.clicked.connect(self.reciveUPparameters)
476 697 self.configUP.closed.connect(self.createUP)
477 698
478 699 def reciveUPparameters(self):
479 700
480 701 self.uporProObjRecover,self.upType=self.configUP.almacena()
481 702
482 703
483 704 def createUP(self):
484 705 print "En este nivel se adiciona una rama de procesamiento, y se le concatena con el id"
485 706 projectObj=self.proObjList[int(self.proConfCmbBox.currentIndex())]
486 707
487 708 datatype=str(self.upType)
488 709 uporprojectObj=self.uporProObjRecover
489 710 #+++++++++++LET FLY+++++++++++#
490 711 if uporprojectObj.getElementName()=='ProcUnit':
491 712 inputId=uporprojectObj.getId()
492 713 elif uporprojectObj.getElementName()=='Project':
493 714 inputId=self.readUnitConfObjList[uporprojectObj.id-1].getId()
494 715
495 716
496 717 self.procUnitConfObj1 = projectObj.addProcUnit(datatype=datatype, inputId=inputId)
497 718 self.upObjList.append(self.procUnitConfObj1)
498 719 print inputId
499 720 print self.procUnitConfObj1.getId()
500 721 self.parentItem=uporprojectObj.arbol
501 722 self.numbertree=int(self.procUnitConfObj1.getId())-1
502 723 self.procUnitConfObj1.arbol=QtGui.QStandardItem(QtCore.QString(datatype +"%1 ").arg(self.numbertree))
503 724 self.parentItem.appendRow(self.procUnitConfObj1.arbol)
504 725 self.parentItem=self.procUnitConfObj1.arbol
505 726 self.loadUp()
506 727 self.treeView.expandAll()
507 728
508 729 def loadUp(self):
509 730 self.addOpUpselec.clear()
510 731 self.addOpSpecUpselec.clear()
511 732 for i in self.upObjList:
512 733 if i.datatype=='Voltage':
513 734 self.upObjVolList.append(i)
514 735 name=i.getElementName()
515 736 id=int(i.id)-1
516 737 self.addOpUpselec.addItem(name+str(id))
517 738 if i.datatype=='Spectra':
518 739 self.upobjSpecList.append(i)
519 740 name=i.getElementName()
520 741 id=int(i.id)-1
521 742 self.addOpSpecUpselec.addItem(name+str(id))
522 743
523 744 self.resetopVolt()
524 745 self.resetopSpec()
525
526
527 @pyqtSignature("int")
528 def on_selecChannelopVolCEB_stateChanged(self, p0):
529 """
530 Slot documentation goes here.
531 """
532 if p0==2:
533 self.numberChannelopVol.setEnabled(True)
534 upProcessSelect=self.upObjVolList[int(self.addOpUpselec.currentIndex())]
535 opObj10=upProcessSelect.addOperation(name='selectChannels')
536 print opObj10.id
537 self.operObjList.append(opObj10)
538 print " Ingresa seleccion de Canales"
539 if p0==0:
540 print " deshabilitado"
541
542 @pyqtSignature("int")
543 def on_selecHeighopVolCEB_stateChanged(self, p0):
544 """
545 Slot documentation goes here.
546 """
547 if p0==2:
548 self.lineHeighProfileTxtopVol.setEnabled(True)
549 upProcessSelect=self.upObjVolList[int(self.addOpUpselec.currentIndex())]
550 opObj10=upProcessSelect.addOperation(name='selectHeights')
551 print opObj10.id
552 self.operObjList.append(opObj10)
553 print " Select Type of Profile"
554 if p0==0:
555 print " deshabilitado"
556
557 746
558 @pyqtSignature("int")
559 def on_profileSelecopVolCEB_stateChanged(self, p0):
560 """
561 Slot documentation goes here.
562 """
563 if p0==2:
564 self.lineProfileSelecopVolCEB.setEnabled(True)
565 upProcessSelect=self.upObjVolList[int(self.addOpUpselec.currentIndex())]
566 opObj10=upProcessSelect.addOperation(name='ProfileSelector', optype='other')
567 print opObj10.id
568 self.operObjList.append(opObj10)
569 print " Select Type of Profile"
570 if p0==0:
571 print " deshabilitado"
572
573
574 @pyqtSignature("int")
575 def on_coherentIntegrationCEB_stateChanged(self, p0):
576 """
577 Slot documentation goes here.
578 """
579 if p0==2:
580 self.numberIntegration.setEnabled(True)
581 upProcessSelect=self.upObjVolList[int(self.addOpUpselec.currentIndex())]
582 opObj10=upProcessSelect.addOperation(name='CohInt', optype='other')
583 print opObj10.id
584 self.operObjList.append(opObj10)
585 print "Choose number of Cohint"
586 if p0==0:
587 print " deshabilitado"
588 self.numberChannelopVol.setEnabled(False)
589
590 747 def resetopVolt(self):
591 748 self.selecChannelopVolCEB.setChecked(False)
592 749 self.selecHeighopVolCEB.setChecked(False)
593 750 self.coherentIntegrationCEB.setChecked(False)
594 751 self.profileSelecopVolCEB.setChecked(False)
595 752 #self.selecChannelopVolCEB.setEnabled(False)
596 753 self.lineHeighProfileTxtopVol.clear()
597 754 self.lineProfileSelecopVolCEB.clear()
598 755 self.numberChannelopVol.clear()
599 756 self.numberIntegration.clear()
600 757
601
602 @pyqtSignature("")
603 def on_dataopVolOkBtn_clicked(self):
604 """
605 Slot documentation goes here.
606 """
607 if self.selecChannelopVolCEB.isChecked():
608 for i in self.operObjList:
609 if i.name=='selectChannels':
610 value=self.numberChannelopVol.text()
611 i.addParameter(name='channelList', value=value, format='intlist')
612
613
614 print "channel"
615
616 if self.selecHeighopVolCEB.isChecked():
617 for i in self.operObjList:
618 if i.name=='selectHeights' :
619 value=self.lineHeighProfileTxtopVol.text()
620 valueList=value.split(',')
621 i.addParameter(name='minHei', value=valueList[0], format='float')
622 i.addParameter(name='maxHei', value=valueList[1], format='float')
623
624 print "height"
625
626
627 if self.selecHeighopVolCEB.isChecked():
628 for i in self.operObjList:
629 if i.name=='ProfileSelector' :
630 value=self.lineProfileSelecopVolCEB.text()
631 i.addParameter(name='ProfileSelector', value=value, format='intlist')
632
633
634
635 if self.coherentIntegrationCEB.isChecked():
636 for i in self.operObjList:
637 if i.name=='CohInt':
638 value=self.numberIntegration.text()
639 i.addParameter(name='n', value=value, format='int')
640
641
642 @pyqtSignature("int")
643 def on_nFFTPointOpSpecCEB_stateChanged(self, p0):
644 """
645 Slot documentation goes here.
646 """
647 if p0==2:
648 self.valuenFFTPointOpSpec.setEnabled(True)
649 print " nFFTPoint"
650 if p0==0:
651 print " deshabilitado"
652
653
758
654 759 def resetopSpec(self):
655 760 self.nFFTPointOpSpecCEB.setChecked(False)
656 761
657 762 self.valuenFFTPointOpSpec.clear()
658
659
660 @pyqtSignature("")
661 def on_dataopSpecOkBtn_clicked(self):
662 """
663 Slot documentation goes here.
664 """
665 print "AΓ±adimos operaciones Spectra,nchannels,value,format"
666 if self.nFFTPointOpSpecCEB.isChecked():
667 upProcessSelect=self.upobjSpecList[int(self.addOpSpecUpselec.currentIndex())]
668 value=self.valuenFFTPointOpSpec.text()
669 upProcessSelect.addParameter(name='nFFTPoints',value=value,format='int')
670
671 @pyqtSignature("int")
672 def on_SpectraPlotGraphCEB_stateChanged(self, p0):
673 """
674 Slot documentation goes here.
675 """
676 if p0==2:
677 upProcessSelect=self.upobjSpecList[int(self.addOpSpecUpselec.currentIndex())]
678 opObj10=upProcessSelect.addOperation(name='SpectraPlot',optype='other')
679 print opObj10.id
680 self.operObjList.append(opObj10)
681
682 if p0==0:
683 print " deshabilitado"
684
685 @pyqtSignature("int")
686 def on_CrossSpectraPlotGraphceb_stateChanged(self, p0):
687 """
688 Slot documentation goes here.
689 """
690 if p0==2:
691 upProcessSelect=self.upobjSpecList[int(self.addOpSpecUpselec.currentIndex())]
692 opObj10=upProcessSelect.addOperation(name='CrossSpectraPlot',optype='other')
693 print opObj10.id
694 self.operObjList.append(opObj10)
695 if p0==0:
696 print " deshabilitado"
697
698 @pyqtSignature("int")
699 def on_RTIPlotGraphCEB_stateChanged(self, p0):
700 """
701 Slot documentation goes here.
702 """
703 if p0==2:
704 upProcessSelect=self.upobjSpecList[int(self.addOpSpecUpselec.currentIndex())]
705 opObj10=upProcessSelect.addOperation(name='RTIPlot',optype='other')
706 print opObj10.id
707 self.operObjList.append(opObj10)
708 if p0==0:
709 print " deshabilitado"
710
711 763
712 764 def resetgraphSpec(self):
713 765 self.SpectraPlotGraphCEB.setChecked(False)
714 766 self.CrossSpectraPlotGraphceb.setChecked(False)
715 767 self.RTIPlotGraphCEB.setChecked(False)
716 768
717 @pyqtSignature("")
718 def on_dataGraphSpecOkBtn_clicked(self):
719 """
720 Slot documentation goes here.
721 """
722 print "Graficar Spec op"
723 if self.SpectraPlotGraphCEB.isChecked():
724 for i in self.operObjList:
725 if i.name=='SpectraPlot':
726 i.addParameter(name='idfigure', value='1', format='int')
727 i.addParameter(name='wintitle', value='SpectraPlot0', format='str')
728 i.addParameter(name='zmin', value='40', format='int')
729 i.addParameter(name='zmax', value='90', format='int')
730 i.addParameter(name='showprofile', value='1', format='int')
731
732 if self.CrossSpectraPlotGraphceb.isChecked():
733 for i in self.operObjList:
734 if i.name=='CrossSpectraPlot' :
735 i.addParameter(name='idfigure', value='2', format='int')
736 i.addParameter(name='wintitle', value='CrossSpectraPlot', format='str')
737 i.addParameter(name='zmin', value='40', format='int')
738 i.addParameter(name='zmax', value='90', format='int')
739
740 if self.RTIPlotGraphCEB.isChecked():
741 for i in self.operObjList:
742 if i.name=='RTIPlot':
743 i.addParameter(name='n', value='2', format='int')
744 i.addParameter(name='overlapping', value='1', format='int')
745
746 @pyqtSignature("")
747 def on_actionguardarObj_triggered(self):
748 """
749 GUARDAR EL ARCHIVO DE CONFIGURACION XML
750 """
751 self.saveProject()
752
753
769
754 770 def saveProject(self):
755 771 if self.idp==1:
756 772 self.valuep=1
757 773
758 774 print "Escribiendo el archivo XML"
759 775 filename="C:\\WorkspaceGUI\\CONFIG"+str(self.valuep)+".xml"
760 776 self.controllerObj=self.proObjList[int(self.valuep)-1]
761 777 self.controllerObj.writeXml(filename)
762 778
779
780
781
763 782
764 783 class Window(QMainWindow, Ui_window):
765 784 """
766 785 Class documentation goes here.
767 786 """
768 787 closed=pyqtSignal()
769 788 def __init__(self, parent = None):
770 789 """
771 790 Constructor
772 791 """
773 792 QMainWindow.__init__(self, parent)
774 793 self.setupUi(self)
775 794 self.name=0
776 795 self.nameproject=None
777 796 self.proyectNameLine.setText('My_name_is...')
778 797 self.descriptionTextEdit.setText('Write a description...')
779 798
780 799
781 800 @pyqtSignature("")
782 801 def on_cancelButton_clicked(self):
783 802 """
784 803 Slot documentation goes here.
785 804 """
786 805 # TODO: not implemented yet
787 806 #raise NotImplementedError
788 807
789 808 self.hide()
790 809
791 810 @pyqtSignature("")
792 811 def on_okButton_clicked(self):
793 812 """
794 813 Slot documentation goes here.
795 814 """
796 815 #self.almacena()
797 816 self.close()
798 817
799 818 @pyqtSignature("")
800 819 def on_saveButton_clicked(self):
801 820 """
802 821 Slot documentation goes here.
803 822 """
804 823 self.almacena()
805 824 # self.close()
806 825
807 826 def almacena(self):
808 827 #print str(self.proyectNameLine.text())
809 828 self.nameproject=str(self.proyectNameLine.text())
810 829 self.description=str(self.descriptionTextEdit.toPlainText())
811 830 return self.nameproject,self.description
812 831
813 832 def closeEvent(self, event):
814 833 self.closed.emit()
815 834 event.accept()
816 835
817 836
837
838 #--------------------------------------VENTANA DE CONFIGURACION DE LA UP-----------------------#
839
818 840 class UnitProcess(QMainWindow, Ui_UnitProcess):
819 841 """
820 842 Class documentation goes here.
821 843 """
822 844 closed=pyqtSignal()
823 845 def __init__(self, parent = None):
824 846 """
825 847 Constructor
826 848 """
827 849 QMainWindow.__init__(self, parent)
828 850 self.setupUi(self)
829 851 self.getFromWindow=None
830 852 self.getfromWindowList=[]
831 853
832 self.listUP=None
833
834 def loadTotalList(self):
835 self.comboInputBox.clear()
836 for i in self.getfromWindowList:
837 name=i.getElementName()
838 id= i.id
839 if i.getElementName()=='ProcUnit':
840 id=int(i.id)-1
841 self.comboInputBox.addItem(str(name)+str(id))
842
843 @pyqtSignature("QString")
844 def on_comboInputBox_activated(self, p0):
845 """
846 Slot documentation goes here.
847 """
848
849 # TODO: not implemented yet
850 #raise NotImplementedError
851
852 @pyqtSignature("QString")
853 def on_comboTypeBox_activated(self, p0):
854 """
855 Slot documentation goes here.
856 """
857 # TODO: not implemented yet
858 #raise NotImplementedError
854 self.listUP=None
859 855
860 856 @pyqtSignature("")
861 857 def on_unitPokbut_clicked(self):
862 858 """
863 859 Slot documentation goes here.
864 860 """
865 861 self.close()
866 862
867 863 @pyqtSignature("")
868 864 def on_unitPsavebut_clicked(self):
869 865 """
870 866 Slot documentation goes here.
871 867 """
872 868
873 869 print "alex"
874 870 self.almacena()
875 871
876 872 @pyqtSignature("")
877 873 def on_unitPcancelbut_clicked(self):
878 874 """
879 875 Slot documentation goes here.
880 876 """
881 877 # TODO: not implemented yet
882 878 #raise NotImplementedError
883 self.hide()
879 self.hide()
880
881 def loadTotalList(self):
882 self.comboInputBox.clear()
883 for i in self.getfromWindowList:
884 name=i.getElementName()
885 id= i.id
886 if i.getElementName()=='ProcUnit':
887 id=int(i.id)-1
888 self.comboInputBox.addItem(str(name)+str(id))
884 889
885 890 def almacena(self):
886 891 self.getFromWindow=self.getfromWindowList[int(self.comboInputBox.currentIndex())]
887 892 #self.nameofUP= str(self.nameUptxt.text())
888 893 self.typeofUP= str(self.comboTypeBox.currentText())
889 894 return self.getFromWindow,self.typeofUP
890 895
891 896 def closeEvent(self, event):
892 897 self.closed.emit()
893 898 event.accept()
894 899
895 900
896 901
897 902
898 903
899 904
900 905 No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now