개정판 d2a401b0
dev issue #581: 라인 Property 가져오는 함수 통일화
DTI_PID/DTI_PID/Shapes/QEngineeringTextItem.py | ||
---|---|---|
265 | 265 |
''' |
266 | 266 |
def getLineNoAttributes(self): |
267 | 267 |
res = {} |
268 |
|
|
269 |
#createText말고 여기 수정(파라미터 첫번째가 true 2번째 값. |
|
270 |
from TextItemFactory import TextItemFactory |
|
271 |
item = TextItemFactory.instance().createTextItem(value, delimiter, lineNoconfigs, sizeDataList, fluidCodeList) |
|
268 | 272 |
|
269 | 273 |
try: |
270 | 274 |
docData = AppDocData.instance() |
DTI_PID/DTI_PID/TextItemFactory.py | ||
---|---|---|
42 | 42 |
|
43 | 43 |
if self.isNoteNoText(text): |
44 | 44 |
item = QEngineeringNoteItem() |
45 |
elif (delimiter != '' and lineNoConfig != '') and self.isLineNo(text, delimiter, lineNoConfig, sizeDataList, fluidCodeList): |
|
45 |
elif (delimiter != '' and lineNoConfig != '') and self.isLineNo(text, delimiter, lineNoConfig, sizeDataList, fluidCodeList)[0]:
|
|
46 | 46 |
item = QEngineeringLineNoTextItem() |
47 | 47 |
# set color |
48 | 48 |
colorCount = len(docData.colors) |
... | ... | |
72 | 72 |
''' |
73 | 73 |
def isLineNo(self, text, delimiter, lineNoConfig, sizeDataList, fluidCodeList): |
74 | 74 |
try: |
75 |
res = [] |
|
76 |
|
|
75 | 77 |
if lineNoConfig is None or len(lineNoConfig) == 0: |
76 |
return False
|
|
78 |
return (False,)
|
|
77 | 79 |
|
78 | 80 |
tokens = text.split(delimiter) |
79 | 81 |
patternText = lineNoConfig[0].value.replace(self.delimiter, '').split(self.delimiter) |
... | ... | |
114 | 116 |
elif i == delimiter: |
115 | 117 |
loopList.append(delimiter) |
116 | 118 |
else: |
117 |
return False
|
|
119 |
return (False,)
|
|
118 | 120 |
|
119 | 121 |
|
120 | 122 |
if isTable: |
... | ... | |
123 | 125 |
result = self.isStartWithWord(loopText, loop) |
124 | 126 |
if result[0]: |
125 | 127 |
loopText = result[1] |
128 |
res.append(result[2]) |
|
126 | 129 |
find = True |
127 | 130 |
break |
128 | 131 |
if not find: |
129 |
return False
|
|
132 |
return (False,)
|
|
130 | 133 |
else: |
131 | 134 |
result = self.isStartWithNumber(loopText) |
132 | 135 |
if result[0]: |
133 | 136 |
loopText = result[1] |
137 |
res.append(result[2]) |
|
134 | 138 |
else: |
135 |
return False
|
|
139 |
return (False,)
|
|
136 | 140 |
|
137 | 141 |
if loopText == '': |
138 |
return True
|
|
142 |
return (True, res)
|
|
139 | 143 |
else: |
140 |
print('Ori : ' + text) |
|
141 |
print('after : ' + loopText) |
|
142 |
return False |
|
144 |
return (False,) |
|
143 | 145 |
|
144 |
return False
|
|
146 |
return (False,)
|
|
145 | 147 |
except : |
146 | 148 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
147 | 149 |
|
... | ... | |
153 | 155 |
def isStartWithWord(self, text, word): |
154 | 156 |
sliceText = text[0:len(word)] |
155 | 157 |
if sliceText == word: |
156 |
return (True, text[len(sliceText):len(text)]) |
|
158 |
return (True, text[len(sliceText):len(text)], word)
|
|
157 | 159 |
else: |
158 | 160 |
return (False,) |
159 | 161 |
|
... | ... | |
165 | 167 |
''' |
166 | 168 |
def isStartWithNumber(self, text): |
167 | 169 |
sliceText = text[0:1] |
170 |
num = '' |
|
168 | 171 |
if self.isNumber(sliceText): |
169 | 172 |
text = text[1:len(text)] |
170 |
|
|
173 |
num += text |
|
171 | 174 |
while len(text) > 0: |
172 | 175 |
sliceText = text[0:1] |
173 | 176 |
|
174 | 177 |
if self.isNumber(sliceText): |
175 | 178 |
text = text[1:len(text)] |
179 |
num += text |
|
176 | 180 |
else: |
177 | 181 |
break |
178 | 182 |
|
179 |
return (True, text) |
|
183 |
return (True, text, num)
|
|
180 | 184 |
else: |
181 | 185 |
return (False,) |
182 | 186 |
|
내보내기 Unified diff