@@ -12,6 +12,8 import Queue | |||
|
12 | 12 | from collections import OrderedDict |
|
13 | 13 | from os.path import expanduser |
|
14 | 14 | from time import sleep |
|
15 | # from gevent import sleep | |
|
16 | ||
|
15 | 17 | import ast |
|
16 | 18 | |
|
17 | 19 | from PyQt4.QtGui import QMainWindow |
@@ -19,11 +21,14 from PyQt4.QtCore import pyqtSignature | |||
|
19 | 21 | from PyQt4.QtCore import pyqtSignal |
|
20 | 22 | from PyQt4 import QtCore |
|
21 | 23 | from PyQt4 import QtGui |
|
24 | # from PyQt4.QtCore import QThread | |
|
25 | # from PyQt4.QtCore import QObject, SIGNAL | |
|
22 | 26 | |
|
23 | 27 | from schainpy.gui.viewer.ui_unitprocess import Ui_UnitProcess |
|
24 | 28 | from schainpy.gui.viewer.ui_ftp import Ui_Ftp |
|
25 | 29 | from schainpy.gui.viewer.ui_mainwindow import Ui_BasicWindow |
|
26 |
from schainpy.controller |
|
|
30 | from schainpy.controller_api import ControllerThread | |
|
31 | from schainpy.controller import Project | |
|
27 | 32 | |
|
28 | 33 | from propertiesViewModel import TreeModel, PropertyBuffer |
|
29 | 34 | from parametersModel import ProjectParms |
@@ -34,23 +39,23 FIGURES_PATH = tools.get_path() | |||
|
34 | 39 | TEMPORAL_FILE = ".temp.xml" |
|
35 | 40 | |
|
36 | 41 | def isRadarFile(file): |
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
|
40 |
|
|
|
41 |
|
|
|
42 |
|
|
|
43 | ||
|
44 |
|
|
|
42 | try: | |
|
43 | year = int(file[1:5]) | |
|
44 | doy = int(file[5:8]) | |
|
45 | set = int(file[8:11]) | |
|
46 | except: | |
|
47 | return 0 | |
|
48 | ||
|
49 | return 1 | |
|
45 | 50 | |
|
46 | 51 | def isRadarPath(path): |
|
47 |
|
|
|
48 |
|
|
|
49 |
|
|
|
50 |
|
|
|
51 |
|
|
|
52 | ||
|
53 |
|
|
|
52 | try: | |
|
53 | year = int(path[1:5]) | |
|
54 | doy = int(path[5:8]) | |
|
55 | except: | |
|
56 | return 0 | |
|
57 | ||
|
58 | return 1 | |
|
54 | 59 | |
|
55 | 60 | class BasicWindow(QMainWindow, Ui_BasicWindow): |
|
56 | 61 | """ |
@@ -84,7 +89,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
84 | 89 | self.walk = 0 |
|
85 | 90 | self.create = False |
|
86 | 91 | self.selectedItemTree = None |
|
87 |
self.controller |
|
|
92 | self.controllerThread = None | |
|
88 | 93 | # self.commCtrlPThread = None |
|
89 | 94 | # self.create_figure() |
|
90 | 95 | self.temporalFTP = ftpBuffer() |
@@ -108,11 +113,11 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
108 | 113 | self.__operationObjDict = {} |
|
109 | 114 | |
|
110 | 115 | self.__puLocalFolder2FTP = {} |
|
111 |
self.__ |
|
|
116 | self.__enable = False | |
|
112 | 117 | |
|
113 | 118 | # self.create_comm() |
|
114 | 119 | self.create_updating_timer() |
|
115 |
self.set |
|
|
120 | self.setGUIStatus() | |
|
116 | 121 | |
|
117 | 122 | @pyqtSignature("") |
|
118 | 123 | def on_actionOpen_triggered(self): |
@@ -271,10 +276,10 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
271 | 276 | self.proDelay.setEnabled(False) |
|
272 | 277 | elif index == 1: |
|
273 | 278 | self.online = 1 |
|
274 |
self.proSet.setText(" |
|
|
279 | self.proSet.setText("") | |
|
275 | 280 | self.proDelay.setText("5") |
|
276 | 281 | self.proSet.setEnabled(True) |
|
277 |
self.proDelay.setEnabled(True) |
|
|
282 | self.proDelay.setEnabled(True) | |
|
278 | 283 | |
|
279 | 284 | @pyqtSignature("int") |
|
280 | 285 | def on_proComDataType_activated(self, index): |
@@ -284,6 +289,9 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
284 | 289 | self.labelSet.show() |
|
285 | 290 | self.proSet.show() |
|
286 | 291 | |
|
292 | self.labExpLabel.show() | |
|
293 | self.proExpLabel.show() | |
|
294 | ||
|
287 | 295 | self.labelIPPKm.hide() |
|
288 | 296 | self.proIPPKm.hide() |
|
289 | 297 | |
@@ -296,11 +304,15 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
296 | 304 | elif index == 3: |
|
297 | 305 | extension = '.hdf5' |
|
298 | 306 | |
|
299 | self.labelSet.hide() | |
|
300 | self.proSet.hide() | |
|
301 | 307 | self.labelIPPKm.show() |
|
302 | 308 | self.proIPPKm.show() |
|
303 | 309 | |
|
310 | self.labelSet.hide() | |
|
311 | self.proSet.hide() | |
|
312 | ||
|
313 | self.labExpLabel.hide() | |
|
314 | self.proExpLabel.hide() | |
|
315 | ||
|
304 | 316 | self.proDataType.setText(extension) |
|
305 | 317 | |
|
306 | 318 | @pyqtSignature("int") |
@@ -345,7 +357,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
345 | 357 | if not os.path.exists(datapath): |
|
346 | 358 | |
|
347 | 359 | self.console.clear() |
|
348 |
self.console.append("Write a |
|
|
360 | self.console.append("Write a valid path") | |
|
349 | 361 | return |
|
350 | 362 | |
|
351 | 363 | self.dataPath = datapath |
@@ -364,7 +376,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
364 | 376 | if not parameter_list[0]: |
|
365 | 377 | return |
|
366 | 378 | |
|
367 | parms_ok, project_name, datatype, ext, data_path, read_mode, delay, walk, set = parameter_list | |
|
379 | parms_ok, project_name, datatype, ext, data_path, read_mode, delay, walk, set, expLabel = parameter_list | |
|
368 | 380 | |
|
369 | 381 | if read_mode == "Offline": |
|
370 | 382 | self.proComStartDate.clear() |
@@ -376,15 +388,15 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
376 | 388 | self.frame_2.setEnabled(True) |
|
377 | 389 | |
|
378 | 390 | if read_mode == "Online": |
|
379 |
self.proComStartDate.addItem(" |
|
|
380 |
self.proComEndDate.addItem("201 |
|
|
391 | self.proComStartDate.addItem("1960/01/30") | |
|
392 | self.proComEndDate.addItem("2018/12/31") | |
|
381 | 393 | self.proComStartDate.setEnabled(False) |
|
382 | 394 | self.proComEndDate.setEnabled(False) |
|
383 | 395 | self.proStartTime.setEnabled(False) |
|
384 | 396 | self.proEndTime.setEnabled(False) |
|
385 | 397 | self.frame_2.setEnabled(True) |
|
386 | 398 | |
|
387 | self.loadDays(data_path, ext, walk) | |
|
399 | self.loadDays(data_path, ext, walk, expLabel) | |
|
388 | 400 | |
|
389 | 401 | @pyqtSignature("int") |
|
390 | 402 | def on_proComStartDate_activated(self, index): |
@@ -964,12 +976,14 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
964 | 976 | """ |
|
965 | 977 | Donde se guardan los DATOS |
|
966 | 978 | """ |
|
967 |
s |
|
|
968 |
self.volGraphPath.setText(s |
|
|
979 | save_path = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) | |
|
980 | self.volGraphPath.setText(save_path) | |
|
969 | 981 | |
|
970 |
|
|
|
971 |
|
|
|
972 | # return | |
|
982 | if not os.path.exists(save_path): | |
|
983 | self.console.clear() | |
|
984 | self.console.append("Set a valid path") | |
|
985 | self.volGraphOk.setEnabled(False) | |
|
986 | return | |
|
973 | 987 | |
|
974 | 988 | @pyqtSignature("int") |
|
975 | 989 | def on_volGraphCebshow_stateChanged(self, p0): |
@@ -1734,7 +1748,6 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
1734 | 1748 | opObj = puObj.addOperation(name='SpectraWriter', optype='other') |
|
1735 | 1749 | opObj.addParameter(name='path', value=output_path) |
|
1736 | 1750 | opObj.addParameter(name='blocksPerFile', value=blocksperfile, format='int') |
|
1737 | opObj.addParameter(name='profilesPerBlock', value=profilesperblock, format='int') | |
|
1738 | 1751 | |
|
1739 | 1752 | self.console.clear() |
|
1740 | 1753 | try: |
@@ -1859,11 +1872,11 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
1859 | 1872 | def on_specGraphToolPath_clicked(self): |
|
1860 | 1873 | """ |
|
1861 | 1874 | """ |
|
1862 |
s |
|
|
1863 |
self.specGraphPath.setText(s |
|
|
1864 |
if not os.path.exists(s |
|
|
1875 | save_path = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) | |
|
1876 | self.specGraphPath.setText(save_path) | |
|
1877 | if not os.path.exists(save_path): | |
|
1865 | 1878 | self.console.clear() |
|
1866 |
self.console.append("Write a |
|
|
1879 | self.console.append("Write a valid path") | |
|
1867 | 1880 | return |
|
1868 | 1881 | |
|
1869 | 1882 | @pyqtSignature("") |
@@ -1874,11 +1887,11 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
1874 | 1887 | def on_specHeisGraphToolPath_clicked(self): |
|
1875 | 1888 | """ |
|
1876 | 1889 | """ |
|
1877 |
s |
|
|
1878 |
self.specHeisGraphPath.setText(s |
|
|
1879 |
if not os.path.exists(s |
|
|
1890 | save_path = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) | |
|
1891 | self.specHeisGraphPath.setText(save_path) | |
|
1892 | if not os.path.exists(save_path): | |
|
1880 | 1893 | self.console.clear() |
|
1881 |
self.console.append("Write a |
|
|
1894 | self.console.append("Write a valid path") | |
|
1882 | 1895 | return |
|
1883 | 1896 | |
|
1884 | 1897 | @pyqtSignature("int") |
@@ -2095,9 +2108,9 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
2095 | 2108 | return 0 |
|
2096 | 2109 | |
|
2097 | 2110 | if addFTP and not localfolder: |
|
2098 |
|
|
|
2099 |
|
|
|
2100 |
|
|
|
2111 | self.console.clear() | |
|
2112 | self.console.append("You should save plots before send them to FTP Server") | |
|
2113 | return 0 | |
|
2101 | 2114 | |
|
2102 | 2115 | # if something happened |
|
2103 | 2116 | parms_ok, output_path, blocksperfile, metada = self.checkInputsPUSave(datatype='SpectraHeis') |
@@ -2376,6 +2389,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
2376 | 2389 | parms_ok = False |
|
2377 | 2390 | |
|
2378 | 2391 | walk = int(self.proComWalk.currentIndex()) |
|
2392 | expLabel = str(self.proExpLabel.text()) | |
|
2379 | 2393 | |
|
2380 | 2394 | startDate = str(self.proComStartDate.currentText()) |
|
2381 | 2395 | endDate = str(self.proComEndDate.currentText()) |
@@ -2404,11 +2418,12 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
2404 | 2418 | projectParms.endDate = endDate |
|
2405 | 2419 | projectParms.startTime = startTime |
|
2406 | 2420 | projectParms.endTime = endTime |
|
2407 | projectParms.delay=delay | |
|
2408 | projectParms.walk=walk | |
|
2409 |
projectParms. |
|
|
2410 |
projectParms. |
|
|
2411 |
projectParms. |
|
|
2421 | projectParms.delay = delay | |
|
2422 | projectParms.walk = walk | |
|
2423 | projectParms.expLabel = expLabel | |
|
2424 | projectParms.set = set | |
|
2425 | projectParms.ippKm = ippKm | |
|
2426 | projectParms.parmsOk = parms_ok | |
|
2412 | 2427 | |
|
2413 | 2428 | return projectParms |
|
2414 | 2429 | |
@@ -2461,6 +2476,12 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
2461 | 2476 | except: |
|
2462 | 2477 | pass |
|
2463 | 2478 | |
|
2479 | expLabel = '' | |
|
2480 | try: | |
|
2481 | expLabel = operationObj.getParameterValue(parameterName='expLabel') | |
|
2482 | except: | |
|
2483 | pass | |
|
2484 | ||
|
2464 | 2485 | ippKm = '' |
|
2465 | 2486 | if datatype.lower() == 'usrp': |
|
2466 | 2487 | try: |
@@ -2484,11 +2505,12 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
2484 | 2505 | projectParms.walk=walk |
|
2485 | 2506 | projectParms.set=set |
|
2486 | 2507 | projectParms.ippKm=ippKm |
|
2508 | projectParms.expLabel = expLabel | |
|
2487 | 2509 | projectParms.parmsOk=parms_ok |
|
2488 | 2510 | |
|
2489 | 2511 | return projectParms |
|
2490 | 2512 | |
|
2491 |
def refreshProjectWindow |
|
|
2513 | def refreshProjectWindow(self, projectObjView): | |
|
2492 | 2514 | |
|
2493 | 2515 | projectParms = self.__getParmsFromProjectObj(projectObjView) |
|
2494 | 2516 | |
@@ -2506,6 +2528,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
2506 | 2528 | self.proSet.setText(str(projectParms.set)) |
|
2507 | 2529 | self.proIPPKm.setText(str(projectParms.ippKm)) |
|
2508 | 2530 | self.proComWalk.setCurrentIndex(projectParms.walk) |
|
2531 | self.proExpLabel.setText(str(projectParms.expLabel).strip()) | |
|
2509 | 2532 | |
|
2510 | 2533 | dateList = self.loadDays(data_path = projectParms.dpath, |
|
2511 | 2534 | ext = projectParms.getExt(), |
@@ -3521,7 +3544,6 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
3521 | 3544 | if opObj == None: |
|
3522 | 3545 | self.specOutputPath.clear() |
|
3523 | 3546 | self.specOutputblocksperfile.clear() |
|
3524 | self.specOutputprofileperblock.clear() | |
|
3525 | 3547 | else: |
|
3526 | 3548 | value = opObj.getParameterObj(parameterName='path') |
|
3527 | 3549 | if value == None: |
@@ -3537,13 +3559,6 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
3537 | 3559 | value = opObj.getParameterValue(parameterName='blocksPerFile') |
|
3538 | 3560 | blocksperfile = str(value) |
|
3539 | 3561 | self.specOutputblocksperfile.setText(blocksperfile) |
|
3540 | value = opObj.getParameterObj(parameterName='profilesPerBlock') | |
|
3541 | if value == None: | |
|
3542 | self.specOutputprofileperblock.clear() | |
|
3543 | else: | |
|
3544 | value = opObj.getParameterValue(parameterName='profilesPerBlock') | |
|
3545 | profilesPerBlock = str(value) | |
|
3546 | self.specOutputprofileperblock.setText(profilesPerBlock) | |
|
3547 | 3562 | |
|
3548 | 3563 | return |
|
3549 | 3564 | |
@@ -3861,7 +3876,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
3861 | 3876 | #A project has been selected |
|
3862 | 3877 | if projectObjView == selectedObjView: |
|
3863 | 3878 | |
|
3864 |
self.refreshProjectWindow |
|
|
3879 | self.refreshProjectWindow(projectObjView) | |
|
3865 | 3880 | self.refreshProjectProperties(projectObjView) |
|
3866 | 3881 | |
|
3867 | 3882 | self.tabProject.setEnabled(True) |
@@ -3939,11 +3954,6 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
3939 | 3954 | if action == quitAction3: |
|
3940 | 3955 | self.close() |
|
3941 | 3956 | return 0 |
|
3942 | ||
|
3943 | def create_updating_timer(self): | |
|
3944 | self.comm_data_timer = QtCore.QTimer(self) | |
|
3945 | self.comm_data_timer.timeout.connect(self.on_comm_updating_timer) | |
|
3946 | self.comm_data_timer.start(1000) | |
|
3947 | 3957 | |
|
3948 | 3958 | def createProjectView(self, id): |
|
3949 | 3959 | |
@@ -4003,7 +4013,10 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
4003 | 4013 | |
|
4004 | 4014 | if projectParms.delay: |
|
4005 | 4015 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") |
|
4006 |
|
|
|
4016 | ||
|
4017 | if projectParms.expLabel: | |
|
4018 | readUnitConfObj.addParameter(name="expLabel", value=projectParms.expLabel) | |
|
4019 | ||
|
4007 | 4020 | if projectParms.datatype == "USRP": |
|
4008 | 4021 | readUnitConfObj = projectObjView.addReadUnit(datatype=projectParms.datatype, |
|
4009 | 4022 | path=projectParms.dpath, |
@@ -4046,6 +4059,9 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
4046 | 4059 | |
|
4047 | 4060 | if projectParms.delay: |
|
4048 | 4061 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") |
|
4062 | ||
|
4063 | if projectParms.expLabel: | |
|
4064 | readUnitConfObj.addParameter(name="expLabel", value=projectParms.expLabel) | |
|
4049 | 4065 | |
|
4050 | 4066 | if projectParms.datatype == "USRP": |
|
4051 | 4067 | readUnitConfObj.update(datatype=projectParms.datatype, |
@@ -4141,35 +4157,35 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
4141 | 4157 | if self.temporalFTP.plot_pos: |
|
4142 | 4158 | opObj.addParameter(name='plot_pos', value=int(self.temporalFTP.plot_pos), format='int') |
|
4143 | 4159 | |
|
4144 | def __checkFTPProcUnit(self, projectObj, localfolder): | |
|
4145 | ||
|
4146 | puId = None | |
|
4147 | puObj = None | |
|
4148 | ||
|
4149 | for thisPuId, thisPuObj in projectObj.procUnitItems(): | |
|
4150 | ||
|
4151 | if not thisPuObj.name == "SendToServer": | |
|
4152 | continue | |
|
4153 | ||
|
4154 | opObj = thisPuObj.getOperationObj(name='run') | |
|
4155 | ||
|
4156 | parmObj = opObj.getParameterObj('localfolder') | |
|
4157 | ||
|
4158 | #localfolder parameter should always be set, if it is not set then ProcUnit should be removed | |
|
4159 | if not parmObj: | |
|
4160 | projectObj.removeProcUnit(thisPuId) | |
|
4161 | continue | |
|
4162 | ||
|
4163 | thisLocalfolder = parmObj.getValue() | |
|
4164 | ||
|
4165 | if localfolder != thisLocalfolder: | |
|
4166 | continue | |
|
4167 | ||
|
4168 | puId = thisPuId | |
|
4169 | puObj = thisPuObj | |
|
4170 | break | |
|
4171 | ||
|
4172 | return puObj | |
|
4160 | # def __checkFTPProcUnit(self, projectObj, localfolder): | |
|
4161 | # | |
|
4162 | # puId = None | |
|
4163 | # puObj = None | |
|
4164 | # | |
|
4165 | # for thisPuId, thisPuObj in projectObj.procUnitItems(): | |
|
4166 | # | |
|
4167 | # if not thisPuObj.name == "SendToServer": | |
|
4168 | # continue | |
|
4169 | # | |
|
4170 | # opObj = thisPuObj.getOperationObj(name='run') | |
|
4171 | # | |
|
4172 | # parmObj = opObj.getParameterObj('localfolder') | |
|
4173 | # | |
|
4174 | # #localfolder parameter should always be set, if it is not set then ProcUnit should be removed | |
|
4175 | # if not parmObj: | |
|
4176 | # projectObj.removeProcUnit(thisPuId) | |
|
4177 | # continue | |
|
4178 | # | |
|
4179 | # thisLocalfolder = parmObj.getValue() | |
|
4180 | # | |
|
4181 | # if localfolder != thisLocalfolder: | |
|
4182 | # continue | |
|
4183 | # | |
|
4184 | # puId = thisPuId | |
|
4185 | # puObj = thisPuObj | |
|
4186 | # break | |
|
4187 | # | |
|
4188 | # return puObj | |
|
4173 | 4189 | |
|
4174 | 4190 | def createFTPProcUnitView(self): |
|
4175 | 4191 | |
@@ -4183,10 +4199,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
4183 | 4199 | if not self.__puLocalFolder2FTP: |
|
4184 | 4200 | return |
|
4185 | 4201 | |
|
4186 | folderList = "" | |
|
4187 | ||
|
4188 | for localfolder in self.__puLocalFolder2FTP.values(): | |
|
4189 | folderList += str(localfolder) + "," | |
|
4202 | folderList = ",".join(self.__puLocalFolder2FTP.values()) | |
|
4190 | 4203 | |
|
4191 | 4204 | procUnitConfObj = projectObj.addProcUnit(name="SendToServer") |
|
4192 | 4205 | |
@@ -4477,7 +4490,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
4477 | 4490 | self.console.append("The selected xml file could not be loaded ...") |
|
4478 | 4491 | return 0 |
|
4479 | 4492 | |
|
4480 |
self.refreshProjectWindow |
|
|
4493 | self.refreshProjectWindow(projectObjLoad) | |
|
4481 | 4494 | self.refreshProjectProperties(projectObjLoad) |
|
4482 | 4495 | |
|
4483 | 4496 | projectId = projectObjLoad.id |
@@ -4534,16 +4547,30 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
4534 | 4547 | |
|
4535 | 4548 | self.actionStart.setEnabled(True) |
|
4536 | 4549 | self.actionStarToolbar.setEnabled(True) |
|
4537 | ||
|
4550 | ||
|
4551 | def create_updating_timer(self): | |
|
4552 | self.comm_data_timer = QtCore.QTimer(self) | |
|
4553 | self.comm_data_timer.timeout.connect(self.on_comm_updating_timer) | |
|
4554 | self.comm_data_timer.start(1000) | |
|
4555 | ||
|
4538 | 4556 | def on_comm_updating_timer(self): |
|
4539 | 4557 | # Verifica si algun proceso ha sido inicializado y sigue ejecutandose |
|
4540 | ||
|
4541 |
if not self.__ |
|
|
4558 | # Si el proceso se ha parado actualizar el GUI (stopProject) | |
|
4559 | if not self.__enable: | |
|
4542 | 4560 | return |
|
4543 | ||
|
4544 |
if |
|
|
4561 | ||
|
4562 | if self.controllerThread.isFinished(): | |
|
4545 | 4563 | self.stopProject() |
|
4546 |
|
|
|
4564 | ||
|
4565 | # def jobStartedFromThread(self, success): | |
|
4566 | # | |
|
4567 | # self.console.clear() | |
|
4568 | # self.console.append("Job started") | |
|
4569 | # | |
|
4570 | # def jobFinishedFromThread(self, success): | |
|
4571 | # | |
|
4572 | # self.stopProject() | |
|
4573 | ||
|
4547 | 4574 | def playProject(self, ext=".xml", save=1): |
|
4548 | 4575 | |
|
4549 | 4576 | # self.console.clear() |
@@ -4572,18 +4599,25 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
4572 | 4599 | |
|
4573 | 4600 | self.console.append("Please Wait...") |
|
4574 | 4601 | |
|
4575 |
self.controller |
|
|
4576 | self.controllerObj.start() | |
|
4602 | self.controllerThread = ControllerThread(filename) | |
|
4603 | ||
|
4604 | # QObject.connect( self.controllerThread, SIGNAL( "jobFinished( PyQt_PyObject )" ), self.jobFinishedFromThread ) | |
|
4605 | # QObject.connect( self.controllerThread, SIGNAL( "jobStarted( PyQt_PyObject )" ), self.jobStartedFromThread ) | |
|
4606 | ||
|
4607 | self.controllerThread.start() | |
|
4577 | 4608 | sleep(0.5) |
|
4578 |
self.__ |
|
|
4609 | self.__enable = True | |
|
4579 | 4610 | |
|
4580 | 4611 | def stopProject(self): |
|
4581 | 4612 | |
|
4582 |
self.__ |
|
|
4613 | self.__enable = False | |
|
4583 | 4614 | |
|
4584 | 4615 | # self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.STOP, True)) |
|
4585 |
self.controller |
|
|
4616 | self.controllerThread.stop() | |
|
4586 | 4617 | |
|
4618 | while self.controllerThread.isRunning(): | |
|
4619 | sleep(0.5) | |
|
4620 | ||
|
4587 | 4621 | self.actionStart.setEnabled(True) |
|
4588 | 4622 | self.actionPause.setEnabled(False) |
|
4589 | 4623 | self.actionStop.setEnabled(False) |
@@ -4597,7 +4631,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
4597 | 4631 | def pauseProject(self): |
|
4598 | 4632 | |
|
4599 | 4633 | # self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.PAUSE, data=True)) |
|
4600 |
self.controller |
|
|
4634 | self.controllerThread.pause() | |
|
4601 | 4635 | |
|
4602 | 4636 | self.actionStart.setEnabled(False) |
|
4603 | 4637 | self.actionPause.setEnabled(True) |
@@ -4940,13 +4974,15 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
4940 | 4974 | parms_ok = False |
|
4941 | 4975 | read_mode = None |
|
4942 | 4976 | |
|
4943 | try: | |
|
4944 | delay = int(str(self.proDelay.text())) | |
|
4945 | except: | |
|
4946 | outputstr = 'Delay: %s, this must be a integer number' % str(self.proDelay.text()) | |
|
4947 | self.console.append(outputstr) | |
|
4948 |
|
|
|
4949 |
|
|
|
4977 | delay = None | |
|
4978 | if read_mode == "Online": | |
|
4979 | parms_ok = False | |
|
4980 | try: | |
|
4981 | delay = int(str(self.proDelay.text())) | |
|
4982 | parms_ok = True | |
|
4983 | except: | |
|
4984 | outputstr = 'Delay: %s, this must be a integer number' % str(self.proDelay.text()) | |
|
4985 | self.console.append(outputstr) | |
|
4950 | 4986 | |
|
4951 | 4987 | try: |
|
4952 | 4988 | set = int(str(self.proSet.text())) |
@@ -4956,9 +4992,10 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
4956 | 4992 | # parms_ok = False |
|
4957 | 4993 | set = None |
|
4958 | 4994 | |
|
4959 | walk = self.proComWalk.currentIndex() | |
|
4995 | walk = int(self.proComWalk.currentIndex()) | |
|
4996 | expLabel = str(self.proExpLabel.text()) | |
|
4960 | 4997 | |
|
4961 | return parms_ok, project_name, datatype, ext, data_path, read_mode, delay, walk, set | |
|
4998 | return parms_ok, project_name, datatype, ext, data_path, read_mode, delay, walk, set, expLabel | |
|
4962 | 4999 | |
|
4963 | 5000 | def checkInputsPUSave(self, datatype): |
|
4964 | 5001 | """ |
@@ -4978,7 +5015,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
4978 | 5015 | if datatype == "Spectra": |
|
4979 | 5016 | output_path = str(self.specOutputPath.text()) |
|
4980 | 5017 | blocksperfile = str(self.specOutputblocksperfile.text()) |
|
4981 | profilesperblock = str(self.specOutputprofileperblock.text()) | |
|
5018 | profilesperblock = 0 | |
|
4982 | 5019 | |
|
4983 | 5020 | if datatype == "SpectraHeis": |
|
4984 | 5021 | output_path = str(self.specHeisOutputPath.text()) |
@@ -5007,12 +5044,6 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5007 | 5044 | self.console.append(outputstr) |
|
5008 | 5045 | parms_ok = False |
|
5009 | 5046 | profilesperblock = None |
|
5010 | ||
|
5011 | elif datatype == "Spectra": | |
|
5012 | outputstr = 'Profilesperblock: %s, this must be a integer number' % str(self.specOutputprofileperblock.text()) | |
|
5013 | self.console.append(outputstr) | |
|
5014 | parms_ok = False | |
|
5015 | profilesperblock = None | |
|
5016 | 5047 | |
|
5017 | 5048 | try: |
|
5018 | 5049 | blocksperfile = int(blocksperfile) |
@@ -5104,11 +5135,13 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5104 | 5135 | if not os.path.isdir(data_path): |
|
5105 | 5136 | return |
|
5106 | 5137 | |
|
5138 | self.dataPath = data_path | |
|
5139 | ||
|
5107 | 5140 | dateList = self.findDatafiles(data_path, ext=ext, walk=walk, expLabel=expLabel) |
|
5108 | 5141 | |
|
5109 | 5142 | if not dateList: |
|
5110 | 5143 | # self.console.clear() |
|
5111 |
outputstr = "The path |
|
|
5144 | outputstr = "The path %s has no files with extension *%s" % (data_path, ext) | |
|
5112 | 5145 | self.console.append(outputstr) |
|
5113 | 5146 | return |
|
5114 | 5147 | |
@@ -5126,6 +5159,9 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5126 | 5159 | self.dateList = dateStrList |
|
5127 | 5160 | self.proOk.setEnabled(True) |
|
5128 | 5161 | |
|
5162 | self.console.clear() | |
|
5163 | self.console.append("Successful load") | |
|
5164 | ||
|
5129 | 5165 | return self.dateList |
|
5130 | 5166 | |
|
5131 | 5167 | def setWorkSpaceGUI(self, pathWorkSpace=None): |
@@ -5156,7 +5192,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5156 | 5192 | self.console.append(text) |
|
5157 | 5193 | self.console.setTextColor(color_black) |
|
5158 | 5194 | |
|
5159 |
def set |
|
|
5195 | def setGUIStatus(self): | |
|
5160 | 5196 | |
|
5161 | 5197 | self.setWindowTitle("ROJ-Signal Chain") |
|
5162 | 5198 | self.setWindowIcon(QtGui.QIcon( os.path.join(FIGURES_PATH,"adn.jpg") )) |
@@ -5226,8 +5262,9 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5226 | 5262 | self.treeProjectProperties.resizeColumnToContents(1) |
|
5227 | 5263 | |
|
5228 | 5264 | # set Project |
|
5265 | self.proExpLabel.setEnabled(True) | |
|
5229 | 5266 | self.proDelay.setEnabled(False) |
|
5230 |
self.proSet.setEnabled( |
|
|
5267 | self.proSet.setEnabled(True) | |
|
5231 | 5268 | self.proDataType.setReadOnly(True) |
|
5232 | 5269 | |
|
5233 | 5270 | # set Operation Voltage |
@@ -5332,6 +5369,12 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5332 | 5369 | |
|
5333 | 5370 | self.specGraphPrefix.setToolTip('Example: EXPERIMENT_NAME') |
|
5334 | 5371 | |
|
5372 | self.labelSet.show() | |
|
5373 | self.proSet.show() | |
|
5374 | ||
|
5375 | self.labelIPPKm.hide() | |
|
5376 | self.proIPPKm.hide() | |
|
5377 | ||
|
5335 | 5378 | sys.stdout = ShowMeConsole(textWritten=self.normalOutputWritten) |
|
5336 | 5379 | # sys.stderr = ShowMeConsole(textWritten=self.errorOutputWritten) |
|
5337 | 5380 | |
@@ -5441,9 +5484,9 class Ftp(QMainWindow, Ui_Ftp): | |||
|
5441 | 5484 | """ |
|
5442 | 5485 | QMainWindow.__init__(self, parent) |
|
5443 | 5486 | self.setupUi(self) |
|
5444 |
self.set |
|
|
5487 | self.setGUIStatus() | |
|
5445 | 5488 | |
|
5446 |
def set |
|
|
5489 | def setGUIStatus(self): | |
|
5447 | 5490 | self.setWindowTitle("ROJ-Signal Chain") |
|
5448 | 5491 | self.serverFTP.setToolTip('Example: jro-app.igp.gob.pe') |
|
5449 | 5492 | self.folderFTP.setToolTip('Example: /home/wmaster/graficos') |
@@ -70,7 +70,7 class ProjectParms(): | |||
|
70 | 70 | |
|
71 | 71 | def set(self, project_name, datatype, ext, dpath, online, |
|
72 | 72 | startDate=None, endDate=None, startTime=None, endTime=None, |
|
73 | delay=None, walk=None, set=None, ippKm=None, parmsOk=True): | |
|
73 | delay=None, walk=None, set=None, ippKm=None, parmsOk=True, expLabel=''): | |
|
74 | 74 | |
|
75 | 75 | name = project_name |
|
76 | 76 | datatype = datatype |
@@ -85,6 +85,7 class ProjectParms(): | |||
|
85 | 85 | walk = walk |
|
86 | 86 | set = set |
|
87 | 87 | ippKm = ippKm |
|
88 | expLabel = expLabel | |
|
88 | 89 | |
|
89 | 90 | self.parmsOk = parmsOk |
|
90 | 91 |
@@ -17,7 +17,7 except AttributeError: | |||
|
17 | 17 | import os |
|
18 | 18 | from schainpy.gui.figures import tools |
|
19 | 19 | |
|
20 |
INITIAL_MSG = "Signal Chain GUI - v2.1. |
|
|
20 | INITIAL_MSG = "Signal Chain GUI - v2.1.5" | |
|
21 | 21 | FIGURES_PATH = tools.get_path() |
|
22 | 22 | |
|
23 | 23 | class Ui_InitWindow(object): |
@@ -68,17 +68,29 class Ui_ProjectTab(object): | |||
|
68 | 68 | self.label_33 = QtGui.QLabel(self.frame) |
|
69 | 69 | self.label_33.setObjectName(_fromUtf8("label_33")) |
|
70 | 70 | self.gridLayout_2.addWidget(self.label_33, 3, 5, 1, 1) |
|
71 | ||
|
71 | 72 | self.proDelay = QtGui.QLineEdit(self.frame) |
|
72 | 73 | self.proDelay.setObjectName(_fromUtf8("proDelay")) |
|
73 | 74 | self.gridLayout_2.addWidget(self.proDelay, 3, 6, 1, 1) |
|
75 | ||
|
74 | 76 | self.label_32 = QtGui.QLabel(self.frame) |
|
75 | 77 | self.label_32.setObjectName(_fromUtf8("label_32")) |
|
76 | 78 | self.gridLayout_2.addWidget(self.label_32, 4, 0, 1, 1) |
|
79 | ||
|
77 | 80 | self.proComWalk = QtGui.QComboBox(self.frame) |
|
78 | 81 | self.proComWalk.setObjectName(_fromUtf8("proComWalk")) |
|
79 | 82 | self.proComWalk.addItem(_fromUtf8("")) |
|
80 | 83 | self.proComWalk.addItem(_fromUtf8("")) |
|
81 |
self.gridLayout_2.addWidget(self.proComWalk, 4, 1, 1, |
|
|
84 | self.gridLayout_2.addWidget(self.proComWalk, 4, 1, 1, 4) | |
|
85 | ||
|
86 | self.labExpLabel = QtGui.QLabel(self.frame) | |
|
87 | self.labExpLabel.setObjectName(_fromUtf8("labExpLabel")) | |
|
88 | self.gridLayout_2.addWidget(self.labExpLabel, 4, 5, 1, 1) | |
|
89 | ||
|
90 | self.proExpLabel = QtGui.QLineEdit(self.frame) | |
|
91 | self.proExpLabel.setObjectName(_fromUtf8("proExpLabel")) | |
|
92 | self.gridLayout_2.addWidget(self.proExpLabel, 4, 6, 1, 1) | |
|
93 | ||
|
82 | 94 | self.proLoadButton = QtGui.QPushButton(self.frame) |
|
83 | 95 | self.proLoadButton.setObjectName(_fromUtf8("proLoadButton")) |
|
84 | 96 | self.gridLayout_2.addWidget(self.proLoadButton, 5, 0, 1, 9) |
@@ -164,6 +176,7 class Ui_ProjectTab(object): | |||
|
164 | 176 | self.proComReadMode.setItemText(0, _translate("MainWindow", "Offline", None)) |
|
165 | 177 | self.proComReadMode.setItemText(1, _translate("MainWindow", "Online", None)) |
|
166 | 178 | self.label_33.setText(_translate("MainWindow", "Delay:", None)) |
|
179 | self.labExpLabel.setText(_translate("MainWindow", "Exp Label:", None)) | |
|
167 | 180 | self.label_32.setText(_translate("MainWindow", "Walk :", None)) |
|
168 | 181 | self.proComWalk.setItemText(0, _translate("MainWindow", "On Files", None)) |
|
169 | 182 | self.proComWalk.setItemText(1, _translate("MainWindow", "On Folder", None)) |
@@ -104,8 +104,10 class Ui_SpectraTab(object): | |||
|
104 | 104 | self.specOpRadarfrequency = QtGui.QLineEdit(self.tabopSpectra) |
|
105 | 105 | self.specOpRadarfrequency.setObjectName(_fromUtf8("specOpRadarfrequency")) |
|
106 | 106 | self.gridLayout_5.addWidget(self.specOpRadarfrequency, 0, 3, 1, 2) |
|
107 | ||
|
107 | 108 | spacerItem12 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) |
|
108 | 109 | self.gridLayout_5.addItem(spacerItem12, 4, 3, 1, 1) |
|
110 | ||
|
109 | 111 | self.label_21 = QtGui.QLabel(self.tabopSpectra) |
|
110 | 112 | self.label_21.setObjectName(_fromUtf8("label_21")) |
|
111 | 113 | self.gridLayout_5.addWidget(self.label_21, 1, 0, 1, 1) |
@@ -115,8 +117,10 class Ui_SpectraTab(object): | |||
|
115 | 117 | self.specOpCebRemoveInt = QtGui.QCheckBox(self.tabopSpectra) |
|
116 | 118 | self.specOpCebRemoveInt.setObjectName(_fromUtf8("specOpCebRemoveInt")) |
|
117 | 119 | self.gridLayout_5.addWidget(self.specOpCebRemoveInt, 15, 0, 1, 1) |
|
120 | ||
|
118 | 121 | spacerItem13 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) |
|
119 | 122 | self.gridLayout_5.addItem(spacerItem13, 15, 3, 1, 1) |
|
123 | ||
|
120 | 124 | self.label_70 = QtGui.QLabel(self.tabopSpectra) |
|
121 | 125 | self.label_70.setObjectName(_fromUtf8("label_70")) |
|
122 | 126 | self.gridLayout_5.addWidget(self.label_70, 3, 0, 1, 1) |
@@ -136,213 +140,219 class Ui_SpectraTab(object): | |||
|
136 | 140 | self.gridLayout_5.addWidget(self.specOpgetNoise, 16, 3, 1, 2) |
|
137 | 141 | self.tabWidgetSpectra.addTab(self.tabopSpectra, _fromUtf8("")) |
|
138 | 142 | |
|
143 | ################################################################ | |
|
144 | ################################################################ | |
|
139 | 145 | |
|
140 | 146 | self.tabgraphSpectra = QtGui.QWidget() |
|
141 | 147 | self.tabgraphSpectra.setObjectName(_fromUtf8("tabgraphSpectra")) |
|
142 | 148 | self.gridLayout_9 = QtGui.QGridLayout(self.tabgraphSpectra) |
|
143 | 149 | self.gridLayout_9.setObjectName(_fromUtf8("gridLayout_9")) |
|
144 | 150 | |
|
145 | spacerItem14 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) | |
|
146 | self.gridLayout_9.addItem(spacerItem14, 14, 2, 1, 1) | |
|
151 | # spacerItem14 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) | |
|
152 | # self.gridLayout_9.addItem(spacerItem14, 14, 2, 1, 1) | |
|
153 | xi = 0 | |
|
147 | 154 | |
|
148 | 155 | self.label_24 = QtGui.QLabel(self.tabgraphSpectra) |
|
149 | 156 | self.label_24.setObjectName(_fromUtf8("label_24")) |
|
150 |
self.gridLayout_9.addWidget(self.label_24, |
|
|
157 | self.gridLayout_9.addWidget(self.label_24, xi, 0, 1, 1) | |
|
151 | 158 | |
|
152 | 159 | self.specGraphPath = QtGui.QLineEdit(self.tabgraphSpectra) |
|
153 | 160 | self.specGraphPath.setObjectName(_fromUtf8("specGraphPath")) |
|
154 |
self.gridLayout_9.addWidget(self.specGraphPath, |
|
|
161 | self.gridLayout_9.addWidget(self.specGraphPath, xi, 1, 1, 6) | |
|
155 | 162 | |
|
156 | 163 | self.specGraphToolPath = QtGui.QToolButton(self.tabgraphSpectra) |
|
157 | 164 | self.specGraphToolPath.setObjectName(_fromUtf8("specGraphToolPath")) |
|
158 |
self.gridLayout_9.addWidget(self.specGraphToolPath, |
|
|
165 | self.gridLayout_9.addWidget(self.specGraphToolPath, xi, 7, 1, 1) | |
|
159 | 166 | |
|
160 | 167 | self.label_25 = QtGui.QLabel(self.tabgraphSpectra) |
|
161 | 168 | self.label_25.setObjectName(_fromUtf8("label_25")) |
|
162 |
self.gridLayout_9.addWidget(self.label_25, |
|
|
169 | self.gridLayout_9.addWidget(self.label_25, xi+1, 0, 1, 1) | |
|
163 | 170 | self.specGraphPrefix = QtGui.QLineEdit(self.tabgraphSpectra) |
|
164 | 171 | self.specGraphPrefix.setObjectName(_fromUtf8("specGraphPrefix")) |
|
165 |
self.gridLayout_9.addWidget(self.specGraphPrefix, |
|
|
172 | self.gridLayout_9.addWidget(self.specGraphPrefix, xi+1, 1, 1, 7) | |
|
166 | 173 | |
|
174 | xi = 2 | |
|
167 | 175 | |
|
168 | 176 | self.label_40 = QtGui.QLabel(self.tabgraphSpectra) |
|
169 | 177 | self.label_40.setObjectName(_fromUtf8("label_40")) |
|
170 |
self.gridLayout_9.addWidget(self.label_40, |
|
|
178 | self.gridLayout_9.addWidget(self.label_40, xi+1, 0, 1, 1) | |
|
171 | 179 | self.label_41 = QtGui.QLabel(self.tabgraphSpectra) |
|
172 | 180 | self.label_41.setObjectName(_fromUtf8("label_41")) |
|
173 |
self.gridLayout_9.addWidget(self.label_41, |
|
|
181 | self.gridLayout_9.addWidget(self.label_41, xi+2, 0, 1, 1) | |
|
174 | 182 | self.label_42 = QtGui.QLabel(self.tabgraphSpectra) |
|
175 | 183 | self.label_42.setObjectName(_fromUtf8("label_42")) |
|
176 |
self.gridLayout_9.addWidget(self.label_42, |
|
|
184 | self.gridLayout_9.addWidget(self.label_42, xi+3, 0, 1, 1) | |
|
177 | 185 | self.label_44 = QtGui.QLabel(self.tabgraphSpectra) |
|
178 | 186 | self.label_44.setObjectName(_fromUtf8("label_44")) |
|
179 |
self.gridLayout_9.addWidget(self.label_44, |
|
|
187 | self.gridLayout_9.addWidget(self.label_44, xi+4, 0, 1, 1) | |
|
180 | 188 | self.label_46 = QtGui.QLabel(self.tabgraphSpectra) |
|
181 | 189 | self.label_46.setObjectName(_fromUtf8("label_46")) |
|
182 |
self.gridLayout_9.addWidget(self.label_46, |
|
|
190 | self.gridLayout_9.addWidget(self.label_46, xi+5, 0, 1, 1) | |
|
183 | 191 | self.label_45 = QtGui.QLabel(self.tabgraphSpectra) |
|
184 | 192 | self.label_45.setObjectName(_fromUtf8("label_45")) |
|
185 |
self.gridLayout_9.addWidget(self.label_45, |
|
|
193 | self.gridLayout_9.addWidget(self.label_45, xi+6, 0, 1, 1) | |
|
186 | 194 | |
|
187 | 195 | self.label_43 = QtGui.QLabel(self.tabgraphSpectra) |
|
188 | 196 | self.label_43.setObjectName(_fromUtf8("label_43")) |
|
189 |
self.gridLayout_9.addWidget(self.label_43, |
|
|
197 | self.gridLayout_9.addWidget(self.label_43, xi, 3, 1, 1) | |
|
190 | 198 | self.specGraphCebSpectraplot = QtGui.QCheckBox(self.tabgraphSpectra) |
|
191 | 199 | self.specGraphCebSpectraplot.setText(_fromUtf8("")) |
|
192 | 200 | self.specGraphCebSpectraplot.setObjectName(_fromUtf8("specGraphCebSpectraplot")) |
|
193 |
self.gridLayout_9.addWidget(self.specGraphCebSpectraplot, |
|
|
201 | self.gridLayout_9.addWidget(self.specGraphCebSpectraplot, xi+1, 3, 1, 1) | |
|
194 | 202 | self.specGraphCebCrossSpectraplot = QtGui.QCheckBox(self.tabgraphSpectra) |
|
195 | 203 | self.specGraphCebCrossSpectraplot.setText(_fromUtf8("")) |
|
196 | 204 | self.specGraphCebCrossSpectraplot.setObjectName(_fromUtf8("specGraphCebCrossSpectraplot")) |
|
197 |
self.gridLayout_9.addWidget(self.specGraphCebCrossSpectraplot, |
|
|
205 | self.gridLayout_9.addWidget(self.specGraphCebCrossSpectraplot, xi+2, 3, 1, 1) | |
|
198 | 206 | self.specGraphCebRTIplot = QtGui.QCheckBox(self.tabgraphSpectra) |
|
199 | 207 | self.specGraphCebRTIplot.setText(_fromUtf8("")) |
|
200 | 208 | self.specGraphCebRTIplot.setObjectName(_fromUtf8("specGraphCebRTIplot")) |
|
201 |
self.gridLayout_9.addWidget(self.specGraphCebRTIplot, |
|
|
209 | self.gridLayout_9.addWidget(self.specGraphCebRTIplot, xi+3, 3, 1, 1) | |
|
202 | 210 | self.specGraphCebCoherencmap = QtGui.QCheckBox(self.tabgraphSpectra) |
|
203 | 211 | self.specGraphCebCoherencmap.setText(_fromUtf8("")) |
|
204 | 212 | self.specGraphCebCoherencmap.setObjectName(_fromUtf8("specGraphCebCoherencmap")) |
|
205 |
self.gridLayout_9.addWidget(self.specGraphCebCoherencmap, |
|
|
213 | self.gridLayout_9.addWidget(self.specGraphCebCoherencmap, xi+4, 3, 1, 1) | |
|
206 | 214 | self.specGraphPowerprofile = QtGui.QCheckBox(self.tabgraphSpectra) |
|
207 | 215 | self.specGraphPowerprofile.setText(_fromUtf8("")) |
|
208 | 216 | self.specGraphPowerprofile.setObjectName(_fromUtf8("specGraphPowerprofile")) |
|
209 |
self.gridLayout_9.addWidget(self.specGraphPowerprofile, |
|
|
217 | self.gridLayout_9.addWidget(self.specGraphPowerprofile, xi+5, 3, 1, 1) | |
|
210 | 218 | self.specGraphCebRTInoise = QtGui.QCheckBox(self.tabgraphSpectra) |
|
211 | 219 | self.specGraphCebRTInoise.setText(_fromUtf8("")) |
|
212 | 220 | self.specGraphCebRTInoise.setObjectName(_fromUtf8("specGraphCebRTInoise")) |
|
213 |
self.gridLayout_9.addWidget(self.specGraphCebRTInoise, |
|
|
221 | self.gridLayout_9.addWidget(self.specGraphCebRTInoise, xi+6, 3, 1, 1) | |
|
214 | 222 | |
|
215 | 223 | # spacerItem18 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) |
|
216 | 224 | # self.gridLayout_9.addItem(spacerItem18, 4, 3, 1, 1) |
|
217 | 225 | |
|
218 | 226 | self.label_47 = QtGui.QLabel(self.tabgraphSpectra) |
|
219 | 227 | self.label_47.setObjectName(_fromUtf8("label_47")) |
|
220 |
self.gridLayout_9.addWidget(self.label_47, |
|
|
228 | self.gridLayout_9.addWidget(self.label_47, xi, 5, 1, 1) | |
|
221 | 229 | self.specGraphSaveSpectra = QtGui.QCheckBox(self.tabgraphSpectra) |
|
222 | 230 | self.specGraphSaveSpectra.setText(_fromUtf8("")) |
|
223 | 231 | self.specGraphSaveSpectra.setObjectName(_fromUtf8("specGraphSaveSpectra")) |
|
224 |
self.gridLayout_9.addWidget(self.specGraphSaveSpectra, |
|
|
232 | self.gridLayout_9.addWidget(self.specGraphSaveSpectra, xi+1, 5, 1, 1) | |
|
225 | 233 | self.specGraphSaveCross = QtGui.QCheckBox(self.tabgraphSpectra) |
|
226 | 234 | self.specGraphSaveCross.setText(_fromUtf8("")) |
|
227 | 235 | self.specGraphSaveCross.setObjectName(_fromUtf8("specGraphSaveCross")) |
|
228 |
self.gridLayout_9.addWidget(self.specGraphSaveCross, |
|
|
236 | self.gridLayout_9.addWidget(self.specGraphSaveCross, xi+2, 5, 1, 1) | |
|
229 | 237 | self.specGraphSaveRTIplot = QtGui.QCheckBox(self.tabgraphSpectra) |
|
230 | 238 | self.specGraphSaveRTIplot.setText(_fromUtf8("")) |
|
231 | 239 | self.specGraphSaveRTIplot.setObjectName(_fromUtf8("specGraphSaveRTIplot")) |
|
232 |
self.gridLayout_9.addWidget(self.specGraphSaveRTIplot, |
|
|
240 | self.gridLayout_9.addWidget(self.specGraphSaveRTIplot, xi+3, 5, 1, 1) | |
|
233 | 241 | self.specGraphSaveCoherencemap = QtGui.QCheckBox(self.tabgraphSpectra) |
|
234 | 242 | self.specGraphSaveCoherencemap.setText(_fromUtf8("")) |
|
235 | 243 | self.specGraphSaveCoherencemap.setObjectName(_fromUtf8("specGraphSaveCoherencemap")) |
|
236 |
self.gridLayout_9.addWidget(self.specGraphSaveCoherencemap, |
|
|
244 | self.gridLayout_9.addWidget(self.specGraphSaveCoherencemap, xi+4, 5, 1, 1) | |
|
237 | 245 | self.specGraphSavePowerprofile = QtGui.QCheckBox(self.tabgraphSpectra) |
|
238 | 246 | self.specGraphSavePowerprofile.setText(_fromUtf8("")) |
|
239 | 247 | self.specGraphSavePowerprofile.setObjectName(_fromUtf8("specGraphSavePowerprofile")) |
|
240 |
self.gridLayout_9.addWidget(self.specGraphSavePowerprofile, |
|
|
248 | self.gridLayout_9.addWidget(self.specGraphSavePowerprofile, xi+5, 5, 1, 1) | |
|
241 | 249 | self.specGraphSaveRTInoise = QtGui.QCheckBox(self.tabgraphSpectra) |
|
242 | 250 | self.specGraphSaveRTInoise.setText(_fromUtf8("")) |
|
243 | 251 | self.specGraphSaveRTInoise.setObjectName(_fromUtf8("specGraphSaveRTInoise")) |
|
244 |
self.gridLayout_9.addWidget(self.specGraphSaveRTInoise, |
|
|
252 | self.gridLayout_9.addWidget(self.specGraphSaveRTInoise, xi+6, 5, 1, 1) | |
|
245 | 253 | |
|
246 | 254 | self.label_19 = QtGui.QLabel(self.tabgraphSpectra) |
|
247 | 255 | self.label_19.setObjectName(_fromUtf8("label_19")) |
|
248 |
self.gridLayout_9.addWidget(self.label_19, |
|
|
256 | self.gridLayout_9.addWidget(self.label_19, xi, 7, 1, 1) | |
|
249 | 257 | self.specGraphftpSpectra = QtGui.QCheckBox(self.tabgraphSpectra) |
|
250 | 258 | self.specGraphftpSpectra.setText(_fromUtf8("")) |
|
251 | 259 | self.specGraphftpSpectra.setObjectName(_fromUtf8("specGraphftpSpectra")) |
|
252 |
self.gridLayout_9.addWidget(self.specGraphftpSpectra, |
|
|
260 | self.gridLayout_9.addWidget(self.specGraphftpSpectra, xi+1, 7, 1, 1) | |
|
253 | 261 | self.specGraphftpCross = QtGui.QCheckBox(self.tabgraphSpectra) |
|
254 | 262 | self.specGraphftpCross.setText(_fromUtf8("")) |
|
255 | 263 | self.specGraphftpCross.setObjectName(_fromUtf8("specGraphftpCross")) |
|
256 |
self.gridLayout_9.addWidget(self.specGraphftpCross, |
|
|
264 | self.gridLayout_9.addWidget(self.specGraphftpCross, xi+2, 7, 1, 1) | |
|
257 | 265 | self.specGraphftpRTIplot = QtGui.QCheckBox(self.tabgraphSpectra) |
|
258 | 266 | self.specGraphftpRTIplot.setText(_fromUtf8("")) |
|
259 | 267 | self.specGraphftpRTIplot.setObjectName(_fromUtf8("specGraphftpRTIplot")) |
|
260 |
self.gridLayout_9.addWidget(self.specGraphftpRTIplot, |
|
|
268 | self.gridLayout_9.addWidget(self.specGraphftpRTIplot, xi+3, 7, 1, 1) | |
|
261 | 269 | self.specGraphftpCoherencemap = QtGui.QCheckBox(self.tabgraphSpectra) |
|
262 | 270 | self.specGraphftpCoherencemap.setText(_fromUtf8("")) |
|
263 | 271 | self.specGraphftpCoherencemap.setObjectName(_fromUtf8("specGraphftpCoherencemap")) |
|
264 |
self.gridLayout_9.addWidget(self.specGraphftpCoherencemap, |
|
|
272 | self.gridLayout_9.addWidget(self.specGraphftpCoherencemap, xi+4, 7, 1, 1) | |
|
265 | 273 | self.specGraphftpPowerprofile = QtGui.QCheckBox(self.tabgraphSpectra) |
|
266 | 274 | self.specGraphftpPowerprofile.setText(_fromUtf8("")) |
|
267 | 275 | self.specGraphftpPowerprofile.setObjectName(_fromUtf8("specGraphftpPowerprofile")) |
|
268 |
self.gridLayout_9.addWidget(self.specGraphftpPowerprofile, |
|
|
276 | self.gridLayout_9.addWidget(self.specGraphftpPowerprofile, xi+5, 7, 1, 1) | |
|
269 | 277 | self.specGraphftpRTInoise = QtGui.QCheckBox(self.tabgraphSpectra) |
|
270 | 278 | self.specGraphftpRTInoise.setText(_fromUtf8("")) |
|
271 | 279 | self.specGraphftpRTInoise.setObjectName(_fromUtf8("specGraphftpRTInoise")) |
|
272 |
self.gridLayout_9.addWidget(self.specGraphftpRTInoise, |
|
|
280 | self.gridLayout_9.addWidget(self.specGraphftpRTInoise, xi+6, 7, 1, 1) | |
|
273 | 281 | |
|
274 | spacerItem19 = QtGui.QSpacerItem(39, 15, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) | |
|
275 | self.gridLayout_9.addItem(spacerItem19, 27, 4, 1, 1) | |
|
282 | # spacerItem19 = QtGui.QSpacerItem(39, 15, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) | |
|
283 | # self.gridLayout_9.addItem(spacerItem19, 27, 4, 1, 1) | |
|
284 | ||
|
285 | xi = 11 | |
|
276 | 286 | |
|
277 | 287 | self.label_22 = QtGui.QLabel(self.tabgraphSpectra) |
|
278 | 288 | self.label_22.setObjectName(_fromUtf8("label_22")) |
|
279 |
self.gridLayout_9.addWidget(self.label_22, |
|
|
289 | self.gridLayout_9.addWidget(self.label_22, xi, 0, 1, 1) | |
|
280 | 290 | self.specGgraphFreq = QtGui.QLineEdit(self.tabgraphSpectra) |
|
281 | 291 | self.specGgraphFreq.setObjectName(_fromUtf8("specGgraphFreq")) |
|
282 |
self.gridLayout_9.addWidget(self.specGgraphFreq, |
|
|
292 | self.gridLayout_9.addWidget(self.specGgraphFreq, xi, 2, 1, 2) | |
|
283 | 293 | |
|
284 | 294 | self.label_16 = QtGui.QLabel(self.tabgraphSpectra) |
|
285 | 295 | self.label_16.setObjectName(_fromUtf8("label_16")) |
|
286 |
self.gridLayout_9.addWidget(self.label_16, 1 |
|
|
296 | self.gridLayout_9.addWidget(self.label_16, xi+1, 0, 1, 1) | |
|
287 | 297 | self.specGgraphHeight = QtGui.QLineEdit(self.tabgraphSpectra) |
|
288 | 298 | self.specGgraphHeight.setObjectName(_fromUtf8("specGgraphHeight")) |
|
289 |
self.gridLayout_9.addWidget(self.specGgraphHeight, 1 |
|
|
299 | self.gridLayout_9.addWidget(self.specGgraphHeight, xi+1, 2, 1, 2) | |
|
290 | 300 | |
|
291 | 301 | self.label_17 = QtGui.QLabel(self.tabgraphSpectra) |
|
292 | 302 | self.label_17.setObjectName(_fromUtf8("label_17")) |
|
293 |
self.gridLayout_9.addWidget(self.label_17, |
|
|
303 | self.gridLayout_9.addWidget(self.label_17, xi+2, 0, 1, 1) | |
|
294 | 304 | self.specGgraphDbsrange = QtGui.QLineEdit(self.tabgraphSpectra) |
|
295 | 305 | self.specGgraphDbsrange.setObjectName(_fromUtf8("specGgraphDbsrange")) |
|
296 |
self.gridLayout_9.addWidget(self.specGgraphDbsrange, |
|
|
306 | self.gridLayout_9.addWidget(self.specGgraphDbsrange, xi+2, 2, 1, 2) | |
|
297 | 307 | |
|
298 | 308 | self.specGraphTminTmaxLabel = QtGui.QLabel(self.tabgraphSpectra) |
|
299 | 309 | self.specGraphTminTmaxLabel.setObjectName(_fromUtf8("specGraphTminTmaxLabel")) |
|
300 |
self.gridLayout_9.addWidget(self.specGraphTminTmaxLabel, |
|
|
310 | self.gridLayout_9.addWidget(self.specGraphTminTmaxLabel, xi+3, 0, 1, 2) | |
|
301 | 311 | self.specGgraphTminTmax = QtGui.QLineEdit(self.tabgraphSpectra) |
|
302 | 312 | self.specGgraphTminTmax.setObjectName(_fromUtf8("specGgraphTminTmax")) |
|
303 |
self.gridLayout_9.addWidget(self.specGgraphTminTmax, |
|
|
313 | self.gridLayout_9.addWidget(self.specGgraphTminTmax, xi+3, 2, 1, 2) | |
|
304 | 314 | |
|
305 | 315 | self.specGraphMagLabel = QtGui.QLabel(self.tabgraphSpectra) |
|
306 | 316 | self.specGraphMagLabel.setObjectName(_fromUtf8("specGraphMagLabel")) |
|
307 |
self.gridLayout_9.addWidget(self.specGraphMagLabel, |
|
|
317 | self.gridLayout_9.addWidget(self.specGraphMagLabel, xi, 4, 1, 2) | |
|
308 | 318 | self.specGgraphmagnitud = QtGui.QLineEdit(self.tabgraphSpectra) |
|
309 | 319 | self.specGgraphmagnitud.setObjectName(_fromUtf8("specGgraphmagnitud")) |
|
310 |
self.gridLayout_9.addWidget(self.specGgraphmagnitud, |
|
|
320 | self.gridLayout_9.addWidget(self.specGgraphmagnitud, xi, 6, 1, 2) | |
|
311 | 321 | |
|
312 | 322 | self.specGraphPhaseLabel = QtGui.QLabel(self.tabgraphSpectra) |
|
313 | 323 | self.specGraphPhaseLabel.setObjectName(_fromUtf8("specGraphPhaseLabel")) |
|
314 |
self.gridLayout_9.addWidget(self.specGraphPhaseLabel, 1 |
|
|
324 | self.gridLayout_9.addWidget(self.specGraphPhaseLabel, xi+1, 4, 1, 2) | |
|
315 | 325 | self.specGgraphPhase = QtGui.QLineEdit(self.tabgraphSpectra) |
|
316 | 326 | self.specGgraphPhase.setObjectName(_fromUtf8("specGgraphPhase")) |
|
317 |
self.gridLayout_9.addWidget(self.specGgraphPhase, 1 |
|
|
327 | self.gridLayout_9.addWidget(self.specGgraphPhase, xi+1, 6, 1, 2) | |
|
318 | 328 | |
|
319 | 329 | self.label_6 = QtGui.QLabel(self.tabgraphSpectra) |
|
320 | 330 | self.label_6.setObjectName(_fromUtf8("label_6")) |
|
321 |
self.gridLayout_9.addWidget(self.label_6, |
|
|
331 | self.gridLayout_9.addWidget(self.label_6, xi+2, 4, 1, 1) | |
|
322 | 332 | self.specGgraphChannelList = QtGui.QLineEdit(self.tabgraphSpectra) |
|
323 | 333 | self.specGgraphChannelList.setObjectName(_fromUtf8("specGgraphChannelList")) |
|
324 |
self.gridLayout_9.addWidget(self.specGgraphChannelList, |
|
|
334 | self.gridLayout_9.addWidget(self.specGgraphChannelList, xi+2, 6, 1, 2) | |
|
325 | 335 | |
|
326 | 336 | self.label_29 = QtGui.QLabel(self.tabgraphSpectra) |
|
327 | 337 | self.label_29.setObjectName(_fromUtf8("label_29")) |
|
328 |
self.gridLayout_9.addWidget(self.label_29, |
|
|
338 | self.gridLayout_9.addWidget(self.label_29, xi+3, 4, 1, 2) | |
|
329 | 339 | self.specGgraphftpratio = QtGui.QLineEdit(self.tabgraphSpectra) |
|
330 | 340 | self.specGgraphftpratio.setObjectName(_fromUtf8("specGgraphftpratio")) |
|
331 |
self.gridLayout_9.addWidget(self.specGgraphftpratio, |
|
|
341 | self.gridLayout_9.addWidget(self.specGgraphftpratio, xi+3, 6, 1, 2) | |
|
332 | 342 | |
|
333 | 343 | self.label_48 = QtGui.QLabel(self.tabgraphSpectra) |
|
334 | 344 | self.label_48.setObjectName(_fromUtf8("label_48")) |
|
335 |
self.gridLayout_9.addWidget(self.label_48, |
|
|
345 | self.gridLayout_9.addWidget(self.label_48, xi+4, 4, 1, 2) | |
|
336 | 346 | self.specGgraphTimeRange = QtGui.QLineEdit(self.tabgraphSpectra) |
|
337 | 347 | self.specGgraphTimeRange.setObjectName(_fromUtf8("specGgraphTimeRange")) |
|
338 |
self.gridLayout_9.addWidget(self.specGgraphTimeRange, |
|
|
339 | ||
|
340 | spacerItem15 = QtGui.QSpacerItem(28, 15, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) | |
|
341 | self.gridLayout_9.addItem(spacerItem15, 27, 6, 1, 2) | |
|
342 | spacerItem16 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) | |
|
343 | self.gridLayout_9.addItem(spacerItem16, 3, 5, 1, 1) | |
|
344 | spacerItem17 = QtGui.QSpacerItem(49, 15, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) | |
|
345 | self.gridLayout_9.addItem(spacerItem17, 27, 0, 1, 1) | |
|
348 | self.gridLayout_9.addWidget(self.specGgraphTimeRange, xi+4, 6, 1, 2) | |
|
349 | ||
|
350 | # spacerItem15 = QtGui.QSpacerItem(28, 15, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) | |
|
351 | # self.gridLayout_9.addItem(spacerItem15, 27, 6, 1, 2) | |
|
352 | # spacerItem16 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) | |
|
353 | # self.gridLayout_9.addItem(spacerItem16, 3, 5, 1, 1) | |
|
354 | # spacerItem17 = QtGui.QSpacerItem(49, 15, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) | |
|
355 | # self.gridLayout_9.addItem(spacerItem17, 27, 0, 1, 1) | |
|
346 | 356 | |
|
347 | 357 | |
|
348 | 358 | |
@@ -375,12 +385,7 class Ui_SpectraTab(object): | |||
|
375 | 385 | self.label_9 = QtGui.QLabel(self.taboutputSpectra) |
|
376 | 386 | self.label_9.setObjectName(_fromUtf8("label_9")) |
|
377 | 387 | self.gridLayout_11.addWidget(self.label_9, 2, 0, 1, 2) |
|
378 | self.label_38 = QtGui.QLabel(self.taboutputSpectra) | |
|
379 | self.label_38.setObjectName(_fromUtf8("label_38")) | |
|
380 | self.gridLayout_11.addWidget(self.label_38, 3, 0, 1, 1) | |
|
381 | self.specOutputprofileperblock = QtGui.QLineEdit(self.taboutputSpectra) | |
|
382 | self.specOutputprofileperblock.setObjectName(_fromUtf8("specOutputprofileperblock")) | |
|
383 | self.gridLayout_11.addWidget(self.specOutputprofileperblock, 3, 2, 1, 1) | |
|
388 | ||
|
384 | 389 | self.tabWidgetSpectra.addTab(self.taboutputSpectra, _fromUtf8("")) |
|
385 | 390 | self.gridLayout_7.addWidget(self.tabWidgetSpectra, 0, 1, 1, 1) |
|
386 | 391 | |
@@ -444,7 +449,7 class Ui_SpectraTab(object): | |||
|
444 | 449 | self.label_34.setText(_translate("MainWindow", "Path:", None)) |
|
445 | 450 | self.specOutputToolPath.setText(_translate("MainWindow", "...", None)) |
|
446 | 451 | self.label_9.setText(_translate("MainWindow", "Blocks per File: ", None)) |
|
447 | self.label_38.setText(_translate("MainWindow", "Profile per Block: ", None)) | |
|
452 | ||
|
448 | 453 | self.tabWidgetSpectra.setTabText(self.tabWidgetSpectra.indexOf(self.taboutputSpectra), _translate("MainWindow", "Output", None)) |
|
449 | 454 | |
|
450 | 455 | self.tabWidgetProject.setTabText(self.tabWidgetProject.indexOf(self.tabSpectra), _translate("MainWindow", "Spectra", None)) |
@@ -1,125 +0,0 | |||
|
1 | import threading | |
|
2 | import Queue | |
|
3 | try: | |
|
4 | from gevent import sleep | |
|
5 | except: | |
|
6 | from time import sleep | |
|
7 | ||
|
8 | from schainpy.controller import Project | |
|
9 | from command import * | |
|
10 | ||
|
11 | class ControllerThread(threading.Thread): | |
|
12 | ||
|
13 | def __init__(self, filename, data_q=None): | |
|
14 | ||
|
15 | super(ControllerThread, self).__init__() | |
|
16 | self.setDaemon(True) | |
|
17 | ||
|
18 | self.filename = filename | |
|
19 | self.data_q = data_q | |
|
20 | self.control = {'stop':False,'pause':False} | |
|
21 | ||
|
22 | def stop(self): | |
|
23 | self.control['stop'] = True | |
|
24 | ||
|
25 | def pause(self): | |
|
26 | self.control['pause'] = not(self.control['pause']) | |
|
27 | ||
|
28 | def run(self): | |
|
29 | self.control['stop'] = False | |
|
30 | self.control['pause'] = False | |
|
31 | self.controllerObj = Project(self.control, self.data_q) | |
|
32 | self.controllerObj.readXml(self.filename) | |
|
33 | self.controllerObj.createObjects() | |
|
34 | self.controllerObj.connectObjects() | |
|
35 | self.controllerObj.run() | |
|
36 | ||
|
37 | class CommCtrlProcessThread(threading.Thread): | |
|
38 | """ Implements the threading.Thread interface (start, join, etc.) and | |
|
39 | can be controlled via the cmd_q Queue attribute. Replies are placed in | |
|
40 | the reply_q Queue attribute. | |
|
41 | """ | |
|
42 | def __init__(self, cmd_q=Queue.Queue(), reply_q=Queue.Queue()): | |
|
43 | super(CommCtrlProcessThread, self).__init__() | |
|
44 | self.cmd_q = cmd_q | |
|
45 | # self.reply_q = reply_q | |
|
46 | ||
|
47 | # self.print_q = Queue.Queue() | |
|
48 | # self.data_q = Queue.Queue() | |
|
49 | ||
|
50 | ||
|
51 | self.alive = threading.Event() | |
|
52 | self.setDaemon(True) | |
|
53 | self.alive.set() | |
|
54 | self.socket = None | |
|
55 | ||
|
56 | self.socketIO = None | |
|
57 | self.mySocket = None | |
|
58 | ||
|
59 | self.controllerObj = None | |
|
60 | ||
|
61 | self.handlers = { | |
|
62 | ProcessCommand.PROCESS: self._handle_ioPROCESSTHREAD, | |
|
63 | ProcessCommand.MESSAGE: self._handle_ioMESSAGE, | |
|
64 | ProcessCommand.DATA: self._handle_ioDATA, | |
|
65 | ProcessCommand.STOP: self._handle_ioSTOP, | |
|
66 | ProcessCommand.PAUSE: self._handle_ioPAUSE | |
|
67 | } | |
|
68 | ||
|
69 | def run(self): | |
|
70 | ||
|
71 | while self.alive.isSet(): | |
|
72 | try: | |
|
73 | cmd = self.cmd_q.get(True, 0.1) | |
|
74 | self.handlers[cmd.type](cmd) | |
|
75 | except Queue.Empty as e: | |
|
76 | continue | |
|
77 | ||
|
78 | def isRunning(self): | |
|
79 | ||
|
80 | if self.controllerObj == None: | |
|
81 | return False | |
|
82 | ||
|
83 | if self.controllerObj.isAlive(): | |
|
84 | return True | |
|
85 | ||
|
86 | return False | |
|
87 | ||
|
88 | def _handle_ioPROCESSTHREAD(self, cmd): | |
|
89 | filename = cmd.data | |
|
90 | self.controllerObj = ControllerThread(filename=filename) | |
|
91 | self.controllerObj.start() | |
|
92 | ||
|
93 | def _handle_ioPAUSE(self, cmd): | |
|
94 | self.controllerObj.pause() | |
|
95 | ||
|
96 | def _handle_ioSTOP(self, cmd): | |
|
97 | self.controllerObj.stop() | |
|
98 | ||
|
99 | while self.controllerObj.isAlive(): | |
|
100 | self.console.clear() | |
|
101 | self.console.append("Close graphics before continue...") | |
|
102 | sleep(0.1) | |
|
103 | ||
|
104 | ||
|
105 | self.controllerObj.join() | |
|
106 | # print "Process thread finished" | |
|
107 | ||
|
108 | def _handle_ioDATA(self, cmd): | |
|
109 | self.reply_q.put(self._success_reply_data(data=cmd.data)) | |
|
110 | ||
|
111 | def _handle_ioMESSAGE(self, cmd): | |
|
112 | self.reply_q.put(self._success_reply_message(data=cmd.data)) | |
|
113 | ||
|
114 | def _success_reply_data(self, data=None): | |
|
115 | return ClientReply(ClientReply.DATA, data) | |
|
116 | ||
|
117 | def _success_reply_message(self, data=None): | |
|
118 | return ClientReply(ClientReply.MESSAGE, data) | |
|
119 | ||
|
120 | def join(self, timeout=None): | |
|
121 | self.alive.clear() | |
|
122 | threading.Thread.join(self, timeout) | |
|
123 | ||
|
124 | ||
|
125 | No newline at end of file |
@@ -1,50 +0,0 | |||
|
1 | class ProcessCommand(object): | |
|
2 | """ A command to the client thread. | |
|
3 | Each command type has its associated data: | |
|
4 | ||
|
5 | DATA: Data Radar Object | |
|
6 | MESSAGE: Data String | |
|
7 | STOP: Event to Stop the process thread | |
|
8 | PAUSE: Event to Pause the process thread | |
|
9 | """ | |
|
10 | PROCESS, DATA, MESSAGE, STOP, PAUSE = range(5) | |
|
11 | ||
|
12 | def __init__(self, type, data=None): | |
|
13 | self.type = type | |
|
14 | self.data = data | |
|
15 | ||
|
16 | ||
|
17 | class ClientCommand(object): | |
|
18 | """ A command to the client thread. | |
|
19 | Each command type has its associated data: | |
|
20 | ||
|
21 | CONNECT: (host, port) tuple | |
|
22 | SEND: Data string | |
|
23 | RECEIVE: None | |
|
24 | CLOSE: None | |
|
25 | PROCESS: to processing | |
|
26 | SEND: send a data | |
|
27 | SENDXML: send xml file | |
|
28 | """ | |
|
29 | CONNECT, SEND, SENDXML, RECEIVE, CLOSE, PROCESS = range(6) | |
|
30 | ||
|
31 | def __init__(self, type, data=None): | |
|
32 | self.type = type | |
|
33 | self.data = data | |
|
34 | ||
|
35 | ||
|
36 | class ClientReply(object): | |
|
37 | """ A reply from the client thread. | |
|
38 | Each reply type has its associated data: | |
|
39 | ||
|
40 | ERROR: The error string | |
|
41 | MESSAGE: Data String | |
|
42 | DATA: Data | |
|
43 | SUCCESS: Depends on the command - for RECEIVE it's the received | |
|
44 | data string, for others None. | |
|
45 | """ | |
|
46 | ERROR, SUCCESS, MESSAGE, DATA= range(4) | |
|
47 | ||
|
48 | def __init__(self, type, data=None): | |
|
49 | self.type = type | |
|
50 | self.data = data |
This diff has been collapsed as it changes many lines, (632 lines changed) Show them Hide them | |||
@@ -1,632 +0,0 | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | """ | |
|
3 | Module implementing MainWindow. | |
|
4 | #+++++++++++++++++++++INTERFAZ DE USUARIO V1.1++++++++++++++++++++++++# | |
|
5 | """ | |
|
6 | from PyQt4.QtGui import QMainWindow | |
|
7 | from PyQt4.QtCore import pyqtSignature | |
|
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 | ||
|
14 | from schainpy.gui.viewer.ui_unitprocess import Ui_UnitProcess | |
|
15 | from schainpy.gui.viewer.ui_window import Ui_window | |
|
16 | from schainpy.gui.viewer.ui_mainwindow import Ui_MainWindow | |
|
17 | ||
|
18 | from schainpy.controller import Project,ReadUnitConf,ProcUnitConf,OperationConf,ParameterConf | |
|
19 | import os | |
|
20 | ||
|
21 | ||
|
22 | class BodyMainWindow(QMainWindow, Ui_MainWindow): | |
|
23 | __projObjDict = {} | |
|
24 | __arbolDict = {} | |
|
25 | __upObjDict = {} | |
|
26 | ||
|
27 | """ | |
|
28 | Class documentation goes here. | |
|
29 | #*##################VENTANA CUERPO DEL PROGRAMA#################### | |
|
30 | """ | |
|
31 | def __init__(self, parent = None): | |
|
32 | """ | |
|
33 | Constructor | |
|
34 | """ | |
|
35 | print "Inicio de Programa Interfaz Gráfica" | |
|
36 | QMainWindow.__init__(self, parent) | |
|
37 | self.setupUi(self) | |
|
38 | ||
|
39 | self.indexclick=None | |
|
40 | ||
|
41 | self.online=0 | |
|
42 | self.datatype=0 | |
|
43 | self.variableList=[] | |
|
44 | ||
|
45 | self.proObjList=[] | |
|
46 | self.idp=0 | |
|
47 | self.namep=0 | |
|
48 | self.description=0 | |
|
49 | self.namepTree=0 | |
|
50 | self.valuep=0 | |
|
51 | ||
|
52 | self.upObjList= [] | |
|
53 | self.upn=0 | |
|
54 | self.upName=0 | |
|
55 | self.upType=0 | |
|
56 | self.uporProObjRecover=0 | |
|
57 | ||
|
58 | self.readUnitConfObjList=[] | |
|
59 | ||
|
60 | self.upObjVolList=[] | |
|
61 | self.upobjSpecList=[] | |
|
62 | ||
|
63 | self.operObjList=[] | |
|
64 | ||
|
65 | self.configProject=None | |
|
66 | self.configUP=None | |
|
67 | ||
|
68 | self.readUnitConfObj=None | |
|
69 | self.procUnitConfObj0=None | |
|
70 | self.opObj10=None | |
|
71 | self.opObj12=None | |
|
72 | ||
|
73 | self.setParam() | |
|
74 | ||
|
75 | #-----------------------------------NEW PROPERTIES------------------------------------------------# | |
|
76 | QtGui.QToolTip.setFont(QtGui.QFont('SansSerif', 10)) | |
|
77 | self.addprojectBtn.setToolTip('Add_New_Project') | |
|
78 | self.addUnitProces.setToolTip('Add_New_Processing_Unit') | |
|
79 | ||
|
80 | #-----------------------------------NEW PROPERTIES------------------------------------------------# | |
|
81 | self.model = QtGui.QStandardItemModel() | |
|
82 | self.treeView.setModel(self.model) | |
|
83 | self.treeView.clicked.connect(self.clickFunctiontree) | |
|
84 | self.treeView.expandAll() | |
|
85 | #self.treeView.clicked.connect(self.treefunction1) | |
|
86 | ||
|
87 | #-----------------------------------BARRA DE MENU-------------------------------------------------# | |
|
88 | ||
|
89 | #----------------------------------- MENU_PROJECT--------------------------------------------------# | |
|
90 | ||
|
91 | @pyqtSignature("") | |
|
92 | def on_menuFileAbrirObj_triggered(self): | |
|
93 | """ | |
|
94 | Abre un archivo de configuracion seleccionado, lee los parametros y | |
|
95 | actualiza los atributos de esta clase; creando los objetos necesarios | |
|
96 | con los parametros leidos desde el archivo. | |
|
97 | """ | |
|
98 | print "Leer un archivo xml y extraer sus atributos Not implemented yet" | |
|
99 | ||
|
100 | @pyqtSignature("") | |
|
101 | def on_menuFileCrearObj_triggered(self): | |
|
102 | """ | |
|
103 | Crea un proyecto nuevo y lo anade a mi diccionario de proyectos | |
|
104 | y habilita la ventana de configuracion del proyecto. | |
|
105 | ||
|
106 | """ | |
|
107 | self.addProject() | |
|
108 | ||
|
109 | @pyqtSignature("") | |
|
110 | def on_menuFileGuardarObj_triggered(self): | |
|
111 | """ | |
|
112 | METODO EJECUTADO CUANDO OCURRE EL EVENTO GUARDAR PROJECTO | |
|
113 | ||
|
114 | Llama al metodo saveProject. | |
|
115 | """ | |
|
116 | # my_id = arbol_selected() | |
|
117 | # filename = savefindow.show() | |
|
118 | # self.saveProject(id, filename) | |
|
119 | print "probsave" | |
|
120 | self.saveProject() | |
|
121 | ||
|
122 | @pyqtSignature("") | |
|
123 | def on_menuFileCerrarObj_triggered(self): | |
|
124 | """ | |
|
125 | METODO EJECUTADO CUANDO OCURRE EL EVENTO CERRAR | |
|
126 | Llama al metodo close. | |
|
127 | """ | |
|
128 | self.close() | |
|
129 | ||
|
130 | #-----------------------------------MENU_RUN----------------------------------------------------# | |
|
131 | ||
|
132 | @pyqtSignature("") | |
|
133 | def on_menuRUNStartObj_clicked(self): | |
|
134 | """ | |
|
135 | METODO EJECUTADO CUANDO OCURRE EL EVENTO RUN | |
|
136 | Llama al metodo RUN. | |
|
137 | """ | |
|
138 | print "Not implemented yet" | |
|
139 | ||
|
140 | @pyqtSignature("") | |
|
141 | def on_menuRUNPausaObj_clicked(self): | |
|
142 | """ | |
|
143 | METODO EJECUTADO CUANDO OCURRE EL EVENTO PAUSA | |
|
144 | Llama al metodo PAUSA. | |
|
145 | """ | |
|
146 | print "Not implemented yet" | |
|
147 | ||
|
148 | #-----------------------------------MENU_OPTION-------------------------------------------------# | |
|
149 | ||
|
150 | @pyqtSignature("") | |
|
151 | def on_menuOptConfigLogfileObj_clicked(self): | |
|
152 | """ | |
|
153 | METODO EJECUTADO CUANDO OCURRE EL EVENTO ConfigLog | |
|
154 | Llama al metodo close. | |
|
155 | """ | |
|
156 | print "Not implemented yet" | |
|
157 | ||
|
158 | @pyqtSignature("") | |
|
159 | def on_menuOptConfigserverObj_clicked(self): | |
|
160 | """ | |
|
161 | METODO EJECUTADO CUANDO OCURRE EL EVENTO Config Server | |
|
162 | Llama al metodo close. | |
|
163 | """ | |
|
164 | print "Not implemented yet" | |
|
165 | #-----------------------------------MENU_HELP-------------------------------------------------------# | |
|
166 | ||
|
167 | @pyqtSignature("") | |
|
168 | def on_menuHELPAboutObj_clicked(self): | |
|
169 | """ | |
|
170 | METODO EJECUTADO CUANDO OCURRE EL EVENTO HELP | |
|
171 | Llama al metodo close. | |
|
172 | """ | |
|
173 | print "Not implemented yet" | |
|
174 | ||
|
175 | @pyqtSignature("") | |
|
176 | def on_menuHELPPrfObj_clicked(self): | |
|
177 | """ | |
|
178 | METODO EJECUTADO CUANDO OCURRE EL EVENTO HElp | |
|
179 | Llama al metodo close. | |
|
180 | """ | |
|
181 | print "Not implemented yet" | |
|
182 | ||
|
183 | #-----------------------------------BARRA DE HERRAMIENTAS----------------------------------------# | |
|
184 | ||
|
185 | @pyqtSignature("") | |
|
186 | def on_actOpenObj_triggered(self): | |
|
187 | """ | |
|
188 | METODO CARGA UN ARCHIVO DE CONFIGURACION ANTERIOR | |
|
189 | """ | |
|
190 | print "Leer un archivo xml y extraer sus atributos Not implemented yet" | |
|
191 | ||
|
192 | @pyqtSignature("") | |
|
193 | def on_actCreateObj_triggered(self): | |
|
194 | """ | |
|
195 | CREAR PROJECT ,ANADE UN NUEVO PROYECTO, LLAMA AL MÉTODO QUE CONTIENE LAS OPERACION DE CREACION DE PROYECTOS | |
|
196 | Llama al metodo addProject. | |
|
197 | """ | |
|
198 | self.addProject() | |
|
199 | ||
|
200 | @pyqtSignature("") | |
|
201 | def on_actStopObj_triggered(self): | |
|
202 | """ | |
|
203 | METODO EJECUTADO CUANDO OCURRE EL EVENTO PAUSA | |
|
204 | Llama al metodo PAUSA. | |
|
205 | """ | |
|
206 | print "Not implemented yet" | |
|
207 | ||
|
208 | @pyqtSignature("") | |
|
209 | def on_actPlayObj_triggered(self): | |
|
210 | """ | |
|
211 | METODO EJECUTADO CUANDO OCURRE EL EVENTO PAUSA | |
|
212 | Llama al metodo PAUSA. | |
|
213 | """ | |
|
214 | print "Not implemented yet" | |
|
215 | ||
|
216 | @pyqtSignature("") | |
|
217 | def on_actSaveObj_triggered(self): | |
|
218 | """ | |
|
219 | METODO EJECUTADO CUANDO OCURRE EL EVENTO SAVE | |
|
220 | Llama al metodo SAVE. | |
|
221 | """ | |
|
222 | self.saveProject() | |
|
223 | ||
|
224 | #-----------------------------------PUSHBUTTON_CREATE PROJECT----------------------------------# | |
|
225 | ||
|
226 | @pyqtSignature("") | |
|
227 | def on_addprojectBtn_clicked(self): | |
|
228 | """ | |
|
229 | CREAR PROJECT ,ANADE UN NUEVO PROYECTO, LLAMA AL MÉTODO QUE CONTIENE LAS OPERACION DE CREACION DE PROYECTOS | |
|
230 | Llama al metodo addProject. | |
|
231 | """ | |
|
232 | self.addProject() | |
|
233 | ||
|
234 | #------------------------------------VENTANA CONFIGURACION PROJECT----------------------------# | |
|
235 | ||
|
236 | @pyqtSignature("int") | |
|
237 | def on_dataTypeCmbBox_activated(self,index): | |
|
238 | """ | |
|
239 | Metodo que identifica que tipo de dato se va a trabajar VOLTAGE O ESPECTRA | |
|
240 | """ | |
|
241 | self.dataFormatTxt.setReadOnly(True) | |
|
242 | if index==0: | |
|
243 | self.datatype='Voltage' | |
|
244 | elif index==1: | |
|
245 | self.datatype='Spectra' | |
|
246 | else : | |
|
247 | self.datatype='' | |
|
248 | self.dataFormatTxt.setReadOnly(False) | |
|
249 | self.dataFormatTxt.setText(self.datatype) | |
|
250 | ||
|
251 | @pyqtSignature("") | |
|
252 | def on_dataPathBrowse_clicked(self): | |
|
253 | """ | |
|
254 | OBTENCION DE LA RUTA DE DATOS | |
|
255 | """ | |
|
256 | self.dataPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) | |
|
257 | self.dataPathTxt.setText(self.dataPath) | |
|
258 | self.statusDpath=self.existDir(self.dataPath) | |
|
259 | self.loadDays() | |
|
260 | ||
|
261 | @pyqtSignature("int") | |
|
262 | def on_starDateCmbBox_activated(self, index): | |
|
263 | """ | |
|
264 | SELECCION DEL RANGO DE FECHAS -START DATE | |
|
265 | """ | |
|
266 | var_StopDay_index=self.endDateCmbBox.count() - self.endDateCmbBox.currentIndex() | |
|
267 | self.endDateCmbBox.clear() | |
|
268 | for i in self.variableList[index:]: | |
|
269 | self.endDateCmbBox.addItem(i) | |
|
270 | self.endDateCmbBox.setCurrentIndex(self.endDateCmbBox.count() - var_StopDay_index) | |
|
271 | self.getsubList() | |
|
272 | ||
|
273 | @pyqtSignature("int") | |
|
274 | def on_endDateCmbBox_activated(self, index): | |
|
275 | """ | |
|
276 | SELECCION DEL RANGO DE FECHAS-END DATE | |
|
277 | """ | |
|
278 | var_StartDay_index=self.starDateCmbBox.currentIndex() | |
|
279 | var_end_index = self.endDateCmbBox.count() - index | |
|
280 | self.starDateCmbBox.clear() | |
|
281 | for i in self.variableList[:len(self.variableList) - var_end_index + 1]: | |
|
282 | self.starDateCmbBox.addItem(i) | |
|
283 | self.starDateCmbBox.setCurrentIndex(var_StartDay_index) | |
|
284 | self.getsubList() #Se carga var_sublist[] con el rango de las fechas seleccionadas | |
|
285 | ||
|
286 | @pyqtSignature("int") | |
|
287 | def on_readModeCmBox_activated(self, p0): | |
|
288 | """ | |
|
289 | SELECCION DEL MODO DE LECTURA ON=1, OFF=0 | |
|
290 | """ | |
|
291 | if p0==0: | |
|
292 | self.online=0 | |
|
293 | elif p0==1: | |
|
294 | self.online=1 | |
|
295 | ||
|
296 | #---------------PUSHBUTTON_DATA " OKBUTTON "_CONFIGURATION PROJECT--------------------------# | |
|
297 | ||
|
298 | @pyqtSignature("") | |
|
299 | def on_dataOkBtn_clicked(self): | |
|
300 | """ | |
|
301 | Añade al Obj XML de Projecto, name,datatype,date,time,readmode,wait,etc, crea el readUnitProcess del archivo xml. | |
|
302 | Prepara la configuración del diágrama del Arbol del treeView numero 2 | |
|
303 | """ | |
|
304 | print "En este nivel se pasa el tipo de dato con el que se trabaja,path,startDate,endDate,startTime,endTime,online" | |
|
305 | ||
|
306 | for i in self.__arbolDict: | |
|
307 | if self.__arbolDict[i]==self.indexclick: | |
|
308 | self.projectObj=self.__projObjDict[int(i)] | |
|
309 | # print self.projectObj | |
|
310 | # print i | |
|
311 | # print "get",self.__arbolDict.items() | |
|
312 | # print "keys",self.__arbolDict.keys() | |
|
313 | self.description="Think" | |
|
314 | id=i | |
|
315 | name=str(self.nameProjectTxt.text()) | |
|
316 | desc=str(self.description) | |
|
317 | ||
|
318 | self.projectObj.setup(id = id, name=name, description=desc) | |
|
319 | print self.projectObj.id | |
|
320 | # print self.projectObj.name | |
|
321 | # print self.projectObj.description | |
|
322 | ||
|
323 | datatype=str(self.dataTypeCmbBox.currentText()) | |
|
324 | path=str(self.dataPathTxt.text()) | |
|
325 | online=int(self.online) | |
|
326 | starDate=str(self.starDateCmbBox.currentText()) | |
|
327 | endDate=str(self.endDateCmbBox.currentText()) | |
|
328 | ||
|
329 | ||
|
330 | self.readUnitConfObj = self.projectObj.addReadUnit(datatype=datatype, | |
|
331 | path=path, | |
|
332 | startDate=starDate, | |
|
333 | endDate=endDate, | |
|
334 | startTime='06:10:00', | |
|
335 | endTime='23:59:59', | |
|
336 | online=online) | |
|
337 | ||
|
338 | self.readUnitConfObjList.append(self.readUnitConfObj) | |
|
339 | print "self.readUnitConfObj.getId",self.readUnitConfObj.getId(),datatype,path,starDate,endDate,online | |
|
340 | ||
|
341 | self.model_2=treeModel() | |
|
342 | self.model_2.setParams(name=self.projectObj.name+str(self.projectObj.id), | |
|
343 | directorio=path, | |
|
344 | workspace="C:\\WorkspaceGUI", | |
|
345 | remode=str(self.readModeCmBox.currentText()), | |
|
346 | dataformat=datatype, | |
|
347 | date=str(starDate)+"-"+str(endDate), | |
|
348 | initTime='06:10:00', | |
|
349 | endTime='23:59:59', | |
|
350 | timezone="Local" , | |
|
351 | Summary="test de prueba") | |
|
352 | self.model_2.arbol() | |
|
353 | self.treeView_2.setModel(self.model_2) | |
|
354 | self.treeView_2.expandAll() | |
|
355 | ||
|
356 | # | |
|
357 | #-----------------PUSHBUTTON_ADD_PROCESSING UNIT PROJECT------------------# | |
|
358 | @pyqtSignature("") | |
|
359 | def on_addUnitProces_clicked(self): | |
|
360 | """ | |
|
361 | CREAR PROCESSING UNI ,ANADE UNA UNIDAD DE PROCESAMIENTO, LLAMA AL MÉTODO addUP QUE CONTIENE LAS OPERACION DE CREACION DE UNIDADES DE PROCESAMIENTO | |
|
362 | Llama al metodo addUP. | |
|
363 | """ | |
|
364 | # print "En este nivel se adiciona una rama de procesamiento, y se le concatena con el id" | |
|
365 | self.addUP() | |
|
366 | ||
|
367 | #----------------------------BASICO-----------------------------------# | |
|
368 | ||
|
369 | def getNumberofProject(self): | |
|
370 | # for i in self.proObjList: | |
|
371 | # print i | |
|
372 | return self.proObjList | |
|
373 | # for i in self.proObjList: | |
|
374 | # print i | |
|
375 | ||
|
376 | def setParam(self): | |
|
377 | ||
|
378 | self.tabWidgetProject.setEnabled(False) | |
|
379 | self.dataPathTxt.setText('C:\data') | |
|
380 | self.nameProjectTxt.setText("Test") | |
|
381 | self.numberChannelopVol.setEnabled(False) | |
|
382 | self.lineHeighProfileTxtopVol.setEnabled(False) | |
|
383 | self.numberIntegration.setEnabled(False) | |
|
384 | self.valuenFFTPointOpSpec.setEnabled(False) | |
|
385 | self.lineProfileSelecopVolCEB.setEnabled(False) | |
|
386 | ||
|
387 | def clickFunctiontree(self,index): | |
|
388 | self.indexclick= index.model().itemFromIndex(index) | |
|
389 | print self.indexclick | |
|
390 | return self.indexclick | |
|
391 | # self.indexclick= index.model().itemFromIndex(index).text() | |
|
392 | # return self.indexclick | |
|
393 | # print self.indexclick() | |
|
394 | # print index.model().itemFromIndex(index) | |
|
395 | # print self.indexclick | |
|
396 | # NumofPro=self.indexclick[8:10] | |
|
397 | # self.valuep=NumofPro | |
|
398 | # #print self.valuep | |
|
399 | # NameofPro=self.indexclick[0:7] | |
|
400 | # self.namepTree=NameofPro | |
|
401 | # print self.namepTree | |
|
402 | ||
|
403 | def addProject(self): | |
|
404 | self.tabWidgetProject.setEnabled(True) | |
|
405 | print "En este nivel se debe crear el proyecto,id,nombre,desc" | |
|
406 | #+++++++++++++++++++Creacion del Objeto Controller-XML+++++++++++++# | |
|
407 | ||
|
408 | self.idp += 1 | |
|
409 | self.projectObj = Project() | |
|
410 | print self.projectObj | |
|
411 | self.__projObjDict[self.idp] = self.projectObj | |
|
412 | ||
|
413 | #++++++++++++++++++Creación del Arbol++++++++++++++++++++# | |
|
414 | self.parentItem = self.model.invisibleRootItem() | |
|
415 | name=str(self.nameProjectTxt.text()) | |
|
416 | self.__arbolDict[self.idp] = QtGui.QStandardItem(QtCore.QString(name+" %0").arg(self.idp)) | |
|
417 | print self.__arbolDict[self.idp] | |
|
418 | self.parentItem.appendRow(self.__arbolDict[self.idp]) | |
|
419 | self.parentItem=self.__arbolDict[self.idp] | |
|
420 | ||
|
421 | print "Porfavor ingrese los parámetros de configuracion del Proyecto" | |
|
422 | ||
|
423 | def existDir(self, var_dir): | |
|
424 | """ | |
|
425 | METODO PARA VERIFICAR SI LA RUTA EXISTE-VAR_DIR | |
|
426 | VARIABLE DIRECCION | |
|
427 | """ | |
|
428 | if os.path.isdir(var_dir): | |
|
429 | return True | |
|
430 | else: | |
|
431 | self.textEdit.append("Incorrect path:" + str(var_dir)) | |
|
432 | return False | |
|
433 | ||
|
434 | def loadDays(self): | |
|
435 | """ | |
|
436 | METODO PARA CARGAR LOS DIAS | |
|
437 | """ | |
|
438 | self.variableList=[] | |
|
439 | self.starDateCmbBox.clear() | |
|
440 | self.endDateCmbBox.clear() | |
|
441 | ||
|
442 | Dirlist = os.listdir(self.dataPath) | |
|
443 | Dirlist.sort() | |
|
444 | ||
|
445 | for a in range(0, len(Dirlist)): | |
|
446 | fname= Dirlist[a] | |
|
447 | Doy=fname[5:8] | |
|
448 | fname = fname[1:5] | |
|
449 | print fname | |
|
450 | fecha=Doy2Date(int(fname),int(Doy)) | |
|
451 | fechaList=fecha.change2date() | |
|
452 | #print fechaList[0] | |
|
453 | Dirlist[a]=fname+"/"+str(fechaList[0])+"/"+str(fechaList[1]) | |
|
454 | #+"-"+ fechaList[0]+"-"+fechaList[1] | |
|
455 | ||
|
456 | #---------------AQUI TIENE QUE SER MODIFICADO--------# | |
|
457 | ||
|
458 | #Se cargan las listas para seleccionar StartDay y StopDay (QComboBox) | |
|
459 | for i in range(0, (len(Dirlist))): | |
|
460 | self.variableList.append(Dirlist[i]) | |
|
461 | ||
|
462 | for i in self.variableList: | |
|
463 | self.starDateCmbBox.addItem(i) | |
|
464 | self.endDateCmbBox.addItem(i) | |
|
465 | self.endDateCmbBox.setCurrentIndex(self.starDateCmbBox.count()-1) | |
|
466 | ||
|
467 | self.getsubList() | |
|
468 | self.dataOkBtn.setEnabled(True) | |
|
469 | ||
|
470 | def getsubList(self): | |
|
471 | """ | |
|
472 | OBTIENE EL RANDO DE LAS FECHAS SELECCIONADAS | |
|
473 | """ | |
|
474 | self.subList=[] | |
|
475 | for i in self.variableList[self.starDateCmbBox.currentIndex():self.starDateCmbBox.currentIndex() + self.endDateCmbBox.currentIndex()+1]: | |
|
476 | self.subList.append(i) | |
|
477 | ||
|
478 | def addUP(self): | |
|
479 | ||
|
480 | self.configUP=UnitProcess(self) | |
|
481 | for i in self.__arbolDict: | |
|
482 | if self.__arbolDict[i]==self.indexclick: | |
|
483 | if self.__projObjDict.has_key(i)==True: | |
|
484 | self.projectObj=self.__projObjDict[int(i)] | |
|
485 | print self.projectObj.id | |
|
486 | self.configUP.getfromWindowList.append(self.projectObj) | |
|
487 | ||
|
488 | ||
|
489 | for i in self.projectObj.procUnitConfObjDict: | |
|
490 | if self.projectObj.procUnitConfObjDict[i].getElementName()=='ProcUnit': | |
|
491 | self.upObj=self.projectObj.procUnitConfObjDict[i] | |
|
492 | self.configUP.getfromWindowList.append(self.upObj) | |
|
493 | ||
|
494 | ||
|
495 | ||
|
496 | self.configUP.loadTotalList() | |
|
497 | self.configUP.show() | |
|
498 | #self.configUP.unitPsavebut.clicked.connect(self.reciveUPparameters) | |
|
499 | self.configUP.closed.connect(self.createUP) | |
|
500 | ||
|
501 | ||
|
502 | ||
|
503 | def createUP(self): | |
|
504 | ||
|
505 | print "En este nivel se adiciona una rama de procesamiento, y se le concatena con el id" | |
|
506 | ||
|
507 | if not self.configUP.create: | |
|
508 | return | |
|
509 | ||
|
510 | self.uporProObjRecover=self.configUP.getFromWindow | |
|
511 | ||
|
512 | self.upType = self.configUP.typeofUP | |
|
513 | for i in self.__arbolDict: | |
|
514 | if self.__arbolDict[i]==self.indexclick: | |
|
515 | self.projectObj=self.__projObjDict[int(i)] | |
|
516 | ||
|
517 | datatype=str(self.upType) | |
|
518 | uporprojectObj=self.uporProObjRecover | |
|
519 | ||
|
520 | if uporprojectObj.getElementName()=='ProcUnit': | |
|
521 | inputId=uporprojectObj.getId() | |
|
522 | else: | |
|
523 | inputId=self.readUnitConfObjList[uporprojectObj.id-1].getId() | |
|
524 | ||
|
525 | print 'uporprojectObj.id','inputId', uporprojectObj.id,inputId | |
|
526 | self.procUnitConfObj1 = self.projectObj.addProcUnit(datatype=datatype, inputId=inputId) | |
|
527 | self.__upObjDict[inputId]= self.procUnitConfObj1 | |
|
528 | ||
|
529 | self.parentItem=self.__arbolDict[uporprojectObj.id] | |
|
530 | #print "i","self.__arbolDict[i]",i ,self.__arbolDict[i] | |
|
531 | self.numbertree=int(self.procUnitConfObj1.getId())-1 | |
|
532 | self.__arbolDict[self.procUnitConfObj1.id]=QtGui.QStandardItem(QtCore.QString(datatype +"%1 ").arg(self.numbertree)) | |
|
533 | self.parentItem.appendRow(self.__arbolDict[self.procUnitConfObj1.id]) | |
|
534 | self.parentItem=self.__arbolDict[self.procUnitConfObj1.id] | |
|
535 | # self.loadUp() | |
|
536 | self.treeView.expandAll() | |
|
537 | ||
|
538 | def resetopVolt(self): | |
|
539 | self.selecChannelopVolCEB.setChecked(False) | |
|
540 | self.selecHeighopVolCEB.setChecked(False) | |
|
541 | self.coherentIntegrationCEB.setChecked(False) | |
|
542 | self.profileSelecopVolCEB.setChecked(False) | |
|
543 | #self.selecChannelopVolCEB.setEnabled(False) | |
|
544 | self.lineHeighProfileTxtopVol.clear() | |
|
545 | self.lineProfileSelecopVolCEB.clear() | |
|
546 | self.numberChannelopVol.clear() | |
|
547 | self.numberIntegration.clear() | |
|
548 | ||
|
549 | ||
|
550 | def resetopSpec(self): | |
|
551 | self.nFFTPointOpSpecCEB.setChecked(False) | |
|
552 | ||
|
553 | self.valuenFFTPointOpSpec.clear() | |
|
554 | ||
|
555 | def resetgraphSpec(self): | |
|
556 | self.SpectraPlotGraphCEB.setChecked(False) | |
|
557 | self.CrossSpectraPlotGraphceb.setChecked(False) | |
|
558 | self.RTIPlotGraphCEB.setChecked(False) | |
|
559 | ||
|
560 | ||
|
561 | def saveProject(self): | |
|
562 | print "entro" | |
|
563 | #filename="C:\WorkspaceGUI\config1.xml" | |
|
564 | for i in self.__arbolDict: | |
|
565 | if self.__arbolDict[i]==self.indexclick: | |
|
566 | self.projectObj=self.__projObjDict[int(i)] | |
|
567 | print "Encontre project" | |
|
568 | filename="C:\WorkspaceGUI\config"+str(self.projectObj.id)+".xml" | |
|
569 | print "Escribo Project" | |
|
570 | self.projectObj.writeXml(filename) | |
|
571 | ||
|
572 | ||
|
573 | class UnitProcess(QMainWindow, Ui_UnitProcess): | |
|
574 | """ | |
|
575 | Class documentation goes here. | |
|
576 | """ | |
|
577 | closed=pyqtSignal() | |
|
578 | create= False | |
|
579 | def __init__(self, parent = None): | |
|
580 | """ | |
|
581 | Constructor | |
|
582 | """ | |
|
583 | QMainWindow.__init__(self, parent) | |
|
584 | self.setupUi(self) | |
|
585 | self.getFromWindow=None | |
|
586 | self.getfromWindowList=[] | |
|
587 | ||
|
588 | self.listUP=None | |
|
589 | ||
|
590 | @pyqtSignature("") | |
|
591 | def on_unitPokbut_clicked(self): | |
|
592 | """ | |
|
593 | Slot documentation goes here. | |
|
594 | """ | |
|
595 | self.create =True | |
|
596 | self.getFromWindow=self.getfromWindowList[int(self.comboInputBox.currentIndex())] | |
|
597 | #self.nameofUP= str(self.nameUptxt.text()) | |
|
598 | self.typeofUP= str(self.comboTypeBox.currentText()) | |
|
599 | self.close() | |
|
600 | ||
|
601 | ||
|
602 | @pyqtSignature("") | |
|
603 | def on_unitPcancelbut_clicked(self): | |
|
604 | """ | |
|
605 | Slot documentation goes here. | |
|
606 | """ | |
|
607 | # TODO: not implemented yet | |
|
608 | #raise NotImplementedError | |
|
609 | self.create=False | |
|
610 | self.close() | |
|
611 | ||
|
612 | def loadTotalList(self): | |
|
613 | self.comboInputBox.clear() | |
|
614 | for i in self.getfromWindowList: | |
|
615 | ||
|
616 | name=i.getElementName() | |
|
617 | if name=='Project': | |
|
618 | id= i.id | |
|
619 | if name=='ProcUnit': | |
|
620 | id=int(i.id)-1 | |
|
621 | self.comboInputBox.addItem(str(name)+str(id)) | |
|
622 | ||
|
623 | def closeEvent(self, event): | |
|
624 | self.closed.emit() | |
|
625 | event.accept() | |
|
626 | ||
|
627 | ||
|
628 | ||
|
629 | ||
|
630 | ||
|
631 | ||
|
632 | No newline at end of file |
@@ -1,303 +0,0 | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | from PyQt4 import QtCore | |
|
3 | import itertools | |
|
4 | ||
|
5 | HORIZONTAL_HEADERS = ("Property","Value " ) | |
|
6 | ||
|
7 | HORIZONTAL = ("RAMA :",) | |
|
8 | ||
|
9 | class treeModel(QtCore.QAbstractItemModel): | |
|
10 | ''' | |
|
11 | a model to display a few names, ordered by encabezado | |
|
12 | ||
|
13 | ''' | |
|
14 | def __init__(self ,parent=None): | |
|
15 | super(treeModel, self).__init__(parent) | |
|
16 | self.people = [] | |
|
17 | self.initProjectProperties() | |
|
18 | self.initPUVoltageProperties() | |
|
19 | self.initPUSpectraProperties() | |
|
20 | self.initPUSpectraHeisProperties() | |
|
21 | ||
|
22 | def initProjectProperties(self): | |
|
23 | ||
|
24 | name=None | |
|
25 | directorio=None | |
|
26 | workspace=None | |
|
27 | remode=None | |
|
28 | dataformat=None | |
|
29 | startDate=None | |
|
30 | endDate=None | |
|
31 | startTime=None | |
|
32 | endTime=None | |
|
33 | delay=None | |
|
34 | set= None | |
|
35 | walk=None | |
|
36 | timezone=None | |
|
37 | Summary=None | |
|
38 | description=None | |
|
39 | ||
|
40 | def initPUVoltageProperties(self): | |
|
41 | type=None | |
|
42 | channel=None | |
|
43 | heights=None | |
|
44 | filter=None | |
|
45 | profile=None | |
|
46 | code=None | |
|
47 | mode=None | |
|
48 | coherentintegration=None | |
|
49 | ||
|
50 | def initPUSpectraProperties(self): | |
|
51 | type =None | |
|
52 | nFFTpoints =None | |
|
53 | ippFactor = None | |
|
54 | pairsList =None | |
|
55 | channel =None | |
|
56 | heights =None | |
|
57 | incoherentintegration =None | |
|
58 | removeDC = None | |
|
59 | removeInterference =None | |
|
60 | getNoise = None | |
|
61 | operationSpecPlot=None | |
|
62 | operationCrossSpecPlot = None | |
|
63 | operationRTIPlot = None | |
|
64 | operationCohermap = None | |
|
65 | operationPowProfilePlot = None | |
|
66 | ||
|
67 | def initPUSpectraHeisProperties(self): | |
|
68 | type =None | |
|
69 | incoherentintegration =None | |
|
70 | operationSpecHeisPlot=None | |
|
71 | operationRTIHeisPlot = None | |
|
72 | ||
|
73 | def initProjectView(self): | |
|
74 | """ | |
|
75 | Reemplazo del método showtree | |
|
76 | """ | |
|
77 | HORIZONTAL_HEADERS = ("Property","Value " ) | |
|
78 | HORIZONTAL = ("RAMA :",) | |
|
79 | self.rootItem = TreeItem(None, "ALL", None) | |
|
80 | self.parents = {0 : self.rootItem} | |
|
81 | self.setupModelData() | |
|
82 | ||
|
83 | def initPUVoltageView(self): | |
|
84 | HORIZONTAL_HEADERS = ("Operation"," Parameter Value " ) | |
|
85 | HORIZONTAL = ("RAMA :",) | |
|
86 | self.rootItem = TreeItem(None, "ALL", None) | |
|
87 | self.parents = {0 : self.rootItem} | |
|
88 | self.setupModelData() | |
|
89 | ||
|
90 | def showProjectParms(self,caracteristicaList,principalList,descripcionList): | |
|
91 | """ | |
|
92 | set2Obje | |
|
93 | """ | |
|
94 | for caracteristica,principal, descripcion in itertools.izip(caracteristicaList,principalList,descripcionList): | |
|
95 | person = person_class(caracteristica, principal, descripcion) | |
|
96 | self.people.append(person) | |
|
97 | self.rootItem = TreeItem(None, "ALL", None) | |
|
98 | self.parents = {0 : self.rootItem} | |
|
99 | self.setupModelData() | |
|
100 | ||
|
101 | def showPUVoltageParms(self,caracteristicaList,principalList,descripcionList): | |
|
102 | ||
|
103 | for caracteristica,principal, descripcion in itertools.izip(caracteristicaList,principalList,descripcionList): | |
|
104 | person = person_class(caracteristica, principal, descripcion) | |
|
105 | self.people.append(person) | |
|
106 | self.rootItem = TreeItem(None, "ALL", None) | |
|
107 | self.parents = {0 : self.rootItem} | |
|
108 | self.setupModelData() | |
|
109 | ||
|
110 | ||
|
111 | def showPUSpectraParms(self,caracteristicaList,principalList,descripcionList): | |
|
112 | ||
|
113 | for caracteristica,principal, descripcion in itertools.izip(caracteristicaList,principalList,descripcionList): | |
|
114 | person = person_class(caracteristica, principal, descripcion) | |
|
115 | self.people.append(person) | |
|
116 | self.rootItem = TreeItem(None, "ALL", None) | |
|
117 | self.parents = {0 : self.rootItem} | |
|
118 | self.setupModelData() | |
|
119 | ||
|
120 | def showPUSpectraHeisParms(self,caracteristicaList,principalList,descripcionList): | |
|
121 | ||
|
122 | for caracteristica,principal, descripcion in itertools.izip(caracteristicaList,principalList,descripcionList): | |
|
123 | person = person_class(caracteristica, principal, descripcion) | |
|
124 | self.people.append(person) | |
|
125 | self.rootItem = TreeItem(None, "ALL", None) | |
|
126 | self.parents = {0 : self.rootItem} | |
|
127 | self.setupModelData() | |
|
128 | ||
|
129 | ||
|
130 | def columnCount(self, parent=None): | |
|
131 | if parent and parent.isValid(): | |
|
132 | return parent.internalPointer().columnCount() | |
|
133 | else: | |
|
134 | return len(HORIZONTAL_HEADERS) | |
|
135 | ||
|
136 | def data(self, index, role): | |
|
137 | if not index.isValid(): | |
|
138 | return QtCore.QVariant() | |
|
139 | ||
|
140 | item = index.internalPointer() | |
|
141 | if role == QtCore.Qt.DisplayRole: | |
|
142 | return item.data(index.column()) | |
|
143 | if role == QtCore.Qt.UserRole: | |
|
144 | if item: | |
|
145 | return item.person | |
|
146 | ||
|
147 | return QtCore.QVariant() | |
|
148 | ||
|
149 | def headerData(self, column, orientation, role): | |
|
150 | if (orientation == QtCore.Qt.Horizontal and | |
|
151 | role == QtCore.Qt.DisplayRole): | |
|
152 | try: | |
|
153 | return QtCore.QVariant(HORIZONTAL_HEADERS[column]) | |
|
154 | except IndexError: | |
|
155 | pass | |
|
156 | ||
|
157 | return QtCore.QVariant() | |
|
158 | ||
|
159 | def index(self, row, column, parent): | |
|
160 | if not self.hasIndex(row, column, parent): | |
|
161 | return QtCore.QModelIndex() | |
|
162 | ||
|
163 | if not parent.isValid(): | |
|
164 | parentItem = self.rootItem | |
|
165 | else: | |
|
166 | parentItem = parent.internalPointer() | |
|
167 | ||
|
168 | childItem = parentItem.child(row) | |
|
169 | if childItem: | |
|
170 | return self.createIndex(row, column, childItem) | |
|
171 | else: | |
|
172 | return QtCore.QModelIndex() | |
|
173 | ||
|
174 | def parent(self, index): | |
|
175 | if not index.isValid(): | |
|
176 | return QtCore.QModelIndex() | |
|
177 | ||
|
178 | childItem = index.internalPointer() | |
|
179 | if not childItem: | |
|
180 | return QtCore.QModelIndex() | |
|
181 | ||
|
182 | parentItem = childItem.parent() | |
|
183 | ||
|
184 | if parentItem == self.rootItem: | |
|
185 | return QtCore.QModelIndex() | |
|
186 | ||
|
187 | return self.createIndex(parentItem.row(), 0, parentItem) | |
|
188 | ||
|
189 | def rowCount(self, parent=QtCore.QModelIndex()): | |
|
190 | if parent.column() > 0: | |
|
191 | return 0 | |
|
192 | if not parent.isValid(): | |
|
193 | p_Item = self.rootItem | |
|
194 | else: | |
|
195 | p_Item = parent.internalPointer() | |
|
196 | return p_Item.childCount() | |
|
197 | ||
|
198 | def setupModelData(self): | |
|
199 | for person in self.people: | |
|
200 | if person.descripcion: | |
|
201 | encabezado = person.caracteristica | |
|
202 | ||
|
203 | ||
|
204 | if not self.parents.has_key(encabezado): | |
|
205 | newparent = TreeItem(None, encabezado, self.rootItem) | |
|
206 | self.rootItem.appendChild(newparent) | |
|
207 | ||
|
208 | self.parents[encabezado] = newparent | |
|
209 | ||
|
210 | parentItem = self.parents[encabezado] | |
|
211 | newItem = TreeItem(person, "", parentItem) | |
|
212 | parentItem.appendChild(newItem) | |
|
213 | ||
|
214 | def searchModel(self, person): | |
|
215 | ''' | |
|
216 | get the modelIndex for a given appointment | |
|
217 | ''' | |
|
218 | def searchNode(node): | |
|
219 | ''' | |
|
220 | a function called recursively, looking at all nodes beneath node | |
|
221 | ''' | |
|
222 | for child in node.childItems: | |
|
223 | if person == child.person: | |
|
224 | index = self.createIndex(child.row(), 0, child) | |
|
225 | return index | |
|
226 | ||
|
227 | if child.childCount() > 0: | |
|
228 | result = searchNode(child) | |
|
229 | if result: | |
|
230 | return result | |
|
231 | ||
|
232 | retarg = searchNode(self.parents[0]) | |
|
233 | #print retarg | |
|
234 | return retarg | |
|
235 | ||
|
236 | def find_GivenName(self, principal): | |
|
237 | app = None | |
|
238 | for person in self.people: | |
|
239 | if person.principal == principal: | |
|
240 | app = person | |
|
241 | break | |
|
242 | if app != None: | |
|
243 | index = self.searchModel(app) | |
|
244 | return (True, index) | |
|
245 | return (False, None) | |
|
246 | ||
|
247 | ||
|
248 | class person_class(object): | |
|
249 | ''' | |
|
250 | a trivial custom data object | |
|
251 | ''' | |
|
252 | def __init__(self, caracteristica, principal, descripcion): | |
|
253 | self.caracteristica = caracteristica | |
|
254 | self.principal = principal | |
|
255 | self.descripcion = descripcion | |
|
256 | ||
|
257 | def __repr__(self): | |
|
258 | return "PERSON - %s %s"% (self.principal, self.caracteristica) | |
|
259 | ||
|
260 | class TreeItem(object): | |
|
261 | ''' | |
|
262 | a python object used to return row/column data, and keep note of | |
|
263 | it's parents and/or children | |
|
264 | ''' | |
|
265 | def __init__(self, person, header, parentItem): | |
|
266 | self.person = person | |
|
267 | self.parentItem = parentItem | |
|
268 | self.header = header | |
|
269 | self.childItems = [] | |
|
270 | ||
|
271 | def appendChild(self, item): | |
|
272 | self.childItems.append(item) | |
|
273 | ||
|
274 | def child(self, row): | |
|
275 | return self.childItems[row] | |
|
276 | ||
|
277 | def childCount(self): | |
|
278 | return len(self.childItems) | |
|
279 | ||
|
280 | def columnCount(self): | |
|
281 | return 2 | |
|
282 | ||
|
283 | def data(self, column): | |
|
284 | if self.person == None: | |
|
285 | if column == 0: | |
|
286 | return QtCore.QVariant(self.header) | |
|
287 | if column == 1: | |
|
288 | return QtCore.QVariant("") | |
|
289 | else: | |
|
290 | if column == 0: | |
|
291 | return QtCore.QVariant(self.person.principal) | |
|
292 | if column == 1: | |
|
293 | return QtCore.QVariant(self.person.descripcion) | |
|
294 | return QtCore.QVariant() | |
|
295 | ||
|
296 | def parent(self): | |
|
297 | return self.parentItem | |
|
298 | ||
|
299 | def row(self): | |
|
300 | if self.parentItem: | |
|
301 | return self.parentItem.childItems.index(self) | |
|
302 | return 0 | |
|
303 | No newline at end of file |
@@ -1,38 +0,0 | |||
|
1 | import os, sys | |
|
2 | import getopt | |
|
3 | ||
|
4 | from schainpy.controller import Project | |
|
5 | ||
|
6 | class scProcessController(): | |
|
7 | def __init__(self): | |
|
8 | print "ESTOY EJECUTANDO EL NUEVO PROCESO PERO APARENTEMENTE NO QUIERE" | |
|
9 | self.setfilename() | |
|
10 | self.operation() | |
|
11 | ||
|
12 | def setfilename(self): | |
|
13 | arglist= '' | |
|
14 | longarglist=['filename='] | |
|
15 | optlist,args=getopt.getopt(sys.argv[1:],arglist,longarglist) | |
|
16 | for opt in optlist: | |
|
17 | if opt[0]== '--filename': | |
|
18 | self.filename = opt[1] | |
|
19 | ||
|
20 | def operation(self): | |
|
21 | print 'inicia operation' | |
|
22 | controllerObj = Project() | |
|
23 | print "Leyendo el archivo XML" | |
|
24 | #self.filename="C://Users//alex//schain_workspace//Alexander1.xml" | |
|
25 | controllerObj.readXml(self.filename) | |
|
26 | #controllerObj.printattr() | |
|
27 | ||
|
28 | controllerObj.createObjects() | |
|
29 | controllerObj.connectObjects() | |
|
30 | controllerObj.run() | |
|
31 | ||
|
32 | ||
|
33 | def main(): | |
|
34 | a=scProcessController() | |
|
35 | ||
|
36 | ||
|
37 | if __name__ == "__main__": | |
|
38 | main() No newline at end of file |
@@ -1,427 +0,0 | |||
|
1 | """ | |
|
2 | The TIME_CONVERSIONS.py module gathers classes and functions for time system transformations | |
|
3 | (e.g. between seconds from 1970 to datetime format). | |
|
4 | ||
|
5 | MODULES CALLED: | |
|
6 | NUMPY, TIME, DATETIME, CALENDAR | |
|
7 | ||
|
8 | MODIFICATION HISTORY: | |
|
9 | Created by Ing. Freddy Galindo (frederickgalindo@gmail.com). ROJ Aug 13, 2009. | |
|
10 | """ | |
|
11 | ||
|
12 | import numpy as np | |
|
13 | import time as tm | |
|
14 | import datetime as dt | |
|
15 | import calendar as cr | |
|
16 | ||
|
17 | class Time: | |
|
18 | """ | |
|
19 | time(year,month,dom,hour,min,secs) | |
|
20 | ||
|
21 | An object represents a date and time of certain event.. | |
|
22 | ||
|
23 | Parameters | |
|
24 | ---------- | |
|
25 | YEAR = Number of the desired year. Year must be valid values from the civil calendar. | |
|
26 | Years B.C.E must be represented as negative integers. Years in the common era are repre- | |
|
27 | sented as positive integers. In particular, note that there is no year 0 in the civil | |
|
28 | calendar. 1 B.C.E. (-1) is followed by 1 C.E. (1). | |
|
29 | ||
|
30 | MONTH = Number of desired month (1=Jan, ..., 12=December). | |
|
31 | ||
|
32 | DOM = Number of day of the month. | |
|
33 | ||
|
34 | HOUR = Number of the hour of the day. By default hour=0 | |
|
35 | ||
|
36 | MINS = Number of the minute of the hour. By default min=0 | |
|
37 | ||
|
38 | SECS = Number of the second of the minute. By default secs=0. | |
|
39 | ||
|
40 | Examples | |
|
41 | -------- | |
|
42 | time_info = time(2008,9,30,12,30,00) | |
|
43 | ||
|
44 | time_info = time(2008,9,30) | |
|
45 | """ | |
|
46 | ||
|
47 | def __init__(self,year=None,month=None,dom=None,hour=0,mins=0,secs=0): | |
|
48 | # If one the first three inputs are not defined, it takes the current date. | |
|
49 | date = tm.localtime() | |
|
50 | if year==None:year=date[0] | |
|
51 | if month==None:month=date[1] | |
|
52 | if dom==None:dom=date[2] | |
|
53 | ||
|
54 | # Converting to arrays | |
|
55 | year = np.array([year]); month = np.array([month]); dom = np.array([dom]) | |
|
56 | hour = np.array([hour]); mins = np.array([mins]); secs = np.array([secs]) | |
|
57 | ||
|
58 | # Defining time information object. | |
|
59 | self.year = np.atleast_1d(year) | |
|
60 | self.month = np.atleast_1d(month) | |
|
61 | self.dom = np.atleast_1d(dom) | |
|
62 | self.hour = np.atleast_1d(hour) | |
|
63 | self.mins = np.atleast_1d(mins) | |
|
64 | self.secs = np.atleast_1d(secs) | |
|
65 | ||
|
66 | def change2julday(self): | |
|
67 | """ | |
|
68 | Converts a datetime to Julian days. | |
|
69 | """ | |
|
70 | ||
|
71 | # Defining constants | |
|
72 | greg = 2299171 # incorrect Julian day for Oct, 25, 1582. | |
|
73 | min_calendar = -4716 | |
|
74 | max_calendar = 5000000 | |
|
75 | ||
|
76 | min_year = np.nanmin(self.year) | |
|
77 | max_year = np.nanmax(self.year) | |
|
78 | if (min_year<min_calendar) or (max_year>max_calendar): | |
|
79 | print "Value of Julian date is out of allowed range" | |
|
80 | return -1 | |
|
81 | ||
|
82 | noyear = np.sum(self.year==0) | |
|
83 | if noyear>0: | |
|
84 | print "There is no year zero in the civil calendar" | |
|
85 | return -1 | |
|
86 | ||
|
87 | # Knowing if the year is less than 0. | |
|
88 | bc = self.year<0 | |
|
89 | ||
|
90 | # Knowing if the month is less than March. | |
|
91 | inJanFeb = self.month<=2 | |
|
92 | ||
|
93 | jy = self.year + bc - inJanFeb | |
|
94 | jm = self.month + (1 + 12*inJanFeb) | |
|
95 | ||
|
96 | # Computing Julian days. | |
|
97 | jul= np.floor(365.25*jy) + np.floor(30.6001*jm) + (self.dom+1720995.0) | |
|
98 | ||
|
99 | # Test whether to change to Gregorian Calendar | |
|
100 | if np.min(jul) >= greg: | |
|
101 | ja = np.int32(0.01*jy) | |
|
102 | jul = jul + 2 - ja + np.int32(0.25*ja) | |
|
103 | else: | |
|
104 | gregchange = np.where(jul >= greg) | |
|
105 | if gregchange[0].size>0: | |
|
106 | ja = np.int32(0.01 + jy[gregchange]) | |
|
107 | jy[grechange] = jy[gregchange] + 2 - ja + np.int32(0.25*ja) | |
|
108 | ||
|
109 | # Determining machine-specific parameters affecting floating-point. | |
|
110 | eps = 0.0 # Replace this line for a function to get precision. | |
|
111 | eps = abs(jul)*0.0 > eps | |
|
112 | ||
|
113 | jul = jul + (self.hour/24. -0.5) + (self.mins/1440.) + (self.secs/86400.) + eps | |
|
114 | ||
|
115 | return jul[0] | |
|
116 | ||
|
117 | def change2secs(self): | |
|
118 | """ | |
|
119 | Converts datetime to number of seconds respect to 1970. | |
|
120 | """ | |
|
121 | ||
|
122 | year = self.year | |
|
123 | if year.size>1: year = year[0] | |
|
124 | ||
|
125 | month = self.month | |
|
126 | if month.size>1: month = month[0] | |
|
127 | ||
|
128 | dom = self.dom | |
|
129 | if dom.size>1: dom = dom[0] | |
|
130 | ||
|
131 | # Resizing hour, mins and secs if it was necessary. | |
|
132 | hour = self.hour | |
|
133 | if hour.size>1:hour = hour[0] | |
|
134 | if hour.size==1:hour = np.resize(hour,year.size) | |
|
135 | ||
|
136 | mins = self.mins | |
|
137 | if mins.size>1:mins = mins[0] | |
|
138 | if mins.size==1:mins = np.resize(mins,year.size) | |
|
139 | ||
|
140 | secs = self.secs | |
|
141 | if secs.size>1:secs = secs[0] | |
|
142 | if secs.size==1:secs = np.resize(secs,year.size) | |
|
143 | ||
|
144 | # Using time.mktime to compute seconds respect to 1970. | |
|
145 | secs1970 = np.zeros(year.size) | |
|
146 | for ii in np.arange(year.size): | |
|
147 | secs1970[ii] = tm.mktime((int(year[ii]),int(month[ii]),int(dom[ii]),\ | |
|
148 | int(hour[ii]),int(mins[ii]),int(secs[ii]),0,0,0)) | |
|
149 | ||
|
150 | secs1970 = np.int32(secs1970 - tm.timezone) | |
|
151 | ||
|
152 | return secs1970 | |
|
153 | ||
|
154 | def change2strdate(self,mode=1): | |
|
155 | """ | |
|
156 | change2strdate method converts a date and time of certain event to date string. The | |
|
157 | string format is like localtime (e.g. Fri Oct 9 15:00:19 2009). | |
|
158 | ||
|
159 | Parameters | |
|
160 | ---------- | |
|
161 | None. | |
|
162 | ||
|
163 | Return | |
|
164 | ------ | |
|
165 | ||
|
166 | Modification History | |
|
167 | -------------------- | |
|
168 | Created by Freddy R. Galindo, ROJ, 09 October 2009. | |
|
169 | ||
|
170 | """ | |
|
171 | ||
|
172 | secs = np.atleast_1d(self.change2secs()) | |
|
173 | strdate = [] | |
|
174 | for ii in np.arange(np.size(secs)): | |
|
175 | secs_tmp = tm.localtime(secs[ii] + tm.timezone) | |
|
176 | if mode==1: | |
|
177 | strdate.append(tm.strftime("%d-%b-%Y (%j) %H:%M:%S",secs_tmp)) | |
|
178 | elif mode==2: | |
|
179 | strdate.append(tm.strftime("%d-%b-%Y (%j)",secs_tmp)) | |
|
180 | ||
|
181 | strdate = np.array(strdate) | |
|
182 | ||
|
183 | return strdate | |
|
184 | ||
|
185 | ||
|
186 | class Secs: | |
|
187 | """ | |
|
188 | secs(secs): | |
|
189 | ||
|
190 | An object represents the number of seconds respect to 1970. | |
|
191 | ||
|
192 | Parameters | |
|
193 | ---------- | |
|
194 | ||
|
195 | SECS = A scalar or array giving the number of seconds respect to 1970. | |
|
196 | ||
|
197 | Example: | |
|
198 | -------- | |
|
199 | secs_info = secs(1251241373) | |
|
200 | ||
|
201 | secs_info = secs([1251241373,1251241383,1251241393]) | |
|
202 | """ | |
|
203 | def __init__(self,secs): | |
|
204 | self.secs = secs | |
|
205 | ||
|
206 | def change2julday(self): | |
|
207 | """ | |
|
208 | Convert seconds from 1970 to Julian days. | |
|
209 | """ | |
|
210 | ||
|
211 | secs_1970 = time(1970,1,1,0,0,0).change2julday() | |
|
212 | ||
|
213 | julian = self.secs/86400.0 + secs_1970 | |
|
214 | ||
|
215 | return julian | |
|
216 | ||
|
217 | def change2time(self): | |
|
218 | """ | |
|
219 | Converts seconds from 1970 to datetime. | |
|
220 | """ | |
|
221 | ||
|
222 | secs1970 = np.atleast_1d(self.secs) | |
|
223 | ||
|
224 | datetime = np.zeros((9,secs1970.size)) | |
|
225 | for ii in np.arange(secs1970.size): | |
|
226 | tuple = tm.gmtime(secs1970[ii]) | |
|
227 | datetime[0,ii] = tuple[0] | |
|
228 | datetime[1,ii] = tuple[1] | |
|
229 | datetime[2,ii] = tuple[2] | |
|
230 | datetime[3,ii] = tuple[3] | |
|
231 | datetime[4,ii] = tuple[4] | |
|
232 | datetime[5,ii] = tuple[5] | |
|
233 | datetime[6,ii] = tuple[6] | |
|
234 | datetime[7,ii] = tuple[7] | |
|
235 | datetime[8,ii] = tuple[8] | |
|
236 | ||
|
237 | datetime = np.int32(datetime) | |
|
238 | ||
|
239 | return datetime | |
|
240 | ||
|
241 | ||
|
242 | class Julian: | |
|
243 | """ | |
|
244 | julian(julian): | |
|
245 | ||
|
246 | An object represents julian days. | |
|
247 | ||
|
248 | Parameters | |
|
249 | ---------- | |
|
250 | ||
|
251 | JULIAN = A scalar or array giving the julina days. | |
|
252 | ||
|
253 | Example: | |
|
254 | -------- | |
|
255 | julian_info = julian(2454740) | |
|
256 | ||
|
257 | julian_info = julian([2454740,2454760,2454780]) | |
|
258 | """ | |
|
259 | def __init__(self,julian): | |
|
260 | self.julian = np.atleast_1d(julian) | |
|
261 | ||
|
262 | def change2time(self): | |
|
263 | """ | |
|
264 | change2time method converts from julian day to calendar date and time. | |
|
265 | ||
|
266 | Return | |
|
267 | ------ | |
|
268 | year = An array giving the year of the desired julian day. | |
|
269 | month = An array giving the month of the desired julian day. | |
|
270 | dom = An array giving the day of the desired julian day. | |
|
271 | hour = An array giving the hour of the desired julian day. | |
|
272 | mins = An array giving the minute of the desired julian day. | |
|
273 | secs = An array giving the second of the desired julian day. | |
|
274 | ||
|
275 | Examples | |
|
276 | -------- | |
|
277 | >> jd = 2455119.0 | |
|
278 | >> [yy,mo,dd,hh,mi,ss] = TimeTools.julian(jd).change2time() | |
|
279 | >> print [yy,mo,dd,hh,mi,ss] | |
|
280 | [2009] [10] [ 14.] [ 12.] [ 0.] [ 0.] | |
|
281 | ||
|
282 | Modification history | |
|
283 | -------------------- | |
|
284 | Translated from "Numerical Recipies in C", by William H. Press, Brian P. Flannery, | |
|
285 | Saul A. Teukolsky, and William T. Vetterling. Cambridge University Press, 1988. | |
|
286 | Converted to Python by Freddy R. Galindo, ROJ, 06 October 2009. | |
|
287 | """ | |
|
288 | ||
|
289 | min_julian = -1095 | |
|
290 | max_julian = 1827933925 | |
|
291 | if (np.min(self.julian) < min_julian) or (np.max(self.julian) > max_julian): | |
|
292 | print 'Value of Julian date is out of allowed range.' | |
|
293 | return None | |
|
294 | ||
|
295 | # Beginning of Gregorian calendar | |
|
296 | igreg = 2299161 | |
|
297 | julLong = np.floor(self.julian + 0.5) | |
|
298 | minJul = np.min(julLong) | |
|
299 | ||
|
300 | if (minJul >= igreg): | |
|
301 | # All are Gregorian | |
|
302 | jalpha = np.int32(((julLong - 1867216) - 0.25)/36524.25) | |
|
303 | ja = julLong + 1 + jalpha - np.int32(0.25*jalpha) | |
|
304 | else: | |
|
305 | ja = julLong | |
|
306 | gregChange = np.where(julLong >= igreg) | |
|
307 | if gregChange[0].size>0: | |
|
308 | jalpha = np.int32(((julLong[gregChange]-1867216) - 0.25)/36524.25) | |
|
309 | ja[gregChange] = julLong[gregChange]+1+jalpha-np.int32(0.25*jalpha) | |
|
310 | ||
|
311 | # clear memory. | |
|
312 | jalpha = -1 | |
|
313 | ||
|
314 | jb = ja + 1524 | |
|
315 | jc = np.int32(6680. + ((jb-2439870)-122.1)/365.25) | |
|
316 | jd = np.int32(365.*jc + (0.25*jc)) | |
|
317 | je = np.int32((jb - jd)/30.6001) | |
|
318 | ||
|
319 | dom = jb - jd - np.int32(30.6001*je) | |
|
320 | month = je - 1 | |
|
321 | month = ((month - 1) % 12) + 1 | |
|
322 | month = np.atleast_1d(month) | |
|
323 | year = jc - 4715 | |
|
324 | year = year - (month > 2)*1 | |
|
325 | year = year - (year <= 0)*1 | |
|
326 | year = np.atleast_1d(year) | |
|
327 | ||
|
328 | # Getting hours, minutes, seconds | |
|
329 | fraction = self.julian + 0.5 - julLong | |
|
330 | eps_0 = dom*0.0 + 1.0e-12 | |
|
331 | eps_1 = 1.0e-12*np.abs(julLong) | |
|
332 | eps = (eps_0>eps_1)*eps_0 + (eps_0<=eps_1)*eps_1 | |
|
333 | ||
|
334 | hour_0 = dom*0 + 23 | |
|
335 | hour_2 = dom*0 + 0 | |
|
336 | hour_1 = np.floor(fraction*24.0 + eps) | |
|
337 | hour = ((hour_1>hour_0)*23) + ((hour_1<=hour_0)*hour_1) | |
|
338 | hour = ((hour_1<hour_2)*0) + ((hour_1>=hour_2)*hour_1) | |
|
339 | ||
|
340 | fraction = fraction - (hour/24.0) | |
|
341 | mins_0 = dom*0 + 59 | |
|
342 | mins_2 = dom*0 + 0 | |
|
343 | mins_1 = np.floor(fraction*1440.0 + eps) | |
|
344 | mins = ((mins_1>mins_0)*59) + ((mins_1<=mins_0)*mins_1) | |
|
345 | mins = ((mins_1<mins_2)*0) + ((mins_1>=mins_2)*mins_1) | |
|
346 | ||
|
347 | secs_2 = dom*0 + 0 | |
|
348 | secs_1 = (fraction - mins/1440.0)*86400.0 | |
|
349 | secs = ((secs_1<secs_2)*0) + ((secs_1>=secs_2)*secs_1) | |
|
350 | ||
|
351 | return year, month,dom, hour, mins, secs | |
|
352 | ||
|
353 | def change2secs(self): | |
|
354 | """ | |
|
355 | Converts from Julian days to seconds from 1970. | |
|
356 | """ | |
|
357 | ||
|
358 | jul_1970 = Time(1970,1,1,0,0,0).change2julday() | |
|
359 | ||
|
360 | secs = np.int32((self.julian - jul_1970)*86400) | |
|
361 | ||
|
362 | return secs | |
|
363 | ||
|
364 | def change2lst(self,longitude=-76.8667): | |
|
365 | """ | |
|
366 | CT2LST converts from local civil time to local mean sideral time | |
|
367 | ||
|
368 | longitude = The longitude in degrees (east of Greenwich) of the place for which | |
|
369 | the local sideral time is desired, scalar. The Greenwich mean sideral time (GMST) | |
|
370 | can be found by setting longitude=0. | |
|
371 | """ | |
|
372 | ||
|
373 | # Useful constants, see Meus, p. 84 | |
|
374 | c = np.array([280.46061837, 360.98564736629, 0.000387933, 38710000.0]) | |
|
375 | jd2000 = 2451545.0 | |
|
376 | t0 = self.julian - jd2000 | |
|
377 | t = t0/36525. | |
|
378 | ||
|
379 | # Computing GST in seconds | |
|
380 | theta = c[0] + (c[1]*t0) + (t**2)*(c[2]-t/c[3]) | |
|
381 | ||
|
382 | # Computing LST in hours | |
|
383 | lst = (theta + longitude)/15.0 | |
|
384 | neg = np.where(lst < 0.0) | |
|
385 | if neg[0].size>0:lst[neg] = 24.0 + (lst[neg] % 24) | |
|
386 | lst = lst % 24.0 | |
|
387 | ||
|
388 | return lst | |
|
389 | ||
|
390 | ||
|
391 | class date2doy: | |
|
392 | def __init__(self,year,month,day): | |
|
393 | self.year = year | |
|
394 | self.month = month | |
|
395 | self.day = day | |
|
396 | ||
|
397 | def change2doy(self): | |
|
398 | if cr.isleap(self.year) == True: | |
|
399 | tfactor = 1 | |
|
400 | else: | |
|
401 | tfactor = 2 | |
|
402 | ||
|
403 | day = self.day | |
|
404 | month = self.month | |
|
405 | ||
|
406 | doy = np.floor((275*month)/9.0) - (tfactor*np.floor((month+9)/12.0)) + day - 30 | |
|
407 | ||
|
408 | return np.int32(doy) | |
|
409 | ||
|
410 | ||
|
411 | class Doy2Date: | |
|
412 | def __init__(self,year,doy): | |
|
413 | self.year = year | |
|
414 | self.doy = doy | |
|
415 | ||
|
416 | def change2date(self): | |
|
417 | months = np.arange(12) + 1 | |
|
418 | ||
|
419 | first_dem = date2doy(self.year,months,1) | |
|
420 | first_dem = first_dem.change2doy() | |
|
421 | ||
|
422 | imm = np.where((self.doy - first_dem) > 0) | |
|
423 | ||
|
424 | month = imm[0].size | |
|
425 | dom = self.doy -first_dem[month - 1] + 1 | |
|
426 | ||
|
427 | return month, dom |
@@ -1,58 +0,0 | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | ||
|
3 | """ | |
|
4 | Module implementing MainWindow. | |
|
5 | """ | |
|
6 | ||
|
7 | from PyQt4.QtGui import QMainWindow | |
|
8 | from PyQt4.QtCore import pyqtSignature | |
|
9 | ||
|
10 | from schainpy.gui.viewer.ui_unitprocess import Ui_UnitProcess | |
|
11 | ||
|
12 | class UnitProcess(QMainWindow, Ui_UnitProcess): | |
|
13 | """ | |
|
14 | Class documentation goes here. | |
|
15 | """ | |
|
16 | ||
|
17 | def __init__(self, parent = None): | |
|
18 | """ | |
|
19 | Constructor | |
|
20 | """ | |
|
21 | QMainWindow.__init__(self, parent) | |
|
22 | self.setupUi(self) | |
|
23 | ||
|
24 | ||
|
25 | @pyqtSignature("QString") | |
|
26 | def on_comboInputBox_activated(self, p0): | |
|
27 | """ | |
|
28 | Slot documentation goes here. | |
|
29 | """ | |
|
30 | # TODO: not implemented yet | |
|
31 | raise NotImplementedError | |
|
32 | ||
|
33 | @pyqtSignature("QString") | |
|
34 | def on_comboTypeBox_activated(self, p0): | |
|
35 | """ | |
|
36 | Slot documentation goes here. | |
|
37 | """ | |
|
38 | # TODO: not implemented yet | |
|
39 | raise NotImplementedError | |
|
40 | ||
|
41 | ||
|
42 | @pyqtSignature("") | |
|
43 | def on_unitPokbut_clicked(self): | |
|
44 | """ | |
|
45 | Slot documentation goes here. | |
|
46 | """ | |
|
47 | # TODO: not implemented yet | |
|
48 | #raise NotImplementedError | |
|
49 | print "this is suspiscious" | |
|
50 | print "njdasjdajj" | |
|
51 | ||
|
52 | @pyqtSignature("") | |
|
53 | def on_unitPcancelbut_clicked(self): | |
|
54 | """ | |
|
55 | Slot documentation goes here. | |
|
56 | """ | |
|
57 | # TODO: not implemented yet | |
|
58 | raise NotImplementedError |
This diff has been collapsed as it changes many lines, (807 lines changed) Show them Hide them | |||
@@ -1,807 +0,0 | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | """ | |
|
3 | Module implementing MainWindow. | |
|
4 | #+++++++++++++++++++++INTERFAZ DE USUARIO V1.1++++++++++++++++++++++++# | |
|
5 | """ | |
|
6 | from PyQt4.QtGui import QMainWindow | |
|
7 | from PyQt4.QtCore import pyqtSignature | |
|
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 schainpy.gui.viewer.ui_unitprocess import Ui_UnitProcess | |
|
14 | from schainpy.gui.viewer.ui_window import Ui_window | |
|
15 | from schainpy.gui.viewer.ui_mainwindow import Ui_MainWindow | |
|
16 | from schainpy.gui.viewer.ui_workspace import Ui_Workspace | |
|
17 | from schainpy.gui.viewer.ui_initwindow import Ui_InitWindow | |
|
18 | ||
|
19 | from schainpy.controller import Project,ReadUnitConf,ProcUnitConf,OperationConf,ParameterConf | |
|
20 | import os | |
|
21 | ||
|
22 | HORIZONTAL_HEADERS = ("ITEM :"," DATOS : " ) | |
|
23 | ||
|
24 | HORIZONTAL = ("RAMA :",) | |
|
25 | ||
|
26 | class MainWindow(QMainWindow, Ui_MainWindow): | |
|
27 | ||
|
28 | nop=None | |
|
29 | ||
|
30 | __projObjDict = {} | |
|
31 | __arbolDict = {} | |
|
32 | ||
|
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_addprojectBtn_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): | |
|
660 | """ | |
|
661 | Class documentation goes here. | |
|
662 | """ | |
|
663 | closed = pyqtSignal() | |
|
664 | ||
|
665 | create = False | |
|
666 | name = None | |
|
667 | description = None | |
|
668 | ||
|
669 | ||
|
670 | ||
|
671 | def __init__(self, parent = None): | |
|
672 | """ | |
|
673 | Constructor | |
|
674 | """ | |
|
675 | QMainWindow.__init__(self, parent) | |
|
676 | self.setupUi(self) | |
|
677 | self.name=None | |
|
678 | ||
|
679 | self.proyectNameLine.setText('My_name_is...') | |
|
680 | self.descriptionTextEdit.setText('Write a description...') | |
|
681 | ||
|
682 | ||
|
683 | @pyqtSignature("") | |
|
684 | def on_cancelButton_clicked(self): | |
|
685 | """ | |
|
686 | Slot documentation goes here. | |
|
687 | """ | |
|
688 | # TODO: not implemented yet | |
|
689 | #raise NotImplementedError | |
|
690 | self.create = False | |
|
691 | self.close() | |
|
692 | ||
|
693 | @pyqtSignature("") | |
|
694 | def on_okButton_clicked(self): | |
|
695 | """ | |
|
696 | Slot documentation goes here. | |
|
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 | ||
|
755 | # TODO: not implemented yet | |
|
756 | #raise NotImplementedError | |
|
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 | """ | |
|
771 | self.close() | |
|
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() | |
|
790 | ||
|
791 | def almacena(self): | |
|
792 | self.getFromWindow=self.getfromWindowList[int(self.comboInputBox.currentIndex())] | |
|
793 | #self.nameofUP= str(self.nameUptxt.text()) | |
|
794 | self.typeofUP= str(self.comboTypeBox.currentText()) | |
|
795 | return self.getFromWindow,self.typeofUP | |
|
796 | ||
|
797 | def closeEvent(self, event): | |
|
798 | self.closed.emit() | |
|
799 | event.accept() | |
|
800 | ||
|
801 | ||
|
802 | ||
|
803 | ||
|
804 | ||
|
805 | ||
|
806 | ||
|
807 | No newline at end of file |
@@ -1,14 +0,0 | |||
|
1 | ''' | |
|
2 | Created on Septembre, 2012 | |
|
3 | ||
|
4 | @author: roj-idl71 | |
|
5 | ''' | |
|
6 | from xml.etree import ElementTree | |
|
7 | from xml.dom import minidom | |
|
8 | ||
|
9 | def prettify(elem): | |
|
10 | """Return a pretty-printed XML string for the Element. | |
|
11 | """ | |
|
12 | rough_string = ElementTree.tostring(elem, 'utf-8') | |
|
13 | reparsed = minidom.parseString(rough_string) | |
|
14 | return reparsed.toprettyxml(indent=" ") No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now