개정판 a23cd008
add text split func
Change-Id: I11dc4a2ec58e988a86cbb9ca884250defbb02349
DTI_PID/DTI_PID/OcrResultDialog.py | ||
---|---|---|
320 | 320 |
# try to detect text if there is no result of detection or |
321 | 321 |
# count of text info list not match with count of split text |
322 | 322 |
if isSplit: |
323 |
if self.textInfoList and (len(self.textInfoList) == len(splitText)): |
|
323 |
if self._text_item and len(self.textInfoList) == 1 and len(splitText) > 1: |
|
324 |
self.textInfoList = self.getSplitedTextInfo(text, splitText) |
|
325 |
elif self.textInfoList and (len(self.textInfoList) == len(splitText)): |
|
324 | 326 |
for index in range(len(self.textInfoList)): |
325 | 327 |
self.textInfoList[index].setText(splitText[index]) |
326 | 328 |
elif not self.textInfoList: |
... | ... | |
369 | 371 |
sys.exc_info()[-1].tb_lineno) |
370 | 372 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
371 | 373 |
|
374 |
def getSplitedTextInfo(self, text, texts): |
|
375 |
from TextInfo import TextInfo |
|
376 |
|
|
377 |
singleWidth = self.textInfoList[0].getW() / len(text) |
|
378 |
height = self.textInfoList[0].getH() |
|
379 |
x = self.textInfoList[0].getX() |
|
380 |
y = self.textInfoList[0].getY() |
|
381 |
|
|
382 |
areas = [] |
|
383 |
|
|
384 |
for _text in texts: |
|
385 |
width = int(singleWidth * len(_text)) |
|
386 |
areas.append(TextInfo(_text, x, y, width, height, 0)) |
|
387 |
y = y + height |
|
388 |
|
|
389 |
return areas |
|
390 |
|
|
372 | 391 |
def getMergedTextInfo(self, text): |
373 | 392 |
from TextInfo import TextInfo |
374 | 393 |
|
내보내기 Unified diff