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