개정판 4b4d954c
issue #622:
- late bind for symbol and text item while loading
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
1906 | 1906 |
# 처음에는 UID가 connectedItem에 String으로 들어가있기 때문에 |
1907 | 1907 |
connector.connectedItem = self.graphicsView.findItemByUid(connector.connectedItem) |
1908 | 1908 |
|
1909 |
""" |
|
1909 | 1910 |
symbols = [item for item in self.graphicsView.scene.items() if issubclass(type(item), SymbolSvgItem) and len(item.attrs) > 0] |
1910 | 1911 |
for symbol in symbols: |
1911 | 1912 |
# 처음에는 attrs의 uid가 connectedItem에 String으로 들어가있기 때문에 |
1912 | 1913 |
for index in range(len(symbol.attrs)): |
1913 | 1914 |
if type(symbol.attrs[index]) is not UserInputAttribute and type(symbol.attrs[index]) is not tuple: |
1914 | 1915 |
symbol.attrs[index] = self.graphicsView.findItemByUid(symbol.attrs[index]) |
1916 |
""" |
|
1915 | 1917 |
|
1916 | 1918 |
# Update Scene |
1917 | 1919 |
self.graphicsView.scene.update(self.graphicsView.sceneRect()) |
... | ... | |
2029 | 2031 |
removeAttrList.append(attr) |
2030 | 2032 |
continue |
2031 | 2033 |
|
2032 |
attrInfo = docData.getSymbolAttributeByUID(attr.attribute)
|
|
2034 |
attrInfo = docData.getSymbolAttributeByUID(attr.UID)
|
|
2033 | 2035 |
if attrInfo is None: |
2034 | 2036 |
removeAttrList.append(attr) |
2035 | 2037 |
# 해당 attribute가 맞는지 확인 |
2036 | 2038 |
else: |
2037 |
attrType = attrInfo[2] |
|
2038 | 2039 |
_type = type(attr) |
2039 |
if attrType == 'Symbol Item': |
|
2040 |
if attrInfo.AttributeType == 'Symbol Item':
|
|
2040 | 2041 |
if not issubclass(_type, SymbolSvgItem): |
2041 | 2042 |
removeAttrList.append(attr) |
2042 |
elif attrType == 'Text Item': |
|
2043 |
elif attrInfo.AttributeType == 'Text Item':
|
|
2043 | 2044 |
if _type is not QEngineeringTextItem: |
2044 | 2045 |
removeAttrList.append(attr) |
2045 |
elif attrType == 'Int': |
|
2046 |
elif attrInfo.AttributeType == 'Int':
|
|
2046 | 2047 |
if _type is not UserInputAttribute and self.isNumber(attr.text): |
2047 | 2048 |
removeAttrList.append(attr) |
2048 |
elif attrType == 'String': |
|
2049 |
elif attrInfo.AttributeType == 'String':
|
|
2049 | 2050 |
if _type is not UserInputAttribute: |
2050 | 2051 |
removeAttrList.append(attr) |
2051 | 2052 |
|
2052 | 2053 |
for attr in removeAttrList: |
2053 |
attrs.remove(attr)
|
|
2054 |
del attrs[attr]
|
|
2054 | 2055 |
|
2055 | 2056 |
# Line No Text Item의 경우 |
2056 | 2057 |
items = [item for item in self.graphicsView.scene.items() if issubclass(type(item), QEngineeringLineNoTextItem)] |
... | ... | |
2060 | 2061 |
removeAttrList = [] |
2061 | 2062 |
for attr in attrs: |
2062 | 2063 |
if type(attr) is UserInputAttribute: |
2063 |
attrInfo = docData.getLinePropertiesByUID(attr.attribute)
|
|
2064 |
attrInfo = docData.getLinePropertiesByUID(attr.UID)
|
|
2064 | 2065 |
if attrInfo is None: |
2065 | 2066 |
removeAttrList.append(attr) |
2066 | 2067 |
|
2067 | 2068 |
for attr in removeAttrList: |
2068 |
attrs.remove(attr)
|
|
2069 |
del attrs[attr]
|
|
2069 | 2070 |
|
2070 | 2071 |
except Exception as ex: |
2071 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
|
2072 |
self.addMessage.emit(MessageType.Error, message) |
|
2072 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
|
2073 |
self.addMessage.emit(MessageType.Error, message) |
|
2074 |
|
|
2073 | 2075 |
''' |
2074 | 2076 |
@brief Check Number |
2075 | 2077 |
@author kyouho |
내보내기 Unified diff