개정판 7d4104df
XML 생성 시 noteTextInfoList None Check / TextItemFactory 에서 isLineNo 에 lineNoConfig None Check 추가
DTI_PID/DTI_PID/XmlGenerator.py | ||
---|---|---|
110 | 110 |
|
111 | 111 |
return xml |
112 | 112 |
|
113 |
''' |
|
114 |
@history 2018.04.30 Jeongwoo noteTextInfoList None Check |
|
115 |
''' |
|
113 | 116 |
def generateXml(pidName, pidWidth, pidHeight, searchedSymbolList, textInfoList, imgLineList, noteTextInfoList): |
114 | 117 |
xml = Element(ROOT_NODE_NAME) # Root Node |
115 | 118 |
SubElement(xml, ROOT_DWGNAME_NODE_NAME).text = pidName |
116 | 119 |
SubElement(xml, ROOT_SIZE_NODE_NAME).text = str(pidWidth) + "," + str(pidHeight) |
120 |
try: |
|
121 |
symbolListNode = Element(SYMBOL_LIST_NODE_NAME) # Symbol List Node |
|
122 |
sortedList = sorted(searchedSymbolList, key=lambda sym:sym.getName()) |
|
123 |
for symbol in sortedList: |
|
124 |
node = getSymbolInfoNode(symbol) |
|
125 |
symbolListNode.append(node) |
|
117 | 126 |
|
118 |
symbolListNode = Element(SYMBOL_LIST_NODE_NAME) # Symbol List Node |
|
119 |
sortedList = sorted(searchedSymbolList, key=lambda sym:sym.getName()) |
|
120 |
for symbol in sortedList: |
|
121 |
node = getSymbolInfoNode(symbol) |
|
122 |
symbolListNode.append(node) |
|
127 |
xml.append(symbolListNode) |
|
123 | 128 |
|
124 |
xml.append(symbolListNode) |
|
129 |
textInfoListNode = Element(TEXT_INFO_LIST_NODE_NAME) # Text Info List Node |
|
130 |
for textInfo in textInfoList: |
|
131 |
node = getTextInfoNode(textInfo) |
|
132 |
textInfoListNode.append(node) |
|
125 | 133 |
|
126 |
textInfoListNode = Element(TEXT_INFO_LIST_NODE_NAME) # Text Info List Node |
|
127 |
for textInfo in textInfoList: |
|
128 |
node = getTextInfoNode(textInfo) |
|
129 |
textInfoListNode.append(node) |
|
134 |
xml.append(textInfoListNode) |
|
130 | 135 |
|
131 |
xml.append(textInfoListNode) |
|
136 |
imgLineListNode = Element(IMG_LINE_LIST_NODE_NAME) # Image Line List Node |
|
137 |
for imgLine in imgLineList: |
|
138 |
node = getImgLineNode(imgLine) |
|
139 |
imgLineListNode.append(node) |
|
132 | 140 |
|
133 |
imgLineListNode = Element(IMG_LINE_LIST_NODE_NAME) # Image Line List Node |
|
134 |
for imgLine in imgLineList: |
|
135 |
node = getImgLineNode(imgLine) |
|
136 |
imgLineListNode.append(node) |
|
141 |
xml.append(imgLineListNode) |
|
137 | 142 |
|
138 |
xml.append(imgLineListNode) |
|
139 | 143 |
|
140 |
noteTextInfoListNode = Element(NOTE_TEXT_INFO_LIST_NOTE_NAME) |
|
141 |
for noteTextInfo in noteTextInfoList: |
|
142 |
node = getNoteTextInfoNode(noteTextInfo) |
|
143 |
noteTextInfoListNode.append(node) |
|
144 |
noteTextInfoListNode = Element(NOTE_TEXT_INFO_LIST_NOTE_NAME) |
|
145 |
if noteTextInfoList is not None: |
|
146 |
for noteTextInfo in noteTextInfoList: |
|
147 |
node = getNoteTextInfoNode(noteTextInfo) |
|
148 |
noteTextInfoListNode.append(node) |
|
144 | 149 |
|
145 |
xml.append(noteTextInfoListNode) |
|
150 |
xml.append(noteTextInfoListNode) |
|
151 |
except Exception as ex: |
|
152 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
|
146 | 153 |
|
147 | 154 |
return xml |
148 | 155 |
|
내보내기 Unified diff