##// END OF EJS Templates
basicwindow:...
Alexander Valdez -
r322:bd8704f4f307
parent child
Show More
This diff has been collapsed as it changes many lines, (717 lines changed) Show them Hide them
@@ -1,47 +1,71
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 Module implementing MainWindow.
4 #+++++++++++++++++++++INTERFAZ DE USUARIO V1.1++++++++++++++++++++++++#
4 #+++++++++++++INTERFAZ DE USUARIO V1.1++++++++++++++#
5 5 """
6 from PyQt4.QtGui import QMainWindow
7 from PyQt4.QtCore import pyqtSignature
8 from PyQt4.QtCore import pyqtSignal
9 from PyQt4 import QtCore
10 from PyQt4 import QtGui
11 from timeconversions import Doy2Date
12 from modelProperties import treeModel
6 import os
7 import datetime
8
9 from PyQt4.QtGui import QMainWindow
10 from PyQt4.QtCore import pyqtSignature
11 from PyQt4.QtCore import pyqtSignal
12 from PyQt4 import QtCore
13 from PyQt4 import QtGui
14 from timeconversions import Doy2Date
15 from modelProperties import treeModel
13 16
14 17 from viewer.ui_unitprocess import Ui_UnitProcess
15 from viewer.ui_window import Ui_window
16 from viewer.ui_mainwindow import Ui_BasicWindow
18 from viewer.ui_window import Ui_window
19 from viewer.ui_mainwindow import Ui_BasicWindow
20 from controller import Project,ReadUnitConf,ProcUnitConf,OperationConf,ParameterConf
17 21
18 22
19 from controller import Project,ReadUnitConf,ProcUnitConf,OperationConf,ParameterConf
20 import os
23 def isRadarFile(file):
21 24
25 try:
26 year = int(file[1:5])
27 doy = int(file[5:8])
28 set = int(file[8:11])
29 except:
30 return 0
31
32 return 1
33
34 def isRadarPath(path):
35 try:
36 year = int(path[1:5])
37 doy = int(path[5:8])
38 except:
39 return 0
40
41 return 1
22 42
23 43 class BasicWindow(QMainWindow, Ui_BasicWindow):
24 __projObjDict = {}
25 __arbolDict = {}
26 __upObjDict = {}
44 __projObjDict = None
45 __arbolDict = None
46 __upObjDict = None
27 47
28 48 """
29 49 Class documentation goes here.
30 #*##################VENTANA CUERPO DEL PROGRAMA####################
50 #*############VENTANA CUERPO DEL PROGRAMA##############
31 51 """
32 52 def __init__(self, parent = None):
33 53 """
34 54 Constructor
35 55 """
36 print "Inicio de Programa Interfaz GrΓ‘fica"
56 print "INICIO PROGRAMA "
37 57 QMainWindow.__init__(self, parent)
38 58 self.setupUi(self)
39 59
60 self.__projObjDict = {}
61 self.__arbolDict = {}
62 self.__upObjDict = {}
63
40 64 self.indexclick=None
41 65
42 66 self.online=0
43 67 self.datatype=0
44 self.variableList=[]
68 self.dateList=[]
45 69
46 70 self.proObjList=[]
47 71 self.idp=0
@@ -85,6 +109,10 class BasicWindow(QMainWindow, Ui_BasicWindow):
85 109 self.treeView.expandAll()
86 110 #self.treeView.clicked.connect(self.treefunction1)
87 111
112
113
114
115
88 116 #-----------------------------------BARRA DE MENU-------------------------------------------------#
89 117
90 118 #----------------------------------- MENU_PROJECT--------------------------------------------------#
@@ -241,13 +269,14 class BasicWindow(QMainWindow, Ui_BasicWindow):
241 269 """
242 270 self.dataFormatTxt.setReadOnly(True)
243 271 if index==0:
244 self.datatype='Voltage'
272 self.datatype='.r'
245 273 elif index==1:
246 self.datatype='Spectra'
274 self.datatype='.pdata'
247 275 else :
248 276 self.datatype=''
249 277 self.dataFormatTxt.setReadOnly(False)
250 self.dataFormatTxt.setText(self.datatype)
278 self.dataFormatTxt.setText(self.datatype)
279 self.loadDays()
251 280
252 281 @pyqtSignature("")
253 282 def on_dataPathBrowse_clicked(self):
@@ -256,33 +285,40 class BasicWindow(QMainWindow, Ui_BasicWindow):
256 285 """
257 286 self.dataPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly))
258 287 self.dataPathTxt.setText(self.dataPath)
259 self.statusDpath=self.existDir(self.dataPath)
260 self.loadDays()
288
289 self.startDateCmbBox.clear()
290 self.endDateCmbBox.clear()
291
292 if not os.path.exists(self.dataPath):
293 self.dataOkBtn.setEnabled(False)
294 return
295
296 self.loadDays()
261 297
262 298 @pyqtSignature("int")
263 299 def on_starDateCmbBox_activated(self, index):
264 300 """
265 301 SELECCION DEL RANGO DE FECHAS -START DATE
266 302 """
267 var_StopDay_index=self.endDateCmbBox.count() - self.endDateCmbBox.currentIndex()
303 stopIndex = self.endDateCmbBox.count() - self.endDateCmbBox.currentIndex()
268 304 self.endDateCmbBox.clear()
269 for i in self.variableList[index:]:
305
306 for i in self.dateList[index:]:
270 307 self.endDateCmbBox.addItem(i)
271 self.endDateCmbBox.setCurrentIndex(self.endDateCmbBox.count() - var_StopDay_index)
272 self.getsubList()
308
309 self.endDateCmbBox.setCurrentIndex(self.endDateCmbBox.count() - stopIndex)
273 310
274 311 @pyqtSignature("int")
275 312 def on_endDateCmbBox_activated(self, index):
276 313 """
277 314 SELECCION DEL RANGO DE FECHAS-END DATE
278 315 """
279 var_StartDay_index=self.starDateCmbBox.currentIndex()
280 var_end_index = self.endDateCmbBox.count() - index
316 startIndex=self.starDateCmbBox.currentIndex()
317 stopIndex = self.endDateCmbBox.count() - index
281 318 self.starDateCmbBox.clear()
282 for i in self.variableList[:len(self.variableList) - var_end_index + 1]:
319 for i in self.dateList[:len(self.dateList) - stopIndex + 1]:
283 320 self.starDateCmbBox.addItem(i)
284 self.starDateCmbBox.setCurrentIndex(var_StartDay_index)
285 self.getsubList() #Se carga var_sublist[] con el rango de las fechas seleccionadas
321 self.starDateCmbBox.setCurrentIndex(startIndex)
286 322
287 323 @pyqtSignature("int")
288 324 def on_readModeCmBox_activated(self, p0):
@@ -302,66 +338,87 class BasicWindow(QMainWindow, Ui_BasicWindow):
302 338 AΓ±ade al Obj XML de Projecto, name,datatype,date,time,readmode,wait,etc, crea el readUnitProcess del archivo xml.
303 339 Prepara la configuraciΓ³n del diΓ‘grama del Arbol del treeView numero 2
304 340 """
305 print "En este nivel se pasa el tipo de dato con el que se trabaja,path,startDate,endDate,startTime,endTime,online"
306
307 for i in self.__arbolDict:
308 if self.__arbolDict[i]==self.indexclick:
309
341 print "DATOS DEL PROJECT PATH,DATE,TIME"
310 342
311 343 # self.model.clear()
312 344 # self.parentItem = self.model.invisibleRootItem()
313 345 # self.__arbolDict[i]= QtGui.QStandardItem(QtCore.QString(name+" %0").arg(self.idp))
314 346 # self.parentItem.appendRow(self.__arbolDict[self.idp
315 self.projectObj=self.__projObjDict[int(i)]
347
316 348 # print self.projectObj
317 349 # print i
318 350 # print "get",self.__arbolDict.items()
319 351 # print "keys",self.__arbolDict.keys()
320 self.description="Think"
321 id=i
322 name=str(self.nameProjectTxt.text())
323 desc=str(self.description)
324
325 self.projectObj.setup(id = id, name=name, description=desc)
326 print self.projectObj.id
352
353 self.idp += 1
354 self.projectObj = Project()
355 print "self.projectObj",self.projectObj
356 self.__projObjDict[self.idp] = self.projectObj
357
358
359 self.description="Think"
360 id=self.idp
361 name=str(self.nameProjectTxt.text())
362 print "name",name
363 desc=str(self.description)
364
365 self.projectObj.setup(id = id, name=name, description=desc)
366 print "self.projectObj.id",self.projectObj.id
327 367 # print self.projectObj.name
328 368 # print self.projectObj.description
369
370 datatype=str(self.dataTypeCmbBox.currentText())
371 path=str(self.dataPathTxt.text())
372 online=int(self.online)
373 starDate=str(self.starDateCmbBox.currentText())
374 endDate=str(self.endDateCmbBox.currentText())
375
376
377 self.readUnitConfObj = self.projectObj.addReadUnit(datatype=datatype,
378 path=path,
379 startDate=starDate,
380 endDate=endDate,
381 startTime='06:10:00',
382 endTime='23:59:59',
383 online=online)
384
385 self.readUnitConfObjList.append(self.readUnitConfObj)
386 print "self.readUnitConfObj.getId",self.readUnitConfObj.getId(),datatype
387
388 reloj1=self.startTimeEdit.time()
389 reloj2=self.timeEdit_2.time()
390 print reloj1.hour()
391 print reloj1.minute()
392 print reloj1.second()
393
394 self.model_2=treeModel()
395 self.model_2.setParams(name =self.projectObj.name,
396 directorio =path,
397 workspace ="C:\\WorkspaceGUI",
398 remode =str(self.readModeCmBox.currentText()),
399 dataformat =datatype,
400 date =str(starDate)+"-"+str(endDate),
401 initTime = str(reloj1.hour()) +":"+str(reloj1.minute())+":"+ str(reloj1.second()),
402 endTime = str(reloj2.hour()) +":"+str(reloj2.minute())+":"+ str(reloj2.second()),
403 timezone ="Local" ,
404 Summary ="test de prueba")
329 405
330 datatype=str(self.dataTypeCmbBox.currentText())
331 path=str(self.dataPathTxt.text())
332 online=int(self.online)
333 starDate=str(self.starDateCmbBox.currentText())
334 endDate=str(self.endDateCmbBox.currentText())
335
336
337 self.readUnitConfObj = self.projectObj.addReadUnit(datatype=datatype,
338 path=path,
339 startDate=starDate,
340 endDate=endDate,
341 startTime='06:10:00',
342 endTime='23:59:59',
343 online=online)
344
345 self.readUnitConfObjList.append(self.readUnitConfObj)
346 print "self.readUnitConfObj.getId",self.readUnitConfObj.getId(),datatype,path,starDate,endDate,online
347
348 self.model_2=treeModel()
349 self.model_2.setParams(name=self.projectObj.name+str(self.projectObj.id),
350 directorio=path,
351 workspace="C:\\WorkspaceGUI",
352 remode=str(self.readModeCmBox.currentText()),
353 dataformat=datatype,
354 date=str(starDate)+"-"+str(endDate),
355 initTime='06:10:00',
356 endTime='23:59:59',
357 timezone="Local" ,
358 Summary="test de prueba")
359 self.model_2.arbol()
360 self.treeView_2.setModel(self.model_2)
361 self.treeView_2.expandAll()
406 self.model_2.arbol()
407 self.treeView_2.setModel(self.model_2)
408 self.treeView_2.expandAll()
362 409
363
364
410 self.parentItem = self.model.invisibleRootItem()
411 #self.__arbolDict[self.idp] = QtGui.QStandardItem(QtCore.QString(name).arg(self.idp))
412 self.__arbolDict[self.idp] = QtGui.QStandardItem(QtCore.QString(name).arg(self.idp))
413
414 print self.__arbolDict[self.idp]
415 self.parentItem.appendRow(self.__arbolDict[self.idp])
416 self.parentItem=self.__arbolDict[self.idp]
417 self.tabProject.setEnabled(False)
418
419
420
421
365 422 #-----------------PUSHBUTTON_ADD_PROCESSING UNIT PROJECT------------------#
366 423 @pyqtSignature("")
367 424 def on_addUnitProces_clicked(self):
@@ -373,215 +430,7 class BasicWindow(QMainWindow, Ui_BasicWindow):
373 430 self.addUP()
374 431
375 432
376
377
378 #-----------------VENTANA CONFIGURACION DE VOLTAGE---------------------------#
379
380 @pyqtSignature("int")
381 def on_selecChannelopVolCEB_stateChanged(self, p0):
382 """
383 Check Box habilita operaciones de SelecciοΏ½n de Canales
384 """
385 if p0==2:
386 self.numberChannelopVol.setEnabled(True)
387 upProcessSelect=self.upObjVolList[int(self.addOpUpselec.currentIndex())]
388 opObj10=upProcessSelect.addOperation(name='selectChannels')
389 print opObj10.id
390 self.operObjList.append(opObj10)
391 print " Ingresa seleccion de Canales"
392 if p0==0:
393 print " deshabilitado"
394
395 @pyqtSignature("int")
396 def on_selecHeighopVolCEB_stateChanged(self, p0):
397 """
398 Check Box habilita operaciones de SelecciοΏ½n de Alturas
399 """
400 if p0==2:
401 self.lineHeighProfileTxtopVol.setEnabled(True)
402 upProcessSelect=self.upObjVolList[int(self.addOpUpselec.currentIndex())]
403 opObj10=upProcessSelect.addOperation(name='selectHeights')
404 print opObj10.id
405 self.operObjList.append(opObj10)
406 print " Select Type of Profile"
407 if p0==0:
408 print " deshabilitado"
409
410
411 @pyqtSignature("int")
412 def on_profileSelecopVolCEB_stateChanged(self, p0):
413 """
414 Check Box habilita ingreso del rango de Perfiles
415 """
416 if p0==2:
417 self.lineProfileSelecopVolCEB.setEnabled(True)
418 upProcessSelect=self.upObjVolList[int(self.addOpUpselec.currentIndex())]
419 opObj10=upProcessSelect.addOperation(name='ProfileSelector', optype='other')
420 print opObj10.id
421 self.operObjList.append(opObj10)
422 print " Select Type of Profile"
423 if p0==0:
424 print " deshabilitado"
425
426
427 @pyqtSignature("int")
428 def on_coherentIntegrationCEB_stateChanged(self, p0):
429 """
430 Check Box habilita ingresode del numero de Integraciones a realizar
431 """
432 if p0==2:
433 self.numberIntegration.setEnabled(True)
434 upProcessSelect=self.upObjVolList[int(self.addOpUpselec.currentIndex())]
435 opObj10=upProcessSelect.addOperation(name='CohInt', optype='other')
436 print opObj10.id
437 self.operObjList.append(opObj10)
438 print "Choose number of Cohint"
439 if p0==0:
440 print " deshabilitado"
441 self.numberChannelopVol.setEnabled(False)
442
443 #-----------------------PUSHBUTTON_ACCEPT_OPERATION----------------------------#
444
445 @pyqtSignature("")
446 def on_dataopVolOkBtn_clicked(self):
447 """
448 BUSCA EN LA LISTA DE OPERACIONES DEL TIPO VOLTAJE Y LES AοΏ½ADE EL PARAMETRO ADECUADO ESPERANDO LA ACEPTACION DEL USUARIO
449 PARA AGREGARLO AL ARCHIVO DE CONFIGURACION XML
450 """
451 if self.selecChannelopVolCEB.isChecked():
452 for i in self.operObjList:
453 if i.name=='selectChannels':
454 value=self.numberChannelopVol.text()
455 i.addParameter(name='channelList', value=value, format='intlist')
456
457
458 print "channel"
459
460 if self.selecHeighopVolCEB.isChecked():
461 for i in self.operObjList:
462 if i.name=='selectHeights' :
463 value=self.lineHeighProfileTxtopVol.text()
464 valueList=value.split(',')
465 i.addParameter(name='minHei', value=valueList[0], format='float')
466 i.addParameter(name='maxHei', value=valueList[1], format='float')
467
468 print "height"
469
470
471 if self.selecHeighopVolCEB.isChecked():
472 for i in self.operObjList:
473 if i.name=='ProfileSelector' :
474 value=self.lineProfileSelecopVolCEB.text()
475 i.addParameter(name='ProfileSelector', value=value, format='intlist')
476
477
478
479 if self.coherentIntegrationCEB.isChecked():
480 for i in self.operObjList:
481 if i.name=='CohInt':
482 value=self.numberIntegration.text()
483 i.addParameter(name='n', value=value, format='int')
484
485
486 #-------------------------VENTANA DE CONFIGURACION SPECTRA------------------------#
487
488 @pyqtSignature("int")
489 def on_nFFTPointOpSpecCEB_stateChanged(self, p0):
490 """
491 Habilita la opcion de aοΏ½adir el parοΏ½metro nFFTPoints a la Unidad de Procesamiento .
492 """
493 if p0==2:
494 self.valuenFFTPointOpSpec.setEnabled(True)
495 print " nFFTPoint"
496 if p0==0:
497 print " deshabilitado"
498
499 #------------------PUSH_BUTTON_SPECTRA_OK------------------------------------#
500
501 @pyqtSignature("")
502 def on_dataopSpecOkBtn_clicked(self):
503 """
504 AοΏ½ade al archivo de configuraciοΏ½n el parοΏ½metros nFFTPoints a la UP.
505 """
506 print "AοΏ½adimos operaciones Spectra,nchannels,value,format"
507 if self.nFFTPointOpSpecCEB.isChecked():
508 upProcessSelect=self.upobjSpecList[int(self.addOpSpecUpselec.currentIndex())]
509 value=self.valuenFFTPointOpSpec.text()
510 upProcessSelect.addParameter(name='nFFTPoints',value=value,format='int')
511 #---------------------VENTANA DE CONFIGURACION GRAPH SPECTRA------------------#
512
513 @pyqtSignature("int")
514 def on_SpectraPlotGraphCEB_stateChanged(self, p0):
515 """
516 Habilita la opcion de Ploteo Spectra Plot
517 """
518 if p0==2:
519 upProcessSelect=self.upobjSpecList[int(self.addOpSpecUpselec.currentIndex())]
520 opObj10=upProcessSelect.addOperation(name='SpectraPlot',optype='other')
521 print opObj10.id
522 self.operObjList.append(opObj10)
523
524 if p0==0:
525 print " deshabilitado"
526
527 @pyqtSignature("int")
528 def on_CrossSpectraPlotGraphceb_stateChanged(self, p0):
529 """
530 Habilita la opciοΏ½n de Ploteo CrossSpectra
531 """
532 if p0==2:
533 upProcessSelect=self.upobjSpecList[int(self.addOpSpecUpselec.currentIndex())]
534 opObj10=upProcessSelect.addOperation(name='CrossSpectraPlot',optype='other')
535 print opObj10.id
536 self.operObjList.append(opObj10)
537 if p0==0:
538 print " deshabilitado"
539
540 @pyqtSignature("int")
541 def on_RTIPlotGraphCEB_stateChanged(self, p0):
542 """
543 Habilita la opciοΏ½n de Plote RTIPlot
544 """
545 if p0==2:
546 upProcessSelect=self.upobjSpecList[int(self.addOpSpecUpselec.currentIndex())]
547 opObj10=upProcessSelect.addOperation(name='RTIPlot',optype='other')
548 print opObj10.id
549 self.operObjList.append(opObj10)
550 if p0==0:
551 print " deshabilitado"
552
553 #------------------PUSH_BUTTON_SPECTRA_GRAPH_OK-----------------------------#
554 @pyqtSignature("")
555 def on_dataGraphSpecOkBtn_clicked(self):
556 """
557 HABILITAR DE ACUERDO A LOS CHECKBOX QUE TIPO DE PLOTEOS SE VAN A REALIZAR MUESTRA Y GRABA LAS IMAGENES.
558 """
559 print "Graficar Spec op"
560 if self.SpectraPlotGraphCEB.isChecked():
561 for i in self.operObjList:
562 if i.name=='SpectraPlot':
563 i.addParameter(name='idfigure', value='1', format='int')
564 i.addParameter(name='wintitle', value='SpectraPlot0', format='str')
565 i.addParameter(name='zmin', value='40', format='int')
566 i.addParameter(name='zmax', value='90', format='int')
567 i.addParameter(name='showprofile', value='1', format='int')
568
569 if self.CrossSpectraPlotGraphceb.isChecked():
570 for i in self.operObjList:
571 if i.name=='CrossSpectraPlot' :
572 i.addParameter(name='idfigure', value='2', format='int')
573 i.addParameter(name='wintitle', value='CrossSpectraPlot', format='str')
574 i.addParameter(name='zmin', value='40', format='int')
575 i.addParameter(name='zmax', value='90', format='int')
576
577 if self.RTIPlotGraphCEB.isChecked():
578 for i in self.operObjList:
579 if i.name=='RTIPlot':
580 i.addParameter(name='n', value='2', format='int')
581 i.addParameter(name='overlapping', value='1', format='int')
582
583
584 #----------------------------BASICO-----------------------------------#
433 #----------------------------BASICO-----------------------------------#
585 434
586 435 def getNumberofProject(self):
587 436 # for i in self.proObjList:
@@ -593,6 +442,9 class BasicWindow(QMainWindow, Ui_BasicWindow):
593 442 def setParam(self):
594 443
595 444 self.tabWidgetProject.setEnabled(False)
445 self.tabVoltage.setEnabled(False)
446 self.tabSpectra.setEnabled(False)
447 self.tabCorrelation.setEnabled(False)
596 448 self.dataPathTxt.setText('C:\data')
597 449 self.nameProjectTxt.setText("Test")
598 450 self.numberChannelopVol.setEnabled(False)
@@ -603,8 +455,31 class BasicWindow(QMainWindow, Ui_BasicWindow):
603 455
604 456 def clickFunctiontree(self,index):
605 457 self.indexclick= index.model().itemFromIndex(index)
606 print self.indexclick
607 return self.indexclick
458 print "OPCION CLICK"
459 print "ArbolDict",self.indexclick
460 print "name:",self.indexclick.text()
461 #print self.tabWidgetProject.currentIndex()
462
463 #return self.indexclick
464 for i in self.__arbolDict:
465 if self.__arbolDict[i]==self.indexclick:
466 print "INDEXCLICK=ARBOLDICT",i
467 if self.__projObjDict.has_key(i)==True:
468 self.tabWidgetProject.setCurrentWidget(self.tabProject)
469
470 if self.indexclick.text()=='Voltage':
471 self.tabVoltage.setEnabled(True)
472 self.tabWidgetProject.setCurrentWidget(self.tabVoltage)
473
474 if self.indexclick.text()=='Spectra':
475 self.tabSpectra.setEnabled(True)
476 self.tabWidgetProject.setCurrentWidget(self.tabSpectra)
477
478 if self.indexclick.text()=='Correlation':
479 self.tabCorrelation.setEnabled(True)
480 self.tabWidgetProject.setCurrentWidget(self.tabCorrelation)
481
482
608 483 # self.indexclick= index.model().itemFromIndex(index).text()
609 484 # return self.indexclick
610 485 # print self.indexclick()
@@ -619,25 +494,29 class BasicWindow(QMainWindow, Ui_BasicWindow):
619 494
620 495 def addProject(self):
621 496 self.tabWidgetProject.setEnabled(True)
622 print "En este nivel se debe crear el proyecto,id,nombre,desc"
497 self.tabWidgetProject.setCurrentWidget(self.tabProject)
498 self.tabProject.setEnabled(True)
499 #self.tabVoltage.setEnabled(False)
500 print "HABILITA WIDGET"
623 501 #+++++++++++++++++++Creacion del Objeto Controller-XML+++++++++++++#
624 502
625 self.idp += 1
626 self.projectObj = Project()
627 print self.projectObj
628 self.__projObjDict[self.idp] = self.projectObj
629
630 #++++++++++++++++++CreaciΓ³n del Arbol++++++++++++++++++++#
631
632 name='Test'
633 self.parentItem = self.model.invisibleRootItem()
634 self.__arbolDict[self.idp] = QtGui.QStandardItem(QtCore.QString(name+" %0").arg(self.idp))
635 print "Nombre del projecto es :",self.__arbolDict[self.idp].setAccessibleText('HOLA')
636 print self.__arbolDict[self.idp]
637 self.parentItem.appendRow(self.__arbolDict[self.idp])
638 self.parentItem=self.__arbolDict[self.idp]
503 # self.idp += 1
504 # self.projectObj = Project()
505 # print self.projectObj
506 # self.__projObjDict[self.idp] = self.projectObj
507 #
508 # #++++++++++++++++++CreaciΓ³n del Arbol++++++++++++++++++++#
509 #
510 # name='Test'
511 #
512 # self.parentItem = self.model.invisibleRootItem()
513 # self.__arbolDict[self.idp] = QtGui.QStandardItem(QtCore.QString(name).arg(self.idp))
514 #
515 # print "Nombre del projecto es :",self.__arbolDict[self.idp].setAccessibleText('HOLA')
516 # print self.__arbolDict[self.idp]
517 # self.parentItem.appendRow(self.__arbolDict[self.idp])
518 # self.parentItem=self.__arbolDict[self.idp]
639 519
640 print "Porfavor ingrese los parΓ‘metros de configuracion del Proyecto"
641 520
642 521 def existDir(self, var_dir):
643 522 """
@@ -650,67 +529,142 class BasicWindow(QMainWindow, Ui_BasicWindow):
650 529 self.textEdit.append("Incorrect path:" + str(var_dir))
651 530 return False
652 531
532 def searchData(self, path, ext, expLabel='', walk=1):
533
534 dateList = []
535 fileList = []
536
537 if walk == 0:
538 files = os.listdir(path)
539 for thisFile in files:
540 if not os.path.isfile(thisFile):
541 continue
542 thisExt = os.path.splitext(thisFile)[-1]
543
544 if thisExt != ext:
545 continue
546
547 fileList.append(file)
548
549 for thisFile in fileList:
550
551 if not isRadarFile(thisFile):
552 continue
553
554 year = int(thisFile[1:5])
555 doy = int(thisFile[5:8])
556
557 date = datetime.date(year,1,1) + datetime.timedelta(doy-1)
558 dateformat = date.strftime("%Y/%m/%d")
559
560 if dateformat not in dateList:
561 dateList.append(dateformat)
562
563 if walk == 1:
564
565 dirList = os.listdir(path)
566 dirList.sort()
567
568 dateList = []
569
570 for thisDir in dirList:
571
572 if not isRadarPath(thisDir):
573 continue
574
575 doypath = os.path.join(path, thisDir, expLabel)
576
577 files = os.listdir(doypath)
578 fileList = []
579
580 for thisFile in files:
581
582 if os.path.splitext(thisFile)[-1] != ext:
583 continue
584
585 if not isRadarFile(thisFile):
586 continue
587
588 fileList.append(thisFile)
589 break
590
591 if fileList == []:
592 continue
593
594 year = int(thisDir[1:5])
595 doy = int(thisDir[5:8])
596
597 date = datetime.date(year,1,1) + datetime.timedelta(doy-1)
598 dateformat = date.strftime("%Y/%m/%d")
599 dateList.append(dateformat)
600
601 return dateList
602
653 603 def loadDays(self):
654 604 """
655 605 METODO PARA CARGAR LOS DIAS
656 606 """
657 self.variableList=[]
607 ext = self.datatype
608 path = str(self.dataPathTxt.text())
609
658 610 self.starDateCmbBox.clear()
659 611 self.endDateCmbBox.clear()
660 612
661 Dirlist = os.listdir(self.dataPath)
662 Dirlist.sort()
613 dateList = self.searchData(path, ext=ext)
614 #Se cargan las listas para seleccionar StartDay y StopDay (QComboBox)
615 self.dateList = dateList
663 616
664 for a in range(0, len(Dirlist)):
665 fname= Dirlist[a]
666 Doy=fname[5:8]
667 fname = fname[1:5]
668 print fname
669 fecha=Doy2Date(int(fname),int(Doy))
670 fechaList=fecha.change2date()
671 #print fechaList[0]
672 Dirlist[a]=fname+"/"+str(fechaList[0])+"/"+str(fechaList[1])
673 #+"-"+ fechaList[0]+"-"+fechaList[1]
674
675 #---------------AQUI TIENE QUE SER MODIFICADO--------#
617 for thisDate in dateList:
618 self.starDateCmbBox.addItem(thisDate)
619 self.endDateCmbBox.addItem(thisDate)
620
621 self.endDateCmbBox.setCurrentIndex(self.starDateCmbBox.count()-1)
622 self.dataOkBtn.setEnabled(True)
623
624
625
626 def HourChanged(self):
627 #self.hour = self.HourScrollBar.value()
628 self.set_time()
676 629
677 #Se cargan las listas para seleccionar StartDay y StopDay (QComboBox)
678 for i in range(0, (len(Dirlist))):
679 self.variableList.append(Dirlist[i])
630 def MinChanged(self):
631 #self.min = self.MinScrollBar.value()
632 self.set_time()
633
634 def SecChanged(self):
635 #self.sec = self.SecScrollBar.value()
636 self.set_time()
637
638 def set_time(self):
639 self.time.setHMS(self.hour, self.min, self.sec)
640 self.startTimeEdit.setTime(self.time)
680 641
681 for i in self.variableList:
682 self.starDateCmbBox.addItem(i)
683 self.endDateCmbBox.addItem(i)
684 self.endDateCmbBox.setCurrentIndex(self.starDateCmbBox.count()-1)
685
686 self.getsubList()
687 self.dataOkBtn.setEnabled(True)
642 self.timeEdit_2.setTime(self.time)
688 643
689 def getsubList(self):
690 """
691 OBTIENE EL RANDO DE LAS FECHAS SELECCIONADAS
692 """
693 self.subList=[]
694 for i in self.variableList[self.starDateCmbBox.currentIndex():self.starDateCmbBox.currentIndex() + self.endDateCmbBox.currentIndex()+1]:
695 self.subList.append(i)
696 644
697 645 def addUP(self):
698 646
699 647 self.configUP=UnitProcess(self)
648
700 649 for i in self.__arbolDict:
701 650 if self.__arbolDict[i]==self.indexclick:
651 print "INDEXCLICK=ARBOLDICT",i
702 652 if self.__projObjDict.has_key(i)==True:
703 653 self.projectObj=self.__projObjDict[int(i)]
704 print self.projectObj.id
654 print "self.projectObj.id",self.projectObj.id
655 self.configUP.dataTypeProject=str(self.dataTypeCmbBox.currentText())
705 656 self.configUP.getfromWindowList.append(self.projectObj)
706
707
657
708 658 for i in self.projectObj.procUnitConfObjDict:
709 659 if self.projectObj.procUnitConfObjDict[i].getElementName()=='ProcUnit':
710 660 self.upObj=self.projectObj.procUnitConfObjDict[i]
711 661 self.configUP.getfromWindowList.append(self.upObj)
712
713
662 else:
663 self.upObj=self.__upObjDict[i]
664 print "self.upObj.id",self.upObj.id
665 self.configUP.getfromWindowList.append(self.upObj)
666
667
714 668
715 669 self.configUP.loadTotalList()
716 670 self.configUP.show()
@@ -721,7 +675,7 class BasicWindow(QMainWindow, Ui_BasicWindow):
721 675
722 676 def createUP(self):
723 677
724 print "En este nivel se adiciona una rama de procesamiento, y se le concatena con el id"
678 print "ADICION DE BRANCH Y ID"
725 679
726 680 if not self.configUP.create:
727 681 return
@@ -730,8 +684,20 class BasicWindow(QMainWindow, Ui_BasicWindow):
730 684
731 685 self.upType = self.configUP.typeofUP
732 686 for i in self.__arbolDict:
687 print self.__arbolDict[i],"VALORES DEL DIC"
733 688 if self.__arbolDict[i]==self.indexclick:
734 self.projectObj=self.__projObjDict[int(i)]
689 if self.__projObjDict.has_key(i)==True:
690 # print "self.__projObjDict[int(i)]" ,__projObjDict[int(i)]
691 self.projectObj=self.__projObjDict[int(i)]
692 print self.__projObjDict[int(i)]
693
694 if self.__upObjDict.has_key(i)==True:
695 print "Entro al else"
696 print self.__upObjDict.items()
697 self.upObj=self.__upObjDict[i]
698 getIdProject=self.upObj.id[0]
699 print getIdProject
700 self.projectObj=self.__projObjDict[int(getIdProject)]
735 701
736 702 datatype=str(self.upType)
737 703 uporprojectObj=self.uporProObjRecover
@@ -741,14 +707,16 class BasicWindow(QMainWindow, Ui_BasicWindow):
741 707 else:
742 708 inputId=self.readUnitConfObjList[uporprojectObj.id-1].getId()
743 709
744 print 'uporprojectObj.id','inputId', uporprojectObj.id,inputId
710 print 'uporprojectObj.id:',uporprojectObj.id,'inputId:',inputId
745 711 self.procUnitConfObj1 = self.projectObj.addProcUnit(datatype=datatype, inputId=inputId)
746 712 self.__upObjDict[self.procUnitConfObj1.id]= self.procUnitConfObj1
747
713 print "PRIMERA UP_VEAMOS",self.__upObjDict.items()
748 714 self.parentItem=self.__arbolDict[uporprojectObj.id]
749 715 #print "i","self.__arbolDict[i]",i ,self.__arbolDict[i]
750 716 self.numbertree=int(self.procUnitConfObj1.getId())-1
751 self.__arbolDict[self.procUnitConfObj1.id]=QtGui.QStandardItem(QtCore.QString(datatype +"%1 ").arg(self.numbertree))
717 print self.procUnitConfObj1.id," ID DE LA UNIDAD DE PROCESAMIENTO "
718 #self.__arbolDict[self.procUnitConfObj1.id]=QtGui.QStandardItem(QtCore.QString(datatype+"%1").arg(self.numbertree))
719 self.__arbolDict[self.procUnitConfObj1.id]=QtGui.QStandardItem(QtCore.QString(datatype).arg(self.numbertree))
752 720 self.parentItem.appendRow(self.__arbolDict[self.procUnitConfObj1.id])
753 721 self.parentItem=self.__arbolDict[self.procUnitConfObj1.id]
754 722 # self.loadUp()
@@ -803,6 +771,7 class UnitProcess(QMainWindow, Ui_UnitProcess):
803 771 self.setupUi(self)
804 772 self.getFromWindow=None
805 773 self.getfromWindowList=[]
774 self.dataTypeProject=None
806 775
807 776 self.listUP=None
808 777
@@ -836,10 +805,25 class UnitProcess(QMainWindow, Ui_UnitProcess):
836 805 if name=='Project':
837 806 id= i.id
838 807 name=i.name
808 if self.dataTypeProject=='Spectra':
809 self.comboTypeBox.clear()
810 self.comboTypeBox.addItem("Spectra")
811 self.comboTypeBox.addItem("Correlation")
812
839 813 if name=='ProcUnit':
840 814 id=int(i.id)-1
841 815 name=i.datatype
816 if name == 'Voltage':
817 self.comboTypeBox.clear()
818 self.comboTypeBox.addItem("Spectra")
819 self.comboTypeBox.addItem("Correlation")
820 if name == 'Spectra':
821 self.comboTypeBox.clear()
822 self.comboTypeBox.addItem("Spectra")
823 self.comboTypeBox.addItem("Correlation")
824
842 825
826 #self.comboInputBox.addItem(str(name))
843 827 self.comboInputBox.addItem(str(name)+str(id))
844 828
845 829 def closeEvent(self, event):
@@ -848,33 +832,9 class UnitProcess(QMainWindow, Ui_UnitProcess):
848 832
849 833
850 834
851
852
853
854 835
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877 # -----------------VENTANA CONFIGURACION DE VOLTAGE---------------------------#
836
837 #-----------------VENTANA CONFIGURACION DE VOLTAGE---------------------------#
878 838 #
879 839 # @pyqtSignature("int")
880 840 # def on_selecChannelopVolCEB_stateChanged(self, p0):
@@ -1078,8 +1038,7 class UnitProcess(QMainWindow, Ui_UnitProcess):
1078 1038 # if i.name=='RTIPlot':
1079 1039 # i.addParameter(name='n', value='2', format='int')
1080 1040 # i.addParameter(name='overlapping', value='1', format='int')
1081 #
1082 #
1083 #
1084
1085 #--------------------------------------VENTANA DE CONFIGURACION DE LA UP-----------------------# No newline at end of file
1041 #
1042 #
1043
1044 No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now