This diff has been collapsed as it changes many lines, (773 lines changed) Show them Hide them | |||||
@@ -1,27 +1,683 | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 |
|
||||
3 | """ |
|
2 | """ | |
4 | Module implementing Window. |
|
3 | Module implementing MainWindow. | |
|
4 | #+++++++++++++++++++++INTERFAZ DE USUARIO V1.1++++++++++++++++++++++++# | |||
5 | """ |
|
5 | """ | |
6 | from PyQt4.QtCore import pyqtSignal |
|
|||
7 | from PyQt4.QtGui import QMainWindow |
|
6 | from PyQt4.QtGui import QMainWindow | |
8 | from PyQt4.QtCore import pyqtSignature |
|
7 | from PyQt4.QtCore import pyqtSignature | |
9 | from GUI.ui_window import Ui_window |
|
8 | from PyQt4.QtCore import pyqtSignal | |
|
9 | from PyQt4 import QtCore | |||
|
10 | from PyQt4 import QtGui | |||
|
11 | from timeconversions import Doy2Date | |||
|
12 | from modelProperties import treeModel | |||
|
13 | from viewer.ui_unitprocess import Ui_UnitProcess | |||
|
14 | from viewer.ui_window import Ui_window | |||
|
15 | from viewer.ui_mainwindow import Ui_MainWindow | |||
|
16 | from viewer.ui_workspace import Ui_Workspace | |||
|
17 | from viewer.ui_initwindow import Ui_InitWindow | |||
|
18 | ||||
|
19 | from controller import Project,ReadUnitConf,ProcUnitConf,OperationConf,ParameterConf | |||
|
20 | import os | |||
|
21 | ||||
|
22 | HORIZONTAL_HEADERS = ("ITEM :"," DATOS : " ) | |||
10 |
|
23 | |||
11 | #closed=pyqtSignal() |
|
24 | HORIZONTAL = ("RAMA :",) | |
|
25 | ||||
|
26 | class MainWindow(QMainWindow, Ui_MainWindow): | |||
|
27 | ||||
|
28 | nop=None | |||
|
29 | ||||
|
30 | __projObjDict = {} | |||
|
31 | __arbolDict = {} | |||
12 |
|
32 | |||
13 | class Window(QMainWindow, Ui_window): |
|
33 | """ | |
|
34 | Class documentation goes here. | |||
|
35 | #*##################VENTANA CUERPO DEL PROGRAMA#################### | |||
|
36 | """ | |||
|
37 | def __init__(self, parent = None): | |||
|
38 | """ | |||
|
39 | Constructor | |||
|
40 | """ | |||
|
41 | print "Inicio de Programa Interfaz Gráfica" | |||
|
42 | QMainWindow.__init__(self, parent) | |||
|
43 | self.setupUi(self) | |||
|
44 | ||||
|
45 | self.online=0 | |||
|
46 | self.datatype=0 | |||
|
47 | self.variableList=[] | |||
|
48 | ||||
|
49 | self.proObjList=[] | |||
|
50 | self.idp=0 | |||
|
51 | self.projectName=0 | |||
|
52 | self.description=0 | |||
|
53 | self.namepTree=0 | |||
|
54 | self.valuep=0 | |||
|
55 | ||||
|
56 | self.upObjList= [] | |||
|
57 | self.upn=0 | |||
|
58 | self.upName=0 | |||
|
59 | self.upType=0 | |||
|
60 | self.uporProObjRecover=0 | |||
|
61 | ||||
|
62 | ||||
|
63 | self.readUnitConfObjList=[] | |||
|
64 | ||||
|
65 | self.upObjVolList=[] | |||
|
66 | self.upobjSpecList=[] | |||
|
67 | ||||
|
68 | ||||
|
69 | self.operObjList=[] | |||
|
70 | ||||
|
71 | self.projectWindow=None | |||
|
72 | self.configUP=None | |||
|
73 | ||||
|
74 | self.projectObj=None | |||
|
75 | self.readUnitConfObj=None | |||
|
76 | self.procUnitConfObj0=None | |||
|
77 | self.opObj10=None | |||
|
78 | self.opObj12=None | |||
|
79 | ||||
|
80 | ||||
|
81 | self.setParam() | |||
|
82 | ||||
|
83 | #++++++++++++++++++NEW PROPERTIES+++++++++++++++++# | |||
|
84 | QtGui.QToolTip.setFont(QtGui.QFont('SansSerif', 10)) | |||
|
85 | self.addpBtn.setToolTip('Add_New_Project') | |||
|
86 | self.addUnitProces.setToolTip('Add_New_Processing_Unit') | |||
|
87 | ||||
|
88 | #++++++++++++++++++NEW PROPERTIES+++++++++++++++++# | |||
|
89 | self.model = QtGui.QStandardItemModel() | |||
|
90 | self.treeView.setModel(self.model) | |||
|
91 | self.treeView.clicked.connect(self.clickFunctiontree) | |||
|
92 | self.treeView.expandAll() | |||
|
93 | #self.treeView.clicked.connect(self.treefunction1) | |||
|
94 | ||||
|
95 | def getNumberofProject(self): | |||
|
96 | # for i in self.proObjList: | |||
|
97 | # print i | |||
|
98 | return self.proObjList | |||
|
99 | # for i in self.proObjList: | |||
|
100 | # print i | |||
|
101 | ||||
|
102 | def setParam(self): | |||
|
103 | self.dataPathTxt.setText('C:\data') | |||
|
104 | self.numberChannelopVol.setEnabled(False) | |||
|
105 | self.lineHeighProfileTxtopVol.setEnabled(False) | |||
|
106 | self.numberIntegration.setEnabled(False) | |||
|
107 | self.valuenFFTPointOpSpec.setEnabled(False) | |||
|
108 | self.lineProfileSelecopVolCEB.setEnabled(False) | |||
|
109 | ||||
|
110 | ||||
|
111 | def clickFunctiontree(self,index): | |||
|
112 | indexclick= index.model().itemFromIndex(index).text() | |||
|
113 | #print indexclick | |||
|
114 | NumofPro=indexclick[8:10] | |||
|
115 | self.valuep=NumofPro | |||
|
116 | #print self.valuep | |||
|
117 | NameofPro=indexclick[0:7] | |||
|
118 | self.namepTree=NameofPro | |||
|
119 | #print self.namepTree | |||
|
120 | ||||
|
121 | ||||
|
122 | @pyqtSignature("") | |||
|
123 | def on_addpBtn_clicked(self): | |||
|
124 | """ | |||
|
125 | Llama al metodo addProject. | |||
|
126 | """ | |||
|
127 | print "En este nivel se abre el window" | |||
|
128 | ||||
|
129 | ||||
|
130 | self.addProject() | |||
|
131 | ||||
|
132 | def addProject(self): | |||
|
133 | """ | |||
|
134 | Muestra una | |||
|
135 | """ | |||
|
136 | ||||
|
137 | self.projectWindow = ProjectWindow(self) | |||
|
138 | self.projectWindow.show() | |||
|
139 | ||||
|
140 | #Al cerrar la venta de proyecto se ejecutara el metodo createProject | |||
|
141 | self.projectWindow.closed.connect(self.createProject) | |||
|
142 | ||||
|
143 | def createProject(self): | |||
|
144 | """ | |||
|
145 | Crea un nuevo proyecto del tipo Controller.Project() y lo adiciona al diccionario | |||
|
146 | self.__projectDict. | |||
|
147 | """ | |||
|
148 | ||||
|
149 | if not self.projectWindow.create: | |||
|
150 | return | |||
|
151 | ||||
|
152 | self.projectName = self.projectWindow.name | |||
|
153 | self.description = self.projectWindow.description | |||
|
154 | ||||
|
155 | print "En este nivel se debe crear el proyecto,id,nombre,desc" | |||
|
156 | #+++++Creacion del Objeto Controller-XML++++++++++# | |||
|
157 | self.idp += 1 | |||
|
158 | self.projectObj = Project() | |||
|
159 | ||||
|
160 | id=int(self.idp) | |||
|
161 | name=str(self.projectName) | |||
|
162 | desc=str(self.description) | |||
|
163 | ||||
|
164 | self.projectObj.setup(id = id, name=name, description=desc) | |||
|
165 | self.__projObjDict[id] = self.projectObj | |||
|
166 | self.proObjList.append(self.projectObj) | |||
|
167 | ||||
|
168 | self.parentItem = self.model.invisibleRootItem() | |||
|
169 | self.__arbolDict[id] = QtGui.QStandardItem(QtCore.QString("Project %0").arg(self.idp)) | |||
|
170 | ||||
|
171 | self.parentItem.appendRow(self.__arbolDict[projectObj.id]) | |||
|
172 | ||||
|
173 | #+++++++++++++++++++LISTA DE PROYECTO++++++++++++++++++++++++++++# | |||
|
174 | ||||
|
175 | ||||
|
176 | # self.parentItem=self.projectObj.arbol | |||
|
177 | # self.loadProjects() | |||
|
178 | ||||
|
179 | print "Porfavor ingrese los parámetros de configuracion del Proyecto" | |||
|
180 | ||||
|
181 | def loadProjects(self): | |||
|
182 | self.proConfCmbBox.clear() | |||
|
183 | for i in self.__projObjDict.values(): | |||
|
184 | self.proConfCmbBox.addItem("Project"+str(i.id)) | |||
|
185 | ||||
|
186 | @pyqtSignature("int") | |||
|
187 | def on_dataTypeCmbBox_activated(self,index): | |||
|
188 | self.dataFormatTxt.setReadOnly(True) | |||
|
189 | if index==0: | |||
|
190 | self.datatype='Voltage' | |||
|
191 | elif index==1: | |||
|
192 | self.datatype='Spectra' | |||
|
193 | else : | |||
|
194 | self.datatype='' | |||
|
195 | self.dataFormatTxt.setReadOnly(False) | |||
|
196 | self.dataFormatTxt.setText(self.datatype) | |||
|
197 | ||||
|
198 | def existDir(self, var_dir): | |||
|
199 | """ | |||
|
200 | METODO PARA VERIFICAR SI LA RUTA EXISTE-VAR_DIR | |||
|
201 | VARIABLE DIRECCION | |||
|
202 | """ | |||
|
203 | if os.path.isdir(var_dir): | |||
|
204 | return True | |||
|
205 | else: | |||
|
206 | self.textEdit.append("Incorrect path:" + str(var_dir)) | |||
|
207 | return False | |||
|
208 | ||||
|
209 | def loadDays(self): | |||
|
210 | """ | |||
|
211 | METODO PARA CARGAR LOS DIAS | |||
|
212 | """ | |||
|
213 | self.variableList=[] | |||
|
214 | self.starDateCmbBox.clear() | |||
|
215 | self.endDateCmbBox.clear() | |||
|
216 | ||||
|
217 | Dirlist = os.listdir(self.dataPath) | |||
|
218 | Dirlist.sort() | |||
|
219 | ||||
|
220 | for a in range(0, len(Dirlist)): | |||
|
221 | fname= Dirlist[a] | |||
|
222 | Doy=fname[5:8] | |||
|
223 | fname = fname[1:5] | |||
|
224 | print fname | |||
|
225 | fecha=Doy2Date(int(fname),int(Doy)) | |||
|
226 | fechaList=fecha.change2date() | |||
|
227 | #print fechaList[0] | |||
|
228 | Dirlist[a]=fname+"/"+str(fechaList[0])+"/"+str(fechaList[1]) | |||
|
229 | #+"-"+ fechaList[0]+"-"+fechaList[1] | |||
|
230 | ||||
|
231 | #---------------AQUI TIENE QUE SER MODIFICADO--------# | |||
|
232 | ||||
|
233 | #Se cargan las listas para seleccionar StartDay y StopDay (QComboBox) | |||
|
234 | for i in range(0, (len(Dirlist))): | |||
|
235 | self.variableList.append(Dirlist[i]) | |||
|
236 | ||||
|
237 | for i in self.variableList: | |||
|
238 | self.starDateCmbBox.addItem(i) | |||
|
239 | self.endDateCmbBox.addItem(i) | |||
|
240 | self.endDateCmbBox.setCurrentIndex(self.starDateCmbBox.count()-1) | |||
|
241 | ||||
|
242 | self.getsubList() | |||
|
243 | self.dataOkBtn.setEnabled(True) | |||
|
244 | ||||
|
245 | def getsubList(self): | |||
|
246 | """ | |||
|
247 | OBTIENE EL RANDO DE LAS FECHAS SELECCIONADAS | |||
|
248 | """ | |||
|
249 | self.subList=[] | |||
|
250 | for i in self.variableList[self.starDateCmbBox.currentIndex():self.starDateCmbBox.currentIndex() + self.endDateCmbBox.currentIndex()+1]: | |||
|
251 | self.subList.append(i) | |||
|
252 | ||||
|
253 | @pyqtSignature("") | |||
|
254 | def on_dataPathBrowse_clicked(self): | |||
|
255 | """ | |||
|
256 | OBTENCION DE LA RUTA DE DATOS | |||
|
257 | """ | |||
|
258 | self.dataPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) | |||
|
259 | self.dataPathTxt.setText(self.dataPath) | |||
|
260 | self.statusDpath=self.existDir(self.dataPath) | |||
|
261 | self.loadDays() | |||
|
262 | ||||
|
263 | @pyqtSignature("int") | |||
|
264 | def on_starDateCmbBox_activated(self, index): | |||
|
265 | """ | |||
|
266 | SELECCION DEL RANGO DE FECHAS -STAR DATE | |||
|
267 | """ | |||
|
268 | var_StopDay_index=self.endDateCmbBox.count() - self.endDateCmbBox.currentIndex() | |||
|
269 | self.endDateCmbBox.clear() | |||
|
270 | for i in self.variableList[index:]: | |||
|
271 | self.endDateCmbBox.addItem(i) | |||
|
272 | self.endDateCmbBox.setCurrentIndex(self.endDateCmbBox.count() - var_StopDay_index) | |||
|
273 | self.getsubList() | |||
|
274 | ||||
|
275 | @pyqtSignature("int") | |||
|
276 | def on_endDateCmbBox_activated(self, index): | |||
|
277 | """ | |||
|
278 | SELECCION DEL RANGO DE FECHAS-END DATE | |||
|
279 | """ | |||
|
280 | var_StartDay_index=self.starDateCmbBox.currentIndex() | |||
|
281 | var_end_index = self.endDateCmbBox.count() - index | |||
|
282 | self.starDateCmbBox.clear() | |||
|
283 | for i in self.variableList[:len(self.variableList) - var_end_index + 1]: | |||
|
284 | self.starDateCmbBox.addItem(i) | |||
|
285 | self.starDateCmbBox.setCurrentIndex(var_StartDay_index) | |||
|
286 | self.getsubList() #Se carga var_sublist[] con el rango de las fechas seleccionadas | |||
|
287 | ||||
|
288 | @pyqtSignature("int") | |||
|
289 | def on_readModeCmBox_activated(self, p0): | |||
|
290 | """ | |||
|
291 | Slot documentation goes here. | |||
|
292 | """ | |||
|
293 | if p0==0: | |||
|
294 | self.online=0 | |||
|
295 | elif p0==1: | |||
|
296 | self.online=1 | |||
|
297 | ||||
|
298 | @pyqtSignature("") | |||
|
299 | def on_dataOkBtn_clicked(self): | |||
|
300 | """ | |||
|
301 | Slot documentation goes here. | |||
|
302 | """ | |||
|
303 | print "En este nivel se pasa el tipo de dato con el que se trabaja,path,startDate,endDate,startTime,endTime,online" | |||
|
304 | ||||
|
305 | projectObj=self.proObjList[int(self.proConfCmbBox.currentIndex())] | |||
|
306 | datatype=str(self.dataTypeCmbBox.currentText()) | |||
|
307 | path=str(self.dataPathTxt.text()) | |||
|
308 | online=int(self.online) | |||
|
309 | starDate=str(self.starDateCmbBox.currentText()) | |||
|
310 | endDate=str(self.endDateCmbBox.currentText()) | |||
|
311 | ||||
|
312 | ||||
|
313 | self.readUnitConfObj = projectObj.addReadUnit(datatype=datatype, | |||
|
314 | path=path, | |||
|
315 | startDate=starDate, | |||
|
316 | endDate=endDate, | |||
|
317 | startTime='06:10:00', | |||
|
318 | endTime='23:59:59', | |||
|
319 | online=online) | |||
|
320 | ||||
|
321 | self.readUnitConfObjList.append(self.readUnitConfObj) | |||
|
322 | ||||
|
323 | print "self.readUnitConfObj.getId",self.readUnitConfObj.getId(),datatype,path,starDate,endDate,online | |||
|
324 | ||||
|
325 | ||||
|
326 | self.model_2=treeModel() | |||
|
327 | ||||
|
328 | self.model_2.setParams(name=projectObj.name+str(projectObj.id), | |||
|
329 | directorio=path, | |||
|
330 | workspace="C:\\WorkspaceGUI", | |||
|
331 | remode=str(self.readModeCmBox.currentText()), | |||
|
332 | dataformat=datatype, | |||
|
333 | date=str(starDate)+"-"+str(endDate), | |||
|
334 | initTime='06:10:00', | |||
|
335 | endTime='23:59:59', | |||
|
336 | timezone="Local" , | |||
|
337 | Summary="test de prueba") | |||
|
338 | self.model_2.arbol() | |||
|
339 | self.treeView_2.setModel(self.model_2) | |||
|
340 | self.treeView_2.expandAll() | |||
|
341 | ||||
|
342 | ||||
|
343 | @pyqtSignature("") | |||
|
344 | def on_addUnitProces_clicked(self): | |||
|
345 | """ | |||
|
346 | Slot documentation goes here. | |||
|
347 | """ | |||
|
348 | # print "En este nivel se adiciona una rama de procesamiento, y se le concatena con el id" | |||
|
349 | # self.procUnitConfObj0 = self.projectObj.addProcUnit(datatype='Voltage', inputId=self.readUnitConfObj.getId()) | |||
|
350 | self.showUp() | |||
|
351 | ||||
|
352 | def showUp(self): | |||
|
353 | ||||
|
354 | self.configUP=UnitProcess(self) | |||
|
355 | for i in self.proObjList: | |||
|
356 | self.configUP.getfromWindowList.append(i) | |||
|
357 | #print i | |||
|
358 | for i in self.upObjList: | |||
|
359 | self.configUP.getfromWindowList.append(i) | |||
|
360 | self.configUP.loadTotalList() | |||
|
361 | self.configUP.show() | |||
|
362 | self.configUP.unitPsavebut.clicked.connect(self.reciveUPparameters) | |||
|
363 | self.configUP.closed.connect(self.createUP) | |||
|
364 | ||||
|
365 | def reciveUPparameters(self): | |||
|
366 | ||||
|
367 | self.uporProObjRecover,self.upType=self.configUP.almacena() | |||
|
368 | ||||
|
369 | ||||
|
370 | def createUP(self): | |||
|
371 | print "En este nivel se adiciona una rama de procesamiento, y se le concatena con el id" | |||
|
372 | projectObj=self.proObjList[int(self.proConfCmbBox.currentIndex())] | |||
|
373 | ||||
|
374 | datatype=str(self.upType) | |||
|
375 | uporprojectObj=self.uporProObjRecover | |||
|
376 | #+++++++++++LET FLY+++++++++++# | |||
|
377 | if uporprojectObj.getElementName()=='ProcUnit': | |||
|
378 | inputId=uporprojectObj.getId() | |||
|
379 | elif uporprojectObj.getElementName()=='Project': | |||
|
380 | inputId=self.readUnitConfObjList[uporprojectObj.id-1].getId() | |||
|
381 | ||||
|
382 | ||||
|
383 | self.procUnitConfObj1 = projectObj.addProcUnit(datatype=datatype, inputId=inputId) | |||
|
384 | self.upObjList.append(self.procUnitConfObj1) | |||
|
385 | print inputId | |||
|
386 | print self.procUnitConfObj1.getId() | |||
|
387 | self.parentItem=uporprojectObj.arbol | |||
|
388 | self.numbertree=int(self.procUnitConfObj1.getId())-1 | |||
|
389 | self.procUnitConfObj1.arbol=QtGui.QStandardItem(QtCore.QString(datatype +"%1 ").arg(self.numbertree)) | |||
|
390 | self.parentItem.appendRow(self.procUnitConfObj1.arbol) | |||
|
391 | self.parentItem=self.procUnitConfObj1.arbol | |||
|
392 | self.loadUp() | |||
|
393 | self.treeView.expandAll() | |||
|
394 | ||||
|
395 | def loadUp(self): | |||
|
396 | self.addOpUpselec.clear() | |||
|
397 | self.addOpSpecUpselec.clear() | |||
|
398 | for i in self.upObjList: | |||
|
399 | if i.datatype=='Voltage': | |||
|
400 | self.upObjVolList.append(i) | |||
|
401 | name=i.getElementName() | |||
|
402 | id=int(i.id)-1 | |||
|
403 | self.addOpUpselec.addItem(name+str(id)) | |||
|
404 | if i.datatype=='Spectra': | |||
|
405 | self.upobjSpecList.append(i) | |||
|
406 | name=i.getElementName() | |||
|
407 | id=int(i.id)-1 | |||
|
408 | self.addOpSpecUpselec.addItem(name+str(id)) | |||
|
409 | ||||
|
410 | self.resetopVolt() | |||
|
411 | self.resetopSpec() | |||
|
412 | ||||
|
413 | ||||
|
414 | @pyqtSignature("int") | |||
|
415 | def on_selecChannelopVolCEB_stateChanged(self, p0): | |||
|
416 | """ | |||
|
417 | Slot documentation goes here. | |||
|
418 | """ | |||
|
419 | if p0==2: | |||
|
420 | self.numberChannelopVol.setEnabled(True) | |||
|
421 | upProcessSelect=self.upObjVolList[int(self.addOpUpselec.currentIndex())] | |||
|
422 | opObj10=upProcessSelect.addOperation(name='selectChannels') | |||
|
423 | print opObj10.id | |||
|
424 | self.operObjList.append(opObj10) | |||
|
425 | print " Ingresa seleccion de Canales" | |||
|
426 | if p0==0: | |||
|
427 | print " deshabilitado" | |||
|
428 | ||||
|
429 | @pyqtSignature("int") | |||
|
430 | def on_selecHeighopVolCEB_stateChanged(self, p0): | |||
|
431 | """ | |||
|
432 | Slot documentation goes here. | |||
|
433 | """ | |||
|
434 | if p0==2: | |||
|
435 | self.lineHeighProfileTxtopVol.setEnabled(True) | |||
|
436 | upProcessSelect=self.upObjVolList[int(self.addOpUpselec.currentIndex())] | |||
|
437 | opObj10=upProcessSelect.addOperation(name='selectHeights') | |||
|
438 | print opObj10.id | |||
|
439 | self.operObjList.append(opObj10) | |||
|
440 | print " Select Type of Profile" | |||
|
441 | if p0==0: | |||
|
442 | print " deshabilitado" | |||
|
443 | ||||
|
444 | ||||
|
445 | @pyqtSignature("int") | |||
|
446 | def on_profileSelecopVolCEB_stateChanged(self, p0): | |||
|
447 | """ | |||
|
448 | Slot documentation goes here. | |||
|
449 | """ | |||
|
450 | if p0==2: | |||
|
451 | self.lineProfileSelecopVolCEB.setEnabled(True) | |||
|
452 | upProcessSelect=self.upObjVolList[int(self.addOpUpselec.currentIndex())] | |||
|
453 | opObj10=upProcessSelect.addOperation(name='ProfileSelector', optype='other') | |||
|
454 | print opObj10.id | |||
|
455 | self.operObjList.append(opObj10) | |||
|
456 | print " Select Type of Profile" | |||
|
457 | if p0==0: | |||
|
458 | print " deshabilitado" | |||
|
459 | ||||
|
460 | ||||
|
461 | @pyqtSignature("int") | |||
|
462 | def on_coherentIntegrationCEB_stateChanged(self, p0): | |||
|
463 | """ | |||
|
464 | Slot documentation goes here. | |||
|
465 | """ | |||
|
466 | if p0==2: | |||
|
467 | self.numberIntegration.setEnabled(True) | |||
|
468 | upProcessSelect=self.upObjVolList[int(self.addOpUpselec.currentIndex())] | |||
|
469 | opObj10=upProcessSelect.addOperation(name='CohInt', optype='other') | |||
|
470 | print opObj10.id | |||
|
471 | self.operObjList.append(opObj10) | |||
|
472 | print "Choose number of Cohint" | |||
|
473 | if p0==0: | |||
|
474 | print " deshabilitado" | |||
|
475 | self.numberChannelopVol.setEnabled(False) | |||
|
476 | ||||
|
477 | def resetopVolt(self): | |||
|
478 | self.selecChannelopVolCEB.setChecked(False) | |||
|
479 | self.selecHeighopVolCEB.setChecked(False) | |||
|
480 | self.coherentIntegrationCEB.setChecked(False) | |||
|
481 | self.profileSelecopVolCEB.setChecked(False) | |||
|
482 | #self.selecChannelopVolCEB.setEnabled(False) | |||
|
483 | self.lineHeighProfileTxtopVol.clear() | |||
|
484 | self.lineProfileSelecopVolCEB.clear() | |||
|
485 | self.numberChannelopVol.clear() | |||
|
486 | self.numberIntegration.clear() | |||
|
487 | ||||
|
488 | ||||
|
489 | @pyqtSignature("") | |||
|
490 | def on_dataopVolOkBtn_clicked(self): | |||
|
491 | """ | |||
|
492 | Slot documentation goes here. | |||
|
493 | """ | |||
|
494 | if self.selecChannelopVolCEB.isChecked(): | |||
|
495 | for i in self.operObjList: | |||
|
496 | if i.name=='selectChannels': | |||
|
497 | value=self.numberChannelopVol.text() | |||
|
498 | i.addParameter(name='channelList', value=value, format='intlist') | |||
|
499 | ||||
|
500 | ||||
|
501 | print "channel" | |||
|
502 | ||||
|
503 | if self.selecHeighopVolCEB.isChecked(): | |||
|
504 | for i in self.operObjList: | |||
|
505 | if i.name=='selectHeights' : | |||
|
506 | value=self.lineHeighProfileTxtopVol.text() | |||
|
507 | valueList=value.split(',') | |||
|
508 | i.addParameter(name='minHei', value=valueList[0], format='float') | |||
|
509 | i.addParameter(name='maxHei', value=valueList[1], format='float') | |||
|
510 | ||||
|
511 | print "height" | |||
|
512 | ||||
|
513 | ||||
|
514 | if self.selecHeighopVolCEB.isChecked(): | |||
|
515 | for i in self.operObjList: | |||
|
516 | if i.name=='ProfileSelector' : | |||
|
517 | value=self.lineProfileSelecopVolCEB.text() | |||
|
518 | i.addParameter(name='ProfileSelector', value=value, format='intlist') | |||
|
519 | ||||
|
520 | ||||
|
521 | ||||
|
522 | if self.coherentIntegrationCEB.isChecked(): | |||
|
523 | for i in self.operObjList: | |||
|
524 | if i.name=='CohInt': | |||
|
525 | value=self.numberIntegration.text() | |||
|
526 | i.addParameter(name='n', value=value, format='int') | |||
|
527 | ||||
|
528 | ||||
|
529 | @pyqtSignature("int") | |||
|
530 | def on_nFFTPointOpSpecCEB_stateChanged(self, p0): | |||
|
531 | """ | |||
|
532 | Slot documentation goes here. | |||
|
533 | """ | |||
|
534 | if p0==2: | |||
|
535 | self.valuenFFTPointOpSpec.setEnabled(True) | |||
|
536 | print " nFFTPoint" | |||
|
537 | if p0==0: | |||
|
538 | print " deshabilitado" | |||
|
539 | ||||
|
540 | ||||
|
541 | def resetopSpec(self): | |||
|
542 | self.nFFTPointOpSpecCEB.setChecked(False) | |||
|
543 | ||||
|
544 | self.valuenFFTPointOpSpec.clear() | |||
|
545 | ||||
|
546 | ||||
|
547 | @pyqtSignature("") | |||
|
548 | def on_dataopSpecOkBtn_clicked(self): | |||
|
549 | """ | |||
|
550 | Slot documentation goes here. | |||
|
551 | """ | |||
|
552 | print "Añadimos operaciones Spectra,nchannels,value,format" | |||
|
553 | if self.nFFTPointOpSpecCEB.isChecked(): | |||
|
554 | upProcessSelect=self.upobjSpecList[int(self.addOpSpecUpselec.currentIndex())] | |||
|
555 | value=self.valuenFFTPointOpSpec.text() | |||
|
556 | upProcessSelect.addParameter(name='nFFTPoints',value=value,format='int') | |||
|
557 | ||||
|
558 | @pyqtSignature("int") | |||
|
559 | def on_SpectraPlotGraphCEB_stateChanged(self, p0): | |||
|
560 | """ | |||
|
561 | Slot documentation goes here. | |||
|
562 | """ | |||
|
563 | if p0==2: | |||
|
564 | upProcessSelect=self.upobjSpecList[int(self.addOpSpecUpselec.currentIndex())] | |||
|
565 | opObj10=upProcessSelect.addOperation(name='SpectraPlot',optype='other') | |||
|
566 | print opObj10.id | |||
|
567 | self.operObjList.append(opObj10) | |||
|
568 | ||||
|
569 | if p0==0: | |||
|
570 | print " deshabilitado" | |||
|
571 | ||||
|
572 | @pyqtSignature("int") | |||
|
573 | def on_CrossSpectraPlotGraphceb_stateChanged(self, p0): | |||
|
574 | """ | |||
|
575 | Slot documentation goes here. | |||
|
576 | """ | |||
|
577 | if p0==2: | |||
|
578 | upProcessSelect=self.upobjSpecList[int(self.addOpSpecUpselec.currentIndex())] | |||
|
579 | opObj10=upProcessSelect.addOperation(name='CrossSpectraPlot',optype='other') | |||
|
580 | print opObj10.id | |||
|
581 | self.operObjList.append(opObj10) | |||
|
582 | if p0==0: | |||
|
583 | print " deshabilitado" | |||
|
584 | ||||
|
585 | @pyqtSignature("int") | |||
|
586 | def on_RTIPlotGraphCEB_stateChanged(self, p0): | |||
|
587 | """ | |||
|
588 | Slot documentation goes here. | |||
|
589 | """ | |||
|
590 | if p0==2: | |||
|
591 | upProcessSelect=self.upobjSpecList[int(self.addOpSpecUpselec.currentIndex())] | |||
|
592 | opObj10=upProcessSelect.addOperation(name='RTIPlot',optype='other') | |||
|
593 | print opObj10.id | |||
|
594 | self.operObjList.append(opObj10) | |||
|
595 | if p0==0: | |||
|
596 | print " deshabilitado" | |||
|
597 | ||||
|
598 | ||||
|
599 | def resetgraphSpec(self): | |||
|
600 | self.SpectraPlotGraphCEB.setChecked(False) | |||
|
601 | self.CrossSpectraPlotGraphceb.setChecked(False) | |||
|
602 | self.RTIPlotGraphCEB.setChecked(False) | |||
|
603 | ||||
|
604 | @pyqtSignature("") | |||
|
605 | def on_dataGraphSpecOkBtn_clicked(self): | |||
|
606 | """ | |||
|
607 | Slot documentation goes here. | |||
|
608 | """ | |||
|
609 | print "Graficar Spec op" | |||
|
610 | if self.SpectraPlotGraphCEB.isChecked(): | |||
|
611 | for i in self.operObjList: | |||
|
612 | if i.name=='SpectraPlot': | |||
|
613 | i.addParameter(name='idfigure', value='1', format='int') | |||
|
614 | i.addParameter(name='wintitle', value='SpectraPlot0', format='str') | |||
|
615 | i.addParameter(name='zmin', value='40', format='int') | |||
|
616 | i.addParameter(name='zmax', value='90', format='int') | |||
|
617 | i.addParameter(name='showprofile', value='1', format='int') | |||
|
618 | ||||
|
619 | if self.CrossSpectraPlotGraphceb.isChecked(): | |||
|
620 | for i in self.operObjList: | |||
|
621 | if i.name=='CrossSpectraPlot' : | |||
|
622 | i.addParameter(name='idfigure', value='2', format='int') | |||
|
623 | i.addParameter(name='wintitle', value='CrossSpectraPlot', format='str') | |||
|
624 | i.addParameter(name='zmin', value='40', format='int') | |||
|
625 | i.addParameter(name='zmax', value='90', format='int') | |||
|
626 | ||||
|
627 | if self.RTIPlotGraphCEB.isChecked(): | |||
|
628 | for i in self.operObjList: | |||
|
629 | if i.name=='RTIPlot': | |||
|
630 | i.addParameter(name='n', value='2', format='int') | |||
|
631 | i.addParameter(name='overlapping', value='1', format='int') | |||
|
632 | ||||
|
633 | @pyqtSignature("") | |||
|
634 | def on_actionguardarObj_triggered(self): | |||
|
635 | """ | |||
|
636 | GUARDAR EL ARCHIVO DE CONFIGURACION XML | |||
|
637 | """ | |||
|
638 | if self.idp==1: | |||
|
639 | self.valuep=1 | |||
|
640 | ||||
|
641 | print "Escribiendo el archivo XML" | |||
|
642 | filename="C:\\WorkspaceGUI\\CONFIG"+str(self.valuep)+".xml" | |||
|
643 | self.projectObj=self.proObjList[int(self.valuep)-1] | |||
|
644 | self.projectObj.writeXml(filename) | |||
|
645 | ||||
|
646 | ||||
|
647 | class BasicWindow(MainWindow): | |||
|
648 | ||||
|
649 | def __init__(self): | |||
|
650 | pass | |||
|
651 | ||||
|
652 | class AdvancedWindow(MainWindow): | |||
|
653 | ||||
|
654 | def __init__(self): | |||
|
655 | pass | |||
|
656 | ||||
|
657 | ||||
|
658 | ||||
|
659 | class ProjectWindow(QMainWindow, Ui_window): | |||
14 | """ |
|
660 | """ | |
15 | Class documentation goes here. |
|
661 | Class documentation goes here. | |
16 | """ |
|
662 | """ | |
17 | closed=pyqtSignal() |
|
663 | closed = pyqtSignal() | |
|
664 | ||||
|
665 | create = False | |||
|
666 | name = None | |||
|
667 | description = None | |||
|
668 | ||||
|
669 | ||||
|
670 | ||||
18 | def __init__(self, parent = None): |
|
671 | def __init__(self, parent = None): | |
19 | """ |
|
672 | """ | |
20 | Constructor |
|
673 | Constructor | |
21 | """ |
|
674 | """ | |
22 | QMainWindow.__init__(self, parent) |
|
675 | QMainWindow.__init__(self, parent) | |
23 | self.setupUi(self) |
|
676 | self.setupUi(self) | |
24 |
self.name= |
|
677 | self.name=None | |
|
678 | ||||
|
679 | self.proyectNameLine.setText('My_name_is...') | |||
|
680 | self.descriptionTextEdit.setText('Write a description...') | |||
25 |
|
681 | |||
26 |
|
682 | |||
27 | @pyqtSignature("") |
|
683 | @pyqtSignature("") | |
@@ -31,6 +687,7 class Window(QMainWindow, Ui_window): | |||||
31 | """ |
|
687 | """ | |
32 | # TODO: not implemented yet |
|
688 | # TODO: not implemented yet | |
33 | #raise NotImplementedError |
|
689 | #raise NotImplementedError | |
|
690 | self.create = False | |||
34 | self.close() |
|
691 | self.close() | |
35 |
|
692 | |||
36 | @pyqtSignature("") |
|
693 | @pyqtSignature("") | |
@@ -38,17 +695,113 class Window(QMainWindow, Ui_window): | |||||
38 | """ |
|
695 | """ | |
39 | Slot documentation goes here. |
|
696 | Slot documentation goes here. | |
40 | """ |
|
697 | """ | |
|
698 | #self.almacena() | |||
|
699 | self.create = True | |||
|
700 | self.name = str(self.proyectNameLine.text()) | |||
|
701 | self.description = str(self.descriptionTextEdit.toPlainText()) | |||
|
702 | ||||
|
703 | self.close() | |||
|
704 | ||||
|
705 | # @pyqtSignature("") | |||
|
706 | # def on_saveButton_clicked(self): | |||
|
707 | # """ | |||
|
708 | # Slot documentation goes here. | |||
|
709 | # """ | |||
|
710 | # self.almacena() | |||
|
711 | ## self.close() | |||
|
712 | # | |||
|
713 | # def almacena(self): | |||
|
714 | # #print str(self.proyectNameLine.text()) | |||
|
715 | # self.nameproject=str(self.proyectNameLine.text()) | |||
|
716 | # self.description=str(self.descriptionTextEdit.toPlainText()) | |||
|
717 | # return self.nameproject,self.description | |||
|
718 | # | |||
|
719 | def closeEvent(self, event): | |||
|
720 | self.closed.emit() | |||
|
721 | event.accept() | |||
|
722 | ||||
|
723 | ||||
|
724 | class UnitProcess(QMainWindow, Ui_UnitProcess): | |||
|
725 | """ | |||
|
726 | Class documentation goes here. | |||
|
727 | """ | |||
|
728 | closed=pyqtSignal() | |||
|
729 | def __init__(self, parent = None): | |||
|
730 | """ | |||
|
731 | Constructor | |||
|
732 | """ | |||
|
733 | QMainWindow.__init__(self, parent) | |||
|
734 | self.setupUi(self) | |||
|
735 | self.getFromWindow=None | |||
|
736 | self.getfromWindowList=[] | |||
|
737 | ||||
|
738 | self.listUP=None | |||
|
739 | ||||
|
740 | def loadTotalList(self): | |||
|
741 | self.comboInputBox.clear() | |||
|
742 | for i in self.getfromWindowList: | |||
|
743 | name=i.getElementName() | |||
|
744 | id= i.id | |||
|
745 | if i.getElementName()=='ProcUnit': | |||
|
746 | id=int(i.id)-1 | |||
|
747 | self.comboInputBox.addItem(str(name)+str(id)) | |||
|
748 | ||||
|
749 | @pyqtSignature("QString") | |||
|
750 | def on_comboInputBox_activated(self, p0): | |||
|
751 | """ | |||
|
752 | Slot documentation goes here. | |||
|
753 | """ | |||
|
754 | ||||
41 | # TODO: not implemented yet |
|
755 | # TODO: not implemented yet | |
42 | #raise NotImplementedError |
|
756 | #raise NotImplementedError | |
43 | # self.almacena() |
|
757 | ||
|
758 | @pyqtSignature("QString") | |||
|
759 | def on_comboTypeBox_activated(self, p0): | |||
|
760 | """ | |||
|
761 | Slot documentation goes here. | |||
|
762 | """ | |||
|
763 | # TODO: not implemented yet | |||
|
764 | #raise NotImplementedError | |||
|
765 | ||||
|
766 | @pyqtSignature("") | |||
|
767 | def on_unitPokbut_clicked(self): | |||
|
768 | """ | |||
|
769 | Slot documentation goes here. | |||
|
770 | """ | |||
44 | self.close() |
|
771 | self.close() | |
45 |
|
772 | |||
|
773 | @pyqtSignature("") | |||
|
774 | def on_unitPsavebut_clicked(self): | |||
|
775 | """ | |||
|
776 | Slot documentation goes here. | |||
|
777 | """ | |||
|
778 | ||||
|
779 | print "alex" | |||
|
780 | self.almacena() | |||
|
781 | ||||
|
782 | @pyqtSignature("") | |||
|
783 | def on_unitPcancelbut_clicked(self): | |||
|
784 | """ | |||
|
785 | Slot documentation goes here. | |||
|
786 | """ | |||
|
787 | # TODO: not implemented yet | |||
|
788 | #raise NotImplementedError | |||
|
789 | self.hide() | |||
46 |
|
790 | |||
47 | def almacena(self): |
|
791 | def almacena(self): | |
48 | #print str(self.proyectNameLine.text()) |
|
792 | self.getFromWindow=self.getfromWindowList[int(self.comboInputBox.currentIndex())] | |
49 |
|
|
793 | #self.nameofUP= str(self.nameUptxt.text()) | |
|
794 | self.typeofUP= str(self.comboTypeBox.currentText()) | |||
|
795 | return self.getFromWindow,self.typeofUP | |||
50 |
|
796 | |||
51 | def closeEvent(self, event): |
|
797 | def closeEvent(self, event): | |
52 | self.closed.emit() |
|
798 | self.closed.emit() | |
53 | event.accept() |
|
799 | event.accept() | |
54 |
|
800 | |||
|
801 | ||||
|
802 | ||||
|
803 | ||||
|
804 | ||||
|
805 | ||||
|
806 | ||||
|
807 | No newline at end of file |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now