##// END OF EJS Templates
-Se escribieron alertas y paradas en caso el usuario cometa errores en el ingreso de datos.
Alexander Valdez -
r378:b9df6de2be70
parent child
Show More
@@ -1,1337 +1,1372
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 Module implementing MainWindow.
4 4 #+++++++++++++GUI V1++++++++++++++#
5 5 @author: AlexanderValdezPortocarrero ñ_ñ
6 6 """
7 7 import os, sys
8 8 import datetime
9 9 from PyQt4.QtGui import QMainWindow
10 10 from PyQt4.QtCore import pyqtSignature
11 11 from PyQt4.QtCore import pyqtSignal
12 12 from PyQt4 import QtCore
13 13 from PyQt4 import QtGui
14 14
15 15 from viewer.ui_unitprocess import Ui_UnitProcess
16 16 from viewer.ui_window import Ui_window
17 17 from viewer.ui_mainwindow import Ui_BasicWindow
18 18
19 19
20 20 from modelProperties import treeModel
21 21
22 22 path = os.path.split(os.getcwd())[0]
23 23
24 24 sys.path.append(path)
25 25
26 26 from controller import *
27 27
28 28 def isRadarFile(file):
29 29 try:
30 30 year = int(file[1:5])
31 31 doy = int(file[5:8])
32 32 set = int(file[8:11])
33 33 except:
34 34 return 0
35 35
36 36 return 1
37 37
38 38 def isRadarPath(path):
39 39 try:
40 40 year = int(path[1:5])
41 41 doy = int(path[5:8])
42 42 except:
43 43 return 0
44 44
45 45 return 1
46 46
47 47
48 48 class BasicWindow(QMainWindow,Ui_BasicWindow):
49 49 """
50 50
51 51 """
52 52 def __init__(self,parent = None):
53 53 """
54 54
55 55 """
56 56 QMainWindow.__init__(self,parent)
57 57 self.setupUi(self)
58 58 self.__projObjDict = {}
59 59 self.__upObjDict = {}
60 60 self.__arbolDict = {}
61 61 self.readUnitConfObjList=[]
62 62 self.operObjList=[]
63 63 self.idp = 0
64 64 self.online=0
65 65 self.walk=1
66 66 self.indexclick=None
67 67 self.setParameter()
68 68
69 69 @pyqtSignature("")
70 70 def on_actionCreate_triggered(self):
71 71 """
72 72 Slot documentation goes here.
73 73 """
74 74 self.setProjectParam()
75 75
76 76 @pyqtSignature("")
77 77 def on_actionSave_triggered(self):
78 78 """
79 79 Slot documentation goes here.
80 80 """
81 81 self.saveProject()
82 82
83 83 def on_actionStart_triggered(self):
84 84 """
85 85 """
86 86 self.playProject()
87 87
88 88 @pyqtSignature("")
89 89 def on_actionCreateToolbar_triggered(self):
90 90 """
91 91 Slot documentation goes here.
92 92 """
93 93 self.setProjectParam()
94 94
95 95 @pyqtSignature("")
96 96 def on_actionSaveToolbar_triggered(self):
97 97 """
98 98 Slot documentation goes here.
99 99 """
100 100 self.saveProject()
101 101
102 102 @pyqtSignature("")
103 103 def on_actionStarToolbar_triggered(self):
104 104 """
105 105 Slot documentation goes here.
106 106 """
107 107 self.playProject()
108 108
109 109
110 110 @pyqtSignature("int")
111 111 def on_proComReadMode_activated(self, p0):
112 112 """
113 113 SELECCION DEL MODO DE LECTURA ON=1, OFF=0
114 114 """
115 115 if p0==0:
116 116 self.online=0
117 self.proDelay.setText("0")
117 118 self.proDelay.setEnabled(False)
118 119 elif p0==1:
119 120 self.online=1
121 self.proDelay.setText("5")
120 122 self.proDelay.setEnabled(True)
121 123 self.console.clear()
122 124 self.console.append("Choose the type of Walk")
123 125
124 126
125 127
126 128 @pyqtSignature("int")
127 129 def on_proComDataType_activated(self,index):
128 130 """
129 131 Voltage or Spectra
130 132 """
131 133 if index==0:
132 134 self.datatype='.r'
133 135 elif index==1:
134 136 self.datatype='.pdata'
135 137
136 138 self.proDataType.setText(self.datatype)
137 139 self.console.clear()
138 140 self.console.append("Choose your DataPath")
139 141 self.console.append("Use the toolpath or Write the path")
140 142
141 143 @pyqtSignature("int")
142 144 def on_proComWalk_activated(self,index):
143 145 """
144 146
145 147 """
146 148 if index==0:
147 149 self.walk=0
148 150 elif index==1:
149 151 self.walk=1
150 152
151 153 self.console.clear()
154 self.console.append("If you have choose online mode write the delay")
152 155 self.console.append("Now, Push the Button Load to charge the date")
153 156
154 157 @pyqtSignature("")
155 158 def on_proToolPath_clicked(self):
156 159 """
157 160 Choose your path
158 161 """
159 162 self.dataPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly))
160 163 self.proDataPath.setText(self.dataPath)
161 164
162 165 self.proComStartDate.clear()
163 166 self.proComEndDate.clear()
164 167
165 168 if not os.path.exists(self.dataPath):
166 169 self.proOk.setEnabled(False)
167 170 self.console.clear()
168 171 self.console.append("Write a correct a path")
169 172 return
170 173 self.console.clear()
171 174 self.console.append("Select the read mode")
172 175
173
176
174 177 @pyqtSignature("")
175 178 def on_proLoadButton_clicked(self):
176 179 self.proOk.setEnabled(True)
177 180 self.console.clear()
178 181 self.console.append("You will see the range of date Load")
179 182 self.console.append("First,Don't forget to Choose the Read Mode: OffLine or Online")
180 self.console.append("The option Wait is for default 0")
183 self.console.append("The option delay is for default 0")
181 184 self.loadDays()
182 185
183 186
184 187 @pyqtSignature("int")
185 188 def on_proComStartDate_activated(self, index):
186 189 """
187 190 SELECCION DEL RANGO DE FECHAS -START DATE
188 191 """
189 192 stopIndex = self.proComEndDate.count() - self.proComEndDate.currentIndex()
190 193 self.proComEndDate.clear()
191 194
192 195 for i in self.dateList[index:]:
193 196 self.proComEndDate.addItem(i)
194 197
195 198 self.proComEndDate.setCurrentIndex(self.proComEndDate.count() - stopIndex)
196 199
197 200 @pyqtSignature("int")
198 201 def on_proComEndDate_activated(self, index):
199 202 """
200 203 SELECCION DEL RANGO DE FECHAS-END DATE
201 204 """
202 205 startIndex=self.proComStartDate.currentIndex()
203 206 stopIndex = self.proComEndDate.count() - index
204 207 self.proComStartDate.clear()
205 208 for i in self.dateList[:len(self.dateList) - stopIndex + 1]:
206 209 self.proComStartDate.addItem(i)
207 210 self.proComStartDate.setCurrentIndex(startIndex)
208 211
209 212 @pyqtSignature("")
210 213 def on_proOk_clicked(self):
211 214 """
212 215 Añade al Obj XML de Projecto, name,datatype,date,time,readmode,wait,etc, crea el readUnitProcess del archivo xml.
213 216 Prepara la configuración del diágrama del Arbol del treeView numero 2
214 217 """
215 218 self.console.clear()
216 219 self.idp +=1
217 220 self.projectObj= Project ()
218 221 self.__projObjDict[self.idp]=self.projectObj
219 222
220 223 id = self.idp
221 224 name = str(self.proName.text())
225 try:
226 name=str(self.proName.text())
227 except:
228 self.console.clear()
229 self.console.append("Please Write a name")
230 return 0
231
232
222 233 desc=str(self.proDescription.toPlainText())
223 234 self.projectObj.setup(id = id, name=name, description=desc)
224 235 datatype = str(self.proComDataType.currentText())
225 236 path = str(self.proDataPath.text())
226 237 #path='C://data3'
227 238 online = int(self.online)
239 if online ==0:
240 delay=0
241 else:
242 delay=self.proDelay.text()
243 try:
244 delay=int(self.proDelay.text())
245 except:
246 self.console.clear()
247 self.console.append("Please Write a number for delay")
248 return 0
249
228 250 walk = int(self.walk)
229 251 starDate = str(self.proComStartDate.currentText())
230 252 endDate = str(self.proComEndDate.currentText())
231 253 reloj1=self.proStartTime.time()
232 254 reloj2=self.proEndTime.time()
233 255
234 256 self.readUnitConfObj = self.projectObj.addReadUnit(datatype = datatype,
235 257 path = path,
236 258 startDate = starDate,
237 259 endDate = endDate,
238 260 startTime= str(reloj1.hour()) +":"+str(reloj1.minute())+":"+ str(reloj1.second()),
239 261 endTime= str(reloj2.hour()) +":"+str(reloj2.minute())+":"+ str(reloj2.second()),
240 262 online= online,
263 delay=delay,
241 264 walk= walk)
242 265 self.readUnitConfObjList.append(self.readUnitConfObj)
243 266
244 267 #Project Explorer
245 268 self.parentItem=self.model.invisibleRootItem()
246 269 self.__arbolDict[self.idp] =QtGui.QStandardItem(QtCore.QString(name).arg(self.idp))
247 270 self.parentItem.appendRow(self.__arbolDict[self.idp])
248 271 self.parentItem=self.__arbolDict[self.idp]
249 272
250 273 #Project Properties
251 274 self.model_2=treeModel()
252 275 self.model_2.setParams(name = self.projectObj.name,
253 276 directorio = path,
254 workspace = "C:\\WorkspaceGUI",
277 workspace = self.pathWorkSpace,
255 278 remode = str(self.proComReadMode.currentText()),
256 279 dataformat = datatype,
257 280 date = str(starDate)+"-"+str(endDate),
258 281 initTime = str(reloj1.hour()) +":"+str(reloj1.minute())+":"+ str(reloj1.second()),
259 282 endTime = str(reloj2.hour()) +":"+str(reloj2.minute())+":"+ str(reloj2.second()),
260 283 timezone = "Local" ,
261 284 Summary = desc)
262 285
263 286 self.treeProjectProperties.setModel(self.model_2)
264 287 self.treeProjectProperties.expandAll()
265 288
266 289 #Disable tabProject after finish the creation
267 290 #self.tabProject.setEnabled(False)
268 291 self.console.clear()
269 292 self.console.append("Now you can add a Unit Processing")
270 293 self.console.append("If you want to save your project")
271 294 self.console.append("click on your project name in the Tree Project Explorer")
272 295 #----------------Voltage Operation-------------------#
273 296
274 297 @pyqtSignature("int")
275 298 def on_volOpCebChannels_stateChanged(self, p0):
276 299 """
277 300 Check Box habilita operaciones de Selecci�n de Canales
278 301 """
279 302 if p0==2:
280 303 self.volOpComChannels.setEnabled(True)
281 304 self.volOpChannel.setEnabled(True)
282 305
283 306 if p0==0:
284 307 self.volOpComChannels.setEnabled(False)
285 308 self.volOpChannel.setEnabled(False)
286 309
287 310
288 311 @pyqtSignature("int")
289 312 def on_volOpCebHeights_stateChanged(self, p0):
290 313 """
291 314 Check Box habilita operaciones de Selecci�n de Alturas
292 315 """
293 316 if p0==2:
294 317 self.volOpHeights.setEnabled(True)
295 318 self.volOpComHeights.setEnabled(True)
296 319
297 320 if p0==0:
298 321 self.volOpHeights.setEnabled(False)
299 322 self.volOpComHeights.setEnabled(False)
300 323
301 324 @pyqtSignature("int")
302 325 def on_volOpCebFilter_stateChanged(self, p0):
303 326 """
304 327 Name='Decoder', optype='other'
305 328 """
306 329 if p0==2:
307 330 self.volOpFilter.setEnabled(True)
308 331
309 332 if p0==0:
310 333 self.volOpFilter.setEnabled(False)
311 334
312 335 @pyqtSignature("int")
313 336 def on_volOpCebProfile_stateChanged(self, p0):
314 337 """
315 338 Check Box habilita ingreso del rango de Perfiles
316 339 """
317 340 if p0==2:
318 341 self.volOpComProfile.setEnabled(True)
319 342 self.volOpProfile.setEnabled(True)
320 343
321 344 if p0==0:
322 345 self.volOpComProfile.setEnabled(False)
323 346 self.volOpProfile.setEnabled(False)
324 347
325 348 @pyqtSignature("int")
326 349 def on_volOpCebDecodification_stateChanged(self, p0):
327 350 """
328 351 Check Box habilita
329 352 """
330 353 if p0==2:
331 354 self.volOpComCode.setEnabled(True)
332 355 self.volOpComMode.setEnabled(True)
333 356
334 357 if p0==0:
335 358 self.volOpComCode.setEnabled(False)
336 359 self.volOpComMode.setEnabled(False)
337 360
338 361
339 362 @pyqtSignature("int")
340 363 def on_volOpCebCohInt_stateChanged(self, p0):
341 364 """
342 365 Check Box habilita ingresode del numero de Integraciones a realizar
343 366 """
344 367 if p0==2:
345 368 self.volOpCohInt.setEnabled(True)
346 369 if p0==0:
347 370 self.volOpCohInt.setEnabled(False)
348 371
349 372
350 373
351 374
352 375 @pyqtSignature("")
353 376 def on_volOpOk_clicked(self):
354 377 """
355 378 BUSCA EN LA LISTA DE OPERACIONES DEL TIPO VOLTAJE Y LES A�ADE EL PARAMETRO ADECUADO ESPERANDO LA ACEPTACION DEL USUARIO
356 379 PARA AGREGARLO AL ARCHIVO DE CONFIGURACION XML
357 380 """
358 381 for i in self.__arbolDict:
359 382 if self.__arbolDict[i]==self.indexclick:
360 383 if self.__upObjDict.has_key(i)==True:
361 384 self.upObj=self.__upObjDict[i]
362 385
363 386 if self.volOpCebChannels.isChecked():
364 387 if self.volOpComChannels.currentIndex()== 0:
365 388 opObj10=self.upObj.addOperation(name="selectChannels")
366 389 self.operObjList.append(opObj10)
367 390 value=self.volOpChannel.text()
368 391 opObj10.addParameter(name='channelList', value=value, format='intlist')
369 392 else:
370 393 opObj10=self.upObj.addOperation(name="selectChannelsByIndex")
371 394 self.operObjList.append(opObj10)
372 395 value=self.volOpChannel.text()
373 396 opObj10.addParameter(name='channelIndexList', value=value, format='intlist')
374 397
375 398 if self.volOpCebHeights.isChecked():
376 399 if self.volOpComHeights.currentIndex()== 0:
377 400 opObj10=self.upObj.addOperation(name='selectHeights')
378 401 value=self.volOpHeights.text()
379 402 valueList=value.split(',')
380 403 opObj10.addParameter(name='minHei', value=valueList[0], format='float')
381 404 opObj10.addParameter(name='maxHei', value=valueList[1], format='float')
382 405 else:
383 406 opObj10=self.upObj.addOperation(name='selectHeightsByIndex')
384 407 value=self.volOpHeights.text()
385 408 valueList=value.split(',')
386 409 opObj10.addParameter(name='minIndex', value=valueList[0], format='float')
387 410 opObj10.addParameter(name='maxIndex', value=valueList[1], format='float')
388 411
389 412 if self.volOpCebFilter.isChecked():
390 413 opObj10=self.upObj.addOperation(name='filterByHeights')
391 414 value=self.volOpFilter.text()
392 415 opObj10.addParameter(name='window', value=value, format='int')
393 416
394 417 if self.volOpCebProfile.isChecked():
395 418 opObj10=self.upObj.addOperation(name='ProfileSelector', optype='other')
396 419 if self.volOpComProfile.currentIndex()== 0:
397 420 self.operObjList.append(opObj10)
398 421 value=self.volOpProfile.text()
399 422 opObj10.addParameter(name='profileList', value=value, format='intlist')
400 423 else:
401 424 self.operObjList.append(opObj10)
402 425 value=self.volOpProfile.text()
403 426 opObj10.addParameter(name='profileRangeList', value=value, format='intlist')
404 427
405 428 if self.volOpCebDecodification.isChecked():
406 429 opObj10=self.upObj.addOperation(name='Decoder', optype='other')
407 430 if self.volOpComCode.currentIndex()==0:
408 431 opObj10.addParameter(name='code', value='1,1,-1,-1,-1,1', format='floatlist')
409 432 opObj10.addParameter(name='nCode', value='2', format='int')
410 433 opObj10.addParameter(name='nBaud', value='3', format='int')
411 434 if self.volOpComCode.currentIndex()==1:
412 435 opObj10.addParameter(name='code', value='1,1,−1,1,-1,-1,1,-1', format='floatlist')
413 436 opObj10.addParameter(name='nCode', value='2', format='int')
414 437 opObj10.addParameter(name='nBaud', value='4', format='int')
415 438 if self.volOpComCode.currentIndex()==2:
416 439 opObj10.addParameter(name='code', value='1,1,1,−1,1,-1,-1,-1,1,-1', format='floatlist')
417 440 opObj10.addParameter(name='nCode', value='2', format='int')
418 441 opObj10.addParameter(name='nBaud', value='5', format='int')
419 442 if self.volOpComCode.currentIndex()==3:
420 443 opObj10.addParameter(name='code', value='1,1,1,−1,−1,1,−1,-1,-1,-1,1,1,-1,1', format='floatlist')
421 444 opObj10.addParameter(name='nCode', value='2', format='int')
422 445 opObj10.addParameter(name='nBaud', value='7', format='int')
423 446 if self.volOpComCode.currentIndex()==4:
424 447 opObj10.addParameter(name='code', value='1,1,1,−1,−1,−1,1,−1,−1,1,−1,-1 ,-1 ,-1 ,1 ,1 ,1 ,-1 ,1 ,1 ,-1 ,1', format='floatlist')
425 448 opObj10.addParameter(name='nCode', value='2', format='int')
426 449 opObj10.addParameter(name='nBaud', value='11', format='int')
427 450 if self.volOpComCode.currentIndex()==5:
428 451 opObj10.addParameter(name='code', value='1,1,1,1,1,−1,−1,1,1,−1,1,−1,1,-1,-1,-1,-1,-1,1,1,-1,-1,1,-1,1,-1', format='floatlist')
429 452 opObj10.addParameter(name='nCode', value='2', format='int')
430 453 opObj10.addParameter(name='nBaud', value='13', format='int')
431 454
432 455 if self.volOpComMode.currentIndex()==0:
433 456 opObj10.addParameter(name='mode', value='0', format='int')
434 457
435 458 if self.volOpComMode.currentIndex()==1:
436 459 opObj10.addParameter(name='mode', value='1', format='int')
437 460
438 461 if self.volOpComMode.currentIndex()==2:
439 462 opObj10.addParameter(name='mode', value='2', format='int')
440 463
441 464 if self.volOpCebCohInt.isChecked():
442 465 opObj10=self.upObj.addOperation(name='CohInt', optype='other')
443 466 self.operObjList.append(opObj10)
444 467 value=self.volOpCohInt.text()
445 468 opObj10.addParameter(name='n', value=value, format='int')
446 469 #self.tabopVoltage.setEnabled(False)
447 470 self.console.clear()
448 471 self.console.append("If you want to save your project")
449 472 self.console.append("click on your project name in the Tree Project Explorer")
450 473
451 474 #----------------Voltage Graph-------------------#
452 475 @pyqtSignature("int")
453 476 def on_volGraphCebSave_stateChanged(self, p0):
454 477 """
455 478 Check Box habilita ingresode del numero de Integraciones a realizar
456 479 """
457 480 if p0==2:
458 481 self.volGraphPath.setEnabled(True)
459 482 self.volGraphPrefix.setEnabled(True)
460 483 self.volGraphToolPath.setEnabled(True)
461 484
462 485 if p0==0:
463 486 self.volGraphPath.setEnabled(False)
464 487 self.volGraphPrefix.setEnabled(False)
465 488 self.volGraphToolPath.setEnabled(False)
466 489
467 490 @pyqtSignature("")
468 491 def on_volGraphToolPath_clicked(self):
469 492 """
470 493 Donde se guardan los DATOS
471 494 """
472 495 self.dataPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly))
473 496 self.volGraphPath.setText(self.dataPath)
474 497
475 498 if not os.path.exists(self.dataPath):
476 499 self.volGraphOk.setEnabled(False)
477 500 return
478 501
479 502
480 503 @pyqtSignature("int")
481 504 def on_volGraphComType_activated(self,index):
482 505 """
483 506 Metodo que identifica que tipo de dato se va a trabajar VOLTAGE O ESPECTRA
484 507 """
485 508 if index==0:
486 509 self.volGraphIdFigure.setEnabled(False)
487 510 self.volGraphWintitle.setEnabled(False)
488 511 self.volGraphChannelList.setEnabled(False)
489 512 self.volGraphxrange.setEnabled(False)
490 513 self.volGraphyrange.setEnabled(False)
491 514 if index==1:
492 515 self.volGraphIdFigure.setEnabled(True)
493 516 self.volGraphWintitle.setEnabled(True)
494 517 self.volGraphChannelList.setEnabled(True)
495 518 self.volGraphxrange.setEnabled(True)
496 519 self.volGraphyrange.setEnabled(True)
497 520
498 521 @pyqtSignature(" ")
499 522 def on_volGraphOk_clicked(self):
500 523 """
501 524 GRAPH
502 525 """
503 526 for i in self.__arbolDict:
504 527 if self.__arbolDict[i]==self.indexclick:
505 528 if self.__upObjDict.has_key(i)==True:
506 529 self.upObj=self.__upObjDict[i]
507 530
508 531 if self.volGraphComType.currentIndex()==1:
509 532 opObj10=self.upObj.addOperation(name='Scope', optype='other')
510 533 self.operObjList.append(opObj10)
511 534 wintitle=self.volGraphWintitle.text()
512 535 channelList=self.volGraphChannelList.text()
513 536 xvalue= self.volGraphxrange.text()
514 537 yvalue= self.volGraphxrange.text()
515 538
516 539 opObj10.addParameter(name='wintitle', value=wintitle, format='str')
517 540 opObj10.addParameter(name='channelList', value=channelList, format='int')
518 541 xvalueList=xvalue.split(',')
519 542 opObj10.addParameter(name='xmin', value=xvalueList[0], format='int')
520 543 opObj10.addParameter(name='xmax', value=xvalueList[1], format='int')
521 544 yvalueList=yvalue.split(",")
522 545 opObj10.addParameter(name='ymin', value=yvalueList[0], format='int')
523 546 opObj10.addParameter(name='ymax', value=yvalueList[1], format='int')
524 547
525 548 if self.volGraphCebSave.isChecked():
526 549 opObj10.addParameter(name='save', value='1', format='int')
527 550 opObj10.addParameter(name='figpath', value= self.volGraphPath.text())
528 551 opObj10.addParameter(name='figfile', value= self.volGraphPrefix.text())
529 552 self.tabgraphVoltage.setEnabled(False)
530 553 self.console.clear()
531 554 self.console.append("If you want to save your project")
532 555 self.console.append("click on your project name in the Tree Project Explorer")
533 556
534 557 #------Spectra operation--------#
535 558 @pyqtSignature("int")
536 559 def on_specOpCebnFFTpoints_stateChanged(self, p0):
537 560 """
538 561 Habilita la opcion de a�adir el par�metro nFFTPoints a la Unidad de Procesamiento .
539 562 """
540 563 if p0==2:
541 564 self.specOpnFFTpoints.setEnabled(True)
542 565 self.specOppairsList.setEnabled(True)
543 566 if p0==0:
544 567 self.specOpnFFTpoints.setEnabled(False)
545 568 self.specOppairsList.setEnabled(False)
546 569
547 570 @pyqtSignature("int")
548 571 def on_specOpCebChannel_stateChanged(self, p0):
549 572 """
550 573 Habilita la opcion de a�adir el par�metro nFFTPoints a la Unidad de Procesamiento .
551 574 """
552 575 if p0==2:
553 576 self.specOpChannel.setEnabled(True)
554 577 self.specOpComChannel.setEnabled(True)
555 578 if p0==0:
556 579 self.specOpChannel.setEnabled(False)
557 580 self.specOpComChannel.setEnabled(False)
558 581
559 582 @pyqtSignature("int")
560 583 def on_specOpCebHeights_stateChanged(self, p0):
561 584 """
562 585 Habilita la opcion de a�adir el par�metro nFFTPoints a la Unidad de Procesamiento .
563 586 """
564 587 if p0==2:
565 588 self.specOpComHeights.setEnabled(True)
566 589 self.specOpHeights.setEnabled(True)
567 590 if p0==0:
568 591 self.specOpComHeights.setEnabled(False)
569 592 self.specOpHeights.setEnabled(False)
570 593
571 594
572 595 @pyqtSignature("int")
573 596 def on_specOpCebIncoherent_stateChanged(self, p0):
574 597 """
575 598 Habilita la opcion de a�adir el par�metro nFFTPoints a la Unidad de Procesamiento .
576 599 """
577 600 if p0==2:
578 601 self.specOpIncoherent.setEnabled(True)
579 602 if p0==0:
580 603 self.specOpIncoherent.setEnabled(False)
581 604
582 605 @pyqtSignature("int")
583 606 def on_specOpCebRemoveDC_stateChanged(self, p0):
584 607 """
585 608 Habilita la opcion de a�adir el par�metro nFFTPoints a la Unidad de Procesamiento .
586 609 """
587 610 if p0==2:
588 611 self.specOpRemoveDC.setEnabled(True)
589 612 if p0==0:
590 613 self.specOpRemoveDC.setEnabled(False)
591 614
592 615 @pyqtSignature("")
593 616 def on_specOpOk_clicked(self):
594 617 """
595 618 AÑADE OPERACION SPECTRA
596 619 """
597 620 for i in self.__arbolDict:
598 621 if self.__arbolDict[i]==self.indexclick:
599 622 if self.__upObjDict.has_key(i)==True:
600 623 self.upObj=self.__upObjDict[i]
601 624 # self.operObjList.append(opObj10)
602 625 if self.specOpCebnFFTpoints.isChecked():
603 626 value1=self.specOpnFFTpoints.text()
604 627 value2=self.specOppairsList.text()
605 628 self.upObj.addParameter(name='nFFTPoints',value=value1,format='int')
606 629 self.upObj.addParameter(name='pairsList', value=value2, format='pairslist')
607 630
608 631 if self.specOpCebHeights.isChecked():
609 632 if self.specOpComHeights.currentIndex()== 0:
610 633 opObj10=self.upObj.addOperation(name='selectHeights')
611 634 value=self.specOpHeights.text()
612 635 valueList=value.split(',')
613 636 opObj10.addParameter(name='minHei', value=valueList[0], format='float')
614 637 opObj10.addParameter(name='maxHei', value=valueList[1], format='float')
615 638 else:
616 639 opObj10=self.upObj.addOperation(name='selectHeightsByIndex')
617 640 value=self.specOpHeights.text()
618 641 valueList=value.split(',')
619 642 opObj10.addParameter(name='minIndex', value=valueList[0], format='float')
620 643 opObj10.addParameter(name='maxIndex', value=valueList[1], format='float')
621 644
622 645 if self.specOpCebChannel.isChecked():
623 646 if self.specOpComChannel.currentIndex()== 0:
624 647 opObj10=self.upObj.addOperation(name="selectChannels")
625 648 self.operObjList.append(opObj10)
626 649 value=self.specOpChannel.text()
627 650 opObj10.addParameter(name='channelList', value=value, format='intlist')
628 651 else:
629 652 opObj10=self.upObj.addOperation(name="selectChannelsByIndex")
630 653 self.operObjList.append(opObj10)
631 654 value=self.specOpChannel.text()
632 655 opObj10.addParameter(name='channelIndexList', value=value, format='intlist')
633 656
634 657 if self.specOpCebIncoherent.isChecked():
635 658 opObj10=self.upObj.addOperation(name='IncohInt', optype='other')
636 659 self.operObjList.append(opObj10)
637 660 value=self.specOpIncoherent.text()
638 661 opObj10.addParameter(name='n', value=value, format='float')
639 662
640 663 if self.specOpCebRemoveDC.isChecked():
641 664 opObj10=self.upObj.addOperation(name='removeDC')
642 665 value=self.specOpRemoveDC.text()
643 666 opObj10.addParameter(name='mode', value=value,format='int')
644 667
645 668
646 669 self.tabopSpectra.setEnabled(False)
647 670 self.console.clear()
648 671 self.console.append("If you want to save your project")
649 672 self.console.append("click on your project name in the Tree Project Explorer")
650 673
651 674
652 675 #------Spectra Graph--------#
653 676 @pyqtSignature("int")
654 677 def on_specGraphComType_activated(self,index):
655 678 if index==0:
656 679 print "return"
657 680
658 681 if index==1:
659 682 self.setspecGraph()
660 683 self.specGraphTimeRange.setEnabled(False)
661 684
662 685 if index==2:
663 686 self.setspecGraph()
664 687 self.specGraphTimeRange.setEnabled(False)
665 688
666 689 if index==3:
667 690 self.setspecGraph()
668 691
669 692
670 693 if index==4:
671 694 self.setspecGraph()
672 695 self.specGraphTimeRange.setEnabled(False)
673 696
674 697 if index==5:
675 698 self.setspecGraph()
676 699
677 700 if index==6:
678 701 self.setspecGraph()
679 702 self.specGgraphzrange.setEnabled(False)
680 703
681 704 @pyqtSignature("int")
682 705 def on_specGraphCebSave_stateChanged(self, p0):
683 706 """
684 707 """
685 708 if p0==2:
686 709 self.specGraphPath.setEnabled(True)
687 710 self.specGraphPrefix.setEnabled(True)
688 711 self.specGraphToolPath.setEnabled(True)
689 712 if p0==0:
690 713 self.specGraphPath.setEnabled(False)
691 714 self.specGraphPrefix.setEnabled(False)
692 715 slef.specGraphToolPath.setEnabled(False)
693 716 @pyqtSignature("")
694 717 def on_specGraphToolPath_clicked(self):
695 718 """
696 719 """
697 720 self.savePath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly))
698 721 self.specGraphPath.setText(self.savePath)
699 722 if not os.path.exists(self.savePath):
700 723 self.console.clear()
701 724 self.console.append("Write a correct a path")
702 725 return
703 726
704 727 @pyqtSignature("")
705 728 def on_specGraphOk_clicked(self):
706 729
707 730 for i in self.__arbolDict:
708 731 if self.__arbolDict[i]==self.indexclick:
709 732 if self.__upObjDict.has_key(i)==True:
710 733 self.upObj=self.__upObjDict[i]
711 734
712 735 if self.specGraphComType.currentIndex()==1:
713 736 opObj10=self.upObj.addOperation(name='SpectraPlot',optype='other')
714 737 self.properSpecGraph(opObj10)
715 738
716 739 if self.specGraphComType.currentIndex()==2:
717 740 opObj10=self.upObj.addOperation(name='CrossSpectraPlot',optype='other')
718 741 self.properSpecGraph(opObj10)
719 742 opObj10.addParameter(name='power_cmap', value='jet', format='str')
720 743 opObj10.addParameter(name='coherence_cmap', value='jet', format='str')
721 744 opObj10.addParameter(name='phase_cmap', value='RdBu_r', format='str')
722 745
723 746 if self.specGraphComType.currentIndex()==3:
724 747 opObj10=self.upObj.addOperation(name='RTIPlot',optype='other')
725 748 self.properSpecGraph(opObj10)
726 749 value =self.specGraphTimeRange.text()
727 750 opObj10.addParameter(name='timerange', value=value, format='int')
728 751
729 752 if self.specGraphComType.currentIndex()==4:
730 753 opObj10=self.upObj.addOperation(name='CoherenceMap',optype='other')
731 754 self.properSpecGraph(opObj10)
732 755 opObj10.addParameter(name='coherence_cmap', value='jet', format='str')
733 756 opObj10.addParameter(name='phase_cmap', value='RdBu_r', format='str')
734 757
735 758 if self.specGraphComType.currentIndex()==5:
736 759 opObj10=self.upObj.addOperation(name='RTIfromNoise',optype='other')
737 760 self.properSpecGraph(opObj10)
738 761 self.specGgraphzrange.setEnabled(False)
739 762
740 763 if self.specGraphComType.currentIndex()==6:
741 764 opObj10=self.upObj.addOperation(name='ProfilePlot',optype='other')
742 765 self.properSpecGraph(opObj10)
743 766 self.specGgraphzrange.setEnabled(False)
744 767
745 768
746 769 #self.tabgraphSpectra.setEnabled(False)
747 770 self.specGraphComType.setEnabled(False)
748 771 self.console.clear()
749 772 self.console.append("If you want to save your project")
750 773 self.console.append("click on your project name in the Tree Project Explorer")
751 774
752 775 @pyqtSignature("")
753 776 def on_specGraphClear_clicked(self):
754 777 self.clearspecGraph()
755 778
756 779 def properSpecGraph(self,opObj10):
757 780
758 781 self.operObjList.append(opObj10)
759 782 wintitle=self.specGraphWinTitle.text()
760 783 opObj10.addParameter(name='wintitle', value=wintitle, format='str')
761 784 idfigure=self.specGraphIdFigure.text()
762 785
763 786 opObj10.addParameter(name='idfigure', value=idfigure, format='int')
764 787
765 788 channelList=self.specGraphChannelList.text()
766 789 if self.specGraphChannelList.isModified():
767 790 opObj10.addParameter(name='channelList', value=channelList, format='intlist')
768 791
769 792 xvalue= self.specGgraphxrange.text()
770 793 if self.specGgraphxrange.isModified():
771 794 xvalueList=xvalue.split(',')
772 795 try:
773 796 value=int(xvalueList[0])
774 797 value=int(xvalueList[1])
775 798 opObj10.addParameter(name='xmin', value=xvalueList[0], format='int')
776 799 opObj10.addParameter(name='xmax', value=xvalueList[1], format='int')
777 800 except:
778 801 return 0
779 802
780 803 yvalue= self.specGgraphyrange.text()
781 804 if self.specGgraphyrange.isModified():
782 805 yvalueList=yvalue.split(",")
783 806 try:
784 807 value=int(yvalueList[0])
785 808 value=int(yvalueList[1])
786 809 opObj10.addParameter(name='ymin', value=yvalueList[0], format='int')
787 810 opObj10.addParameter(name='ymax', value=yvalueList[1], format='int')
788 811 except:
789 812 return 0
790 813
791 814 zvalue= self.specGgraphzrange.text()
792 815 if self.specGgraphzrange.isModified():
793 816 zvalueList=zvalue.split(",")
794 817 try:
795 818 value=int(zvalueList[0])
796 819 value=int(zvalueList[1])
797 820 opObj10.addParameter(name='zmin', value=zvalueList[0], format='int')
798 821 opObj10.addParameter(name='zmax', value=zvalueList[1], format='int')
799 822 except:
800 823 return 0
801 824
802 825
803 826 if self.specGraphCebSave.isChecked():
804 827 opObj10.addParameter(name='save', value='1', format='bool')
805 828 opObj10.addParameter(name='figpath', value= self.specGraphPath.text(),format='str')
806 829 opObj10.addParameter(name='figfile', value= self.specGraphPrefix.text(),format='str')
807 830
808 831
809 832 def setspecGraph(self):
810 833 self.specGraphIdFigure.setEnabled(True)
811 834 self.specGraphWinTitle.setEnabled(True)
812 835 self.specGraphChannelList.setEnabled(True)
813 836 self.specGgraphxrange.setEnabled(True)
814 837 self.specGgraphyrange.setEnabled(True)
815 838 self.specGgraphzrange.setEnabled(True)
816 839 self.specGraphTimeRange.setEnabled(True)
817 840 # self.specGraphPath.setEnabled(True)
818 841 # self.specGraphToolPath.setEnabled(True)
819 842 # self.specGraphPrefix.setEnabled(True)
820 843 def clearspecGraph(self):
821 844 self.specGraphComType.setEnabled(True)
822 845 self.specGraphComType.setCurrentIndex(0)
823 846 self.specGraphIdFigure.clear()
824 847 self.specGraphWinTitle.clear()
825 848 self.specGraphChannelList.clear()
826 849 self.specGgraphxrange.clear()
827 850 self.specGgraphyrange.clear()
828 851 self.specGgraphzrange.clear()
829 852 self.specGraphTimeRange.clear()
830 853
831 854 def playProject(self):
832 855
833 856 for i in self.__arbolDict:
834 857 if self.__arbolDict[i]==self.indexclick:
835 858 self.projectObj=self.__projObjDict[i]
836 filename="C:\WorkspaceGUI\config"+str(self.projectObj.name)+str(self.projectObj.id)+".xml"
859 filename=self.pathWorkSpace+str(self.projectObj.name)+str(self.projectObj.id)+".xml"
837 860 self.projectObj.readXml(filename)
838 861 #controllerObj.printattr()
839 862
840 863 self.projectObj.createObjects()
841 864 self.projectObj.connectObjects()
842 865 self.projectObj.run()
843 866 self.console.clear()
844 867 self.console.append("Please Wait...")
845 868
846 869
847 870 def saveProject(self):
848 871
849 872 for i in self.__arbolDict:
850 873 if self.__arbolDict[i]==self.indexclick:
851 874 self.projectObj=self.__projObjDict[i]
852 filename="C:\WorkspaceGUI\config"+str(self.projectObj.name)+str(self.projectObj.id)+".xml"
875
876 filename=self.pathWorkSpace+str(self.projectObj.name)+str(self.projectObj.id)+".xml"
853 877 self.projectObj.writeXml(filename)
854 878 self.console.clear()
855 879 self.console.append("Now, you can push the icon Start in the toolbar or push start in menu run")
856 880
857 881
858 882 def clickFunction(self,index):
859 883 self.indexclick= index.model().itemFromIndex(index)
860 884
861 885 def doubleclickFunction(self):
862 886 for i in self.__arbolDict:
863 887 if self.__arbolDict[i]==self.indexclick:
864 888 if self.__projObjDict.has_key(i)==True:
865 889 self.proName.setText(str(self.__projObjDict[i].name))
866 890 self.proDataPath.setText(str(self.readUnitConfObjList[i-1].path))
867 891 self.model_2=treeModel()
868 892 self.model_2.setParams(name = str(self.__projObjDict[i].name),
869 893 directorio = str(self.readUnitConfObjList[i-1].path),
870 workspace = "C:\\WorkspaceGUI",
894 workspace = self.pathWorkSpace,
871 895 remode = "off Line",
872 896 dataformat = self.readUnitConfObjList[i-1].datatype,
873 897 date = str(self.readUnitConfObjList[i-1].startDate)+"-"+str(self.readUnitConfObjList[i-1].endDate),
874 898 initTime = str(self.readUnitConfObjList[i-1].startTime),
875 899 endTime = str(self.readUnitConfObjList[i-1].endTime),
876 900 timezone = "Local" ,
877 901 Summary = str(self.__projObjDict[i].description))
878 902 self.treeProjectProperties.setModel(self.model_2)
879 903 self.treeProjectProperties.expandAll()
880 904 self.tabWidgetProject.setCurrentWidget(self.tabProject)
881 905
882 906 if self.indexclick.text()=='Voltage':
883 907 self.tabVoltage.setEnabled(True)
884 908 self.tabSpectra.setEnabled(False)
885 909 self.tabCorrelation.setEnabled(False)
886 910 self.tabWidgetProject.setCurrentWidget(self.tabVoltage)
887 911
888 912 self.volOpComChannels.setEnabled(False)
889 913 self.volOpComHeights.setEnabled(False)
890 914 self.volOpFilter.setEnabled(False)
891 915 self.volOpComProfile.setEnabled(False)
892 916 self.volOpComCode.setEnabled(False)
893 917 self.volOpCohInt.setEnabled(False)
894 918 self.volOpChannel.clear()
895 919 self.volOpHeights.clear()
896 920 self.volOpProfile.clear()
897 921 self.volOpFilter.clear()
898 922
899 923 self.volOpChannel.setEnabled(False)
900 924 self.volOpHeights.setEnabled(False)
901 925 self.volOpProfile.setEnabled(False)
902 926 self.volOpCebHeights.clearFocus()
903 927 # self.volOpCebChannels.clear()
904 928 # self.volOpCebHeights.clear()
905 929 # self.volOpCebFilter.clear()
906 930 # self.volOpCebProfile.clear()
907 931 # self.volOpCebDecodification.clear()
908 932 # self.volOpCebCohInt.clear()
909 933
910 934
911 935 if self.indexclick.text()=='Spectra':
912 936 self.tabSpectra.setEnabled(True)
913 937 self.tabVoltage.setEnabled(False)
914 938 self.tabCorrelation.setEnabled(False)
915 939 self.tabWidgetProject.setCurrentWidget(self.tabSpectra)
916 940
917 941 if self.indexclick.text()=='Correlation':
918 942 self.tabCorrelation.setEnabled(True)
919 943 self.tabVoltage.setEnabled(False)
920 944 self.tabSpectra.setEnabled(False)
921 945 self.tabWidgetProject.setCurrentWidget(self.tabCorrelation)
922 946
923 947 def popup(self, pos):
924 948
925 949 menu = QtGui.QMenu()
926 950 quitAction0 = menu.addAction("AddNewProject")
927 951 quitAction1 = menu.addAction("AddNewProcessingUnit")
928 952 quitAction2 = menu.addAction("Exit")
929 953 #quitAction2 = menu.addAction("Exit")
930 954 action = menu.exec_(self.mapToGlobal(pos))
931 955 if action == quitAction0:
932 956 self.setProjectParam()
933 957 if action == quitAction1:
934 958 self.addPU()
935 959 self.console.clear()
936 960 self.console.append("Please, Choose the type of Processing Unit")
937 961 self.console.append("If your Datatype is rawdata, you will start with processing unit Type Voltage")
938 962 self.console.append("If your Datatype is pdata, you will choose between processing unit Type Spectra or Correlation")
939 963 if action == quitAction2:
940 964 return
941 965
942 966 def setProjectParam(self):
943 967 self.tabWidgetProject.setEnabled(True)
944 968 self.tabWidgetProject.setCurrentWidget(self.tabProject)
945 969 self.tabProject.setEnabled(True)
946 970
947 971 self.proName.clear()
948 972 self.proDataPath.clear()
949 973 self.proComDataType.clear()
950 974 self.proComDataType.addItem("Voltage")
951 975 self.proComDataType.addItem("Spectra")
952 976 startTime="00:00:00"
953 977 endTime="23:59:59"
954 978 starlist=startTime.split(":")
955 979 endlist=endTime.split(":")
956 980
957 981 self.time.setHMS(int(starlist[0]),int(starlist[1]),int(starlist[2]))
958 982 self.proStartTime.setTime(self.time)
959 983 self.time.setHMS(int(endlist[0]),int(endlist[1]),int(endlist[2]))
960 984 self.proEndTime.setTime(self.time)
961 985 self.proDescription.clear()
962 986
963 987 self.console.clear()
964 988 self.console.append("Please, Write a name Project")
965 989 self.console.append("Introduce Project Parameters")
966 990 self.console.append("Select data type Voltage( .rawdata) or Spectra(.pdata)")
967 991
968 992
969 993 def addPU(self):
970 994 self.configUP=UnitProcess(self)
971 995 for i in self.__arbolDict:
972 996 if self.__arbolDict[i]==self.indexclick:
973 997 if self.__projObjDict.has_key(i)==True:
974 998 self.projectObj=self.__projObjDict[int(i)]
975 999 self.configUP.dataTypeProject=str(self.proComDataType.currentText())
976 1000 self.configUP.getfromWindowList.append(self.projectObj)
977 1001 else:
978 1002 self.upObj=self.__upObjDict[i]
979 1003 self.configUP.getfromWindowList.append(self.upObj)
980 1004
981 1005 self.configUP.loadTotalList()
982 1006 self.configUP.show()
983 1007 self.configUP.closed.connect(self.createUP)
984 1008
985 1009 def createUP(self):
986 1010
987 1011 if not self.configUP.create:
988 1012 return
989 1013
990 1014 self.uporProObjRecover=self.configUP.getFromWindow
991 1015
992 1016 self.upType = self.configUP.typeofUP
993 1017 for i in self.__arbolDict:
994 1018 if self.__arbolDict[i]==self.indexclick:
995 1019 if self.__projObjDict.has_key(i)==True:
996 1020 self.projectObj=self.__projObjDict[int(i)]
997 1021
998 1022 if self.__upObjDict.has_key(i)==True:
999 1023 self.upObj=self.__upObjDict[i]
1000 1024 getIdProject=self.upObj.id[0]
1001 1025 self.projectObj=self.__projObjDict[int(getIdProject)]
1002 1026
1003 1027 datatype=str(self.upType)
1004 1028 uporprojectObj=self.uporProObjRecover
1005 1029
1006 1030 if uporprojectObj.getElementName()=='ProcUnit':
1007 1031 inputId=uporprojectObj.getId()
1008 1032 self.console.clear()
1009 1033 self.console.append("Double Clik on the Processing Unit to enable the tab")
1010 1034 self.console.append("Before Add other Processing Unit complete the tab")
1011 1035 else:
1012 1036 inputId=self.readUnitConfObjList[uporprojectObj.id-1].getId()
1013 1037 self.console.clear()
1014 1038 self.console.append("Double Clik on the Processing Unit to enable the tab")
1015 1039 self.console.append("Before Add other Project or Processing Unit complete the tab")
1016 1040
1017 1041 self.procUnitConfObj1 = self.projectObj.addProcUnit(datatype=datatype, inputId=inputId)
1018 1042 self.__upObjDict[self.procUnitConfObj1.id]= self.procUnitConfObj1
1019 1043 self.parentItem=self.__arbolDict[uporprojectObj.id]
1020 1044 self.numbertree=int(self.procUnitConfObj1.getId())-1
1021 1045 self.__arbolDict[self.procUnitConfObj1.id]=QtGui.QStandardItem(QtCore.QString(datatype).arg(self.numbertree))
1022 1046 self.parentItem.appendRow(self.__arbolDict[self.procUnitConfObj1.id])
1023 1047 self.parentItem=self.__arbolDict[self.procUnitConfObj1.id]
1024 1048 self.treeProjectExplorer.expandAll()
1025 1049
1026 1050
1027 1051 def searchData(self,path,ext,walk,expLabel=''):
1028 1052 dateList=[]
1029 1053 fileList=[]
1030 1054 if walk== 0:
1031 1055 files= os.listdir(path)
1032 1056 for thisFile in files:
1033 1057 if not os.path.isfile(thisFile):
1034 1058 continue
1035 1059 thisExt = os.path.splitext(thisFile)[-1]
1036 1060
1037 1061 if thisExt != ext:
1038 1062 continue
1039 1063
1040 1064 fileList.append(file)
1041 1065
1042 1066 for thisFile in fileList:
1043 1067
1044 1068 if not isRadarFile(thisFile):
1045 1069 self.console.clear()
1046 1070 self.console.append("Please, Choose the Correct Path")
1047 1071 self.proOk.setEnabled(False)
1048 1072 continue
1049 1073
1050 1074 year = int(thisFile[1:5])
1051 1075 doy = int(thisFile[5:8])
1052 1076
1053 1077 date = datetime.date(year,1,1) + datetime.timedelta(doy-1)
1054 1078 dateformat = date.strftime("%Y/%m/%d")
1055 1079
1056 1080 if dateformat not in dateList:
1057 1081 dateList.append(dateformat)
1058 1082
1059 1083 if walk == 1:
1060 1084
1061 1085 dirList = os.listdir(path)
1086
1062 1087 dirList.sort()
1063 1088
1064 1089 dateList = []
1065 1090
1066 1091 for thisDir in dirList:
1067 1092
1068 1093 if not isRadarPath(thisDir):
1069 1094 self.console.clear()
1070 1095 self.console.append("Please, Choose the Correct Path")
1071 1096 self.proOk.setEnabled(False)
1072 1097 continue
1073 1098
1074 1099 doypath = os.path.join(path, thisDir, expLabel)
1075 1100
1076 1101 files = os.listdir(doypath)
1077 1102 fileList = []
1078 1103
1079 1104 for thisFile in files:
1080 1105
1081 1106 if os.path.splitext(thisFile)[-1] != ext:
1082 1107 continue
1083 1108
1084 1109 if not isRadarFile(thisFile):
1085 1110 self.proOk.setEnabled(False)
1086 1111 self.console.clear()
1087 1112 self.console.append("Please, Choose the Correct Path")
1088 1113 continue
1089 1114
1090 1115 fileList.append(thisFile)
1091 1116 break
1092 1117
1093 1118 if fileList == []:
1094 1119 continue
1095 1120
1096 1121 year = int(thisDir[1:5])
1097 1122 doy = int(thisDir[5:8])
1098 1123
1099 1124 date = datetime.date(year,1,1) + datetime.timedelta(doy-1)
1100 1125 dateformat = date.strftime("%Y/%m/%d")
1101 1126 dateList.append(dateformat)
1102 1127
1103 1128 return dateList
1104 1129
1105 1130 def loadDays(self):
1106 1131 """
1107 1132 Method to loads day
1108 1133 """
1109 1134 ext=str(self.proDataType.text())
1110 1135 try:
1111 1136 punto = str(ext[1:2])
1112 1137 ext=self.datatype
1113 1138 except:
1139 self.proOk.setEnabled(False)
1114 1140 self.console.clear()
1115 1141 self.console.append("Please, Choose DataType")
1116 1142 return 0
1117 1143
1118 1144 #-------------------------#
1119 1145 walk= self.walk
1120 1146
1121 1147 path=str(self.proDataPath.text())
1148 if not os.path.exists(path):
1149 self.proOk.setEnabled(False)
1150 self.console.clear()
1151 self.console.append("Write a correct a path")
1152 return
1122 1153 self.proComStartDate.clear()
1123 1154 self.proComEndDate.clear()
1124 1155 #Load List to select start day and end day.(QComboBox)
1125 1156 dateList=self.searchData(path,ext=ext,walk=walk)
1126 1157 self.dateList=dateList
1127 1158 for thisDate in dateList:
1128 1159 self.proComStartDate.addItem(thisDate)
1129 1160 self.proComEndDate.addItem(thisDate)
1130 1161 self.proComEndDate.setCurrentIndex(self.proComStartDate.count()-1)
1162
1163 def setWorkSpaceGUI(self,pathWorkSpace):
1164 self.pathWorkSpace = pathWorkSpace
1131 1165
1132 1166 def setParameter(self):
1133 1167 self.setWindowTitle("ROJ-Signal Chain")
1134 1168 self.setWindowIcon(QtGui.QIcon("figure/adn.jpg"))
1135 1169 self.tabWidgetProject.setEnabled(False)
1136 1170 self.tabVoltage.setEnabled(False)
1137 1171 self.tabSpectra.setEnabled(False)
1138 1172 self.tabCorrelation.setEnabled(False)
1139 1173
1140 1174 self.proName.clear()
1141 1175 self.proDataPath.setText('C:\Rawdata')
1142 1176 self.console.append("Welcome to Signal Chain please Create a New Project")
1143 1177 self.proStartTime.setDisplayFormat("hh:mm:ss")
1144 1178 self.time =QtCore.QTime()
1145 1179 self.hour =0
1146 1180 self.min =0
1147 1181 self.sec =0
1148 1182 self.proEndTime.setDisplayFormat("hh:mm:ss")
1149 1183 startTime="00:00:00"
1150 1184 endTime="23:59:59"
1151 1185 starlist=startTime.split(":")
1152 1186 endlist=endTime.split(":")
1153 1187 self.time.setHMS(int(starlist[0]),int(starlist[1]),int(starlist[2]))
1154 1188 self.proStartTime.setTime(self.time)
1155 1189 self.time.setHMS(int(endlist[0]),int(endlist[1]),int(endlist[2]))
1156 1190 self.proEndTime.setTime(self.time)
1157 1191 self.proOk.setEnabled(False)
1158 1192 #set model Project Explorer
1159 1193 self.model = QtGui.QStandardItemModel()
1160 1194 self.model.setHorizontalHeaderLabels(("Project Explorer",))
1161 1195 layout = QtGui.QVBoxLayout()
1162 1196 layout.addWidget(self.treeProjectExplorer)
1163 1197 self.treeProjectExplorer.setModel(self.model)
1164 1198 self.treeProjectExplorer.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
1165 1199 self.treeProjectExplorer.customContextMenuRequested.connect(self.popup)
1166 1200 self.treeProjectExplorer.clicked.connect(self.clickFunction)
1167 1201
1168 1202 self.treeProjectExplorer.doubleClicked.connect(self.doubleclickFunction)
1169 1203 self.treeProjectExplorer.expandAll()
1170 1204 #set model Project Properties
1171 1205
1172 1206 self.model_2=treeModel()
1173 1207 self.model_2.showtree()
1174 1208 self.treeProjectProperties.setModel(self.model_2)
1175 1209 self.treeProjectProperties.expandAll()
1176 1210 #set Project
1177 1211 self.proDelay.setEnabled(False)
1212 self.proDataType.setReadOnly(True)
1178 1213
1179 1214 #set Operation Voltage
1180 1215 self.volOpComChannels.setEnabled(False)
1181 1216 self.volOpComHeights.setEnabled(False)
1182 1217 self.volOpFilter.setEnabled(False)
1183 1218 self.volOpComProfile.setEnabled(False)
1184 1219 self.volOpComCode.setEnabled(False)
1185 1220 self.volOpCohInt.setEnabled(False)
1186 1221
1187 1222 self.volOpChannel.setEnabled(False)
1188 1223 self.volOpHeights.setEnabled(False)
1189 1224 self.volOpProfile.setEnabled(False)
1190 1225 self.volOpComMode.setEnabled(False)
1191 1226
1192 1227 self.volGraphPath.setEnabled(False)
1193 1228 self.volGraphPrefix.setEnabled(False)
1194 1229 self.volGraphToolPath.setEnabled(False)
1195 1230
1196 1231 #set Graph Voltage
1197 1232 self.volGraphIdFigure.setEnabled(False)
1198 1233 self.volGraphWintitle.setEnabled(False)
1199 1234 self.volGraphChannelList.setEnabled(False)
1200 1235 self.volGraphxrange.setEnabled(False)
1201 1236 self.volGraphyrange.setEnabled(False)
1202 1237 #set Operation Spectra
1203 1238 self.specOpnFFTpoints.setEnabled(False)
1204 1239 self.specOppairsList.setEnabled(False)
1205 1240 self.specOpComChannel.setEnabled(False)
1206 1241 self.specOpComHeights.setEnabled(False)
1207 1242 self.specOpIncoherent.setEnabled(False)
1208 1243 self.specOpRemoveDC .setEnabled(False)
1209 1244 self.specOpRemoveInterference.setEnabled(False)
1210 1245
1211 1246 self.specOpChannel.setEnabled(False)
1212 1247 self.specOpHeights.setEnabled(False)
1213 1248 #set Graph Spectra
1214 1249 self.specGraphIdFigure.setEnabled(False)
1215 1250 self.specGraphWinTitle.setEnabled(False)
1216 1251 self.specGraphChannelList.setEnabled(False)
1217 1252 self.specGgraphxrange.setEnabled(False)
1218 1253 self.specGgraphyrange.setEnabled(False)
1219 1254 self.specGgraphzrange.setEnabled(False)
1220 1255 self.specGraphTimeRange.setEnabled(False)
1221 1256 self.specGraphPath.setEnabled(False)
1222 1257 self.specGraphToolPath.setEnabled(False)
1223 1258 self.specGraphPrefix.setEnabled(False)
1224 1259
1225 1260
1226 1261 #tool tip gui
1227 1262 QtGui.QToolTip.setFont(QtGui.QFont('SansSerif', 10))
1228 1263 self.treeProjectExplorer.setToolTip('Right clik to add Project or Unit Process')
1229 1264 #tool tip gui project
1230 self.proComWalk.setToolTip('Search 0: Search in format .r or pdata ,Search 1 : Search in D2009123004')
1265 self.proComWalk.setToolTip('Search 0: Search file in format .r or pdata ,Search 1 : Search file in a directory DYYYYDOY')
1231 1266 self.proComWalk.setCurrentIndex(1)
1232 1267 #tool tip gui volOp
1233 1268 self.volOpChannel.setToolTip('Example: 1,2,3,4,5')
1234 1269 self.volOpHeights.setToolTip('Example: 90,180')
1235 1270 self.volOpFilter.setToolTip('Example: 3')
1236 1271 self.volOpProfile.setToolTip('Example:0,125 ')
1237 1272 self.volOpCohInt.setToolTip('Example: 100')
1238 1273 self.volOpOk.setToolTip('If you have finish, please Ok ')
1239 1274 #tool tip gui volGraph
1240 1275 self.volGraphIdFigure.setToolTip('Example: 1')
1241 1276 self.volGraphxrange.setToolTip('Example: 10,150')
1242 1277 self.volGraphyrange.setToolTip('Example: 20,180')
1243 1278 self.volGraphOk.setToolTip('If you have finish, please Ok ')
1244 1279 #tool tip gui specOp
1245 1280 self.specOpnFFTpoints.setToolTip('Example: 100')
1246 1281 self.specOpIncoherent.setToolTip('Example: 150')
1247 1282 self.specOpRemoveDC .setToolTip('Example: 1')
1248 1283
1249 1284
1250 1285 self.specOpChannel.setToolTip('Example: 1,2,3,4,5')
1251 1286 self.specOpHeights.setToolTip('Example: 90,180')
1252 1287 self.specOppairsList.setToolTip('Example: (0,1),(2,3)')
1253 1288 #tool tip gui specGraph
1254 1289 self.specGraphIdFigure.setToolTip('Example: 2')
1255 1290 self.specGraphWinTitle.setToolTip('Example: Myplot')
1256 1291 self.specGraphChannelList.setToolTip('Example: Myplot')
1257 1292 self.specGgraphxrange.setToolTip('Example: 10,150')
1258 1293 self.specGgraphyrange.setToolTip('Example: 20,160')
1259 1294 self.specGgraphzrange.setToolTip('Example: 30,170')
1260 1295
1261 1296 self.specGraphPrefix.setToolTip('Example: figure')
1262 1297
1263 1298
1264 1299 class UnitProcess(QMainWindow, Ui_UnitProcess):
1265 1300 """
1266 1301 Class documentation goes here.
1267 1302 """
1268 1303 closed=pyqtSignal()
1269 1304 create= False
1270 1305 def __init__(self, parent = None):
1271 1306 """
1272 1307 Constructor
1273 1308 """
1274 1309 QMainWindow.__init__(self, parent)
1275 1310 self.setupUi(self)
1276 1311 self.getFromWindow=None
1277 1312 self.getfromWindowList=[]
1278 1313 self.dataTypeProject=None
1279 1314
1280 1315 self.listUP=None
1281 1316
1282 1317 @pyqtSignature("")
1283 1318 def on_unitPokbut_clicked(self):
1284 1319 """
1285 1320 Slot documentation goes here.
1286 1321 """
1287 1322 self.create =True
1288 1323 self.getFromWindow=self.getfromWindowList[int(self.comboInputBox.currentIndex())]
1289 1324 #self.nameofUP= str(self.nameUptxt.text())
1290 1325 self.typeofUP= str(self.comboTypeBox.currentText())
1291 1326 self.close()
1292 1327
1293 1328
1294 1329 @pyqtSignature("")
1295 1330 def on_unitPcancelbut_clicked(self):
1296 1331 """
1297 1332 Slot documentation goes here.
1298 1333 """
1299 1334 self.create=False
1300 1335 self.close()
1301 1336
1302 1337 def loadTotalList(self):
1303 1338 self.comboInputBox.clear()
1304 1339 for i in self.getfromWindowList:
1305 1340
1306 1341 name=i.getElementName()
1307 1342 if name=='Project':
1308 1343 id= i.id
1309 1344 name=i.name
1310 1345 if self.dataTypeProject=='Voltage':
1311 1346 self.comboTypeBox.clear()
1312 1347 self.comboTypeBox.addItem("Voltage")
1313 1348
1314 1349 if self.dataTypeProject=='Spectra':
1315 1350 self.comboTypeBox.clear()
1316 1351 self.comboTypeBox.addItem("Spectra")
1317 1352 self.comboTypeBox.addItem("Correlation")
1318 1353
1319 1354 if name=='ProcUnit':
1320 1355 id=int(i.id)-1
1321 1356 name=i.datatype
1322 1357 if name == 'Voltage':
1323 1358 self.comboTypeBox.clear()
1324 1359 self.comboTypeBox.addItem("Spectra")
1325 1360 self.comboTypeBox.addItem("Correlation")
1326 1361 if name == 'Spectra':
1327 1362 self.comboTypeBox.clear()
1328 1363 self.comboTypeBox.addItem("Spectra")
1329 1364 self.comboTypeBox.addItem("Correlation")
1330 1365
1331 1366
1332 1367 self.comboInputBox.addItem(str(name))
1333 1368 #self.comboInputBox.addItem(str(name)+str(id))
1334 1369
1335 1370 def closeEvent(self, event):
1336 1371 self.closed.emit()
1337 1372 event.accept() No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now