##// END OF EJS Templates
ULTIMA MODIFICACION...
Alexander Valdez -
r346:f02e56279251
parent child
Show More
This diff has been collapsed as it changes many lines, (709 lines changed) Show them Hide them
@@ -1,1129 +1,1506
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 Module implementing MainWindow.
4 4 #+++++++++++++INTERFAZ DE USUARIO V1.1++++++++++++++#
5 5 """
6 import os
6 import os,sys
7
8
7 9 import datetime
8 10
9 11 from PyQt4.QtGui import QMainWindow
10 12 from PyQt4.QtCore import pyqtSignature
11 13 from PyQt4.QtCore import pyqtSignal
12 14 from PyQt4 import QtCore
13 15 from PyQt4 import QtGui
14 16 from timeconversions import Doy2Date
15 17 from modelProperties import treeModel
16 18
17 19 from viewer.ui_unitprocess import Ui_UnitProcess
18 20 from viewer.ui_window import Ui_window
19 21 from viewer.ui_mainwindow import Ui_BasicWindow
20 from controller import Project,ReadUnitConf,ProcUnitConf,OperationConf,ParameterConf
22
23 print "Nohayproblema"
24 pathe = os.path.split(os.getcwd())[0]
25 sys.path.append(pathe)
26 print "leer", pathe
27
28 from controller import *
29
30
31 #from controller import Project,ReadUnitConf,ProcUnitConf,OperationConf,ParameterConf
21 32
22 33
23 34 def isRadarFile(file):
24 35
25 36 try:
26 37 year = int(file[1:5])
27 38 doy = int(file[5:8])
28 39 set = int(file[8:11])
29 40 except:
30 41 return 0
31 42
32 43 return 1
33 44
34 45 def isRadarPath(path):
35 46 try:
36 47 year = int(path[1:5])
37 48 doy = int(path[5:8])
38 49 except:
39 50 return 0
40 51
41 52 return 1
42 53
43 54 class BasicWindow(QMainWindow, Ui_BasicWindow):
44 55 __projObjDict = None
45 56 __arbolDict = None
46 57 __upObjDict = None
47 58
48 59 """
49 60 Class documentation goes here.
50 61 #*############VENTANA CUERPO DEL PROGRAMA##############
51 62 """
52 63 def __init__(self, parent = None):
53 64 """
54 65 Constructor
55 66 """
56 67 print "INICIO PROGRAMA "
57 68 QMainWindow.__init__(self, parent)
58 69 self.setupUi(self)
59 70
60 71 self.__projObjDict = {}
61 72 self.__arbolDict = {}
62 73 self.__upObjDict = {}
63 74 self.__opObjDict= {}
64 75 self.indexclick=None
76 self.b=0
65 77
66 78 self.online=0
67 79 self.datatype=0
68 80 self.dateList=[]
69 81
70 82 self.proObjList=[]
71 83 self.idp=0
72 84 self.namep=0
73 85 self.description=0
74 86 self.namepTree=0
75 87 self.valuep=0
76 88
77 89 self.upObjList= []
78 90 self.upn=0
79 91 self.upName=0
80 92 self.upType=0
81 93 self.uporProObjRecover=0
82 94
83 95 self.readUnitConfObjList=[]
84 96
85 97 self.upObjVolList=[]
86 98 self.upobjSpecList=[]
87 99
88 100 self.operObjList=[]
89 101
90 102 self.configProject=None
91 103 self.configUP=None
92 104
93 105 self.readUnitConfObj=None
94 106 self.procUnitConfObj0=None
95 107 self.opObj10=None
96 108 self.opObj12=None
97 109
98 110 self.setParam()
99 111
100 112 #------------------VistadelNombreCompletousandoelpunteroSobrelosbotones---------------------------#
101 113 QtGui.QToolTip.setFont(QtGui.QFont('SansSerif', 10))
102 114 self.addprojectBtn.setToolTip('Add_New_Project')
103 115 self.addUnitProces.setToolTip('Add_New_Processing_Unit')
104 116
105 117 #------------------------ManejodeEventosconelmouse------------------------------------------------#
106 118 self.model = QtGui.QStandardItemModel()
107 119 self.treeView.setModel(self.model)
108 120 self.treeView.clicked.connect(self.clickFunctiontree)
109 121 self.treeView.doubleClicked.connect(self.doubleclickFunctiontree)
110 122 self.treeView.expandAll()
111 123
112 124 #self.treeView.setReadOnly(True)
113 125 self.treeView.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
114 126 self.treeView.customContextMenuRequested.connect(self.popup)
115 127 #self.treeView.clicked.connect(self.treefunction1)
116
128 self.model_2=treeModel()
117 129
118 130
119 131 #-----------------------------------BARRA DE MENU-------------------------------------------------#
120 132
121 133 def popup(self, pos):
122 134 # for i in self.treeView.selectionModel().selection().indexes():
123 135 # print i.row(), i.column()
124 136 menu = QtGui.QMenu()
125 137 #menu.centralWidget.setObjectName(_fromUtf8("centralWidget"))
126 138 quitAction0 = menu.addAction("Add Branch")
127 139 quitAction1 = menu.addAction("Delete Branch")
128 140 quitAction2 = menu.addAction("Exit")
129 141 #quitAction2 = menu.addAction("Exit")
130 142 print "pos:", pos
131 143 action = menu.exec_(self.mapToGlobal(pos))
132 144 if action == quitAction0:
133 145 self.addUP()
134 146
135 147 if action == quitAction1:
136 148 for i in self.__arbolDict:
137 149 if self.__arbolDict[i]==self.indexclick:
138 150 self.arbolItem=self.__arbolDict[i]
139 151 print self.arbolItem
140 152 self.arbolItem.removeRows(self.arbolItem.row(),1)
141 153 if action == quitAction2:
142 154 return
143 155 #----------------------------------- MENU_PROJECT--------------------------------------------------#
144 156
145 157 @pyqtSignature("")
146 158 def on_menuFileAbrirObj_triggered(self):
147 159 """
148 160 Abre un archivo de configuracion seleccionado, lee los parametros y
149 161 actualiza los atributos de esta clase; creando los objetos necesarios
150 162 con los parametros leidos desde el archivo.
151 163 """
152 164 print "Leer un archivo xml y extraer sus atributos Not implemented yet"
153 165
154 166 @pyqtSignature("")
155 167 def on_menuFileCrearObj_triggered(self):
156 168 """
157 169 Crea un proyecto nuevo y lo anade a mi diccionario de proyectos
158 170 y habilita la ventana de configuracion del proyecto.
159 171
160 172 """
161 173 self.addProject()
162 174
163 175 @pyqtSignature("")
164 176 def on_menuFileGuardarObj_triggered(self):
165 177 """
166 178 METODO EJECUTADO CUANDO OCURRE EL EVENTO GUARDAR PROJECTO
167 179
168 180 Llama al metodo saveProject.
169 181 """
170 182 # my_id = arbol_selected()
171 183 # filename = savefindow.show()
172 184 # self.saveProject(id, filename)
173 185 print "probsave"
174 186 self.saveProject()
175 187
176 188 @pyqtSignature("")
177 189 def on_menuFileCerrarObj_triggered(self):
178 190 """
179 191 METODO EJECUTADO CUANDO OCURRE EL EVENTO CERRAR
180 192 Llama al metodo close.
181 193 """
182 194 self.close()
183 195
184 196 #-----------------------------------MENU_RUN----------------------------------------------------#
185 197
186 198 @pyqtSignature("")
187 199 def on_menuRUNStartObj_clicked(self):
188 200 """
189 201 METODO EJECUTADO CUANDO OCURRE EL EVENTO RUN
190 202 Llama al metodo RUN.
191 203 """
204
205 print "Leyendo el archivo XML"
206 for i in self.__arbolDict:
207 if self.__arbolDict[i]==self.indexclick:
208 self.projectObj=self.__projObjDict[i]
209 print "Encontre project"
210 filename="C:\WorkspaceGUI\config"+str(self.projectObj.id)+".xml"
211 self.projectObj.readXml(filename)
212 #controllerObj.printattr()
213
214 self.projectObj.createObjects()
215 self.projectObj.connectObjects()
216 self.projectObj.run()
192 217 print "Not implemented yet"
193 218
194 219 @pyqtSignature("")
195 220 def on_menuRUNPausaObj_clicked(self):
196 221 """
197 222 METODO EJECUTADO CUANDO OCURRE EL EVENTO PAUSA
198 223 Llama al metodo PAUSA.
199 224 """
200 225 print "Not implemented yet"
201 226
202 227 #-----------------------------------MENU_OPTION-------------------------------------------------#
203 228
204 229 @pyqtSignature("")
205 230 def on_menuOptConfigLogfileObj_clicked(self):
206 231 """
207 232 METODO EJECUTADO CUANDO OCURRE EL EVENTO ConfigLog
208 233 Llama al metodo close.
209 234 """
210 235 print "Not implemented yet"
211 236
212 237 @pyqtSignature("")
213 238 def on_menuOptConfigserverObj_clicked(self):
214 239 """
215 240 METODO EJECUTADO CUANDO OCURRE EL EVENTO Config Server
216 241 Llama al metodo close.
217 242 """
218 243 print "Not implemented yet"
219 244 #-----------------------------------MENU_HELP-------------------------------------------------------#
220 245
221 246 @pyqtSignature("")
222 247 def on_menuHELPAboutObj_clicked(self):
223 248 """
224 249 METODO EJECUTADO CUANDO OCURRE EL EVENTO HELP
225 250 Llama al metodo close.
226 251 """
227 252 print "Not implemented yet"
228 253
229 @pyqtSignature("")
230 def on_menuHELPPrfObj_clicked(self):
231 """
232 METODO EJECUTADO CUANDO OCURRE EL EVENTO HElp
233 Llama al metodo close.
234 """
235 print "Not implemented yet"
236
254
237 255 #-----------------------------------BARRA DE HERRAMIENTAS----------------------------------------#
238 256
239 257 @pyqtSignature("")
240 258 def on_actOpenObj_triggered(self):
241 259 """
242 260 METODO CARGA UN ARCHIVO DE CONFIGURACION ANTERIOR
243 261 """
244 262 print "Leer un archivo xml y extraer sus atributos Not implemented yet"
245 263
246 264 @pyqtSignature("")
247 265 def on_actCreateObj_triggered(self):
248 266 """
249 267 CREAR PROJECT ,ANADE UN NUEVO PROYECTO, LLAMA AL MÉTODO QUE CONTIENE LAS OPERACION DE CREACION DE PROYECTOS
250 268 Llama al metodo addProject.
251 269 """
252 270 self.addProject()
253 271
254 272 @pyqtSignature("")
255 273 def on_actStopObj_triggered(self):
256 274 """
257 275 METODO EJECUTADO CUANDO OCURRE EL EVENTO PAUSA
258 276 Llama al metodo PAUSA.
259 277 """
260 278 print "Not implemented yet"
261 279
262 280 @pyqtSignature("")
263 281 def on_actPlayObj_triggered(self):
264 282 """
265 283 METODO EJECUTADO CUANDO OCURRE EL EVENTO PAUSA
266 284 Llama al metodo PAUSA.
267 285 """
286 print "Leyendo el archivo XML"
287 for i in self.__arbolDict:
288 if self.__arbolDict[i]==self.indexclick:
289 self.projectObj=self.__projObjDict[i]
290 print "Encontre project"
291 filename="C:\WorkspaceGUI\config"+str(self.projectObj.id)+".xml"
292 self.projectObj.readXml(filename)
293 #controllerObj.printattr()
294
295 self.projectObj.createObjects()
296 self.projectObj.connectObjects()
297 self.projectObj.run()
268 298 print "Not implemented yet"
269 299
270 300 @pyqtSignature("")
271 301 def on_actSaveObj_triggered(self):
272 302 """
273 303 METODO EJECUTADO CUANDO OCURRE EL EVENTO SAVE
274 304 Llama al metodo SAVE.
275 305 """
276 306 self.saveProject()
277 307
278 308 #-----------------------------------PUSHBUTTON_CREATE PROJECT----------------------------------#
279 309
280 310 @pyqtSignature("")
281 311 def on_addprojectBtn_clicked(self):
282 312 """
283 313 CREAR PROJECT ,ANADE UN NUEVO PROYECTO, LLAMA AL MÉTODO QUE CONTIENE LAS OPERACION DE CREACION DE PROYECTOS
284 314 Llama al metodo addProject.
285 315 """
286 316 self.addProject()
287 317 self.setProjectParam()
288 318
289 319 #------------------------------------VENTANA CONFIGURACION PROJECT----------------------------#
290
320
291 321 @pyqtSignature("int")
292 322 def on_dataTypeCmbBox_activated(self,index):
293 323 """
294 324 Metodo que identifica que tipo de dato se va a trabajar VOLTAGE O ESPECTRA
295 325 """
296 326 self.dataFormatTxt.setReadOnly(True)
297 327 if index==0:
298 328 self.datatype='.r'
299 329 elif index==1:
300 330 self.datatype='.pdata'
301 331 else :
302 332 self.datatype=''
303 333 self.dataFormatTxt.setReadOnly(False)
304 334 self.dataFormatTxt.setText(self.datatype)
305 335 self.loadDays()
306 336
307 337 @pyqtSignature("")
308 338 def on_dataPathBrowse_clicked(self):
309 339 """
310 340 OBTENCION DE LA RUTA DE DATOS
311 341 """
312 342 self.dataPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly))
313 343 self.dataPathTxt.setText(self.dataPath)
314 344
315 345 self.starDateCmbBox.clear()
316 346 self.endDateCmbBox.clear()
317 347
318 348 if not os.path.exists(self.dataPath):
319 349 self.dataOkBtn.setEnabled(False)
320 350 return
321 351
322 352 self.loadDays()
323 353
324 354 @pyqtSignature("int")
325 355 def on_starDateCmbBox_activated(self, index):
326 356 """
327 357 SELECCION DEL RANGO DE FECHAS -START DATE
328 358 """
329 359 stopIndex = self.endDateCmbBox.count() - self.endDateCmbBox.currentIndex()
330 360 self.endDateCmbBox.clear()
331 361
332 362 for i in self.dateList[index:]:
333 363 self.endDateCmbBox.addItem(i)
334 364
335 365 self.endDateCmbBox.setCurrentIndex(self.endDateCmbBox.count() - stopIndex)
336 366
337 367 @pyqtSignature("int")
338 368 def on_endDateCmbBox_activated(self, index):
339 369 """
340 370 SELECCION DEL RANGO DE FECHAS-END DATE
341 371 """
342 372 startIndex=self.starDateCmbBox.currentIndex()
343 373 stopIndex = self.endDateCmbBox.count() - index
344 374 self.starDateCmbBox.clear()
345 375 for i in self.dateList[:len(self.dateList) - stopIndex + 1]:
346 376 self.starDateCmbBox.addItem(i)
347 377 self.starDateCmbBox.setCurrentIndex(startIndex)
348 378
349 379 @pyqtSignature("int")
350 380 def on_readModeCmBox_activated(self, p0):
351 381 """
352 382 SELECCION DEL MODO DE LECTURA ON=1, OFF=0
353 383 """
354 384 if p0==0:
355 385 self.online=0
356 386 elif p0==1:
357 387 self.online=1
358 388
359 389 #---------------PUSHBUTTON_DATA " OKBUTTON "_CONFIGURATION PROJECT--------------------------#
360 390
361 391 @pyqtSignature("")
362 392 def on_dataOkBtn_clicked(self):
363 393 """
364 394 AΓ±ade al Obj XML de Projecto, name,datatype,date,time,readmode,wait,etc, crea el readUnitProcess del archivo xml.
365 395 Prepara la configuraciΓ³n del diΓ‘grama del Arbol del treeView numero 2
366 396 """
367 397 print "DATOS DEL PROJECT PATH,DATE,TIME"
368 398
369 399 # print self.projectObj
370 400 # print i
371 401 # print "get",self.__arbolDict.items()
372 402 # print "keys",self.__arbolDict.keys()
373 403
374 404 self.idp += 1
375 405 self.projectObj = Project()
376 406 self.__projObjDict[self.idp] = self.projectObj
377 407
378 408 self.description="Think"
379 409
380 410 id = self.idp
381 411 name = str(self.nameProjectTxt.text())
382 412 desc = str(self.description)
383 413
384 414 self.projectObj.setup(id = id, name=name, description=desc)
385 415 print "self.projectObj.id",self.projectObj.id
386 416
387 417 #-------AΓ‘ADIENDO PARAMETROS A LA UNIDAD DE LECTURA---------#
388 418
389 419 datatype = str(self.dataTypeCmbBox.currentText())
390 420 path = str(self.dataPathTxt.text())
391 421 online = int(self.online)
392 422 starDate = str(self.starDateCmbBox.currentText())
393 423 endDate = str(self.endDateCmbBox.currentText())
394 424
395 425
396 426 reloj1=self.startTimeEdit.time()
397 427 print
398 428
399 reloj2=self.timeEdit_2.time()
429 reloj2=self.endTimeEdit.time()
400 430
401 431 print reloj1.hour()
402 432 print reloj1.minute()
403 433 print reloj1.second()
404 434
405 435 self.readUnitConfObj = self.projectObj.addReadUnit(datatype = datatype,
406 436 path = path,
407 437 startDate = starDate,
408 438 endDate = endDate,
409 439 startTime = str(reloj1.hour()) +":"+str(reloj1.minute())+":"+ str(reloj1.second()),
410 440 endTime = str(reloj2.hour()) +":"+str(reloj2.minute())+":"+ str(reloj2.second()),
411 441 online = online)
412 442 print self.readUnitConfObj.datatype,"self.readUnitConfObj.datatype"
413 443
414 444 self.readUnitConfObjList.append(self.readUnitConfObj)
415 445
416 446 #--------VISUALIZACION EN LA VENTANA PROJECT PROPERTIES-----------------#
417 self.model_2=treeModel()
447 #self.model_2=treeModel()
448 self.model_2=treeModel()
418 449 self.model_2.setParams(name = self.projectObj.name,
419 450 directorio = path,
420 451 workspace = "C:\\WorkspaceGUI",
421 452 remode = str(self.readModeCmBox.currentText()),
422 453 dataformat = datatype,
423 454 date = str(starDate)+"-"+str(endDate),
424 455 initTime = str(reloj1.hour()) +":"+str(reloj1.minute())+":"+ str(reloj1.second()),
425 456 endTime = str(reloj2.hour()) +":"+str(reloj2.minute())+":"+ str(reloj2.second()),
426 457 timezone = "Local" ,
427 458 Summary = "test de prueba")
428 459
429 460 self.model_2.arbol()
461 self.model_2.showtree()
430 462 self.treeView_2.setModel(self.model_2)
431 463 self.treeView_2.expandAll()
432 464
433 465 #--------CREACIΓ“NDELDIAGRAMADELARBOL------------------------#
434 466 self.parentItem = self.model.invisibleRootItem()
435 467 #self.__arbolDict[self.idp] = QtGui.QStandardItem(QtCore.QString(name).arg(self.idp))
436 468 self.__arbolDict[self.idp] = QtGui.QStandardItem(QtCore.QString(name).arg(self.idp))
437 469
438 470 print self.__arbolDict[self.idp]
439 471 self.parentItem.appendRow(self.__arbolDict[self.idp])
440 472 self.parentItem=self.__arbolDict[self.idp]
441 473
442 474 #--------BLOQUEO-------#
443 475 self.tabProject.setEnabled(False)
444 476
445 477
446 478 #-----------------PUSHBUTTON_ADD_PROCESSING UNIT PROJECT------------------#
447 479 @pyqtSignature("")
448 480 def on_addUnitProces_clicked(self):
449 481 """
450 482 CREAR PROCESSING UNIT ,añade unidad de procesamiento, LLAMA AL MÉTODO addUP QUE CONTIENE LAS OPERACION DE CREACION DE UNIDADES DE PROCESAMIENTO
451 483 Llama al metodo addUP.
452 484 """
453 485 self.addUP()
454 486
455 487 def setParam(self):
456 488
457 489 self.tabWidgetProject.setEnabled(False)
458 490 self.tabVoltage.setEnabled(False)
459 491 self.tabSpectra.setEnabled(False)
460 492 self.tabCorrelation.setEnabled(False)
461 self.dataPathTxt.setText('C:\data')
493 self.dataPathTxt.setText('C:\data2')
462 494 self.nameProjectTxt.setText("Test")
463 495 self.numberChannelopVol.setEnabled(False)
496 self.lineFilteropVolCEB.setEnabled(False)
464 497 self.lineHeighProfileTxtopVol.setEnabled(False)
465 498 self.numberIntegration.setEnabled(False)
466 499 self.valuenFFTPointOpSpec.setEnabled(False)
467 500 self.lineProfileSelecopVolCEB.setEnabled(False)
468
501 self.valueSelecChOpVol.setEnabled(False)
502 self.valueSelecHeigOpVol.setEnabled(False)
503 self.profileSelecOpVol.setEnabled(False)
504 self.decodeCcob.setEnabled(False)
505 self.decodeMcob.setEnabled(False)
506
507 self.wiWineTxtGraphicsVol.setEnabled(False)
508 self.channelLisstTxtVol.setEnabled(False)
509 self.xminTxtVol.setEnabled(False)
510 self.yminTxtVol.setEnabled(False)
511
512 self.setDisableAllSpecop()
513 self.setDisableAllElementSpecGraph()
514 # self.winTitleGraphSpec.setEnabled(False)
515 # self.channelListgraphSpec.setEnabled(False)
516 # self.xminGraphSpec.setEnabled(False)
517 # self.yminGraphSpec.setEnabled(False)
518 # self.zminGraphSpec.setEnabled(False)
519 # self.timeRangeGraphSpec.setEnabled(False)
520 # self.dataPathTxtSpec.setEnabled(False)
521 # self.dataPrefixGraphSpec.setEnabled(False)
522
469 523 def setProjectParam(self):
470 524 self.nameProjectTxt.setText("Test")
471 self.dataPathTxt.setText('C:\data')
525 self.dataPathTxt.setText('C:\data2')
472 526 self.dataTypeCmbBox.clear()
473 527 self.dataTypeCmbBox.addItem("Voltage")
474 528 self.dataTypeCmbBox.addItem("Spectra")
475 529 startTime="00:00:00"
476 530 endTime="23:59:59"
477 531 starlist=startTime.split(":")
478 532 endlist=endTime.split(":")
479 533 print starlist[0],starlist[1],starlist[2]
480 534 print endlist[0],endlist[1],endlist[2]
481 535 self.time.setHMS(int(starlist[0]),int(starlist[1]),int(starlist[2]))
482 536 self.startTimeEdit.setTime(self.time)
483 537 self.time.setHMS(int(endlist[0]),int(endlist[1]),int(endlist[2]))
484 self.timeEdit_2.setTime(self.time)
538 self.endTimeEdit.setTime(self.time)
485 539
486 540 def clickFunctiontree(self,index):
487 541
488 542 self.indexclick= index.model().itemFromIndex(index)
489 543 print "OPCION CLICK"
490 544 print "ArbolDict",self.indexclick
491 545 print "name:",self.indexclick.text()
492 546 #print self.tabWidgetProject.currentIndex()
493 547
494 548
495 549
496 550
497 551 def doubleclickFunctiontree(self):
498 552 for i in self.__arbolDict:
499 553 if self.__arbolDict[i]==self.indexclick:
500 554 print "INDEXCLICK=ARBOLDICT",i
501 555 if self.__projObjDict.has_key(i)==True:
502 556 self.tabWidgetProject.setCurrentWidget(self.tabProject)
503 557 self.nameProjectTxt.setText(str(self.__projObjDict[i].name))
504 558 self.dataTypeCmbBox.clear()
505 559 self.dataTypeCmbBox.addItem(str(self.readUnitConfObjList[i-1].datatype))
506 560 print str(self.readUnitConfObjList[i-1].path)
507 561 self.dataPathTxt.setText(str(self.readUnitConfObjList[i-1].path))
508 562 self.starDateCmbBox.clear()
509 563 self.endDateCmbBox.clear()
510 564 self.starDateCmbBox.addItem(str(self.readUnitConfObjList[i-1].startDate))
511 565 self.endDateCmbBox.addItem(str(self.readUnitConfObjList[i-1].endDate))
512 566 startTime=self.readUnitConfObjList[i-1].startTime
513 567 endTime=self.readUnitConfObjList[i-1].endTime
514 568 starlist=startTime.split(":")
515 569 endlist=endTime.split(":")
516 570 print starlist[0],starlist[1],starlist[2]
517 571 print endlist[0],endlist[1],endlist[2]
518 572 self.time.setHMS(int(starlist[0]),int(starlist[1]),int(starlist[2]))
519 573 self.startTimeEdit.setTime(self.time)
520 574 self.time.setHMS(int(endlist[0]),int(endlist[1]),int(endlist[2]))
521 self.timeEdit_2.setTime(self.time)
575 self.endTimeEdit.setTime(self.time)
522 576
523 577 #--------VISUALIZACION EN LA VENTANA PROJECT PROPERTIES-----------------#
524 self.model_2=treeModel()
525 self.model_2.setParams(name = str(self.__projObjDict[i].name),
526 directorio = str(self.readUnitConfObjList[i-1].path),
527 workspace = "C:\\WorkspaceGUI",
528 remode = str(self.readModeCmBox.currentText()),
529 dataformat = "Voltage",
530 date = str(self.readUnitConfObjList[i-1].startDate)+"-"+str(self.readUnitConfObjList[i-1].endDate),
531 initTime = str(starlist[0]) +":"+str(starlist[1])+":"+ str(starlist[2]),
532 endTime = str(endlist[0]) +":"+str(endlist[1])+":"+ str(endlist[2]),
533 timezone = "Local" ,
534 Summary = "test de prueba")
535
536 self.model_2.arbol()
537 self.treeView_2.setModel(self.model_2)
538 self.treeView_2.expandAll()
578 # self.model_2=treeModel()
579 # self.model_2.setParams(name = str(self.__projObjDict[i].name),
580 # directorio = str(self.readUnitConfObjList[i-1].path),
581 # workspace = "C:\\WorkspaceGUI",
582 # remode = str(self.readModeCmBox.currentText()),
583 # dataformat = "Voltage",
584 # date = str(self.readUnitConfObjList[i-1].startDate)+"-"+str(self.readUnitConfObjList[i-1].endDate),
585 # initTime = str(starlist[0]) +":"+str(starlist[1])+":"+ str(starlist[2]),
586 # endTime = str(endlist[0]) +":"+str(endlist[1])+":"+ str(endlist[2]),
587 # timezone = "Local" ,
588 # Summary = "test de prueba")
589 #
590 # self.model_2.arbol()
591 # self.model_2.showtree()
592 # self.treeView_2.setModel(self.model_2)
593 # self.treeView_2.expandAll()
539 594
540 595 #self.dataPathTxt.setText(str(self.__projObjDict[i].addReadUnit.path()))
541 596
542 597 if self.indexclick.text()=='Voltage':
543 598 self.tabVoltage.setEnabled(True)
544 599 self.tabWidgetProject.setCurrentWidget(self.tabVoltage)
545 600 # for i in self.__opObjDict[i]
546 601 # self.OpObj=
547 602
548 603 if self.indexclick.text()=='Spectra':
549 604 self.tabSpectra.setEnabled(True)
550 605 self.tabWidgetProject.setCurrentWidget(self.tabSpectra)
606
551 607
552 608 if self.indexclick.text()=='Correlation':
553 609 self.tabCorrelation.setEnabled(True)
554 610 self.tabWidgetProject.setCurrentWidget(self.tabCorrelation)
555 611
556 612 def addProject(self):
557 613
558 614 self.tabWidgetProject.setEnabled(True)
559 615 #---------------KILL-----------------#
560 616 # self.tabWidgetProject.setTabsClosable(True)
561 617 # self.tabWidgetProject.tabCloseRequested.connect(self.tabWidgetProject.removeTab)
562 618 #------------------------------------#
563 619 self.tabWidgetProject.setCurrentWidget(self.tabProject)
564 620 self.tabProject.setEnabled(True)
565 621 #self.tabVoltage.setEnabled(False)
566 622 print "HABILITA WIDGET"
567 623
568 624 def existDir(self, var_dir):
569 625 """
570 626 METODO PARA VERIFICAR SI LA RUTA EXISTE-VAR_DIR
571 627 VARIABLE DIRECCION
572 628 """
573 629 if os.path.isdir(var_dir):
574 630 return True
575 631 else:
576 632 self.textEdit.append("Incorrect path:" + str(var_dir))
577 633 return False
578 634
579 635 def searchData(self, path, ext, expLabel='', walk=1):
580 636
581 637 dateList = []
582 638 fileList = []
583 639
584 640 if walk == 0:
585 641 files = os.listdir(path)
586 642 for thisFile in files:
587 643 if not os.path.isfile(thisFile):
588 644 continue
589 645 thisExt = os.path.splitext(thisFile)[-1]
590 646
591 647 if thisExt != ext:
592 648 continue
593 649
594 650 fileList.append(file)
595 651
596 652 for thisFile in fileList:
597 653
598 654 if not isRadarFile(thisFile):
599 655 continue
600 656
601 657 year = int(thisFile[1:5])
602 658 doy = int(thisFile[5:8])
603 659
604 660 date = datetime.date(year,1,1) + datetime.timedelta(doy-1)
605 661 dateformat = date.strftime("%Y/%m/%d")
606 662
607 663 if dateformat not in dateList:
608 664 dateList.append(dateformat)
609 665
610 666 if walk == 1:
611 667
612 668 dirList = os.listdir(path)
613 669 dirList.sort()
614 670
615 671 dateList = []
616 672
617 673 for thisDir in dirList:
618 674
619 675 if not isRadarPath(thisDir):
620 676 continue
621 677
622 678 doypath = os.path.join(path, thisDir, expLabel)
623 679
624 680 files = os.listdir(doypath)
625 681 fileList = []
626 682
627 683 for thisFile in files:
628 684
629 685 if os.path.splitext(thisFile)[-1] != ext:
630 686 continue
631 687
632 688 if not isRadarFile(thisFile):
633 689 continue
634 690
635 691 fileList.append(thisFile)
636 692 break
637 693
638 694 if fileList == []:
639 695 continue
640 696
641 697 year = int(thisDir[1:5])
642 698 doy = int(thisDir[5:8])
643 699
644 700 date = datetime.date(year,1,1) + datetime.timedelta(doy-1)
645 701 dateformat = date.strftime("%Y/%m/%d")
646 702 dateList.append(dateformat)
647 703
648 704 return dateList
649 705
650 706 def loadDays(self):
651 707 """
652 708 METODO PARA CARGAR LOS DIAS
653 709 """
654 710 ext = self.datatype
655 711 path = str(self.dataPathTxt.text())
656 712
657 713 self.starDateCmbBox.clear()
658 714 self.endDateCmbBox.clear()
659 715
660 716 dateList = self.searchData(path, ext=ext)
661 717 #Se cargan las listas para seleccionar StartDay y StopDay (QComboBox)
662 718 self.dateList = dateList
663 719
664 720 for thisDate in dateList:
665 721 self.starDateCmbBox.addItem(thisDate)
666 722 self.endDateCmbBox.addItem(thisDate)
667 723
668 724 self.endDateCmbBox.setCurrentIndex(self.starDateCmbBox.count()-1)
669 725 self.dataOkBtn.setEnabled(True)
670 726
671 727 def HourChanged(self):
672 728 #self.hour = self.HourScrollBar.value()
673 729 self.set_time()
674 730
675 731 def MinChanged(self):
676 732 #self.min = self.MinScrollBar.value()
677 733 self.set_time()
678 734
679 735 def SecChanged(self):
680 736 #self.sec = self.SecScrollBar.value()
681 737 self.set_time()
682 738
683 739 def set_time(self):
684 740 self.time.setHMS(self.hour, self.min, self.sec)
685 741 self.startTimeEdit.setTime(self.time)
686 742
687 self.timeEdit_2.setTime(self.time)
743 self.endTimeEdit.setTime(self.time)
688 744
689 745
690 746 def addUP(self):
691 747
692 748 self.configUP=UnitProcess(self)
693 749
694 750 for i in self.__arbolDict:
695 751 if self.__arbolDict[i]==self.indexclick:
696 752 print "INDEXCLICK=ARBOLDICT",i
697 753 if self.__projObjDict.has_key(i)==True:
698 754 self.projectObj=self.__projObjDict[int(i)]
699 755 print "self.projectObj.id",self.projectObj.id
700 756 #-----------AΓ±adiendo Tipo de dato y Projecto a la Clase UnitProcess que abre la ventana de selecciΓ³n----#
701 757 self.configUP.dataTypeProject=str(self.dataTypeCmbBox.currentText())
702 758 self.configUP.getfromWindowList.append(self.projectObj)
703 759
704 760 # for i in self.projectObj.procUnitConfObjDict:
705 761 # if self.projectObj.procUnitConfObjDict[i].getElementName()=='ProcUnit':
706 762 # self.upObj=self.projectObj.procUnitConfObjDict[i]
707 763 # self.configUP.getfromWindowList.append(self.upObj)
708 764 else:
709 765 #-----------AΓ±adiendo Unidad de Procesamiento a una Unidad de Procesamiento----#
710 766 self.upObj=self.__upObjDict[i]
711 767 print "self.upObj.id",self.upObj.id
712 768 self.configUP.getfromWindowList.append(self.upObj)
713 769
714 770 self.configUP.loadTotalList()
715 771 self.configUP.show()
716 772 self.configUP.closed.connect(self.createUP)
717 773
718 774 def createUP(self):
719 775
720 776 print "ADICION DE BRANCH Y ID"
721 777
722 778 if not self.configUP.create:
723 779 return
724 780
725 781 self.uporProObjRecover=self.configUP.getFromWindow
726 782
727 783 self.upType = self.configUP.typeofUP
728 784 for i in self.__arbolDict:
729 785 print self.__arbolDict[i],"VALORES DEL DIC"
730 786 if self.__arbolDict[i]==self.indexclick:
731 787 if self.__projObjDict.has_key(i)==True:
732 788 # print "self.__projObjDict[int(i)]" ,__projObjDict[int(i)]
733 789 self.projectObj=self.__projObjDict[int(i)]
734 790 print self.__projObjDict[int(i)]
735 791
736 792 if self.__upObjDict.has_key(i)==True:
737 793 print "Entro al else"
738 794 print self.__upObjDict.items()
739 795 self.upObj=self.__upObjDict[i]
740 796 getIdProject=self.upObj.id[0]
741 797 print getIdProject
742 798 self.projectObj=self.__projObjDict[int(getIdProject)]
743 799
744 800 datatype=str(self.upType)
745 801 uporprojectObj=self.uporProObjRecover
746 802
747 803 if uporprojectObj.getElementName()=='ProcUnit':
748 804 inputId=uporprojectObj.getId()
749 805 else:
750 806 inputId=self.readUnitConfObjList[uporprojectObj.id-1].getId()
751 807
752 808 print 'uporprojectObj.id:',uporprojectObj.id,'inputId:',inputId
753 809 self.procUnitConfObj1 = self.projectObj.addProcUnit(datatype=datatype, inputId=inputId)
754 810 self.__upObjDict[self.procUnitConfObj1.id]= self.procUnitConfObj1
755 811 print "PRIMERA UP_VEAMOS",self.__upObjDict.items()
756 812 self.parentItem=self.__arbolDict[uporprojectObj.id]
757 813 #print "i","self.__arbolDict[i]",i ,self.__arbolDict[i]
758 814 self.numbertree=int(self.procUnitConfObj1.getId())-1
759 815 print self.procUnitConfObj1.id," ID DE LA UNIDAD DE PROCESAMIENTO "
760 816 #self.__arbolDict[self.procUnitConfObj1.id]=QtGui.QStandardItem(QtCore.QString(datatype+"%1").arg(self.numbertree))
761 817
762 818
763 819
764 820 self.__arbolDict[self.procUnitConfObj1.id]=QtGui.QStandardItem(QtCore.QString(datatype).arg(self.numbertree))
765 821 self.parentItem.appendRow(self.__arbolDict[self.procUnitConfObj1.id])
766 822 self.parentItem=self.__arbolDict[self.procUnitConfObj1.id]
767 823 # self.loadUp()
768 824 self.treeView.expandAll()
769 825
770 826 def resetopVolt(self):
771 827 self.selecChannelopVolCEB.setChecked(False)
772 828 self.selecHeighopVolCEB.setChecked(False)
773 829 self.coherentIntegrationCEB.setChecked(False)
774 830 self.profileSelecopVolCEB.setChecked(False)
831 self.FilterCEB.setChecked(False)
832
775 833 #self.selecChannelopVolCEB.setEnabled(False)
776 834 self.lineHeighProfileTxtopVol.clear()
777 835 self.lineProfileSelecopVolCEB.clear()
778 836 self.numberChannelopVol.clear()
779 837 self.numberIntegration.clear()
780
838 self.lineFilteropVolCEB.clear()
781 839
782 840 def resetopSpec(self):
783 841
784 842 self.nFFTPointOpSpecCEB.setChecked(False)
785 843 self.valuenFFTPointOpSpec.clear()
786 844
787 845 def resetgraphSpec(self):
788 846 self.SpectraPlotGraphCEB.setChecked(False)
789 847 self.CrossSpectraPlotGraphceb.setChecked(False)
790 848 self.RTIPlotGraphCEB.setChecked(False)
791 849
792 850 def saveProject(self):
793 851 print "entro"
794 852 #filename="C:\WorkspaceGUI\config1.xml"
795 853 for i in self.__arbolDict:
796 854 if self.__arbolDict[i]==self.indexclick:
797 855 self.projectObj=self.__projObjDict[i]
798 856 print "Encontre project"
799 857 filename="C:\WorkspaceGUI\config"+str(self.projectObj.id)+".xml"
800 858 print "Escribo Project"
801 859 self.projectObj.writeXml(filename)
802 860
861 # -----------------OPCIONES DE CONFIGURACION VOLTAGE---------------------------#
803 862
863 @pyqtSignature("")
864 def on_dataGraphicsVolPathBrowse_clicked(self):
865 """
866 OBTENCION DE LA RUTA DE DATOS
867 """
868 self.dataPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly))
869 self.dataPathtxtGraphicsVol.setText(self.dataPath)
870
871 if not os.path.exists(self.dataPath):
872 self.dataGraphVolOkBtn.setEnabled(False)
873 return
804 874
805 875 # -----------------VENTANA CONFIGURACION DE VOLTAGE---------------------------#
806
876
807 877 @pyqtSignature("int")
808 878 def on_selecChannelopVolCEB_stateChanged(self, p0):
809 879 """
810 880 Check Box habilita operaciones de SelecciοΏ½n de Canales
811 881 """
812 882 if p0==2:
813 883 self.numberChannelopVol.setEnabled(True)
814 # upProcessSelect=self.upObjVolList[int(self.addOpUpselec.currentIndex())]
815 # opObj10=upProcessSelect.addOperation(name='selectChannels')
816 # print opObj10.id
817 # self.operObjList.append(opObj10)
884 self.valueSelecChOpVol.setEnabled(True)
818 885 print " Ingresa seleccion de Canales"
819 886 if p0==0:
820 887 self.numberChannelopVol.setEnabled(False)
821
888 self.valueSelecChOpVol.setEnabled(False)
822 889 print " deshabilitado"
823 890
824 891 @pyqtSignature("int")
825 892 def on_selecHeighopVolCEB_stateChanged(self, p0):
826 893 """
827 894 Check Box habilita operaciones de SelecciοΏ½n de Alturas
828 895 """
829 896 if p0==2:
830 897 self.lineHeighProfileTxtopVol.setEnabled(True)
831 # upProcessSelect=self.upObjVolList[int(self.addOpUpselec.currentIndex())]
832 # opObj10=upProcessSelect.addOperation(name='selectHeights')
833 # print opObj10.id
834 # self.operObjList.append(opObj10)
898 self.valueSelecHeigOpVol.setEnabled(True)
835 899 print " Select Type of Profile"
836 900 if p0==0:
837 901 self.lineHeighProfileTxtopVol.setEnabled(False)
902 self.valueSelecHeigOpVol.setEnabled(False)
838 903 print " deshabilitado"
839 904
840 905
841 906 @pyqtSignature("int")
907 def on_filterCEB_stateChanged(self, p0):
908 """
909 Name='Decoder', optype='other'
910 """
911 if p0==2:
912 self.lineFilteropVolCEB.setEnabled(True)
913 print " Select Type of Profile"
914 if p0==0:
915 self.lineFilteropVolCEB.setEnabled(False)
916 print " deshabilitado"
917
918 @pyqtSignature("int")
842 919 def on_profileSelecopVolCEB_stateChanged(self, p0):
843 920 """
844 921 Check Box habilita ingreso del rango de Perfiles
845 922 """
846 923 if p0==2:
847 924 self.lineProfileSelecopVolCEB.setEnabled(True)
848 # upProcessSelect=self.upObjVolList[int(self.addOpUpselec.currentIndex())]
849 # opObj10=upProcessSelect.addOperation(name='ProfileSelector', optype='other')
850 # print opObj10.id
851 # self.operObjList.append(opObj10)
925 self.profileSelecOpVol.setEnabled(True)
852 926 print " Select Type of Profile"
853 927 if p0==0:
854 928 self.lineProfileSelecopVolCEB.setEnabled(False)
855
929 self.profileSelecOpVol.setEnabled(False)
856 930 print " deshabilitado"
857
931
932
933 @pyqtSignature("int")
934 def on_decodeCEB_stateChanged(self, p0):
935 """
936 Check Box habilita ingresode del numero de Integraciones a realizar
937 """
938 if p0==2:
939 self.decodeCcob.setEnabled(True)
940 self.decodeMcob.setEnabled(True)
941 print "Choose number of Cohint"
942 if p0==0:
943 print " deshabilitado"
944 self.decodeCcob.setEnabled(False)
945 self.decodeMcob.setEnabled(False)
946
858 947
859 948 @pyqtSignature("int")
860 949 def on_coherentIntegrationCEB_stateChanged(self, p0):
861 950 """
862 951 Check Box habilita ingresode del numero de Integraciones a realizar
863 952 """
864 953 if p0==2:
865 954 self.numberIntegration.setEnabled(True)
866 # upProcessSelect=self.upObjVolList[int(self.addOpUpselec.currentIndex())]
867 # opObj10=upProcessSelect.addOperation(name='CohInt', optype='other')
868 # print opObj10.id
869 # self.operObjList.append(opObj10)
870 955 print "Choose number of Cohint"
871 956 if p0==0:
872 957 print " deshabilitado"
873 958 self.numberIntegration.setEnabled(False)
874 959
875 #-----------------------PUSHBUTTON_ACCEPT_OPERATION----------------------------#
960 #-----------------------VOL_PUSHBUTTON_ACCEPT_OPERATION----------------------------#
876 961
877 962 @pyqtSignature("")
878 963 def on_dataopVolOkBtn_clicked(self):
879 964 """
880 965 BUSCA EN LA LISTA DE OPERACIONES DEL TIPO VOLTAJE Y LES AοΏ½ADE EL PARAMETRO ADECUADO ESPERANDO LA ACEPTACION DEL USUARIO
881 966 PARA AGREGARLO AL ARCHIVO DE CONFIGURACION XML
882 967 """
883 968 for i in self.__arbolDict:
884 969 if self.__arbolDict[i]==self.indexclick:
885 970 print "INDEXCLICK=ARBOLDICT",i
886 971 if self.__upObjDict.has_key(i)==True:
887 972 self.upObj=self.__upObjDict[i]
888 # self.operObjList.append(opObj10)
889
973 print self.__upObjDict[i].name
974 print "TamaΓ±odeupObjDict",len(self.__upObjDict)
975 # if len(self.__upObjDict)>=1 and len(self.__upObjDict)> self.b:
976
890 977 if self.selecChannelopVolCEB.isChecked():
891 opObj10=self.upObj.addOperation(name='selectChannels')
892 self.operObjList.append(opObj10)
893 value=self.numberChannelopVol.text()
894 opObj10.addParameter(name='channelList', value=value, format='intlist')
895
896
897 print "channel"
898
899 if self.selecHeighopVolCEB.isChecked():
900 opObj10=self.upObj.addOperation(name='selectHeights')
901 print opObj10.id
902 self.operObjList.append(opObj10)
903 value=self.lineHeighProfileTxtopVol.text()
904 valueList=value.split(',')
905 opObj10.addParameter(name='minHei', value=valueList[0], format='float')
906 opObj10.addParameter(name='maxHei', value=valueList[1], format='float')
907
908 print "height"
909
910
978 if self.valueSelecChOpVol.currentIndex()== 0:
979 opObj10=self.upObj.addOperation(name="selectChannels")
980 self.operObjList.append(opObj10)
981 value=self.numberChannelopVol.text()
982 opObj10.addParameter(name='channelList', value=value, format='intlist')
983 else:
984 opObj10=self.upObj.addOperation(name="selectChannelsByIndex")
985 self.operObjList.append(opObj10)
986 value=self.numberChannelopVol.text()
987 opObj10.addParameter(name='channelIndexList', value=value, format='intlist')
988 print "channel"
989
911 990 if self.selecHeighopVolCEB.isChecked():
912 obj10=self.upObj.addOperation(name='ProfileSelector', optype='other')
913 print opObj10.id
914 self.operObjList.append(opObj10)
915 value=self.lineProfileSelecopVolCEB.text()
916 obj10.addParameter(name='ProfileSelector', value=value, format='intlist')
917
918 # for i in self.operObjList:
919 # if i.name=='ProfileSelector' :
920 # value=self.lineProfileSelecopVolCEB.text()
921 # i.addParameter(name='ProfileSelector', value=value, format='intlist')
991 if self.valueSelecHeigOpVol.currentIndex()== 0:
992 opObj10=self.upObj.addOperation(name='selectHeights')
993 value=self.lineHeighProfileTxtopVol.text()
994 valueList=value.split(',')
995 opObj10.addParameter(name='minHei', value=valueList[0], format='float')
996 opObj10.addParameter(name='maxHei', value=valueList[1], format='float')
997 else:
998 opObj10=self.upObj.addOperation(name='selectHeightsByIndex')
999 value=self.lineHeighProfileTxtopVol.text()
1000 valueList=value.split(',')
1001 opObj10.addParameter(name='minIndex', value=valueList[0], format='float')
1002 opObj10.addParameter(name='maxIndex', value=valueList[1], format='float')
1003
1004 print "height"
1005
1006 if self.filterCEB.isChecked():
1007 opObj10=self.upObj.addOperation(name='filterByHeights')
1008 value=self.lineFilteropVolCEB.text()
1009 opObj10.addParameter(name='window', value=value, format='int')
1010 print "filter"
1011
1012 if self.profileSelecopVolCEB.isChecked():
1013 obj10=self.upObj.addOperation(name='ProfileSelector', optype='other')
1014 if self.profileSelecOpVol.currentIndex()== 0:
1015 self.operObjList.append(opObj10)
1016 value=self.lineProfileSelecopVolCEB.text()
1017 obj10.addParameter(name='profileList', value=value, format='intlist')
1018 else:
1019 self.operObjList.append(opObj10)
1020 value=self.lineProfileSelecopVolCEB.text()
1021 obj10.addParameter(name='profileRangeList', value=value, format='intlist')
1022 print "profile"
1023
1024 if self.decodeCEB.isChecked():
1025 opObj10=self.upObj.addOperation(name='Decoder')
1026 if self.decodeCcob.currentIndex()==0:
1027 opObj10.addParameter(name='code', value='1,1,-1,-1,-1,1', format='floatlist')
1028 opObj10.addParameter(name='nCode', value='2', format='int')
1029 opObj10.addParameter(name='nBaud', value='3', format='int')
1030 if self.decodeCcob.currentIndex()==1:
1031 opObj10.addParameter(name='code', value='1,1,βˆ’1,1,-1,-1,1,-1', format='floatlist')
1032 opObj10.addParameter(name='nCode', value='2', format='int')
1033 opObj10.addParameter(name='nBaud', value='4', format='int')
1034 if self.decodeCcob.currentIndex()==2:
1035 opObj10.addParameter(name='code', value='1,1,1,βˆ’1,1,-1,-1,-1,1,-1', format='floatlist')
1036 opObj10.addParameter(name='nCode', value='2', format='int')
1037 opObj10.addParameter(name='nBaud', value='5', format='int')
1038 if self.decodeCcob.currentIndex()==3:
1039 opObj10.addParameter(name='code', value='1,1,1,βˆ’1,βˆ’1,1,βˆ’1,-1,-1,-1,1,1,-1,1', format='floatlist')
1040 opObj10.addParameter(name='nCode', value='2', format='int')
1041 opObj10.addParameter(name='nBaud', value='7', format='int')
1042 if self.decodeCcob.currentIndex()==4:
1043 opObj10.addParameter(name='code', value='1,1,1,βˆ’1,βˆ’1,βˆ’1,1,βˆ’1,βˆ’1,1,βˆ’1,-1 ,-1 ,-1 ,1 ,1 ,1 ,-1 ,1 ,1 ,-1 ,1', format='floatlist')
1044 opObj10.addParameter(name='nCode', value='2', format='int')
1045 opObj10.addParameter(name='nBaud', value='11', format='int')
1046 if self.decodeCcob.currentIndex()==5:
1047 opObj10.addParameter(name='code', value='1,1,1,1,1,βˆ’1,βˆ’1,1,1,βˆ’1,1,βˆ’1,1,-1,-1,-1,-1,-1,1,1,-1,-1,1,-1,1,-1', format='floatlist')
1048 opObj10.addParameter(name='nCode', value='2', format='int')
1049 opObj10.addParameter(name='nBaud', value='13', format='int')
922 1050
1051 if self.decodeMcob.currentIndex()==0:
1052 opObj10.addParameter(name='mode', value='0', format='int')
1053
1054 if self.decodeMcob.currentIndex()==1:
1055 opObj10.addParameter(name='mode', value='1', format='int')
1056
1057 if self.decodeMcob.currentIndex()==2:
1058 opObj10.addParameter(name='mode', value='2', format='int')
1059
923 1060 if self.coherentIntegrationCEB.isChecked():
924 opObj10=self.upObj.addOperation(name='CohInt', optype='other')
925 print opObj10.id
1061 opObj10=self.upObj.addOperation(name='CohInt', optype='other')
1062 print opObj10.id
1063 self.operObjList.append(opObj10)
1064 value=self.numberIntegration.text()
1065 opObj10.addParameter(name='n', value=value, format='int')
1066 print "Coherent"
1067
1068
1069 # print "TamaΓ±odeupObjDict",len(self.__upObjDict)
1070 # self.b=len(self.__upObjDict)
1071 # print "self.b", self.b
1072 # self.model_2.properties_projecto("estaesunaprueba")
1073 # anadir=self.model_2.properties_projecto("estaesunaprueba")
1074 # self.model_2.addProjectproperties(anadir)
1075 # self.model_2.showtree()
1076 # self.treeView_2.setModel(self.model_2)
1077 # self.treeView_2.expandAll()
1078 # else:
1079 # print"It doesn't works"
1080
1081 # self.o
1082
1083
1084 # -----------------VENTANA CONFIGURACION GRAPH VOLTAGE---------------------------#
1085
1086 @pyqtSignature("int")
1087 def on_dataTypeSelecVol_activated(self,index):
1088 """
1089 Metodo que identifica que tipo de dato se va a trabajar VOLTAGE O ESPECTRA
1090 """
1091
1092 if index==0:
1093 self.wiWineTxtGraphicsVol.setEnabled(True)
1094 self.channelLisstTxtVol.setEnabled(True)
1095 self.xminTxtVol.setEnabled(True)
1096 self.yminTxtVol.setEnabled(True)
1097
1098 @pyqtSignature(" ")
1099 def on_dataGraphVolOkBtn_clicked(self):
1100 """
1101 GRAPH
1102 """
1103 for i in self.__arbolDict:
1104 if self.__arbolDict[i]==self.indexclick:
1105 print "INDEXCLICK=ARBOLDICT",i
1106 if self.__upObjDict.has_key(i)==True:
1107 self.upObj=self.__upObjDict[i]
1108 print self.__upObjDict[i].name
1109
1110 if self.valueSelecChOpVol.currentIndex()==0:
1111 opObj10=self.upObj.addOperation(name='Scope', optype='other')
926 1112 self.operObjList.append(opObj10)
927 value=self.numberIntegration.text()
928 opObj10.addParameter(name='n', value=value, format='int')
929 # self.__opObjDict[i]==self.operObjList
1113 wintitle=self.wiWineTxtGraphicsVol.text()
1114 channelList=self.channelLisstTxtVol.text()
1115 xvalue= self.xminTxtVol.text()
1116 yvalue= self.yminTxtVol.text()
1117
1118 opObj10.addParameter(name='wintitle', value=wintitle, format='str')
1119 opObj10.addParameter(name='channelList', value=channelList, format='int')
1120 xvalueList=xvalue.split(',')
1121 opObj10.addParameter(name='xmin', value=xvalueList[0], format='int')
1122 opObj10.addParameter(name='xmax', value=xvalueList[1], format='int')
1123 yvalueList=yvalue.split(",")
1124 opObj10.addParameter(name='ymin', value=yvalueList[0], format='int')
1125 opObj10.addParameter(name='ymax', value=yvalueList[1], format='int')
1126
1127 if self.savedataCEBGraphicsVol.isChecked():
1128 opObj10.addParameter(name='save', value='1', format='int')
1129 opObj10.addParameter(name='figpath', value= self.dataPathtxtGraphicsVol.text())
1130 opObj10.addParameter(name='figfile', value= self.dataPrefixtxtGraphicsVol.text())
1131
930 1132
931 1133
932 1134 #-------------------------VENTANA DE CONFIGURACION SPECTRA------------------------#
933 1135
934 1136 @pyqtSignature("int")
935 1137 def on_nFFTPointOpSpecCEB_stateChanged(self, p0):
936 1138 """
937 1139 Habilita la opcion de aοΏ½adir el parοΏ½metro nFFTPoints a la Unidad de Procesamiento .
938 1140 """
939 1141 if p0==2:
940 1142 self.valuenFFTPointOpSpec.setEnabled(True)
941 1143 print " nFFTPoint"
942 1144 if p0==0:
943 1145 print " deshabilitado"
944 1146 self.valuenFFTPointOpSpec.setEnabled(False)
945 1147
1148 @pyqtSignature("int")
1149 def on_SelectHeiopSpecCEB_stateChanged(self, p0):
1150 """
1151 Habilita la opcion de aοΏ½adir el parοΏ½metro nFFTPoints a la Unidad de Procesamiento .
1152 """
1153 if p0==2:
1154 self.valueSelecChOpHei.setEnabled(True)
1155 self.selecHeiopSpec.setEnabled(True)
1156 print "selectHeights"
1157 if p0==0:
1158 print " deshabilitado"
1159 self.valueSelecChOpHei.setEnabled(False)
1160 self.selecHeiopSpec.setEnabled(False)
1161
1162 @pyqtSignature("int")
1163 def on_selecChannelopSpecCEB_stateChanged(self, p0):
1164 """
1165 Habilita la opcion de aοΏ½adir el parοΏ½metro nFFTPoints a la Unidad de Procesamiento .
1166 """
1167 if p0==2:
1168 self.valueSelecChOpSpec.setEnabled(True)
1169 self.numberChannelopSpec.setEnabled(True)
1170 print "selectChannel"
1171 if p0==0:
1172 print " deshabilitado"
1173 self.valueSelecChOpSpec.setEnabled(False)
1174 self.numberChannelopSpec.setEnabled(False)
1175
1176 @pyqtSignature("int")
1177 def on_IncohIntOpSpecCEB_stateChanged(self, p0):
1178 """
1179 Habilita la opcion de aοΏ½adir el parοΏ½metro nFFTPoints a la Unidad de Procesamiento .
1180 """
1181 if p0==2:
1182 self.valueIncohIntOpSpec.setEnabled(True)
1183
1184 print "selectIncohInt"
1185 if p0==0:
1186 print " deshabilitado"
1187 self.valueIncohIntOpSpec.setEnabled(False)
1188
1189 @pyqtSignature("int")
1190 def on_removedcOpSpecCEB_stateChanged(self, p0):
1191 """
1192 Habilita la opcion de aοΏ½adir el parοΏ½metro nFFTPoints a la Unidad de Procesamiento .
1193 """
1194 if p0==2:
1195 self.valueremoveDCOpSpec.setEnabled(True)
1196
1197 print "removedcOpSpecCEB"
1198 if p0==0:
1199 print " deshabilitado"
1200 self.valueremoveDCOpSpec.setEnabled(False)
1201
1202
1203 def setDisableAllSpecop(self):
1204 self.valuenFFTPointOpSpec.setEnabled(False)
1205 self.valueSelecChOpHei.setEnabled(False)
1206 self.selecHeiopSpec.setEnabled(False)
1207 self.numberChannelopSpec.setEnabled(False)
1208 self.valueSelecChOpSpec.setEnabled(False)
1209 self.valueIncohIntOpSpec.setEnabled(False)
1210 self.valueremoveDCOpSpec.setEnabled(False)
1211 #-----------------------SPEC_PUSHBUTTON_ACCEPT_OPERATION----------------------------#
1212
1213
946 1214
947 1215
948 1216 @pyqtSignature("")
949 1217 def on_dataopSpecOkBtn_clicked(self):
950 1218 """
951 AοΏ½ade al archivo de configuraciοΏ½n el parοΏ½metros nFFTPoints a la UP.
1219 AΓ‘ADE OPERACION SPECTRA
952 1220 """
953 print "AοΏ½adimos operaciones Spectra,nchannels,value,format"
954
1221 print "AΓ‘ADEOPERACIONSPECTRA"
955 1222 for i in self.__arbolDict:
956 1223 if self.__arbolDict[i]==self.indexclick:
957 1224 print "INDEXCLICK=ARBOLDICT",i
958 1225 if self.__upObjDict.has_key(i)==True:
959 1226 self.upObj=self.__upObjDict[i]
1227 print self.__upObjDict[i].name
960 1228 # self.operObjList.append(opObj10)
961 1229
962 1230 if self.nFFTPointOpSpecCEB.isChecked():
963 value=self.numberChannelopVol.text()
1231 value=self.valuenFFTPointOpSpec.text()
964 1232 self.upObj.addParameter(name='nFFTPoints',value=value,format='int')
965 1233 print "nFFTpoints"
966
967
968
969 #---------------------VENTANA DE CONFIGURACION GRAPH SPECTRA------------------#
970
971 @pyqtSignature("int")
972 def on_SpectraPlotGraphCEB_stateChanged(self, p0):
973 """
974 Habilita la opcion de Ploteo Spectra Plot
975 """
976 if p0==2:
977 print "Habilitado"
978
979 if p0==0:
980 print " deshabilitado"
981
1234
1235
1236 if self.SelectHeiopSpecCEB.isChecked():
1237 if self.valueSelecChOpHei.currentIndex()== 0:
1238 opObj10=self.upObj.addOperation(name='selectHeights')
1239 value=self.selecHeiopSpec.text()
1240 valueList=value.split(',')
1241 opObj10.addParameter(name='minHei', value=valueList[0], format='float')
1242 opObj10.addParameter(name='maxHei', value=valueList[1], format='float')
1243 else:
1244 opObj10=self.upObj.addOperation(name='selectHeightsByIndex')
1245 value=self.selecHeiopSpec.text()
1246 valueList=value.split(',')
1247 opObj10.addParameter(name='minIndex', value=valueList[0], format='float')
1248 opObj10.addParameter(name='maxIndex', value=valueList[1], format='float')
1249
1250 if self.selecChannelopSpecCEB.isChecked():
1251 if self.valueSelecChOpSpec.currentIndex()== 0:
1252 opObj10=self.upObj.addOperation(name="selectChannels")
1253 self.operObjList.append(opObj10)
1254 value=self.numberChannelopSpec.text()
1255 opObj10.addParameter(name='channelList', value=value, format='intlist')
1256 else:
1257 opObj10=self.upObj.addOperation(name="selectChannelsByIndex")
1258 self.operObjList.append(opObj10)
1259 value=self.numberChannelopSpec.text()
1260 opObj10.addParameter(name='channelIndexList', value=value, format='intlist')
1261 print "channel"
1262
1263 if self.IncohIntOpSpecCEB.isChecked():
1264 opObj10=self.upObj.addOperation(name='IncohInt', optype='other')
1265 self.operObjList.append(opObj10)
1266 value=self.valueIncohIntOpSpec.text()
1267 opObj10.addParameter(name='n', value=value, format='float')
1268
1269 if self.removedcOpSpecCEB.isChecked():
1270 opObj10=self.upObj.addOperation(name='removeDC')
1271 value=self.valueremoveDCOpSpec.text()
1272 opObj10.addParameter(name='mode', value=value,format='int')
1273
1274
1275 #---------------------VENTANA DE CONFIGURACION GRAPH SPECTRA------------------#
982 1276 @pyqtSignature("int")
983 def on_CrossSpectraPlotGraphceb_stateChanged(self, p0):
984 """
985 Habilita la opciοΏ½n de Ploteo CrossSpectra
986 """
987 if p0==2:
988 print "Habilitado"
989 if p0==0:
990 print " deshabilitado"
1277 def on_dataTypeSelectorCmb_activated(self,index):
1278 self.setClearAllElementGraph()
1279 self.setEnableAllElementGraph()
1280 if index==0:
1281 self.timeRangeGraphSpec.setEnabled(False)
1282 if index==1:
1283 self.timeRangeGraphSpec.setEnabled(False)
1284 if index==2:
1285 self.timeRangeGraphSpec.setEnabled(False)
1286 if index==3:
1287 self.timeRangeGraphSpec.setEnabled(False)
1288
991 1289
992 1290 @pyqtSignature("int")
993 def on_RTIPlotGraphCEB_stateChanged(self, p0):
1291 def on_saveGraphSpec_stateChanged(self, p0):
994 1292 """
995 Habilita la opciοΏ½n de Plote RTIPlot
1293 Habilita la opcion de aοΏ½adir el parοΏ½metro nFFTPoints a la Unidad de Procesamiento .
996 1294 """
997 1295 if p0==2:
998 print "Habilitado"
1296 self.dataPathTxtSpec.setEnabled(True)
1297 self.dataPrefixGraphSpec.setEnabled(True)
1298 print " nFFTPoint"
999 1299 if p0==0:
1000 print " deshabilitado"
1001
1002 #------------------PUSH_BUTTON_SPECTRA_GRAPH_OK-----------------------------#
1300 print " deshabilitado"
1301 self.dataPathTxtSpec.setEnabled(False)
1302 self.dataPrefixGraphSpec.setEnabled(False)
1303
1304
1003 1305 @pyqtSignature("")
1004 1306 def on_dataGraphSpecOkBtn_clicked(self):
1005 """
1006 HABILITAR DE ACUERDO A LOS CHECKBOX QUE TIPO DE PLOTEOS SE VAN A REALIZAR MUESTRA Y GRABA LAS IMAGENES.
1007 """
1307
1308 print "AΓ‘ADEOPERACIONSPECTRA"
1309
1008 1310 for i in self.__arbolDict:
1009 1311 if self.__arbolDict[i]==self.indexclick:
1010 1312 print "INDEXCLICK=ARBOLDICT",i
1011 1313 if self.__upObjDict.has_key(i)==True:
1012 1314 self.upObj=self.__upObjDict[i]
1013 print "Graficar Spec op"
1014
1015 if self.SpectraPlotGraphCEB_2.isChecked():
1315 print self.__upObjDict[i].name
1316
1317 if self.dataTypeSelectorCmb.currentIndex()==0:
1016 1318 opObj10=self.upObj.addOperation(name='SpectraPlot',optype='other')
1017 print opObj10.id
1018 self.operObjList.append(opObj10)
1019 for i in self.operObjList:
1020 if i.name=='SpectraPlot':
1021 i.addParameter(name='idfigure', value='1', format='int')
1022 i.addParameter(name='wintitle', value='SpectraPlot0', format='str')
1023 i.addParameter(name='zmin', value='40', format='int')
1024 i.addParameter(name='zmax', value='90', format='int')
1025 i.addParameter(name='showprofile', value='1', format='int')
1026
1027 if self.CrossSpectraPlotGraphceb.isChecked():
1028 opObj10=self.upObj.addOperation(name='CrossSpectraPlot',optype='other')
1029 print opObj10.id
1030 self.operObjList.append(opObj10)
1031 for i in self.operObjList:
1032 if i.name=='CrossSpectraPlot' :
1033 i.addParameter(name='idfigure', value='2', format='int')
1034 i.addParameter(name='wintitle', value='CrossSpectraPlot', format='str')
1035 i.addParameter(name='zmin', value='40', format='int')
1036 i.addParameter(name='zmax', value='90', format='int')
1037
1038 if self.RTIPlotGraphCEB.isChecked():
1039 opObj10=self.upObj.addOperation(name='RTIPlot',optype='other')
1040 print opObj10.id
1041 self.operObjList.append(opObj10)
1042 for i in self.operObjList:
1043 if i.name=='RTIPlot':
1044 i.addParameter(name='n', value='2', format='int')
1045 i.addParameter(name='overlapping', value='1', format='int')
1046
1319 opObj10.addParameter(name='idfigure', value='1', format='int')
1320 self.properSpecGraph(opObj10)
1321
1322 if self.dataTypeSelectorCmb.currentIndex()==1:
1323 opObj10=self.upObj.addOperation(name='CrossSpectraPlot',optype='other')
1324 self.properSpecGraph(opObj10)
1325 opObj10.addParameter(name='power_cmap', value='jet', format='str')
1326 opObj10.addParameter(name='coherence_cmap', value='jet', format='str')
1327 opObj10.addParameter(name='phase_cmap', value='RdBu_r', format='str')
1328
1329 if self.dataTypeSelectorCmb.currentIndex()==2:
1330 opObj10=self.upObj.addOperation(name='RTIPlot',optype='other')
1331 self.properSpecGraph(opObj10)
1332
1333 if self.dataTypeSelectorCmb.currentIndex()==3:
1334 opObj10=self.upObj.addOperation(name='CoherenceMap',optype='other')
1335 self.properSpecGraph(opObj10)
1336 opObj10.addParameter(name='coherence_cmap', value='jet', format='str')
1337 opObj10.addParameter(name='phase_cmap', value='RdBu_r', format='str')
1338
1339 if self.dataTypeSelectorCmb.currentIndex()==4:
1340 opObj10=self.upObj.addOperation(name='RTIfromNoise',optype='other')
1341 self.properSpecGraph(opObj10)
1342 self.setDisableAllElementSpecGraph()
1343 print "Funciona o no"
1344
1345 @pyqtSignature("")
1346 def on_dataGraphSpecCancelBtn_clicked(self):
1347 print "alexvaldez"
1348
1349 def properSpecGraph(self,opObj10):
1350 print opObj10.id
1351 self.operObjList.append(opObj10)
1352 wintitle=self.winTitleGraphSpec.text()
1353 opObj10.addParameter(name='wintitle', value=wintitle, format='str')
1354 idfigure=self.idfigureGraphSpec.text()
1355 opObj10.addParameter(name='idfigure', value=idfigure, format='int')
1356
1357
1358 channelList=self.channelListgraphSpec.text()
1359 if self.channelListgraphSpec.isModified():
1360 opObj10.addParameter(name='channelList', value=channelList, format='intlist')
1361
1362 xvalue= self.xminGraphSpec.text()
1363 if self.xminGraphSpec.isModified():
1364 xvalueList=xvalue.split(',')
1365 opObj10.addParameter(name='xmin', value=xvalueList[0], format='int')
1366 opObj10.addParameter(name='xmax', value=xvalueList[1], format='int')
1367 else:
1368 print "cambio"
1369 yvalue= self.yminGraphSpec.text()
1370 if self.yminGraphSpec.isModified():
1371 yvalueList=yvalue.split(",")
1372 opObj10.addParameter(name='ymin', value=yvalueList[0], format='int')
1373 opObj10.addParameter(name='ymax', value=yvalueList[1], format='int')
1374 else:
1375 print "cambio"
1376 zvalue= self.zminGraphSpec.text()
1377 if self.zminGraphSpec.isModified():
1378 zvalueList=zvalue.split(",")
1379 if opObj10.name=="RTIfromNoise":
1380 print "No_z"
1381 else:
1382 if self.zminGraphSpec.isModified():
1383 zvalueList=zvalue.split(",")
1384 opObj10.addParameter(name='zmin', value=zvalueList[0], format='int')
1385 opObj10.addParameter(name='zmax', value=zvalueList[1], format='int')
1386 opObj10.addParameter(name='showprofile', value='1', format='int')
1387
1388 else:
1389 print "cambio"
1390
1391 if self.savedataCEBGraphicsVol.isChecked():
1392 opObj10.addParameter(name='save', value='1', format='int')
1393 opObj10.addParameter(name='figpath', value= self.dataPathTxtSpec.text())
1394 opObj10.addParameter(name='figfile', value= self.dataPrefixGraphSpec.text())
1047 1395
1048 1396
1049
1050
1397 def setClearAllElementGraph(self):
1398 self.winTitleGraphSpec.clear()
1399 self.channelListgraphSpec.clear()
1400 self.xminGraphSpec.clear()
1401 self.yminGraphSpec.clear()
1402 self.zminGraphSpec.clear()
1403 self.timeRangeGraphSpec.clear()
1404 self.dataPathTxtSpec.clear()
1405 self.dataPrefixGraphSpec.clear()
1406
1407 def setDisableAllElementSpecGraph(self):
1408 self.winTitleGraphSpec.setEnabled(False)
1409 self.channelListgraphSpec.setEnabled(False)
1410 self.xminGraphSpec.setEnabled(False)
1411 self.yminGraphSpec.setEnabled(False)
1412 self.zminGraphSpec.setEnabled(False)
1413 self.timeRangeGraphSpec.setEnabled(False)
1414 self.dataPathTxtSpec.setEnabled(False)
1415 self.dataPrefixGraphSpec.setEnabled(False)
1416 #
1417 def setEnableAllElementGraph(self):
1418 self.winTitleGraphSpec.setEnabled(True)
1419 self.channelListgraphSpec.setEnabled(True)
1420 self.xminGraphSpec.setEnabled(True)
1421 self.yminGraphSpec.setEnabled(True)
1422 self.zminGraphSpec.setEnabled(True)
1423 self.timeRangeGraphSpec.setEnabled(True)
1424 #
1425
1426
1427
1051 1428 class UnitProcess(QMainWindow, Ui_UnitProcess):
1052 1429 """
1053 1430 Class documentation goes here.
1054 1431 """
1055 1432 closed=pyqtSignal()
1056 1433 create= False
1057 1434 def __init__(self, parent = None):
1058 1435 """
1059 1436 Constructor
1060 1437 """
1061 1438 QMainWindow.__init__(self, parent)
1062 1439 self.setupUi(self)
1063 1440 self.getFromWindow=None
1064 1441 self.getfromWindowList=[]
1065 1442 self.dataTypeProject=None
1066 1443
1067 1444 self.listUP=None
1068 1445
1069 1446 @pyqtSignature("")
1070 1447 def on_unitPokbut_clicked(self):
1071 1448 """
1072 1449 Slot documentation goes here.
1073 1450 """
1074 1451 self.create =True
1075 1452 self.getFromWindow=self.getfromWindowList[int(self.comboInputBox.currentIndex())]
1076 1453 #self.nameofUP= str(self.nameUptxt.text())
1077 1454 self.typeofUP= str(self.comboTypeBox.currentText())
1078 1455 self.close()
1079 1456
1080 1457
1081 1458 @pyqtSignature("")
1082 1459 def on_unitPcancelbut_clicked(self):
1083 1460 """
1084 1461 Slot documentation goes here.
1085 1462 """
1086 1463 self.create=False
1087 1464 self.close()
1088 1465
1089 1466 def loadTotalList(self):
1090 1467 self.comboInputBox.clear()
1091 1468 for i in self.getfromWindowList:
1092 1469
1093 1470 name=i.getElementName()
1094 1471 print "name",name
1095 1472 if name=='Project':
1096 1473 id= i.id
1097 1474 name=i.name
1098 1475 print "tipodeproyecto",self.dataTypeProject
1099 1476 if self.dataTypeProject=='Voltage':
1100 1477 self.comboTypeBox.clear()
1101 1478 self.comboTypeBox.addItem("Voltage")
1102 1479 self.comboTypeBox.addItem("Spectra")
1103 1480 self.comboTypeBox.addItem("Correlation")
1104 1481 if self.dataTypeProject=='Spectra':
1105 1482 self.comboTypeBox.clear()
1106 1483 self.comboTypeBox.addItem("Spectra")
1107 1484 self.comboTypeBox.addItem("Correlation")
1108 1485
1109 1486 if name=='ProcUnit':
1110 1487 id=int(i.id)-1
1111 1488 name=i.datatype
1112 1489 if name == 'Voltage':
1113 1490 self.comboTypeBox.clear()
1114 1491 self.comboTypeBox.addItem("Spectra")
1115 1492 self.comboTypeBox.addItem("Correlation")
1116 1493 if name == 'Spectra':
1117 1494 self.comboTypeBox.clear()
1118 1495 self.comboTypeBox.addItem("Spectra")
1119 1496 self.comboTypeBox.addItem("Correlation")
1120 1497
1121 1498
1122 1499 self.comboInputBox.addItem(str(name))
1123 1500 #self.comboInputBox.addItem(str(name)+str(id))
1124 1501
1125 1502 def closeEvent(self, event):
1126 1503 self.closed.emit()
1127 1504 event.accept()
1128 1505
1129 1506 No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now