##// 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 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """
2 """
3 Module implementing MainWindow.
3 Module implementing MainWindow.
4 #+++++++++++++++++++++INTERFAZ DE USUARIO V1.1++++++++++++++++++++++++#
4 #+++++++++++++INTERFAZ DE USUARIO V1.1++++++++++++++#
5 """
5 """
6 from PyQt4.QtGui import QMainWindow
6 import os
7 from PyQt4.QtCore import pyqtSignature
7 import datetime
8 from PyQt4.QtCore import pyqtSignal
8
9 from PyQt4 import QtCore
9 from PyQt4.QtGui import QMainWindow
10 from PyQt4 import QtGui
10 from PyQt4.QtCore import pyqtSignature
11 from timeconversions import Doy2Date
11 from PyQt4.QtCore import pyqtSignal
12 from modelProperties import treeModel
12 from PyQt4 import QtCore
13 from PyQt4 import QtGui
14 from timeconversions import Doy2Date
15 from modelProperties import treeModel
13
16
14 from viewer.ui_unitprocess import Ui_UnitProcess
17 from viewer.ui_unitprocess import Ui_UnitProcess
15 from viewer.ui_window import Ui_window
18 from viewer.ui_window import Ui_window
16 from viewer.ui_mainwindow import Ui_BasicWindow
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
23 def isRadarFile(file):
20 import os
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 class BasicWindow(QMainWindow, Ui_BasicWindow):
43 class BasicWindow(QMainWindow, Ui_BasicWindow):
24 __projObjDict = {}
44 __projObjDict = None
25 __arbolDict = {}
45 __arbolDict = None
26 __upObjDict = {}
46 __upObjDict = None
27
47
28 """
48 """
29 Class documentation goes here.
49 Class documentation goes here.
30 #*##################VENTANA CUERPO DEL PROGRAMA####################
50 #*############VENTANA CUERPO DEL PROGRAMA##############
31 """
51 """
32 def __init__(self, parent = None):
52 def __init__(self, parent = None):
33 """
53 """
34 Constructor
54 Constructor
35 """
55 """
36 print "Inicio de Programa Interfaz GrΓ‘fica"
56 print "INICIO PROGRAMA "
37 QMainWindow.__init__(self, parent)
57 QMainWindow.__init__(self, parent)
38 self.setupUi(self)
58 self.setupUi(self)
39
59
60 self.__projObjDict = {}
61 self.__arbolDict = {}
62 self.__upObjDict = {}
63
40 self.indexclick=None
64 self.indexclick=None
41
65
42 self.online=0
66 self.online=0
43 self.datatype=0
67 self.datatype=0
44 self.variableList=[]
68 self.dateList=[]
45
69
46 self.proObjList=[]
70 self.proObjList=[]
47 self.idp=0
71 self.idp=0
@@ -85,6 +109,10 class BasicWindow(QMainWindow, Ui_BasicWindow):
85 self.treeView.expandAll()
109 self.treeView.expandAll()
86 #self.treeView.clicked.connect(self.treefunction1)
110 #self.treeView.clicked.connect(self.treefunction1)
87
111
112
113
114
115
88 #-----------------------------------BARRA DE MENU-------------------------------------------------#
116 #-----------------------------------BARRA DE MENU-------------------------------------------------#
89
117
90 #----------------------------------- MENU_PROJECT--------------------------------------------------#
118 #----------------------------------- MENU_PROJECT--------------------------------------------------#
@@ -241,13 +269,14 class BasicWindow(QMainWindow, Ui_BasicWindow):
241 """
269 """
242 self.dataFormatTxt.setReadOnly(True)
270 self.dataFormatTxt.setReadOnly(True)
243 if index==0:
271 if index==0:
244 self.datatype='Voltage'
272 self.datatype='.r'
245 elif index==1:
273 elif index==1:
246 self.datatype='Spectra'
274 self.datatype='.pdata'
247 else :
275 else :
248 self.datatype=''
276 self.datatype=''
249 self.dataFormatTxt.setReadOnly(False)
277 self.dataFormatTxt.setReadOnly(False)
250 self.dataFormatTxt.setText(self.datatype)
278 self.dataFormatTxt.setText(self.datatype)
279 self.loadDays()
251
280
252 @pyqtSignature("")
281 @pyqtSignature("")
253 def on_dataPathBrowse_clicked(self):
282 def on_dataPathBrowse_clicked(self):
@@ -256,33 +285,40 class BasicWindow(QMainWindow, Ui_BasicWindow):
256 """
285 """
257 self.dataPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly))
286 self.dataPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly))
258 self.dataPathTxt.setText(self.dataPath)
287 self.dataPathTxt.setText(self.dataPath)
259 self.statusDpath=self.existDir(self.dataPath)
288
260 self.loadDays()
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 @pyqtSignature("int")
298 @pyqtSignature("int")
263 def on_starDateCmbBox_activated(self, index):
299 def on_starDateCmbBox_activated(self, index):
264 """
300 """
265 SELECCION DEL RANGO DE FECHAS -START DATE
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 self.endDateCmbBox.clear()
304 self.endDateCmbBox.clear()
269 for i in self.variableList[index:]:
305
306 for i in self.dateList[index:]:
270 self.endDateCmbBox.addItem(i)
307 self.endDateCmbBox.addItem(i)
271 self.endDateCmbBox.setCurrentIndex(self.endDateCmbBox.count() - var_StopDay_index)
308
272 self.getsubList()
309 self.endDateCmbBox.setCurrentIndex(self.endDateCmbBox.count() - stopIndex)
273
310
274 @pyqtSignature("int")
311 @pyqtSignature("int")
275 def on_endDateCmbBox_activated(self, index):
312 def on_endDateCmbBox_activated(self, index):
276 """
313 """
277 SELECCION DEL RANGO DE FECHAS-END DATE
314 SELECCION DEL RANGO DE FECHAS-END DATE
278 """
315 """
279 var_StartDay_index=self.starDateCmbBox.currentIndex()
316 startIndex=self.starDateCmbBox.currentIndex()
280 var_end_index = self.endDateCmbBox.count() - index
317 stopIndex = self.endDateCmbBox.count() - index
281 self.starDateCmbBox.clear()
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 self.starDateCmbBox.addItem(i)
320 self.starDateCmbBox.addItem(i)
284 self.starDateCmbBox.setCurrentIndex(var_StartDay_index)
321 self.starDateCmbBox.setCurrentIndex(startIndex)
285 self.getsubList() #Se carga var_sublist[] con el rango de las fechas seleccionadas
286
322
287 @pyqtSignature("int")
323 @pyqtSignature("int")
288 def on_readModeCmBox_activated(self, p0):
324 def on_readModeCmBox_activated(self, p0):
@@ -302,66 +338,87 class BasicWindow(QMainWindow, Ui_BasicWindow):
302 AΓ±ade al Obj XML de Projecto, name,datatype,date,time,readmode,wait,etc, crea el readUnitProcess del archivo xml.
338 AΓ±ade al Obj XML de Projecto, name,datatype,date,time,readmode,wait,etc, crea el readUnitProcess del archivo xml.
303 Prepara la configuraciΓ³n del diΓ‘grama del Arbol del treeView numero 2
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"
341 print "DATOS DEL PROJECT PATH,DATE,TIME"
306
307 for i in self.__arbolDict:
308 if self.__arbolDict[i]==self.indexclick:
309
310
342
311 # self.model.clear()
343 # self.model.clear()
312 # self.parentItem = self.model.invisibleRootItem()
344 # self.parentItem = self.model.invisibleRootItem()
313 # self.__arbolDict[i]= QtGui.QStandardItem(QtCore.QString(name+" %0").arg(self.idp))
345 # self.__arbolDict[i]= QtGui.QStandardItem(QtCore.QString(name+" %0").arg(self.idp))
314 # self.parentItem.appendRow(self.__arbolDict[self.idp
346 # self.parentItem.appendRow(self.__arbolDict[self.idp
315 self.projectObj=self.__projObjDict[int(i)]
347
316 # print self.projectObj
348 # print self.projectObj
317 # print i
349 # print i
318 # print "get",self.__arbolDict.items()
350 # print "get",self.__arbolDict.items()
319 # print "keys",self.__arbolDict.keys()
351 # print "keys",self.__arbolDict.keys()
320 self.description="Think"
352
321 id=i
353 self.idp += 1
322 name=str(self.nameProjectTxt.text())
354 self.projectObj = Project()
323 desc=str(self.description)
355 print "self.projectObj",self.projectObj
324
356 self.__projObjDict[self.idp] = self.projectObj
325 self.projectObj.setup(id = id, name=name, description=desc)
357
326 print self.projectObj.id
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 # print self.projectObj.name
367 # print self.projectObj.name
328 # print self.projectObj.description
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())
406 self.model_2.arbol()
331 path=str(self.dataPathTxt.text())
407 self.treeView_2.setModel(self.model_2)
332 online=int(self.online)
408 self.treeView_2.expandAll()
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()
362
409
363
410 self.parentItem = self.model.invisibleRootItem()
364
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 #-----------------PUSHBUTTON_ADD_PROCESSING UNIT PROJECT------------------#
422 #-----------------PUSHBUTTON_ADD_PROCESSING UNIT PROJECT------------------#
366 @pyqtSignature("")
423 @pyqtSignature("")
367 def on_addUnitProces_clicked(self):
424 def on_addUnitProces_clicked(self):
@@ -373,215 +430,7 class BasicWindow(QMainWindow, Ui_BasicWindow):
373 self.addUP()
430 self.addUP()
374
431
375
432
376
433 #----------------------------BASICO-----------------------------------#
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-----------------------------------#
585
434
586 def getNumberofProject(self):
435 def getNumberofProject(self):
587 # for i in self.proObjList:
436 # for i in self.proObjList:
@@ -593,6 +442,9 class BasicWindow(QMainWindow, Ui_BasicWindow):
593 def setParam(self):
442 def setParam(self):
594
443
595 self.tabWidgetProject.setEnabled(False)
444 self.tabWidgetProject.setEnabled(False)
445 self.tabVoltage.setEnabled(False)
446 self.tabSpectra.setEnabled(False)
447 self.tabCorrelation.setEnabled(False)
596 self.dataPathTxt.setText('C:\data')
448 self.dataPathTxt.setText('C:\data')
597 self.nameProjectTxt.setText("Test")
449 self.nameProjectTxt.setText("Test")
598 self.numberChannelopVol.setEnabled(False)
450 self.numberChannelopVol.setEnabled(False)
@@ -603,8 +455,31 class BasicWindow(QMainWindow, Ui_BasicWindow):
603
455
604 def clickFunctiontree(self,index):
456 def clickFunctiontree(self,index):
605 self.indexclick= index.model().itemFromIndex(index)
457 self.indexclick= index.model().itemFromIndex(index)
606 print self.indexclick
458 print "OPCION CLICK"
607 return self.indexclick
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 # self.indexclick= index.model().itemFromIndex(index).text()
483 # self.indexclick= index.model().itemFromIndex(index).text()
609 # return self.indexclick
484 # return self.indexclick
610 # print self.indexclick()
485 # print self.indexclick()
@@ -619,25 +494,29 class BasicWindow(QMainWindow, Ui_BasicWindow):
619
494
620 def addProject(self):
495 def addProject(self):
621 self.tabWidgetProject.setEnabled(True)
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 #+++++++++++++++++++Creacion del Objeto Controller-XML+++++++++++++#
501 #+++++++++++++++++++Creacion del Objeto Controller-XML+++++++++++++#
624
502
625 self.idp += 1
503 # self.idp += 1
626 self.projectObj = Project()
504 # self.projectObj = Project()
627 print self.projectObj
505 # print self.projectObj
628 self.__projObjDict[self.idp] = self.projectObj
506 # self.__projObjDict[self.idp] = self.projectObj
629
507 #
630 #++++++++++++++++++CreaciΓ³n del Arbol++++++++++++++++++++#
508 # #++++++++++++++++++CreaciΓ³n del Arbol++++++++++++++++++++#
631
509 #
632 name='Test'
510 # name='Test'
633 self.parentItem = self.model.invisibleRootItem()
511 #
634 self.__arbolDict[self.idp] = QtGui.QStandardItem(QtCore.QString(name+" %0").arg(self.idp))
512 # self.parentItem = self.model.invisibleRootItem()
635 print "Nombre del projecto es :",self.__arbolDict[self.idp].setAccessibleText('HOLA')
513 # self.__arbolDict[self.idp] = QtGui.QStandardItem(QtCore.QString(name).arg(self.idp))
636 print self.__arbolDict[self.idp]
514 #
637 self.parentItem.appendRow(self.__arbolDict[self.idp])
515 # print "Nombre del projecto es :",self.__arbolDict[self.idp].setAccessibleText('HOLA')
638 self.parentItem=self.__arbolDict[self.idp]
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 def existDir(self, var_dir):
521 def existDir(self, var_dir):
643 """
522 """
@@ -650,67 +529,142 class BasicWindow(QMainWindow, Ui_BasicWindow):
650 self.textEdit.append("Incorrect path:" + str(var_dir))
529 self.textEdit.append("Incorrect path:" + str(var_dir))
651 return False
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 def loadDays(self):
603 def loadDays(self):
654 """
604 """
655 METODO PARA CARGAR LOS DIAS
605 METODO PARA CARGAR LOS DIAS
656 """
606 """
657 self.variableList=[]
607 ext = self.datatype
608 path = str(self.dataPathTxt.text())
609
658 self.starDateCmbBox.clear()
610 self.starDateCmbBox.clear()
659 self.endDateCmbBox.clear()
611 self.endDateCmbBox.clear()
660
612
661 Dirlist = os.listdir(self.dataPath)
613 dateList = self.searchData(path, ext=ext)
662 Dirlist.sort()
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)):
617 for thisDate in dateList:
665 fname= Dirlist[a]
618 self.starDateCmbBox.addItem(thisDate)
666 Doy=fname[5:8]
619 self.endDateCmbBox.addItem(thisDate)
667 fname = fname[1:5]
620
668 print fname
621 self.endDateCmbBox.setCurrentIndex(self.starDateCmbBox.count()-1)
669 fecha=Doy2Date(int(fname),int(Doy))
622 self.dataOkBtn.setEnabled(True)
670 fechaList=fecha.change2date()
623
671 #print fechaList[0]
624
672 Dirlist[a]=fname+"/"+str(fechaList[0])+"/"+str(fechaList[1])
625
673 #+"-"+ fechaList[0]+"-"+fechaList[1]
626 def HourChanged(self):
674
627 #self.hour = self.HourScrollBar.value()
675 #---------------AQUI TIENE QUE SER MODIFICADO--------#
628 self.set_time()
676
629
677 #Se cargan las listas para seleccionar StartDay y StopDay (QComboBox)
630 def MinChanged(self):
678 for i in range(0, (len(Dirlist))):
631 #self.min = self.MinScrollBar.value()
679 self.variableList.append(Dirlist[i])
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:
642 self.timeEdit_2.setTime(self.time)
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)
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 def addUP(self):
645 def addUP(self):
698
646
699 self.configUP=UnitProcess(self)
647 self.configUP=UnitProcess(self)
648
700 for i in self.__arbolDict:
649 for i in self.__arbolDict:
701 if self.__arbolDict[i]==self.indexclick:
650 if self.__arbolDict[i]==self.indexclick:
651 print "INDEXCLICK=ARBOLDICT",i
702 if self.__projObjDict.has_key(i)==True:
652 if self.__projObjDict.has_key(i)==True:
703 self.projectObj=self.__projObjDict[int(i)]
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 self.configUP.getfromWindowList.append(self.projectObj)
656 self.configUP.getfromWindowList.append(self.projectObj)
706
657
707
708 for i in self.projectObj.procUnitConfObjDict:
658 for i in self.projectObj.procUnitConfObjDict:
709 if self.projectObj.procUnitConfObjDict[i].getElementName()=='ProcUnit':
659 if self.projectObj.procUnitConfObjDict[i].getElementName()=='ProcUnit':
710 self.upObj=self.projectObj.procUnitConfObjDict[i]
660 self.upObj=self.projectObj.procUnitConfObjDict[i]
711 self.configUP.getfromWindowList.append(self.upObj)
661 self.configUP.getfromWindowList.append(self.upObj)
712
662 else:
713
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 self.configUP.loadTotalList()
669 self.configUP.loadTotalList()
716 self.configUP.show()
670 self.configUP.show()
@@ -721,7 +675,7 class BasicWindow(QMainWindow, Ui_BasicWindow):
721
675
722 def createUP(self):
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 if not self.configUP.create:
680 if not self.configUP.create:
727 return
681 return
@@ -730,8 +684,20 class BasicWindow(QMainWindow, Ui_BasicWindow):
730
684
731 self.upType = self.configUP.typeofUP
685 self.upType = self.configUP.typeofUP
732 for i in self.__arbolDict:
686 for i in self.__arbolDict:
687 print self.__arbolDict[i],"VALORES DEL DIC"
733 if self.__arbolDict[i]==self.indexclick:
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 datatype=str(self.upType)
702 datatype=str(self.upType)
737 uporprojectObj=self.uporProObjRecover
703 uporprojectObj=self.uporProObjRecover
@@ -741,14 +707,16 class BasicWindow(QMainWindow, Ui_BasicWindow):
741 else:
707 else:
742 inputId=self.readUnitConfObjList[uporprojectObj.id-1].getId()
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 self.procUnitConfObj1 = self.projectObj.addProcUnit(datatype=datatype, inputId=inputId)
711 self.procUnitConfObj1 = self.projectObj.addProcUnit(datatype=datatype, inputId=inputId)
746 self.__upObjDict[self.procUnitConfObj1.id]= self.procUnitConfObj1
712 self.__upObjDict[self.procUnitConfObj1.id]= self.procUnitConfObj1
747
713 print "PRIMERA UP_VEAMOS",self.__upObjDict.items()
748 self.parentItem=self.__arbolDict[uporprojectObj.id]
714 self.parentItem=self.__arbolDict[uporprojectObj.id]
749 #print "i","self.__arbolDict[i]",i ,self.__arbolDict[i]
715 #print "i","self.__arbolDict[i]",i ,self.__arbolDict[i]
750 self.numbertree=int(self.procUnitConfObj1.getId())-1
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 self.parentItem.appendRow(self.__arbolDict[self.procUnitConfObj1.id])
720 self.parentItem.appendRow(self.__arbolDict[self.procUnitConfObj1.id])
753 self.parentItem=self.__arbolDict[self.procUnitConfObj1.id]
721 self.parentItem=self.__arbolDict[self.procUnitConfObj1.id]
754 # self.loadUp()
722 # self.loadUp()
@@ -803,6 +771,7 class UnitProcess(QMainWindow, Ui_UnitProcess):
803 self.setupUi(self)
771 self.setupUi(self)
804 self.getFromWindow=None
772 self.getFromWindow=None
805 self.getfromWindowList=[]
773 self.getfromWindowList=[]
774 self.dataTypeProject=None
806
775
807 self.listUP=None
776 self.listUP=None
808
777
@@ -836,10 +805,25 class UnitProcess(QMainWindow, Ui_UnitProcess):
836 if name=='Project':
805 if name=='Project':
837 id= i.id
806 id= i.id
838 name=i.name
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 if name=='ProcUnit':
813 if name=='ProcUnit':
840 id=int(i.id)-1
814 id=int(i.id)-1
841 name=i.datatype
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 self.comboInputBox.addItem(str(name)+str(id))
827 self.comboInputBox.addItem(str(name)+str(id))
844
828
845 def closeEvent(self, event):
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
836
856
837 #-----------------VENTANA CONFIGURACION DE VOLTAGE---------------------------#
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---------------------------#
878 #
838 #
879 # @pyqtSignature("int")
839 # @pyqtSignature("int")
880 # def on_selecChannelopVolCEB_stateChanged(self, p0):
840 # def on_selecChannelopVolCEB_stateChanged(self, p0):
@@ -1078,8 +1038,7 class UnitProcess(QMainWindow, Ui_UnitProcess):
1078 # if i.name=='RTIPlot':
1038 # if i.name=='RTIPlot':
1079 # i.addParameter(name='n', value='2', format='int')
1039 # i.addParameter(name='n', value='2', format='int')
1080 # i.addParameter(name='overlapping', value='1', format='int')
1040 # i.addParameter(name='overlapping', value='1', format='int')
1081 #
1041 #
1082 #
1042 #
1083 #
1043
1084
1044 No newline at end of file
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