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