개정판 4666cb35
issue #000: text item loading speed improved
Change-Id: I25d87aa49d5091bc828665fa01c517d5c498dc25
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
88 | 88 |
self._configs = None |
89 | 89 |
self._symbolBase = {} |
90 | 90 |
self._symbolType = {} |
91 |
self._lineNoPropertiesUID = {} |
|
91 | 92 |
|
92 | 93 |
def clearItemList(self, trim): |
93 | 94 |
''' |
... | ... | |
133 | 134 |
self._hmbTable = None |
134 | 135 |
self._titleBlockProperties = None |
135 | 136 |
|
137 |
self._configs = None |
|
138 |
self._symbolBase = {} |
|
139 |
self._symbolType = {} |
|
140 |
self._lineNoPropertiesUID = {} |
|
141 |
|
|
136 | 142 |
''' |
137 | 143 |
@brief Get drawing file list |
138 | 144 |
@author euisung |
... | ... | |
832 | 838 |
|
833 | 839 |
def clearLineNoProperties(self): |
834 | 840 |
self._lineNoProperties = None |
841 |
self._lineNoPropertiesUID = {} |
|
835 | 842 |
|
836 | 843 |
''' |
837 | 844 |
@brief return line properties |
... | ... | |
881 | 888 |
from SymbolAttr import SymbolAttr |
882 | 889 |
|
883 | 890 |
res = [] |
891 |
if UID in self._lineNoPropertiesUID: |
|
892 |
res = self._lineNoPropertiesUID[UID] |
|
893 |
return res |
|
894 |
|
|
884 | 895 |
conn = self.project.database.connect() |
885 | 896 |
with conn: |
886 | 897 |
try: |
... | ... | |
898 | 909 |
attr.AttributeType = row[3] |
899 | 910 |
attr.Length = row[4] |
900 | 911 |
res.append(attr) |
912 |
self._lineNoPropertiesUID[UID] = res |
|
901 | 913 |
# Catch the exception |
902 | 914 |
except Exception as ex: |
903 | 915 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
... | ... | |
1865 | 1877 |
conn.commit() |
1866 | 1878 |
|
1867 | 1879 |
self._lineNoProperties = None |
1880 |
self._lineNoPropertiesUID = {} |
|
1868 | 1881 |
# Catch the exception |
1869 | 1882 |
except Exception as ex: |
1870 | 1883 |
# Roll back any change if something goes wrong |
... | ... | |
1998 | 2011 |
cursor = conn.cursor() if self.project.database.db_type == 'SQLite' else conn.cursor(as_dict=True) |
1999 | 2012 |
|
2000 | 2013 |
sql = "select (select Name from Drawings where UID=a.From_Drawings_UID) as From_Drawing,\ |
2001 |
(select Value from Components where UID=a.From_LineNo_UID) as From_LineNo,\
|
|
2014 |
a.From_LineNo_UID as From_LineNo,\
|
|
2002 | 2015 |
a.From_OPC_UID,\ |
2003 | 2016 |
(select Name from Drawings where UID=a.To_Drawings_UID) as To_Drawing,\ |
2004 |
(select Value from Components where UID=a.To_LineNo_UID) as To_LineNo,\
|
|
2017 |
a.To_LineNo_UID as To_LineNo,\
|
|
2005 | 2018 |
a.To_OPC_UID \ |
2006 | 2019 |
from OPCRelations a" |
2007 | 2020 |
cursor.execute(sql) |
... | ... | |
2026 | 2039 |
sql = 'insert into OPCRelations(From_Drawings_UID,From_LineNo_UID,From_OPC_UID,To_Drawings_UID,To_LineNo_UID,To_OPC_UID) \ |
2027 | 2040 |
values({},{},{},{},{},{})'.format( |
2028 | 2041 |
"(select UID from Drawings where Name='{}')".format(opc[0]), |
2029 |
"(select UID from Components where Value='{}')".format(opc[1]) if opc[1] else 'null',
|
|
2042 |
"'{}'".format(opc[1]) if opc[1] else 'null',
|
|
2030 | 2043 |
"'{}'".format(opc[2]) if opc[2] else 'null', |
2031 | 2044 |
"(select UID from Drawings where Name='{}')".format(opc[3]) if opc[3] else 'null', |
2032 |
"(select UID from Components where Value='{}')".format(opc[4]) if opc[4] else 'null',
|
|
2045 |
"'{}'".format(opc[4]) if opc[4] else 'null',
|
|
2033 | 2046 |
"'{}'".format(opc[5]) if opc[5] else 'null') |
2034 | 2047 |
cursor.execute(sql) |
2035 | 2048 |
|
DTI_PID/DTI_PID/Scripts/MSSQL/ID2.sql | ||
---|---|---|
3460 | 3460 |
Height INTEGER, |
3461 | 3461 |
Rotation REAL, |
3462 | 3462 |
Area TEXT, |
3463 |
Value TEXT,
|
|
3463 |
Value VARCHAR (1024),
|
|
3464 | 3464 |
Owner VARCHAR (37), |
3465 | 3465 |
[From] [varchar](37) NULL, |
3466 | 3466 |
[To] [varchar](37) NULL, |
... | ... | |
4106 | 4106 |
|
4107 | 4107 |
CREATE TABLE OPCRelations ( |
4108 | 4108 |
From_Drawings_UID VARCHAR (37) REFERENCES Drawings (UID), |
4109 |
From_LineNo_UID VARCHAR (37) REFERENCES Components (UID),
|
|
4109 |
From_LineNo_UID VARCHAR (37), |
|
4110 | 4110 |
From_OPC_UID VARCHAR (37) REFERENCES Components (UID) PRIMARY KEY, |
4111 | 4111 |
To_Drawings_UID VARCHAR (37) REFERENCES Drawings (UID), |
4112 |
To_LineNo_UID VARCHAR (37) REFERENCES Components (UID),
|
|
4112 |
To_LineNo_UID VARCHAR (37), |
|
4113 | 4113 |
To_OPC_UID VARCHAR (37) REFERENCES Components (UID) |
4114 | 4114 |
); |
4115 | 4115 |
|
내보내기 Unified diff