개정판 a1ccaef1
issue #000 Export To PAP 수정.
HYTOS/HYTOS/Export_To_PAP.py | ||
---|---|---|
128 | 128 |
|
129 | 129 |
|
130 | 130 |
class QExport_To_PAP(QDialog): |
131 |
def __init__(self): |
|
132 |
QDialog.__init__(self) |
|
131 |
def __init__(self,parent):
|
|
132 |
QDialog.__init__(self,parent)
|
|
133 | 133 |
self.ui = Export_To_PAP_UI.Ui_Dialog() |
134 | 134 |
self.ui.setupUi(self) |
135 | 135 |
self.ui.buttonBox.button(QDialogButtonBox.Ok).setIcon(QtGui.QIcon(':/images/OK.svg')) |
... | ... | |
156 | 156 |
Valve_Datacase.Normal_Flowrate_Case, |
157 | 157 |
Valve_Datacase.Minimum_Flowrate_Case, |
158 | 158 |
Valve_Datacase.N_A] |
159 |
self.send_api(end_point = "/api/Projects", method= "GET") |
|
159 |
try: |
|
160 |
loop = asyncio.get_event_loop() |
|
161 |
loop.run_until_complete(self.send_api()) |
|
162 |
except Exception as ex: |
|
163 |
from App import App |
|
164 |
from AppDocData import MessageType |
|
165 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
166 |
sys.exc_info()[-1].tb_lineno) |
|
167 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
168 |
finally: |
|
169 |
QTimer.singleShot(500, self.close_animation) |
|
170 |
self.ui.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) |
|
171 |
|
|
172 |
if self.papInfomation: |
|
173 |
index = self.ui.comboBox_select_PAP_Project.findText(str(self.papInfomation[0].ProjectNo)) |
|
174 |
if (index != -1): |
|
175 |
self.ui.comboBox_select_PAP_Project.setCurrentIndex(index) |
|
160 | 176 |
self.data_load() |
161 | 177 |
|
162 | 178 |
def schema_PAPUploadInfomationtable(self): |
... | ... | |
330 | 346 |
self.ui.label_loading.setMovie(self.close_movie) |
331 | 347 |
self.close_movie.start() |
332 | 348 |
|
333 |
def send_api(self, end_point, method):
|
|
349 |
async def send_api(self):
|
|
334 | 350 |
app_doc_data = AppDocData.instance() |
351 |
end_point = "/api/Projects" |
|
352 |
method = "GET" |
|
335 | 353 |
url = app_doc_data.API_HOST + end_point |
336 |
headers = {'Content-Type': 'application/json', 'charset': 'UTF-8', 'Accept': '*/*'} |
|
354 |
|
|
337 | 355 |
self.project_list.clear() |
338 | 356 |
self.ui.comboBox_select_PAP_Project.clear() |
339 |
try: |
|
340 |
if method == 'GET': |
|
341 |
response = requests.get(url, headers=headers) |
|
342 |
if response.status_code == 200: |
|
343 |
json_objects = json.loads(response.text) |
|
344 |
for json_object in json_objects: |
|
345 |
project_dto = ProjectDto() |
|
346 |
project_dto.setData(json_object = json_object) |
|
347 |
self.ui.comboBox_select_PAP_Project.addItem(project_dto.Name) |
|
348 |
self.project_list.append(project_dto) |
|
349 |
if self.papInfomation: |
|
350 |
index = self.ui.comboBox_select_PAP_Project.findText(str(self.papInfomation[0].ProjectNo)) |
|
351 |
if (index != -1): |
|
352 |
self.ui.comboBox_select_PAP_Project.setCurrentIndex(index) |
|
353 |
except Exception as ex: |
|
354 |
from App import App |
|
355 |
from AppDocData import MessageType |
|
356 | 357 |
|
357 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
358 |
sys.exc_info()[-1].tb_lineno) |
|
359 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
358 |
if method == 'GET': |
|
359 |
async with aiohttp.ClientSession() as session: |
|
360 |
async with session.get(url) as resp: |
|
361 |
response = await resp.json() |
|
362 |
if resp.status == 200: |
|
363 |
for json_object in response: |
|
364 |
project_dto = ProjectDto() |
|
365 |
project_dto.setData(json_object=json_object) |
|
366 |
self.ui.comboBox_select_PAP_Project.addItem(project_dto.Name) |
|
367 |
self.project_list.append(project_dto) |
|
368 |
|
|
369 |
|
|
370 |
|
|
360 | 371 |
|
361 | 372 |
def connect_api(self, index): |
362 | 373 |
#self.ui.comboBox_select_PAP_Project.setEnabled(False) |
... | ... | |
376 | 387 |
sys.exc_info()[-1].tb_lineno) |
377 | 388 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
378 | 389 |
self.ui.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) |
390 |
finally: |
|
391 |
QTimer.singleShot(500, self.close_animation) |
|
392 |
self.ui.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) |
|
379 | 393 |
|
380 | 394 |
def run_connection(self, projectNo): |
381 | 395 |
loop = asyncio.get_event_loop() # 이벤트 루프를 얻음 |
382 |
result =loop.run_until_complete(self.connection(projectNo)) # main이 끝날 때까지 기다림 |
|
396 |
result = loop.run_until_complete(self.connection(projectNo)) # main이 끝날 때까지 기다림
|
|
383 | 397 |
self.ui.comboBox_select_PAP_Project.setEnabled(True) |
384 | 398 |
if strToBool(str(result)): |
385 | 399 |
QTimer.singleShot(500, self.done_animation) |
HYTOS/HYTOS/MainWindow.py | ||
---|---|---|
277 | 277 |
self.showImageSelectionMessageBox() |
278 | 278 |
return |
279 | 279 |
from Export_To_PAP import QExport_To_PAP |
280 |
dlg = QExport_To_PAP() |
|
280 |
dlg = QExport_To_PAP(self)
|
|
281 | 281 |
dlg.exec_() |
282 | 282 |
|
283 | 283 |
except Exception as ex: |
내보내기 Unified diff