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