프로젝트

일반

사용자정보

개정판 99b4d542

ID99b4d54249be40e42cdb6ca20230c869a33a8463
상위 c0e20e5f
하위 30b0783e

김정우 이(가) 약 7년 전에 추가함

QResultTreeWidget 에서 NOTE No. 클릭 시 NOTE 영역에서 내용 검색 / QRecognitionDialog에서 Tesseract 로그 삭제 / TextItemFactory 에서 TextItem 생성 시 조건 추가

차이점 보기:

DTI_PID/DTI_PID/DTI_PID.py
563 563

  
564 564
    cv2.rectangle(src, sp, (sp[0]+sw, sp[1]+sh), (0, 0, 255), 2)
565 565

  
566
'''
567
    @history    2018.04.27  Jeongwoo    Remove Tesseract Log on listWidget
568
'''
566 569
def drawFoundSymbols(symbol, listWidget):
567 570
    global src
568 571
    global canvas
......
616 619
        ocrData = pytesseract.image_to_boxes(im, config='-c tessedit_char_whitelist="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" -psm 6')
617 620
        #ocrData = pytesseract.image_to_data(im)
618 621
        #ocrData = pytesseract.image_to_string(im, config = "hocr")
619
        listWidget.addItem("tesseract result : \n" + ocrData)
622
        #listWidget.addItem("tesseract result : \n" + ocrData)
620 623

  
621 624
        ### For image_to_data()
622 625
        #if ocrData:
DTI_PID/DTI_PID/QResultTreeWidget.py
14 14
from QEngineeringLineNoTextItem import QEngineeringLineNoTextItem
15 15
from AppDocData import AppDocData
16 16
import os
17
import re
17 18

  
18 19
class QResultTreeWidget(QTreeWidget):
19 20
    TREE_DATA_ROLE = Qt.ToolTipRole
......
140 141
                                            CenterOn() with Symbol's center
141 142
                    18.04.25    Jeongwoo    Add QEngineeringNoteItem Click event
142 143
                    18.04.26    Jeongwoo    QEngineeringTextItem → QEngineeringLineNoTextItem
144
                    18.04.27    Jeongwoo    Find NOTE Contents when NOTE No. Clicked
143 145
    '''
144 146
    lastClickedItem = None
145 147
    def itemClickEvent(self, item, columnNo, isSvgClick = False):
......
176 178
                ## Send new event to imageViewer's zoomImage Method
177 179
                self.imageViewer.zoomImage(True, QMouseEvent(QEvent.MouseButtonPress, self.imageViewer.mapFromScene(QPointF(rect.left(), rect.top())), Qt.LeftButton, Qt.LeftButton, Qt.NoModifier), 3)
178 180
                self.lastClickedItem = graphicItem
181
                self.findNoteContents(itemData.text())
182

  
183
    '''
184
        @brief      Find Note Contents by NOTE No.
185
        @author     Jeongwoo
186
        @date       2018.04.27
187
    '''
188
    def findNoteContents(self, noteNoText):
189
        # Get NoteArea
190
        notesArea = AppDocData.instance().getArea('Note')
191
        # Get all note contents
192
        items = self.imageViewer.scene.items(QRectF(notesArea.x, notesArea.y, notesArea.x + notesArea.width, notesArea.y + notesArea.height), order = Qt.AscendingOrder)
193
        foundNumberStr = None
194
        foundNote = ''
195
        numberStr = ''
196
        results = re.findall("\d+", noteNoText)
197
        if results is not None and len(results) > 0:
198
            numberStr = results[0]
199
        for item in items:
200
            if type(item) is QEngineeringTextItem:
201
                text = item.text()
202
                if foundNumberStr is None: # Not found yet
203
                    try:
204
                        # Find NOTE Contents start with header [ex - 1. 1) 2. 2) ...]
205
                        position = re.search(numberStr+"(.|\))", text).start()
206
                        if position == 0: # Start with NOTE No.
207
                            foundNote = text
208
                            foundNumberStr = numberStr
209
                    except Exception as ex:
210
                        '''NOT FOUND, DO NOTHING'''
211
                else:
212
                    try:
213
                        position = re.search(str(int(foundNumberStr) + 1)+"(.|\))", text).start()
214
                        # If NOTE No starts with next number, break
215
                        if position == 0:
216
                            break
217
                    except Exception as ex:
218
                        foundNote = foundNote + " " + text
219
        print(foundNote)
179 220

  
180 221
    '''
181 222
        @brief  find item which has data is given item
DTI_PID/DTI_PID/TextItemFactory.py
21 21
        '''
22 22
        '''
23 23

  
24
    '''
25
        @history    2018.04.27  Jeongwoo    Add condition on elif-statement (delimiter != '' and lineNoConfig != '')
26
    '''
24 27
    def createTextItem(self, text, delimiter = '', lineNoConfig = ''):
25 28
        item = None
26 29
        if self.isNoteNoText(text):
27 30
            item = QEngineeringNoteItem()
28
        elif self.isLineNo(text, delimiter, lineNoConfig):
31
        elif (delimiter != '' and lineNoConfig != '') and self.isLineNo(text, delimiter, lineNoConfig):
29 32
            item = QEngineeringLineNoTextItem()
30 33
        else:
31 34
            item = QEngineeringTextItem()

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)