##// 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 10 from PyQt4 import QtGui
11 11 from timeconversions import Doy2Date
12 12 from modelProperties import treeModel
13
13 14 from viewer.ui_unitprocess import Ui_UnitProcess
14 15 from viewer.ui_window import Ui_window
15 16 from viewer.ui_mainwindow import Ui_MainWindow
@@ -19,21 +20,24 from controller import Project,ReadUnitConf,ProcUnitConf,OperationConf,Parameter
19 20 import os
20 21
21 22
22 class MainWindow(QMainWindow, Ui_MainWindow):
23 class BodyMainWindow(QMainWindow, Ui_MainWindow):
23 24 __projObjDict = {}
24 25 __arbolDict = {}
26 __upObjDict = {}
25 27
26 28 """
27 29 Class documentation goes here.
28 30 #*##################VENTANA CUERPO DEL PROGRAMA####################
29 31 """
30 def __init__(self, parent = None):
32 def __init__(self, parent = None):
31 33 """
32 34 Constructor
33 35 """
34 36 print "Inicio de Programa Interfaz Gráfica"
35 37 QMainWindow.__init__(self, parent)
36 38 self.setupUi(self)
39
40 self.indexclick=None
37 41
38 42 self.online=0
39 43 self.datatype=0
@@ -61,9 +65,7 class MainWindow(QMainWindow, Ui_MainWindow):
61 65
62 66 self.configProject=None
63 67 self.configUP=None
64
65
66 self.controllerObj=None
68
67 69 self.readUnitConfObj=None
68 70 self.procUnitConfObj0=None
69 71 self.opObj10=None
@@ -90,28 +92,36 class MainWindow(QMainWindow, Ui_MainWindow):
90 92 @pyqtSignature("")
91 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 99 print "Leer un archivo xml y extraer sus atributos Not implemented yet"
96 100
97 101 @pyqtSignature("")
98 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
101 Llama al metodo addProject..
104 Crea un proyecto nuevo y lo anade a mi diccionario de proyectos
105 y habilita la ventana de configuracion del proyecto.
106
102 107 """
103 108 self.addProject()
104 109
105 110 @pyqtSignature("")
106 def on_menuFileGuardarObj_clicked(self):
111 def on_menuFileGuardarObj_triggered(self):
107 112 """
108 113 METODO EJECUTADO CUANDO OCURRE EL EVENTO GUARDAR PROJECTO
114
109 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 121 self.saveProject()
112 122
113 123 @pyqtSignature("")
114 def on_menuFileCerrarObj_clicked(self):
124 def on_menuFileCerrarObj_triggered(self):
115 125 """
116 126 METODO EJECUTADO CUANDO OCURRE EL EVENTO CERRAR
117 127 Llama al metodo close.
@@ -137,6 +147,7 class MainWindow(QMainWindow, Ui_MainWindow):
137 147 print "Not implemented yet"
138 148
139 149 #-----------------------------------MENU_OPTION-------------------------------------------------#
150
140 151 @pyqtSignature("")
141 152 def on_menuOptConfigLogfileObj_clicked(self):
142 153 """
@@ -145,7 +156,6 class MainWindow(QMainWindow, Ui_MainWindow):
145 156 """
146 157 print "Not implemented yet"
147 158
148
149 159 @pyqtSignature("")
150 160 def on_menuOptConfigserverObj_clicked(self):
151 161 """
@@ -154,6 +164,7 class MainWindow(QMainWindow, Ui_MainWindow):
154 164 """
155 165 print "Not implemented yet"
156 166 #-----------------------------------MENU_HELP-------------------------------------------------------#
167
157 168 @pyqtSignature("")
158 169 def on_menuHELPAboutObj_clicked(self):
159 170 """
@@ -186,8 +197,7 class MainWindow(QMainWindow, Ui_MainWindow):
186 197 Llama al metodo addProject.
187 198 """
188 199 self.addProject()
189
190
200
191 201 @pyqtSignature("")
192 202 def on_actStopObj_triggered(self):
193 203 """
@@ -223,7 +233,6 class MainWindow(QMainWindow, Ui_MainWindow):
223 233 self.addProject()
224 234
225 235 #------------------------------------VENTANA CONFIGURACION PROJECT----------------------------#
226
227 236
228 237 @pyqtSignature("int")
229 238 def on_dataTypeCmbBox_activated(self,index):
@@ -285,7 +294,7 class MainWindow(QMainWindow, Ui_MainWindow):
285 294 elif p0==1:
286 295 self.online=1
287 296
288 #---------------PUSHBUTTON_dataOkBtn_CONFIGURATION PROJECT--------------------------#
297 #---------------PUSHBUTTON_DATA " OKBUTTON "_CONFIGURATION PROJECT--------------------------#
289 298
290 299 @pyqtSignature("")
291 300 def on_dataOkBtn_clicked(self):
@@ -294,45 +303,58 class MainWindow(QMainWindow, Ui_MainWindow):
294 303 Prepara la configuración del diágrama del Arbol del treeView numero 2
295 304 """
296 305 print "En este nivel se pasa el tipo de dato con el que se trabaja,path,startDate,endDate,startTime,endTime,online"
297
298 projectObj=self.proObjList[int(self.proConfCmbBox.currentIndex())]
299 datatype=str(self.dataTypeCmbBox.currentText())
300 path=str(self.dataPathTxt.text())
301 online=int(self.online)
302 starDate=str(self.starDateCmbBox.currentText())
303 endDate=str(self.endDateCmbBox.currentText())
306
307 for i in self.__arbolDict:
308 if self.__arbolDict[i]==self.indexclick:
309 self.projectObj=self.__projObjDict[int(i)]
310 # print self.projectObj
311 # print i
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,
307 path=path,
308 startDate=starDate,
309 endDate=endDate,
310 startTime='06:10:00',
311 endTime='23:59:59',
312 online=online)
313
314 self.readUnitConfObjList.append(self.readUnitConfObj)
315
316 print "self.readUnitConfObj.getId",self.readUnitConfObj.getId(),datatype,path,starDate,endDate,online
317
318
319 self.model_2=treeModel()
320
321 self.model_2.setParams(name=projectObj.name+str(projectObj.id),
322 directorio=path,
323 workspace="C:\\WorkspaceGUI",
324 remode=str(self.readModeCmBox.currentText()),
325 dataformat=datatype,
326 date=str(starDate)+"-"+str(endDate),
327 initTime='06:10:00',
328 endTime='23:59:59',
329 timezone="Local" ,
330 Summary="test de prueba")
331 self.model_2.arbol()
332 self.treeView_2.setModel(self.model_2)
333 self.treeView_2.expandAll()
334
335
331 self.readUnitConfObj = self.projectObj.addReadUnit(datatype=datatype,
332 path=path,
333 startDate=starDate,
334 endDate=endDate,
335 startTime='06:10:00',
336 endTime='23:59:59',
337 online=online)
338
339 self.readUnitConfObjList.append(self.readUnitConfObj)
340 print "self.readUnitConfObj.getId",self.readUnitConfObj.getId(),datatype,path,starDate,endDate,online
341
342 self.model_2=treeModel()
343 self.model_2.setParams(name=self.projectObj.name+str(self.projectObj.id),
344 directorio=path,
345 workspace="C:\\WorkspaceGUI",
346 remode=str(self.readModeCmBox.currentText()),
347 dataformat=datatype,
348 date=str(starDate)+"-"+str(endDate),
349 initTime='06:10:00',
350 endTime='23:59:59',
351 timezone="Local" ,
352 Summary="test de prueba")
353 self.model_2.arbol()
354 self.treeView_2.setModel(self.model_2)
355 self.treeView_2.expandAll()
356
357 #
336 358 #-----------------PUSHBUTTON_ADD_PROCESSING UNIT PROJECT------------------#
337 359 @pyqtSignature("")
338 360 def on_addUnitProces_clicked(self):
@@ -341,216 +363,10 class MainWindow(QMainWindow, Ui_MainWindow):
341 363 Llama al metodo addUP.
342 364 """
343 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 366 self.addUP()
346 367
347
348 #-----------------VENTANA CONFIGURACION DE VOLTAGE---------------------------#
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
368 #----------------------------BASICO-----------------------------------#
369
554 370 def getNumberofProject(self):
555 371 # for i in self.proObjList:
556 372 # print i
@@ -569,92 +385,42 class MainWindow(QMainWindow, Ui_MainWindow):
569 385 self.valuenFFTPointOpSpec.setEnabled(False)
570 386 self.lineProfileSelecopVolCEB.setEnabled(False)
571 387
572
573 388 def clickFunctiontree(self,index):
574 indexclick= index.model().itemFromIndex(index).text()
575 #print indexclick
576 NumofPro=indexclick[8:10]
577 self.valuep=NumofPro
578 #print self.valuep
579 NameofPro=indexclick[0:7]
580 self.namepTree=NameofPro
581 #print self.namepTree
389 self.indexclick= index.model().itemFromIndex(index)
390 print self.indexclick
391 return self.indexclick
392 # self.indexclick= index.model().itemFromIndex(index).text()
393 # return self.indexclick
394 # print self.indexclick()
395 # print index.model().itemFromIndex(index)
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 404 def addProject(self):
584 405 self.tabWidgetProject.setEnabled(True)
585 406 print "En este nivel se debe crear el proyecto,id,nombre,desc"
586 #+++++Creacion del Objeto Controller-XML++++++++++#
587
407 #+++++++++++++++++++Creacion del Objeto Controller-XML+++++++++++++#
408
588 409 self.idp += 1
589 410 self.projectObj = Project()
590 self.description="Think"
591 id=int(self.idp)
592 name=str(self.nameProjectTxt.text())
593 desc=str(self.description)
411 print self.projectObj
412 self.__projObjDict[self.idp] = self.projectObj
594 413
595 self.projectObj.setup(id = id, name=name, description=desc)
596 self.__projObjDict[id] = self.projectObj
414 #++++++++++++++++++Creación del Arbol++++++++++++++++++++#
597 415 self.parentItem = self.model.invisibleRootItem()
598 self.__arbolDict[id] = QtGui.QStandardItem(QtCore.QString(name+" %0").arg(self.idp))
599 self.parentItem.appendRow(self.__arbolDict[self.projectObj.id])
600 self.parentItem=self.__arbolDict[id]
601
602 #self.configProject=Window(self)
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()
416 name=str(self.nameProjectTxt.text())
417 self.__arbolDict[self.idp] = QtGui.QStandardItem(QtCore.QString(name+" %0").arg(self.idp))
418 print self.__arbolDict[self.idp]
419 self.parentItem.appendRow(self.__arbolDict[self.idp])
420 self.parentItem=self.__arbolDict[self.idp]
647 421
648 422 print "Porfavor ingrese los parámetros de configuracion del Proyecto"
649
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
423
658 424 def existDir(self, var_dir):
659 425 """
660 426 METODO PARA VERIFICAR SI LA RUTA EXISTE-VAR_DIR
@@ -713,63 +479,62 class MainWindow(QMainWindow, Ui_MainWindow):
713 479 def addUP(self):
714 480
715 481 self.configUP=UnitProcess(self)
716 for i in self.proObjList:
717 self.configUP.getfromWindowList.append(i)
718 #print i
719 for i in self.upObjList:
720 self.configUP.getfromWindowList.append(i)
482 for i in self.__arbolDict:
483 if self.__arbolDict[i]==self.indexclick:
484 if self.__projObjDict.has_key(i)==True:
485 self.projectObj=self.__projObjDict[int(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 497 self.configUP.loadTotalList()
722 498 self.configUP.show()
723 self.configUP.unitPsavebut.clicked.connect(self.reciveUPparameters)
499 #self.configUP.unitPsavebut.clicked.connect(self.reciveUPparameters)
724 500 self.configUP.closed.connect(self.createUP)
725 501
726 def reciveUPparameters(self):
727
728 self.uporProObjRecover,self.upType=self.configUP.almacena()
729
502
730 503
731 504 def createUP(self):
505
732 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 518 datatype=str(self.upType)
736 519 uporprojectObj=self.uporProObjRecover
737 #+++++++++++LET FLY+++++++++++#
520
738 521 if uporprojectObj.getElementName()=='ProcUnit':
739 inputId=uporprojectObj.getId()
740 elif uporprojectObj.getElementName()=='Project':
522 inputId=uporprojectObj.getId()
523 else:
741 524 inputId=self.readUnitConfObjList[uporprojectObj.id-1].getId()
742
743
744 self.procUnitConfObj1 = projectObj.addProcUnit(datatype=datatype, inputId=inputId)
745 self.upObjList.append(self.procUnitConfObj1)
746 print inputId
747 print self.procUnitConfObj1.getId()
748 self.parentItem=uporprojectObj.arbol
525
526 print 'uporprojectObj.id','inputId', uporprojectObj.id,inputId
527 self.procUnitConfObj1 = self.projectObj.addProcUnit(datatype=datatype, inputId=inputId)
528 self.__upObjDict[inputId]= self.procUnitConfObj1
529
530 self.parentItem=self.__arbolDict[uporprojectObj.id]
531 #print "i","self.__arbolDict[i]",i ,self.__arbolDict[i]
749 532 self.numbertree=int(self.procUnitConfObj1.getId())-1
750 self.procUnitConfObj1.arbol=QtGui.QStandardItem(QtCore.QString(datatype +"%1 ").arg(self.numbertree))
751 self.parentItem.appendRow(self.procUnitConfObj1.arbol)
752 self.parentItem=self.procUnitConfObj1.arbol
753 self.loadUp()
533 self.__arbolDict[self.procUnitConfObj1.id]=QtGui.QStandardItem(QtCore.QString(datatype +"%1 ").arg(self.numbertree))
534 self.parentItem.appendRow(self.__arbolDict[self.procUnitConfObj1.id])
535 self.parentItem=self.__arbolDict[self.procUnitConfObj1.id]
536 # self.loadUp()
754 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 539 def resetopVolt(self):
775 540 self.selecChannelopVolCEB.setChecked(False)
@@ -795,80 +560,23 class MainWindow(QMainWindow, Ui_MainWindow):
795 560
796 561
797 562 def saveProject(self):
798 if self.idp==1:
799 self.valuep=1
800
801 print "Escribiendo el archivo XML"
802 filename="C:\\WorkspaceGUI\\CONFIG"+str(self.valuep)+".xml"
803 self.controllerObj=self.proObjList[int(self.valuep)-1]
804 self.controllerObj.writeXml(filename)
563 print "entro"
564 #filename="C:\WorkspaceGUI\config1.xml"
565 for i in self.__arbolDict:
566 if self.__arbolDict[i]==self.indexclick:
567 self.projectObj=self.__projObjDict[int(i)]
568 print "Encontre project"
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 574 class UnitProcess(QMainWindow, Ui_UnitProcess):
868 575 """
869 576 Class documentation goes here.
870 577 """
871 578 closed=pyqtSignal()
579 create= False
872 580 def __init__(self, parent = None):
873 581 """
874 582 Constructor
@@ -885,16 +593,12 class UnitProcess(QMainWindow, Ui_UnitProcess):
885 593 """
886 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 600 self.close()
889
890 @pyqtSignature("")
891 def on_unitPsavebut_clicked(self):
892 """
893 Slot documentation goes here.
894 """
895
896 print "alex"
897 self.almacena()
601
898 602
899 603 @pyqtSignature("")
900 604 def on_unitPcancelbut_clicked(self):
@@ -903,22 +607,19 class UnitProcess(QMainWindow, Ui_UnitProcess):
903 607 """
904 608 # TODO: not implemented yet
905 609 #raise NotImplementedError
906 self.hide()
610 self.create=False
611 self.close()
907 612
908 613 def loadTotalList(self):
909 614 self.comboInputBox.clear()
910 615 for i in self.getfromWindowList:
616
911 617 name=i.getElementName()
912 id= i.id
913 if i.getElementName()=='ProcUnit':
618 if name=='Project':
619 id= i.id
620 if name=='ProcUnit':
914 621 id=int(i.id)-1
915 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
622 self.comboInputBox.addItem(str(name)+str(id))
922 623
923 624 def closeEvent(self, event):
924 625 self.closed.emit()
General Comments 0
You need to be logged in to leave comments. Login now