개정판 c921ff13
issue #000 HYTOS Export_To_PAP.py
1. PAPUploadInfomation 저장 및 불러오기
2. PAPUploadInfomationItem 저장 및 불러오기
Change-Id: I548edb3c76b51559a40a17dd020b8064e7290de7
HYTOS/HYTOS/AppDocData.py | ||
---|---|---|
6 | 6 |
import sqlite3 |
7 | 7 |
import datetime |
8 | 8 |
from enum import Enum |
9 |
|
|
9 |
from typing import List |
|
10 | 10 |
try: |
11 | 11 |
from PyQt5.QtCore import * |
12 | 12 |
from PyQt5.QtGui import * |
... | ... | |
40 | 40 |
Error = 2 |
41 | 41 |
Information = 3 |
42 | 42 |
|
43 |
class PAPUploadInformation: |
|
44 |
def __init__(self,param_project_uid = '', |
|
45 |
param_projectno = '', |
|
46 |
param_calculationcase = ''): |
|
47 |
self.Project_UID = param_project_uid |
|
48 |
self.ProjectNo = param_projectno |
|
49 |
self.CalculationCase = param_calculationcase |
|
50 |
|
|
51 |
def to_sql(self) -> str: |
|
52 |
return f"""insert or replace into PAPUploadInformation( |
|
53 |
Project_UID, |
|
54 |
ProjectNo, |
|
55 |
CalculationCase) |
|
56 |
values( |
|
57 |
'{self.Project_UID}', |
|
58 |
'{self.ProjectNo}', |
|
59 |
'{self.CalculationCase}' |
|
60 |
)""" |
|
61 |
|
|
62 |
class PAPUploadInformationItem: |
|
63 |
def __init__(self, param_project_uid = '', |
|
64 |
param_projectno = '', |
|
65 |
param_components_uid = '', |
|
66 |
param_components_type = '', |
|
67 |
param_components_itemno = '', |
|
68 |
param_components_datacase = ''): |
|
69 |
self.Project_UID = param_project_uid |
|
70 |
self.ProjectNo = param_projectno |
|
71 |
self.Components_UID = param_components_uid |
|
72 |
self.Components_Type = param_components_type |
|
73 |
self.Components_ItemNo = param_components_itemno |
|
74 |
self.Components_DataCase = param_components_datacase |
|
75 |
|
|
76 |
def to_sql(self) -> str: |
|
77 |
return f"""insert or replace into PAPUploadInformationItem( |
|
78 |
Project_UID, |
|
79 |
ProjectNo, |
|
80 |
Components_UID, |
|
81 |
Components_Type, |
|
82 |
Components_ItemNo, |
|
83 |
Components_DataCase) |
|
84 |
values( |
|
85 |
'{self.Project_UID}', |
|
86 |
'{self.ProjectNo}', |
|
87 |
'{self.Components_UID}', |
|
88 |
'{self.Components_Type}', |
|
89 |
'{self.Components_ItemNo}', |
|
90 |
'{self.Components_DataCase}')""" |
|
43 | 91 |
|
44 | 92 |
class AppDocData(SingletonInstane): |
45 | 93 |
|
... | ... | |
1856 | 1904 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
1857 | 1905 |
return res |
1858 | 1906 |
|
1907 |
def is_table(self, table_name): |
|
1908 |
""" This method seems to be working now""" |
|
1909 |
result = False |
|
1910 |
# Creates or opens a file called mydb with a SQLite3 DB |
|
1911 |
conn = sqlite3.connect(self.activeDrawing.path) |
|
1912 |
with conn: |
|
1913 |
try: |
|
1914 |
# Get a cursor object |
|
1915 |
cursor = conn.cursor() |
|
1916 |
query = f"SELECT name from sqlite_master WHERE type='table' AND name='{table_name}';" |
|
1917 |
cursor.execute(query) |
|
1918 |
res = cursor.fetchone() |
|
1919 |
if res == None: |
|
1920 |
result = False |
|
1921 |
else: |
|
1922 |
result = True |
|
1923 |
# Catch the exception |
|
1924 |
except Exception as ex: |
|
1925 |
from App import App |
|
1926 |
|
|
1927 |
# Roll back any change if something goes wrong |
|
1928 |
conn.rollback() |
|
1929 |
|
|
1930 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
1931 |
sys.exc_info()[-1].tb_lineno) |
|
1932 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
1933 |
return result |
|
1934 |
|
|
1935 |
def execute_query(self, sqls: List) -> bool: |
|
1936 |
if not sqls: |
|
1937 |
return True |
|
1938 |
|
|
1939 |
result = False |
|
1940 |
|
|
1941 |
conn = sqlite3.connect(self.activeDrawing.path) |
|
1942 |
with conn: |
|
1943 |
try: |
|
1944 |
cursor = conn.cursor() |
|
1945 |
for sqlquery in sqls: |
|
1946 |
cursor.execute(sqlquery) |
|
1947 |
result = True |
|
1948 |
|
|
1949 |
# Catch the exception |
|
1950 |
except Exception as ex: |
|
1951 |
|
|
1952 |
message = 'error occurred({}) in {}:{}'.format(ex, |
|
1953 |
sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
1954 |
sys.exc_info()[-1].tb_lineno) |
|
1955 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
1956 |
|
|
1957 |
return result |
|
1958 |
|
|
1959 |
def getPAPInfomations(self): |
|
1960 |
pap_Infomations = [] |
|
1961 |
|
|
1962 |
try: |
|
1963 |
conn = sqlite3.connect(self.activeDrawing.path) |
|
1964 |
conn.execute('PRAGMA foreign_keys = ON') |
|
1965 |
cursor = conn.cursor() |
|
1966 |
sql = """ SELECT Project_UID, ProjectNo, CalculationCase |
|
1967 |
FROM PAPUploadInformation |
|
1968 |
ORDER BY CreateDateTime DESC |
|
1969 |
""" |
|
1970 |
try: |
|
1971 |
cursor.execute(sql) |
|
1972 |
rows = cursor.fetchall() |
|
1973 |
for row in rows: |
|
1974 |
pap_Infomations.append(PAPUploadInformation(row[0], row[1], row[2])) |
|
1975 |
except Exception as ex: |
|
1976 |
from App import App |
|
1977 |
|
|
1978 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
1979 |
sys.exc_info()[-1].tb_lineno) |
|
1980 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
1981 |
finally: |
|
1982 |
conn.close() |
|
1983 |
|
|
1984 |
return pap_Infomations |
|
1985 |
|
|
1986 |
def getPAPInfomationItems(self, Project_UID = ''): |
|
1987 |
pap_InfomationItems = [] |
|
1988 |
try: |
|
1989 |
conn = sqlite3.connect(self.activeDrawing.path) |
|
1990 |
conn.execute('PRAGMA foreign_keys = ON') |
|
1991 |
cursor = conn.cursor() |
|
1992 |
sql = f"""Select Project_UID, |
|
1993 |
ProjectNo, |
|
1994 |
Components_UID, |
|
1995 |
Components_Type, |
|
1996 |
Components_ItemNo, |
|
1997 |
Components_DataCase |
|
1998 |
From PAPUploadInformationItem""" |
|
1999 |
|
|
2000 |
if Project_UID: |
|
2001 |
sql += f""" WHERE Project_UID = '{Project_UID}' """ |
|
2002 |
|
|
2003 |
cursor.execute(sql) |
|
2004 |
rows = cursor.fetchall() |
|
2005 |
for row in rows: |
|
2006 |
pap_InfomationItems.append(PAPUploadInformationItem(row[0], |
|
2007 |
row[1], |
|
2008 |
row[2], |
|
2009 |
row[3], |
|
2010 |
row[4], |
|
2011 |
row[5])) |
|
2012 |
except Exception as ex: |
|
2013 |
from App import App |
|
2014 |
|
|
2015 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
2016 |
sys.exc_info()[-1].tb_lineno) |
|
2017 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
2018 |
finally: |
|
2019 |
conn.close() |
|
2020 |
|
|
2021 |
return pap_InfomationItems |
|
2022 |
|
|
2023 |
def create_database_PAPUpdateInfomation(self): |
|
2024 |
""" This method seems to be working now""" |
|
2025 |
result = False |
|
2026 |
# Creates or opens a file called mydb with a SQLite3 DB |
|
2027 |
conn = sqlite3.connect(self.activeDrawing.path) |
|
2028 |
with conn: |
|
2029 |
try: |
|
2030 |
# Get a cursor object |
|
2031 |
cursor = conn.cursor() |
|
2032 |
query = f"""CREATE TABLE if not exists PAPUploadInformation ( |
|
2033 |
Project_UID TEXT NOT NULL, |
|
2034 |
ProjectNo TEXT, |
|
2035 |
CalculationCase TEXT, |
|
2036 |
CreateDateTime datetime NOT NULL DEFAULT (datetime('now', 'localtime')), |
|
2037 |
PRIMARY KEY(Project_UID));"""; |
|
2038 |
cursor.execute(query) |
|
2039 |
query = f"""CREATE TABLE if not exists PAPUploadInformationItem ( |
|
2040 |
Components_UID TEXT NOT NULL, |
|
2041 |
Project_UID TEXT NOT NULL, |
|
2042 |
ProjectNo TEXT, |
|
2043 |
Components_Type TEXT, |
|
2044 |
Components_ItemNo TEXT, |
|
2045 |
Components_DataCase TEXT, |
|
2046 |
PRIMARY KEY(Components_UID,Project_UID));"""; |
|
2047 |
cursor.execute(query) |
|
2048 |
# Catch the exception |
|
2049 |
except Exception as ex: |
|
2050 |
from App import App |
|
2051 |
|
|
2052 |
# Roll back any change if something goes wrong |
|
2053 |
conn.rollback() |
|
2054 |
|
|
2055 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
2056 |
sys.exc_info()[-1].tb_lineno) |
|
2057 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
2058 |
|
|
2059 |
return result |
|
2060 |
|
|
2061 |
|
|
2062 |
|
|
1859 | 2063 |
''' |
1860 | 2064 |
@brief getter of activeDrawing |
1861 | 2065 |
@author humkyung |
HYTOS/HYTOS/Export_To_PAP.py | ||
---|---|---|
14 | 14 |
import math |
15 | 15 |
import requests |
16 | 16 |
import json |
17 |
from AppDocData import AppDocData |
|
17 |
from AppDocData import * |
|
18 |
|
|
18 | 19 |
def is_float(s): |
19 | 20 |
try: |
20 | 21 |
if s: |
... | ... | |
51 | 52 |
else: |
52 | 53 |
return value |
53 | 54 |
|
55 |
class ProjectDto: |
|
56 |
def __init__(self): |
|
57 |
self.UID = '' |
|
58 |
self.Owner = '' |
|
59 |
self.PrjUnit = ProjectUnitDTO() |
|
60 |
self.No = '' |
|
61 |
self.Name = '' |
|
62 |
self.Desc = '' |
|
63 |
self.Status = ProjectStatusDTO() |
|
64 |
|
|
65 |
def setData(self,json_object): |
|
66 |
self.UID = json_object["UID"] |
|
67 |
self.Owner = json_object["Owner"] |
|
68 |
self.No = json_object["No"] |
|
69 |
self.Name = json_object["Name"] |
|
70 |
self.Desc = json_object["Desc"] |
|
71 |
self.PrjUnit.UID = json_object['PrjUnit']['UID'] |
|
72 |
self.PrjUnit.Name = json_object['PrjUnit']['Name'] |
|
73 |
self.Status.UID = json_object['PrjUnit']['UID'] |
|
74 |
self.Status.Name = json_object['PrjUnit']['Name'] |
|
75 |
|
|
76 |
class ProjectUnitDTO: |
|
77 |
def __init__(self): |
|
78 |
self.UID = '' |
|
79 |
self.Name = '' |
|
80 |
|
|
81 |
class ProjectStatusDTO: |
|
82 |
def __init__(self): |
|
83 |
self.UID = '' |
|
84 |
self.Name = '' |
|
85 |
|
|
54 | 86 |
|
55 | 87 |
class MappingsDelegate(QStyledItemDelegate): |
56 |
def __init__(self, parent=None): |
|
88 |
def __init__(self, parent=None, papInfomationItem=None):
|
|
57 | 89 |
QStyledItemDelegate.__init__(self, parent) |
58 |
|
|
90 |
self.papInfomationItem = papInfomationItem |
|
59 | 91 |
|
60 | 92 |
def createEditor(self, parent, option, index): |
61 | 93 |
editor = None |
62 |
item = parent.parent().model().itemFromIndex(parent.parent().model().index(index.row(), 0))
|
|
94 |
item = parent.parent().model().itemFromIndex(parent.parent().model().index(index.row(), 1))
|
|
63 | 95 |
|
64 |
if index.column() == 2:
|
|
96 |
if index.column() == 3:
|
|
65 | 97 |
datacase = [] |
66 | 98 |
editor = QComboBox(parent) |
67 | 99 |
if item.text() == "Pump": |
... | ... | |
83 | 115 |
self.ui = Export_To_PAP_UI.Ui_Dialog() |
84 | 116 |
self.ui.setupUi(self) |
85 | 117 |
self.ui.buttonBox.button(QDialogButtonBox.Ok).setIcon(QtGui.QIcon(':/images/OK.svg')) |
118 |
self.ui.buttonBox.button(QDialogButtonBox.Ok).setText("Update") |
|
86 | 119 |
self.ui.buttonBox.button(QDialogButtonBox.Cancel).setIcon(QtGui.QIcon(':/images/Cancel.svg')) |
120 |
self.ui.btnSave.clicked.connect(self.onSavePapUpdateInfomation) |
|
121 |
self.ui.comboBox_select_PAP_Project.currentIndexChanged.connect(self.connect_api) |
|
87 | 122 |
self.load_movie = QMovie(":/images/loader.gif") |
88 | 123 |
self.close_movie = QMovie(":/images/close.png") |
89 | 124 |
self.done_movie = QMovie(":/images/done.png") |
90 |
self.ui.comboBox_select_PAP_Project.currentIndexChanged.connect(self.connect_api) |
|
125 |
app_doc_data = AppDocData.instance() |
|
126 |
self.project_list = [] |
|
127 |
self.papInfomation = app_doc_data.getPAPInfomations() |
|
128 |
self.papInfomationItem = app_doc_data.getPAPInfomationItems() |
|
129 |
self.schema_PAPUploadInfomationtable() |
|
130 |
|
|
91 | 131 |
self.send_api(end_point = "/api/Projects", method= "GET") |
92 | 132 |
self.data_load() |
93 |
#self.ui.tableView_upload_item_list.resizeColumnsToContents() |
|
94 |
#self.ui.tableView_upload_item_list.horizontalHeader().setSectionResizeMode( |
|
95 |
# self.ui.tableView_upload_item_list.horizontalHeader().count() - 1, QtWidgets.QHeaderView.Stretch) |
|
96 |
#self.ui.tableView_upload_item_list.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeToContents); |
|
97 |
self.ui.tableView_upload_item_list.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) |
|
133 |
|
|
134 |
|
|
135 |
def schema_PAPUploadInfomationtable(self): |
|
136 |
app_doc_data = AppDocData.instance() |
|
137 |
app_doc_data.create_database_PAPUpdateInfomation() |
|
138 |
|
|
139 |
def onSavePapUpdateInfomation(self): |
|
140 |
projectNo = self.ui.comboBox_select_PAP_Project.currentText() |
|
141 |
calculation_Case = self.ui.comboBox_Calculation_Case.currentText() |
|
142 |
projects = [item for item in self.project_list if item.Name == projectNo] |
|
143 |
result = False |
|
144 |
try: |
|
145 |
if len(projects) > 0: |
|
146 |
app_doc_data = AppDocData.instance() |
|
147 |
papUploadInformation = PAPUploadInformation() |
|
148 |
papUploadInformation.Project_UID = projects[0].UID |
|
149 |
papUploadInformation.ProjectNo = projectNo |
|
150 |
papUploadInformation.CalculationCase = calculation_Case |
|
151 |
project_result = app_doc_data.execute_query([papUploadInformation.to_sql()]) |
|
152 |
if project_result: |
|
153 |
if self.ui.tableView_upload_item_list.model().rowCount() > 0: |
|
154 |
papUploadInformationItems = [] |
|
155 |
for row in range(self.ui.tableView_upload_item_list.model().rowCount()): |
|
156 |
papUploadInformation_Item = PAPUploadInformationItem() |
|
157 |
papUploadInformation_Item.ProjectNo = projectNo |
|
158 |
papUploadInformation_Item.Project_UID = projects[0].UID |
|
159 |
papUploadInformation_Item.CalculationCase = calculation_Case |
|
160 |
for column in range(self.ui.tableView_upload_item_list.model().columnCount()): |
|
161 |
index = self.ui.tableView_upload_item_list.model().index(row, column) |
|
162 |
data = self.ui.tableView_upload_item_list.model().data(index, Qt.DisplayRole) |
|
163 |
if column == 0: |
|
164 |
papUploadInformation_Item.Components_UID = data |
|
165 |
elif column == 1: |
|
166 |
papUploadInformation_Item.Components_Type = data |
|
167 |
elif column == 2: |
|
168 |
papUploadInformation_Item.Components_ItemNo= data |
|
169 |
elif column == 3: |
|
170 |
papUploadInformation_Item.Components_DataCase = data |
|
171 |
papUploadInformationItems.append(papUploadInformation_Item) |
|
172 |
if len(papUploadInformationItems) > 0: |
|
173 |
sqls = [] |
|
174 |
for uploadInformation in papUploadInformationItems: |
|
175 |
sqls.append(uploadInformation.to_sql()) |
|
176 |
result = app_doc_data.execute_query(sqls) |
|
177 |
|
|
178 |
except Exception as ex: |
|
179 |
from App import App |
|
180 |
from AppDocData import MessageType |
|
181 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
182 |
sys.exc_info()[-1].tb_lineno) |
|
183 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
184 |
finally: |
|
185 |
if project_result or result: |
|
186 |
QMessageBox.information(self, self.tr("Information"), self.tr("Upload Success")) |
|
187 |
else: |
|
188 |
QMessageBox.information(self, 'Info', "Upload Failed") |
|
189 |
self.papInfomation = app_doc_data.getPAPInfomations() |
|
190 |
self.papInfomationItem = app_doc_data.getPAPInfomationItems() |
|
98 | 191 |
|
99 | 192 |
def data_load(self): |
100 | 193 |
self.calculation_calse = ["Maximum Flowrate Case", "Normal Flowrate Case", "Minimum Flowrate Case"] |
... | ... | |
105 | 198 |
self.data_frame_to_ui_configuration(items) |
106 | 199 |
|
107 | 200 |
def data_frame_to_ui_configuration(self, items): |
108 |
headerColumn = ["Item Type.", "Item Tag No." ,"Data Case"]
|
|
201 |
headerColumn = ["UID", "Item Type", "Item Tag No" ,"Data Case"]
|
|
109 | 202 |
# for the table model |
110 | 203 |
value_model = QtGui.QStandardItemModel() |
111 | 204 |
# set table headers |
112 | 205 |
value_model.setColumnCount(len(headerColumn)) |
113 | 206 |
value_model.setHorizontalHeaderLabels(headerColumn) |
114 |
|
|
207 |
select_papinfomation = [item for item in self.papInfomationItem if |
|
208 |
item.ProjectNo == self.ui.comboBox_select_PAP_Project.currentText()] |
|
115 | 209 |
# fill table model data |
116 | 210 |
for row_idx in range(0, len(items)): # len(data_frame.values) |
117 | 211 |
row = list() |
212 |
value = '' |
|
118 | 213 |
for col_idx in range(len(headerColumn)): |
119 | 214 |
if headerColumn[col_idx] == headerColumn[0] : |
215 |
value = str(items[row_idx].uid) |
|
216 |
val = QtGui.QStandardItem(value) |
|
217 |
val.setEditable(False) |
|
218 |
if headerColumn[col_idx] == headerColumn[1]: |
|
120 | 219 |
value = items[row_idx].type |
121 |
if headerColumn[col_idx] == headerColumn[1] : |
|
220 |
val = QtGui.QStandardItem(value) |
|
221 |
val.setEditable(False) |
|
222 |
if headerColumn[col_idx] == headerColumn[2] : |
|
122 | 223 |
value = items[row_idx].tag_no |
123 |
val = QtGui.QStandardItem(value) |
|
124 |
val.setEditable(True) |
|
224 |
val = QtGui.QStandardItem(value) |
|
225 |
val.setEditable(False) |
|
226 |
if headerColumn[col_idx] == headerColumn[3]: |
|
227 |
val.setEditable(True) |
|
228 |
papinfomation = [item for item in select_papinfomation if |
|
229 |
item.Components_UID == row[0].text()] |
|
230 |
if papinfomation: |
|
231 |
value = papinfomation[0].Components_DataCase |
|
232 |
val = QtGui.QStandardItem(value) |
|
125 | 233 |
row.append(val) |
126 | 234 |
value_model.appendRow(row) |
127 | 235 |
|
... | ... | |
129 | 237 |
self.ui.tableView_upload_item_list.setModel(value_model) |
130 | 238 |
self.model = value_model |
131 | 239 |
# Sort Filter Proxy Set Model |
240 |
|
|
132 | 241 |
# Set Selection Model |
133 | 242 |
self.selection_model = self.ui.tableView_upload_item_list.selectionModel() |
134 | 243 |
# Set Selection Model |
135 | 244 |
self.ui.tableView_upload_item_list.setSortingEnabled(True) |
136 |
self.ui.tableView_upload_item_list.setItemDelegate(MappingsDelegate(self.ui.tableView_upload_item_list)) |
|
245 |
self.ui.tableView_upload_item_list.setItemDelegate(MappingsDelegate(self.ui.tableView_upload_item_list, select_papinfomation)) |
|
246 |
self.ui.tableView_upload_item_list.setColumnHidden(0, True) |
|
247 |
self.ui.tableView_upload_item_list.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) |
|
137 | 248 |
|
138 |
def startAnimation(self):
|
|
249 |
def start_animation(self):
|
|
139 | 250 |
self.close_movie.stop() |
140 | 251 |
self.done_movie.stop() |
141 | 252 |
self.ui.label_loading.setMovie(self.load_movie) |
142 | 253 |
self.load_movie.start() |
143 |
# Stop Animation(According to need) |
|
144 | 254 |
|
145 |
def doneAnimation(self):
|
|
255 |
def done_animation(self):
|
|
146 | 256 |
self.load_movie.stop() |
147 | 257 |
self.close_movie.stop() |
148 | 258 |
self.ui.label_loading.setMovie(self.done_movie) |
149 | 259 |
self.done_movie.start() |
150 | 260 |
|
151 |
def closeAnimation(self):
|
|
261 |
def close_animation(self):
|
|
152 | 262 |
self.load_movie.stop() |
153 | 263 |
self.done_movie.stop() |
154 | 264 |
self.ui.label_loading.setMovie(self.close_movie) |
... | ... | |
158 | 268 |
app_doc_data = AppDocData.instance() |
159 | 269 |
url = app_doc_data.API_HOST + end_point |
160 | 270 |
headers = {'Content-Type': 'application/json', 'charset': 'UTF-8', 'Accept': '*/*'} |
271 |
self.project_list.clear() |
|
161 | 272 |
try: |
162 | 273 |
if method == 'GET': |
163 | 274 |
response = requests.get(url, headers=headers) |
164 | 275 |
if response.status_code == 200: |
165 | 276 |
json_objects = json.loads(response.text) |
166 | 277 |
for json_object in json_objects: |
167 |
self.ui.comboBox_select_PAP_Project.addItem(json_object['Name']) |
|
278 |
project_dto = ProjectDto() |
|
279 |
project_dto.setData(json_object = json_object) |
|
280 |
self.ui.comboBox_select_PAP_Project.addItem(project_dto.Name) |
|
281 |
self.project_list.append(project_dto) |
|
282 |
if self.papInfomation: |
|
283 |
index = self.ui.comboBox_select_PAP_Project.findText(str(self.papInfomation[0].ProjectNo)) |
|
284 |
if (index != -1): |
|
285 |
self.ui.comboBox_select_PAP_Project.setCurrentIndex(index) |
|
168 | 286 |
except Exception as ex: |
169 | 287 |
from App import App |
170 | 288 |
from AppDocData import MessageType |
... | ... | |
175 | 293 |
|
176 | 294 |
def connect_api(self, index): |
177 | 295 |
#self.ui.comboBox_select_PAP_Project.setEnabled(False) |
178 |
self.startAnimation()
|
|
296 |
self.start_animation()
|
|
179 | 297 |
QTimer.singleShot(500, self.connections) |
180 | 298 |
|
181 | 299 |
def connections(self): |
182 |
result = "false" |
|
183 | 300 |
projectNo = self.ui.comboBox_select_PAP_Project.currentText() |
184 | 301 |
try: |
302 |
self.data_load() |
|
185 | 303 |
asyncio.run(self.run_connection(projectNo)) |
186 | 304 |
except Exception as ex: |
187 | 305 |
from App import App |
... | ... | |
197 | 315 |
result = await task |
198 | 316 |
self.ui.comboBox_select_PAP_Project.setEnabled(True) |
199 | 317 |
if strToBool(str(result)): |
200 |
QTimer.singleShot(500, self.doneAnimation)
|
|
318 |
QTimer.singleShot(500, self.done_animation)
|
|
201 | 319 |
else: |
202 |
QTimer.singleShot(500, self.closeAnimation) |
|
320 |
QTimer.singleShot(500, self.close_animation) |
|
321 |
|
|
203 | 322 |
|
204 | 323 |
@asyncio.coroutine |
205 | 324 |
async def connection(self,projectNo): |
내보내기 Unified diff