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