개정판 a0ee9dd8
suffix split funct
Change-Id: Iceb5e7b65e7d2a53661885000e49efaf057854ae
DTI_PID/DTI_PID/Shapes/EngineeringTextItem.py | ||
---|---|---|
306 | 306 |
return |
307 | 307 |
|
308 | 308 |
delimiter = '' |
309 |
if '-' in text and text.rfind('-') == len(text) - 2: |
|
309 |
position = False |
|
310 |
if '-' in text and (text.rfind('-') == len(text) - 2 or text.rfind('-') == len(text) - 3): |
|
310 | 311 |
delimiter = '-' |
311 |
elif '~' in text and text.rfind('~') == len(text) - 2: |
|
312 |
if text.rfind('-') == len(text) - 3: |
|
313 |
position = True |
|
314 |
elif '~' in text and (text.rfind('~') == len(text) - 2 or text.rfind('~') == len(text) - 3): |
|
312 | 315 |
delimiter = '~' |
313 |
elif '^' in text and text.rfind('^') == len(text) - 2: |
|
316 |
if text.rfind('~') == len(text) - 3: |
|
317 |
position = True |
|
318 |
elif '^' in text and (text.rfind('^') == len(text) - 2 or text.rfind('^') == len(text) - 3): |
|
314 | 319 |
delimiter = '^' |
320 |
if text.rfind('^') == len(text) - 3: |
|
321 |
position = True |
|
315 | 322 |
else: |
316 | 323 |
return |
317 | 324 |
|
318 |
commonText = text[:-3] |
|
319 |
suffix = text[-3:] |
|
320 |
startIndex = ord(suffix[0]) |
|
321 |
endIndex = ord(suffix[2]) + 1 |
|
325 |
if position and len(text) < 6: |
|
326 |
return |
|
327 |
|
|
328 |
commonText = text[:-3] if not position else text[:-5] |
|
329 |
suffix = text[-3:] if not position else text[-5:] |
|
330 |
if not position: |
|
331 |
startIndex = ord(suffix[0]) |
|
332 |
endIndex = ord(suffix[2]) + 1 |
|
333 |
else: |
|
334 |
try: |
|
335 |
startIndex = int(suffix[:2]) |
|
336 |
endIndex = int(suffix[-2:]) + 1 |
|
337 |
except: |
|
338 |
return |
|
322 | 339 |
|
323 | 340 |
newTexts = [] |
324 | 341 |
for index in range(startIndex, endIndex): |
325 |
newTexts.append(commonText + chr(index)) |
|
342 |
if not position: |
|
343 |
newTexts.append(commonText + chr(index)) |
|
344 |
else: |
|
345 |
newTexts.append(commonText + str(index)) |
|
326 | 346 |
|
327 |
if 1 < len(newTexts) < 30:
|
|
347 |
if 1 < len(newTexts) < 15:
|
|
328 | 348 |
index = 0 |
329 | 349 |
for _text in newTexts: |
330 | 350 |
textInfo = TextInfo(_text, self.loc[0] + self.size[0] * index, self.loc[1], self.size[0], self.size[1], self.angle) |
내보내기 Unified diff