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