##// END OF EJS Templates
actualizacion de la clase mainwindow...
Alexander Valdez -
r287:c678dd244376
parent child
Show More
This diff has been collapsed as it changes many lines, (629 lines changed) Show them Hide them
@@ -10,6 +10,7 from PyQt4 import QtCore
10 from PyQt4 import QtGui
10 from PyQt4 import QtGui
11 from timeconversions import Doy2Date
11 from timeconversions import Doy2Date
12 from modelProperties import treeModel
12 from modelProperties import treeModel
13
13 from viewer.ui_unitprocess import Ui_UnitProcess
14 from viewer.ui_unitprocess import Ui_UnitProcess
14 from viewer.ui_window import Ui_window
15 from viewer.ui_window import Ui_window
15 from viewer.ui_mainwindow import Ui_MainWindow
16 from viewer.ui_mainwindow import Ui_MainWindow
@@ -19,21 +20,24 from controller import Project,ReadUnitConf,ProcUnitConf,OperationConf,Parameter
19 import os
20 import os
20
21
21
22
22 class MainWindow(QMainWindow, Ui_MainWindow):
23 class BodyMainWindow(QMainWindow, Ui_MainWindow):
23 __projObjDict = {}
24 __projObjDict = {}
24 __arbolDict = {}
25 __arbolDict = {}
26 __upObjDict = {}
25
27
26 """
28 """
27 Class documentation goes here.
29 Class documentation goes here.
28 #*##################VENTANA CUERPO DEL PROGRAMA####################
30 #*##################VENTANA CUERPO DEL PROGRAMA####################
29 """
31 """
30 def __init__(self, parent = None):
32 def __init__(self, parent = None):
31 """
33 """
32 Constructor
34 Constructor
33 """
35 """
34 print "Inicio de Programa Interfaz Gráfica"
36 print "Inicio de Programa Interfaz Gráfica"
35 QMainWindow.__init__(self, parent)
37 QMainWindow.__init__(self, parent)
36 self.setupUi(self)
38 self.setupUi(self)
39
40 self.indexclick=None
37
41
38 self.online=0
42 self.online=0
39 self.datatype=0
43 self.datatype=0
@@ -61,9 +65,7 class MainWindow(QMainWindow, Ui_MainWindow):
61
65
62 self.configProject=None
66 self.configProject=None
63 self.configUP=None
67 self.configUP=None
64
68
65
66 self.controllerObj=None
67 self.readUnitConfObj=None
69 self.readUnitConfObj=None
68 self.procUnitConfObj0=None
70 self.procUnitConfObj0=None
69 self.opObj10=None
71 self.opObj10=None
@@ -90,28 +92,36 class MainWindow(QMainWindow, Ui_MainWindow):
90 @pyqtSignature("")
92 @pyqtSignature("")
91 def on_menuFileAbrirObj_triggered(self):
93 def on_menuFileAbrirObj_triggered(self):
92 """
94 """
93 METODO CARGA UN ARCHIVO DE CONFIGURACION ANTERIOR
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.
94 """
98 """
95 print "Leer un archivo xml y extraer sus atributos Not implemented yet"
99 print "Leer un archivo xml y extraer sus atributos Not implemented yet"
96
100
97 @pyqtSignature("")
101 @pyqtSignature("")
98 def on_menuFileCrearObj_triggered(self):
102 def on_menuFileCrearObj_triggered(self):
99 """
103 """
100 CREAR PROJECT,ANADE UN NUEVO PROYECTO, LLAMA AL MÉTODO QUE CONTIENE LAS OPERACION DE CREACION DE PROYECTOS
104 Crea un proyecto nuevo y lo anade a mi diccionario de proyectos
101 Llama al metodo addProject..
105 y habilita la ventana de configuracion del proyecto.
106
102 """
107 """
103 self.addProject()
108 self.addProject()
104
109
105 @pyqtSignature("")
110 @pyqtSignature("")
106 def on_menuFileGuardarObj_clicked(self):
111 def on_menuFileGuardarObj_triggered(self):
107 """
112 """
108 METODO EJECUTADO CUANDO OCURRE EL EVENTO GUARDAR PROJECTO
113 METODO EJECUTADO CUANDO OCURRE EL EVENTO GUARDAR PROJECTO
114
109 Llama al metodo saveProject.
115 Llama al metodo saveProject.
110 """
116 """
117 # my_id = arbol_selected()
118 # filename = savefindow.show()
119 # self.saveProject(id, filename)
120 print "probsave"
111 self.saveProject()
121 self.saveProject()
112
122
113 @pyqtSignature("")
123 @pyqtSignature("")
114 def on_menuFileCerrarObj_clicked(self):
124 def on_menuFileCerrarObj_triggered(self):
115 """
125 """
116 METODO EJECUTADO CUANDO OCURRE EL EVENTO CERRAR
126 METODO EJECUTADO CUANDO OCURRE EL EVENTO CERRAR
117 Llama al metodo close.
127 Llama al metodo close.
@@ -137,6 +147,7 class MainWindow(QMainWindow, Ui_MainWindow):
137 print "Not implemented yet"
147 print "Not implemented yet"
138
148
139 #-----------------------------------MENU_OPTION-------------------------------------------------#
149 #-----------------------------------MENU_OPTION-------------------------------------------------#
150
140 @pyqtSignature("")
151 @pyqtSignature("")
141 def on_menuOptConfigLogfileObj_clicked(self):
152 def on_menuOptConfigLogfileObj_clicked(self):
142 """
153 """
@@ -145,7 +156,6 class MainWindow(QMainWindow, Ui_MainWindow):
145 """
156 """
146 print "Not implemented yet"
157 print "Not implemented yet"
147
158
148
149 @pyqtSignature("")
159 @pyqtSignature("")
150 def on_menuOptConfigserverObj_clicked(self):
160 def on_menuOptConfigserverObj_clicked(self):
151 """
161 """
@@ -154,6 +164,7 class MainWindow(QMainWindow, Ui_MainWindow):
154 """
164 """
155 print "Not implemented yet"
165 print "Not implemented yet"
156 #-----------------------------------MENU_HELP-------------------------------------------------------#
166 #-----------------------------------MENU_HELP-------------------------------------------------------#
167
157 @pyqtSignature("")
168 @pyqtSignature("")
158 def on_menuHELPAboutObj_clicked(self):
169 def on_menuHELPAboutObj_clicked(self):
159 """
170 """
@@ -186,8 +197,7 class MainWindow(QMainWindow, Ui_MainWindow):
186 Llama al metodo addProject.
197 Llama al metodo addProject.
187 """
198 """
188 self.addProject()
199 self.addProject()
189
200
190
191 @pyqtSignature("")
201 @pyqtSignature("")
192 def on_actStopObj_triggered(self):
202 def on_actStopObj_triggered(self):
193 """
203 """
@@ -223,7 +233,6 class MainWindow(QMainWindow, Ui_MainWindow):
223 self.addProject()
233 self.addProject()
224
234
225 #------------------------------------VENTANA CONFIGURACION PROJECT----------------------------#
235 #------------------------------------VENTANA CONFIGURACION PROJECT----------------------------#
226
227
236
228 @pyqtSignature("int")
237 @pyqtSignature("int")
229 def on_dataTypeCmbBox_activated(self,index):
238 def on_dataTypeCmbBox_activated(self,index):
@@ -285,7 +294,7 class MainWindow(QMainWindow, Ui_MainWindow):
285 elif p0==1:
294 elif p0==1:
286 self.online=1
295 self.online=1
287
296
288 #---------------PUSHBUTTON_dataOkBtn_CONFIGURATION PROJECT--------------------------#
297 #---------------PUSHBUTTON_DATA " OKBUTTON "_CONFIGURATION PROJECT--------------------------#
289
298
290 @pyqtSignature("")
299 @pyqtSignature("")
291 def on_dataOkBtn_clicked(self):
300 def on_dataOkBtn_clicked(self):
@@ -294,45 +303,58 class MainWindow(QMainWindow, Ui_MainWindow):
294 Prepara la configuración del diágrama del Arbol del treeView numero 2
303 Prepara la configuración del diágrama del Arbol del treeView numero 2
295 """
304 """
296 print "En este nivel se pasa el tipo de dato con el que se trabaja,path,startDate,endDate,startTime,endTime,online"
305 print "En este nivel se pasa el tipo de dato con el que se trabaja,path,startDate,endDate,startTime,endTime,online"
297
306
298 projectObj=self.proObjList[int(self.proConfCmbBox.currentIndex())]
307 for i in self.__arbolDict:
299 datatype=str(self.dataTypeCmbBox.currentText())
308 if self.__arbolDict[i]==self.indexclick:
300 path=str(self.dataPathTxt.text())
309 self.projectObj=self.__projObjDict[int(i)]
301 online=int(self.online)
310 # print self.projectObj
302 starDate=str(self.starDateCmbBox.currentText())
311 # print i
303 endDate=str(self.endDateCmbBox.currentText())
312 # print "get",self.__arbolDict.items()
313 # print "keys",self.__arbolDict.keys()
314 self.description="Think"
315 id=i
316 name=str(self.nameProjectTxt.text())
317 desc=str(self.description)
318
319 self.projectObj.setup(id = id, name=name, description=desc)
320 print self.projectObj.id
321 # print self.projectObj.name
322 # print self.projectObj.description
323
324 datatype=str(self.dataTypeCmbBox.currentText())
325 path=str(self.dataPathTxt.text())
326 online=int(self.online)
327 starDate=str(self.starDateCmbBox.currentText())
328 endDate=str(self.endDateCmbBox.currentText())
304
329
305
330
306 self.readUnitConfObj = projectObj.addReadUnit(datatype=datatype,
331 self.readUnitConfObj = self.projectObj.addReadUnit(datatype=datatype,
307 path=path,
332 path=path,
308 startDate=starDate,
333 startDate=starDate,
309 endDate=endDate,
334 endDate=endDate,
310 startTime='06:10:00',
335 startTime='06:10:00',
311 endTime='23:59:59',
336 endTime='23:59:59',
312 online=online)
337 online=online)
313
338
314 self.readUnitConfObjList.append(self.readUnitConfObj)
339 self.readUnitConfObjList.append(self.readUnitConfObj)
315
340 print "self.readUnitConfObj.getId",self.readUnitConfObj.getId(),datatype,path,starDate,endDate,online
316 print "self.readUnitConfObj.getId",self.readUnitConfObj.getId(),datatype,path,starDate,endDate,online
341
317
342 self.model_2=treeModel()
318
343 self.model_2.setParams(name=self.projectObj.name+str(self.projectObj.id),
319 self.model_2=treeModel()
344 directorio=path,
320
345 workspace="C:\\WorkspaceGUI",
321 self.model_2.setParams(name=projectObj.name+str(projectObj.id),
346 remode=str(self.readModeCmBox.currentText()),
322 directorio=path,
347 dataformat=datatype,
323 workspace="C:\\WorkspaceGUI",
348 date=str(starDate)+"-"+str(endDate),
324 remode=str(self.readModeCmBox.currentText()),
349 initTime='06:10:00',
325 dataformat=datatype,
350 endTime='23:59:59',
326 date=str(starDate)+"-"+str(endDate),
351 timezone="Local" ,
327 initTime='06:10:00',
352 Summary="test de prueba")
328 endTime='23:59:59',
353 self.model_2.arbol()
329 timezone="Local" ,
354 self.treeView_2.setModel(self.model_2)
330 Summary="test de prueba")
355 self.treeView_2.expandAll()
331 self.model_2.arbol()
356
332 self.treeView_2.setModel(self.model_2)
357 #
333 self.treeView_2.expandAll()
334
335
336 #-----------------PUSHBUTTON_ADD_PROCESSING UNIT PROJECT------------------#
358 #-----------------PUSHBUTTON_ADD_PROCESSING UNIT PROJECT------------------#
337 @pyqtSignature("")
359 @pyqtSignature("")
338 def on_addUnitProces_clicked(self):
360 def on_addUnitProces_clicked(self):
@@ -341,216 +363,10 class MainWindow(QMainWindow, Ui_MainWindow):
341 Llama al metodo addUP.
363 Llama al metodo addUP.
342 """
364 """
343 # print "En este nivel se adiciona una rama de procesamiento, y se le concatena con el id"
365 # print "En este nivel se adiciona una rama de procesamiento, y se le concatena con el id"
344 # self.procUnitConfObj0 = self.controllerObj.addProcUnit(datatype='Voltage', inputId=self.readUnitConfObj.getId())
345 self.addUP()
366 self.addUP()
346
367
347
368 #----------------------------BASICO-----------------------------------#
348 #-----------------VENTANA CONFIGURACION DE VOLTAGE---------------------------#
369
349
350 @pyqtSignature("int")
351 def on_selecChannelopVolCEB_stateChanged(self, p0):
352 """
353 Check Box habilita operaciones de Selección de Canales
354 """
355 if p0==2:
356 self.numberChannelopVol.setEnabled(True)
357 upProcessSelect=self.upObjVolList[int(self.addOpUpselec.currentIndex())]
358 opObj10=upProcessSelect.addOperation(name='selectChannels')
359 print opObj10.id
360 self.operObjList.append(opObj10)
361 print " Ingresa seleccion de Canales"
362 if p0==0:
363 print " deshabilitado"
364
365 @pyqtSignature("int")
366 def on_selecHeighopVolCEB_stateChanged(self, p0):
367 """
368 Check Box habilita operaciones de Selección de Alturas
369 """
370 if p0==2:
371 self.lineHeighProfileTxtopVol.setEnabled(True)
372 upProcessSelect=self.upObjVolList[int(self.addOpUpselec.currentIndex())]
373 opObj10=upProcessSelect.addOperation(name='selectHeights')
374 print opObj10.id
375 self.operObjList.append(opObj10)
376 print " Select Type of Profile"
377 if p0==0:
378 print " deshabilitado"
379
380
381 @pyqtSignature("int")
382 def on_profileSelecopVolCEB_stateChanged(self, p0):
383 """
384 Check Box habilita ingreso del rango de Perfiles
385 """
386 if p0==2:
387 self.lineProfileSelecopVolCEB.setEnabled(True)
388 upProcessSelect=self.upObjVolList[int(self.addOpUpselec.currentIndex())]
389 opObj10=upProcessSelect.addOperation(name='ProfileSelector', optype='other')
390 print opObj10.id
391 self.operObjList.append(opObj10)
392 print " Select Type of Profile"
393 if p0==0:
394 print " deshabilitado"
395
396
397 @pyqtSignature("int")
398 def on_coherentIntegrationCEB_stateChanged(self, p0):
399 """
400 Check Box habilita ingresode del numero de Integraciones a realizar
401 """
402 if p0==2:
403 self.numberIntegration.setEnabled(True)
404 upProcessSelect=self.upObjVolList[int(self.addOpUpselec.currentIndex())]
405 opObj10=upProcessSelect.addOperation(name='CohInt', optype='other')
406 print opObj10.id
407 self.operObjList.append(opObj10)
408 print "Choose number of Cohint"
409 if p0==0:
410 print " deshabilitado"
411 self.numberChannelopVol.setEnabled(False)
412
413 #-----------------------PUSHBUTTON_ACCEPT_OPERATION----------------------------#
414
415 @pyqtSignature("")
416 def on_dataopVolOkBtn_clicked(self):
417 """
418 BUSCA EN LA LISTA DE OPERACIONES DEL TIPO VOLTAJE Y LES AÑADE EL PARAMETRO ADECUADO ESPERANDO LA ACEPTACION DEL USUARIO
419 PARA AGREGARLO AL ARCHIVO DE CONFIGURACION XML
420 """
421 if self.selecChannelopVolCEB.isChecked():
422 for i in self.operObjList:
423 if i.name=='selectChannels':
424 value=self.numberChannelopVol.text()
425 i.addParameter(name='channelList', value=value, format='intlist')
426
427
428 print "channel"
429
430 if self.selecHeighopVolCEB.isChecked():
431 for i in self.operObjList:
432 if i.name=='selectHeights' :
433 value=self.lineHeighProfileTxtopVol.text()
434 valueList=value.split(',')
435 i.addParameter(name='minHei', value=valueList[0], format='float')
436 i.addParameter(name='maxHei', value=valueList[1], format='float')
437
438 print "height"
439
440
441 if self.selecHeighopVolCEB.isChecked():
442 for i in self.operObjList:
443 if i.name=='ProfileSelector' :
444 value=self.lineProfileSelecopVolCEB.text()
445 i.addParameter(name='ProfileSelector', value=value, format='intlist')
446
447
448
449 if self.coherentIntegrationCEB.isChecked():
450 for i in self.operObjList:
451 if i.name=='CohInt':
452 value=self.numberIntegration.text()
453 i.addParameter(name='n', value=value, format='int')
454
455
456 #-------------------------VENTANA DE CONFIGURACION SPECTRA------------------------#
457
458 @pyqtSignature("int")
459 def on_nFFTPointOpSpecCEB_stateChanged(self, p0):
460 """
461 Habilita la opcion de añadir el parámetro nFFTPoints a la Unidad de Procesamiento .
462 """
463 if p0==2:
464 self.valuenFFTPointOpSpec.setEnabled(True)
465 print " nFFTPoint"
466 if p0==0:
467 print " deshabilitado"
468
469 #------------------PUSH_BUTTON_SPECTRA_OK------------------------------------#
470
471 @pyqtSignature("")
472 def on_dataopSpecOkBtn_clicked(self):
473 """
474 Añade al archivo de configuración el parámetros nFFTPoints a la UP.
475 """
476 print "Añadimos operaciones Spectra,nchannels,value,format"
477 if self.nFFTPointOpSpecCEB.isChecked():
478 upProcessSelect=self.upobjSpecList[int(self.addOpSpecUpselec.currentIndex())]
479 value=self.valuenFFTPointOpSpec.text()
480 upProcessSelect.addParameter(name='nFFTPoints',value=value,format='int')
481 #---------------------VENTANA DE CONFIGURACION GRAPH SPECTRA------------------#
482
483 @pyqtSignature("int")
484 def on_SpectraPlotGraphCEB_stateChanged(self, p0):
485 """
486 Habilita la opcion de Ploteo Spectra Plot
487 """
488 if p0==2:
489 upProcessSelect=self.upobjSpecList[int(self.addOpSpecUpselec.currentIndex())]
490 opObj10=upProcessSelect.addOperation(name='SpectraPlot',optype='other')
491 print opObj10.id
492 self.operObjList.append(opObj10)
493
494 if p0==0:
495 print " deshabilitado"
496
497 @pyqtSignature("int")
498 def on_CrossSpectraPlotGraphceb_stateChanged(self, p0):
499 """
500 Habilita la opción de Ploteo CrossSpectra
501 """
502 if p0==2:
503 upProcessSelect=self.upobjSpecList[int(self.addOpSpecUpselec.currentIndex())]
504 opObj10=upProcessSelect.addOperation(name='CrossSpectraPlot',optype='other')
505 print opObj10.id
506 self.operObjList.append(opObj10)
507 if p0==0:
508 print " deshabilitado"
509
510 @pyqtSignature("int")
511 def on_RTIPlotGraphCEB_stateChanged(self, p0):
512 """
513 Habilita la opción de Plote RTIPlot
514 """
515 if p0==2:
516 upProcessSelect=self.upobjSpecList[int(self.addOpSpecUpselec.currentIndex())]
517 opObj10=upProcessSelect.addOperation(name='RTIPlot',optype='other')
518 print opObj10.id
519 self.operObjList.append(opObj10)
520 if p0==0:
521 print " deshabilitado"
522
523 #------------------PUSH_BUTTON_SPECTRA_GRAPH_OK-----------------------------#
524 @pyqtSignature("")
525 def on_dataGraphSpecOkBtn_clicked(self):
526 """
527 HABILITAR DE ACUERDO A LOS CHECKBOX QUE TIPO DE PLOTEOS SE VAN A REALIZAR MUESTRA Y GRABA LAS IMAGENES.
528 """
529 print "Graficar Spec op"
530 if self.SpectraPlotGraphCEB.isChecked():
531 for i in self.operObjList:
532 if i.name=='SpectraPlot':
533 i.addParameter(name='idfigure', value='1', format='int')
534 i.addParameter(name='wintitle', value='SpectraPlot0', format='str')
535 i.addParameter(name='zmin', value='40', format='int')
536 i.addParameter(name='zmax', value='90', format='int')
537 i.addParameter(name='showprofile', value='1', format='int')
538
539 if self.CrossSpectraPlotGraphceb.isChecked():
540 for i in self.operObjList:
541 if i.name=='CrossSpectraPlot' :
542 i.addParameter(name='idfigure', value='2', format='int')
543 i.addParameter(name='wintitle', value='CrossSpectraPlot', format='str')
544 i.addParameter(name='zmin', value='40', format='int')
545 i.addParameter(name='zmax', value='90', format='int')
546
547 if self.RTIPlotGraphCEB.isChecked():
548 for i in self.operObjList:
549 if i.name=='RTIPlot':
550 i.addParameter(name='n', value='2', format='int')
551 i.addParameter(name='overlapping', value='1', format='int')
552
553
554 def getNumberofProject(self):
370 def getNumberofProject(self):
555 # for i in self.proObjList:
371 # for i in self.proObjList:
556 # print i
372 # print i
@@ -569,92 +385,42 class MainWindow(QMainWindow, Ui_MainWindow):
569 self.valuenFFTPointOpSpec.setEnabled(False)
385 self.valuenFFTPointOpSpec.setEnabled(False)
570 self.lineProfileSelecopVolCEB.setEnabled(False)
386 self.lineProfileSelecopVolCEB.setEnabled(False)
571
387
572
573 def clickFunctiontree(self,index):
388 def clickFunctiontree(self,index):
574 indexclick= index.model().itemFromIndex(index).text()
389 self.indexclick= index.model().itemFromIndex(index)
575 #print indexclick
390 print self.indexclick
576 NumofPro=indexclick[8:10]
391 return self.indexclick
577 self.valuep=NumofPro
392 # self.indexclick= index.model().itemFromIndex(index).text()
578 #print self.valuep
393 # return self.indexclick
579 NameofPro=indexclick[0:7]
394 # print self.indexclick()
580 self.namepTree=NameofPro
395 # print index.model().itemFromIndex(index)
581 #print self.namepTree
396 # print self.indexclick
397 # NumofPro=self.indexclick[8:10]
398 # self.valuep=NumofPro
399 # #print self.valuep
400 # NameofPro=self.indexclick[0:7]
401 # self.namepTree=NameofPro
402 # print self.namepTree
582
403
583 def addProject(self):
404 def addProject(self):
584 self.tabWidgetProject.setEnabled(True)
405 self.tabWidgetProject.setEnabled(True)
585 print "En este nivel se debe crear el proyecto,id,nombre,desc"
406 print "En este nivel se debe crear el proyecto,id,nombre,desc"
586 #+++++Creacion del Objeto Controller-XML++++++++++#
407 #+++++++++++++++++++Creacion del Objeto Controller-XML+++++++++++++#
587
408
588 self.idp += 1
409 self.idp += 1
589 self.projectObj = Project()
410 self.projectObj = Project()
590 self.description="Think"
411 print self.projectObj
591 id=int(self.idp)
412 self.__projObjDict[self.idp] = self.projectObj
592 name=str(self.nameProjectTxt.text())
593 desc=str(self.description)
594
413
595 self.projectObj.setup(id = id, name=name, description=desc)
414 #++++++++++++++++++Creación del Arbol++++++++++++++++++++#
596 self.__projObjDict[id] = self.projectObj
597 self.parentItem = self.model.invisibleRootItem()
415 self.parentItem = self.model.invisibleRootItem()
598 self.__arbolDict[id] = QtGui.QStandardItem(QtCore.QString(name+" %0").arg(self.idp))
416 name=str(self.nameProjectTxt.text())
599 self.parentItem.appendRow(self.__arbolDict[self.projectObj.id])
417 self.__arbolDict[self.idp] = QtGui.QStandardItem(QtCore.QString(name+" %0").arg(self.idp))
600 self.parentItem=self.__arbolDict[id]
418 print self.__arbolDict[self.idp]
601
419 self.parentItem.appendRow(self.__arbolDict[self.idp])
602 #self.configProject=Window(self)
420 self.parentItem=self.__arbolDict[self.idp]
603 #self.configProject.closed.connect(self.show)
604 #self.configProject.show()
605 #self.configProject.closed.connect(self.show)
606 # self.configProject.saveButton.clicked.connect(self.reciveParameters)
607 #self.configProject.closed.connect(self.createProject)
608
609
610
611
612
613
614
615
616 #+++++++++++++++++++LISTA DE PROYECTO++++++++++++++++++++++++++++#
617
618
619 # self.parentItem=self.projectObj.arbol
620 # self.loadProjects()
621
622 print "Porfavor ingrese los parámetros de configuracion del Proyecto"
623
624
625
626
627
628 def reciveParameters(self):
629 self.namep,self.description =self.configProject.almacena()
630
631 def createProject(self):
632
633 print "En este nivel se debe crear el proyecto,id,nombre,desc"
634 #+++++Creacion del Objeto Controller-XML++++++++++#
635 self.idp += 1
636 self.controllerObj = Project()
637 id=int(self.idp)
638 name=str(self.namep)
639 desc=str(self.description)
640 self.parentItem=self.model.invisibleRootItem()
641 self.controllerObj.arbol=QtGui.QStandardItem(QtCore.QString("Project %0").arg(self.idp))
642 self.controllerObj.setup(id = id, name=name, description=desc)
643 self.parentItem.appendRow(self.controllerObj.arbol)
644 self.proObjList.append(self.controllerObj)#+++++++++++++++++++LISTA DE PROYECTO++++++++++++++++++++++++++++#
645 self.parentItem=self.controllerObj.arbol
646 self.loadProjects()
647
421
648 print "Porfavor ingrese los parámetros de configuracion del Proyecto"
422 print "Porfavor ingrese los parámetros de configuracion del Proyecto"
649
423
650 def loadProjects(self):
651
652 self.proConfCmbBox.clear()
653 for i in self.proObjList:
654 self.proConfCmbBox.addItem("Project"+str(i.id))
655
656
657
658 def existDir(self, var_dir):
424 def existDir(self, var_dir):
659 """
425 """
660 METODO PARA VERIFICAR SI LA RUTA EXISTE-VAR_DIR
426 METODO PARA VERIFICAR SI LA RUTA EXISTE-VAR_DIR
@@ -713,63 +479,62 class MainWindow(QMainWindow, Ui_MainWindow):
713 def addUP(self):
479 def addUP(self):
714
480
715 self.configUP=UnitProcess(self)
481 self.configUP=UnitProcess(self)
716 for i in self.proObjList:
482 for i in self.__arbolDict:
717 self.configUP.getfromWindowList.append(i)
483 if self.__arbolDict[i]==self.indexclick:
718 #print i
484 if self.__projObjDict.has_key(i)==True:
719 for i in self.upObjList:
485 self.projectObj=self.__projObjDict[int(i)]
720 self.configUP.getfromWindowList.append(i)
486 print self.projectObj.id
487 self.configUP.getfromWindowList.append(self.projectObj)
488
489
490 for i in self.projectObj.procUnitConfObjDict:
491 if self.projectObj.procUnitConfObjDict[i].getElementName()=='ProcUnit':
492 self.upObj=self.projectObj.procUnitConfObjDict[i]
493 self.configUP.getfromWindowList.append(self.upObj)
494
495
496
721 self.configUP.loadTotalList()
497 self.configUP.loadTotalList()
722 self.configUP.show()
498 self.configUP.show()
723 self.configUP.unitPsavebut.clicked.connect(self.reciveUPparameters)
499 #self.configUP.unitPsavebut.clicked.connect(self.reciveUPparameters)
724 self.configUP.closed.connect(self.createUP)
500 self.configUP.closed.connect(self.createUP)
725
501
726 def reciveUPparameters(self):
502
727
728 self.uporProObjRecover,self.upType=self.configUP.almacena()
729
730
503
731 def createUP(self):
504 def createUP(self):
505
732 print "En este nivel se adiciona una rama de procesamiento, y se le concatena con el id"
506 print "En este nivel se adiciona una rama de procesamiento, y se le concatena con el id"
733 projectObj=self.proObjList[int(self.proConfCmbBox.currentIndex())]
507
508 if not self.configUP.create:
509 return
510
511 self.uporProObjRecover=self.configUP.getFromWindow
512
513 self.upType = self.configUP.typeofUP
514 for i in self.__arbolDict:
515 if self.__arbolDict[i]==self.indexclick:
516 self.projectObj=self.__projObjDict[int(i)]
734
517
735 datatype=str(self.upType)
518 datatype=str(self.upType)
736 uporprojectObj=self.uporProObjRecover
519 uporprojectObj=self.uporProObjRecover
737 #+++++++++++LET FLY+++++++++++#
520
738 if uporprojectObj.getElementName()=='ProcUnit':
521 if uporprojectObj.getElementName()=='ProcUnit':
739 inputId=uporprojectObj.getId()
522 inputId=uporprojectObj.getId()
740 elif uporprojectObj.getElementName()=='Project':
523 else:
741 inputId=self.readUnitConfObjList[uporprojectObj.id-1].getId()
524 inputId=self.readUnitConfObjList[uporprojectObj.id-1].getId()
742
525
743
526 print 'uporprojectObj.id','inputId', uporprojectObj.id,inputId
744 self.procUnitConfObj1 = projectObj.addProcUnit(datatype=datatype, inputId=inputId)
527 self.procUnitConfObj1 = self.projectObj.addProcUnit(datatype=datatype, inputId=inputId)
745 self.upObjList.append(self.procUnitConfObj1)
528 self.__upObjDict[inputId]= self.procUnitConfObj1
746 print inputId
529
747 print self.procUnitConfObj1.getId()
530 self.parentItem=self.__arbolDict[uporprojectObj.id]
748 self.parentItem=uporprojectObj.arbol
531 #print "i","self.__arbolDict[i]",i ,self.__arbolDict[i]
749 self.numbertree=int(self.procUnitConfObj1.getId())-1
532 self.numbertree=int(self.procUnitConfObj1.getId())-1
750 self.procUnitConfObj1.arbol=QtGui.QStandardItem(QtCore.QString(datatype +"%1 ").arg(self.numbertree))
533 self.__arbolDict[self.procUnitConfObj1.id]=QtGui.QStandardItem(QtCore.QString(datatype +"%1 ").arg(self.numbertree))
751 self.parentItem.appendRow(self.procUnitConfObj1.arbol)
534 self.parentItem.appendRow(self.__arbolDict[self.procUnitConfObj1.id])
752 self.parentItem=self.procUnitConfObj1.arbol
535 self.parentItem=self.__arbolDict[self.procUnitConfObj1.id]
753 self.loadUp()
536 # self.loadUp()
754 self.treeView.expandAll()
537 self.treeView.expandAll()
755
756 def loadUp(self):
757 self.addOpUpselec.clear()
758 self.addOpSpecUpselec.clear()
759 for i in self.upObjList:
760 if i.datatype=='Voltage':
761 self.upObjVolList.append(i)
762 name=i.getElementName()
763 id=int(i.id)-1
764 self.addOpUpselec.addItem(name+str(id))
765 if i.datatype=='Spectra':
766 self.upobjSpecList.append(i)
767 name=i.getElementName()
768 id=int(i.id)-1
769 self.addOpSpecUpselec.addItem(name+str(id))
770
771 self.resetopVolt()
772 self.resetopSpec()
773
538
774 def resetopVolt(self):
539 def resetopVolt(self):
775 self.selecChannelopVolCEB.setChecked(False)
540 self.selecChannelopVolCEB.setChecked(False)
@@ -795,80 +560,23 class MainWindow(QMainWindow, Ui_MainWindow):
795
560
796
561
797 def saveProject(self):
562 def saveProject(self):
798 if self.idp==1:
563 print "entro"
799 self.valuep=1
564 #filename="C:\WorkspaceGUI\config1.xml"
800
565 for i in self.__arbolDict:
801 print "Escribiendo el archivo XML"
566 if self.__arbolDict[i]==self.indexclick:
802 filename="C:\\WorkspaceGUI\\CONFIG"+str(self.valuep)+".xml"
567 self.projectObj=self.__projObjDict[int(i)]
803 self.controllerObj=self.proObjList[int(self.valuep)-1]
568 print "Encontre project"
804 self.controllerObj.writeXml(filename)
569 filename="C:\WorkspaceGUI\config"+str(self.projectObj.id)+".xml"
570 print "Escribo Project"
571 self.projectObj.writeXml(filename)
805
572
806
573
807
808
809
810 class Window(QMainWindow, Ui_window):
811 """
812 Class documentation goes here.
813 """
814 closed=pyqtSignal()
815 def __init__(self, parent = None):
816 """
817 Constructor
818 """
819 QMainWindow.__init__(self, parent)
820 self.setupUi(self)
821 self.name=0
822 self.nameproject=None
823 self.proyectNameLine.setText('My_name_is...')
824 self.descriptionTextEdit.setText('Write a description...')
825
826
827 @pyqtSignature("")
828 def on_cancelButton_clicked(self):
829 """
830 Slot documentation goes here.
831 """
832 # TODO: not implemented yet
833 #raise NotImplementedError
834
835 self.hide()
836
837 @pyqtSignature("")
838 def on_okButton_clicked(self):
839 """
840 Slot documentation goes here.
841 """
842 #self.almacena()
843 self.close()
844
845 @pyqtSignature("")
846 def on_saveButton_clicked(self):
847 """
848 Slot documentation goes here.
849 """
850 self.almacena()
851 # self.close()
852
853 def almacena(self):
854 #print str(self.proyectNameLine.text())
855 self.nameproject=str(self.proyectNameLine.text())
856 self.description=str(self.descriptionTextEdit.toPlainText())
857 return self.nameproject,self.description
858
859 def closeEvent(self, event):
860 self.closed.emit()
861 event.accept()
862
863
864
865 #--------------------------------------VENTANA DE CONFIGURACION DE LA UP-----------------------#
866
867 class UnitProcess(QMainWindow, Ui_UnitProcess):
574 class UnitProcess(QMainWindow, Ui_UnitProcess):
868 """
575 """
869 Class documentation goes here.
576 Class documentation goes here.
870 """
577 """
871 closed=pyqtSignal()
578 closed=pyqtSignal()
579 create= False
872 def __init__(self, parent = None):
580 def __init__(self, parent = None):
873 """
581 """
874 Constructor
582 Constructor
@@ -885,16 +593,12 class UnitProcess(QMainWindow, Ui_UnitProcess):
885 """
593 """
886 Slot documentation goes here.
594 Slot documentation goes here.
887 """
595 """
596 self.create =True
597 self.getFromWindow=self.getfromWindowList[int(self.comboInputBox.currentIndex())]
598 #self.nameofUP= str(self.nameUptxt.text())
599 self.typeofUP= str(self.comboTypeBox.currentText())
888 self.close()
600 self.close()
889
601
890 @pyqtSignature("")
891 def on_unitPsavebut_clicked(self):
892 """
893 Slot documentation goes here.
894 """
895
896 print "alex"
897 self.almacena()
898
602
899 @pyqtSignature("")
603 @pyqtSignature("")
900 def on_unitPcancelbut_clicked(self):
604 def on_unitPcancelbut_clicked(self):
@@ -903,22 +607,19 class UnitProcess(QMainWindow, Ui_UnitProcess):
903 """
607 """
904 # TODO: not implemented yet
608 # TODO: not implemented yet
905 #raise NotImplementedError
609 #raise NotImplementedError
906 self.hide()
610 self.create=False
611 self.close()
907
612
908 def loadTotalList(self):
613 def loadTotalList(self):
909 self.comboInputBox.clear()
614 self.comboInputBox.clear()
910 for i in self.getfromWindowList:
615 for i in self.getfromWindowList:
616
911 name=i.getElementName()
617 name=i.getElementName()
912 id= i.id
618 if name=='Project':
913 if i.getElementName()=='ProcUnit':
619 id= i.id
620 if name=='ProcUnit':
914 id=int(i.id)-1
621 id=int(i.id)-1
915 self.comboInputBox.addItem(str(name)+str(id))
622 self.comboInputBox.addItem(str(name)+str(id))
916
917 def almacena(self):
918 self.getFromWindow=self.getfromWindowList[int(self.comboInputBox.currentIndex())]
919 #self.nameofUP= str(self.nameUptxt.text())
920 self.typeofUP= str(self.comboTypeBox.currentText())
921 return self.getFromWindow,self.typeofUP
922
623
923 def closeEvent(self, event):
624 def closeEvent(self, event):
924 self.closed.emit()
625 self.closed.emit()
General Comments 0
You need to be logged in to leave comments. Login now