프로젝트

일반

사용자정보

개정판 8c66ce13

ID8c66ce1364678cdf47c233fad071b835db0de592
상위 1f660f06
하위 ac606273

humkyung 이(가) 6년 이상 전에 추가함

fixed some bugs

차이점 보기:

DTI_PID/DTI_PID/AppDocData.py
425 425
        self.makeChildDir()
426 426
        try:
427 427
            # Creates or opens a file called mydb with a SQLite3 DB
428
            dbPath = self.getCurrentProject().getDbFilePath() + "/ITI_PID.db"
428
            dbPath = os.path.join(self.getCurrentProject().getDbFilePath() , "ITI_PID.db")
429 429
            conn = sqlite3.connect(dbPath)
430 430
            # Get a cursor object
431 431
            cursor = conn.cursor()
......
455 455
        @brief      Make Directory
456 456
        @author     Jeongwoo
457 457
        @date       18.05.08
458
        @history    humkyung 2018.06.19 make 'Tile' directory
458 459
    '''
459 460
    def makeChildDir(self):
460 461
        project = AppDocData.instance().getCurrentProject()
......
473 474
        tempDir = project.getTempPath()
474 475
        if not os.path.exists(tempDir):
475 476
            os.makedirs(tempDir)
477
        
478
        path = os.path.join(tempDir, 'Tile')
479
        if not os.path.exists(path):
480
            os.makedirs(path)
476 481

  
477 482
    '''
478 483
        @brief  Get current Project
DTI_PID/DTI_PID/DTI_PID.py
324 324
    global searchedSymbolList
325 325
    global maxProgressValue
326 326
    
327
    symId = targetSymbol.getId()
328
    symbolName = targetSymbol.getName()
329
    symbolType = targetSymbol.getType()
330
    symbolPath = targetSymbol.getPath()
331
    symbolThreshold = targetSymbol.getThreshold()
332
    symbolMinMatchCount = targetSymbol.getMinMatchCount()
333
    isDetectOnOrigin = targetSymbol.getIsDetectOnOrigin()
334
    symbolRotateCount = targetSymbol.getRotationCount()
335
    symbolOcrOption = targetSymbol.getOcrOption()
336
    isContainChild = targetSymbol.getIsContainChild()
337
    symbolOriginalPoint = targetSymbol.getOriginalPoint()
338
    symbolConnectionPoint = targetSymbol.getConnectionPoint()
339
    baseSymbol = targetSymbol.getBaseSymbol()
340
    additionalSymbol = targetSymbol.getAdditionalSymbol()
341
    isExceptDetect = targetSymbol.getIsExceptDetect()
342

  
343
    if isExceptDetect == 1:
344
        item = QListWidgetItem('{} file is not target'.format(os.path.basename(symbolPath.replace('.png', ''))))
345
        item.setBackground(QColor('green'))
346
        listWidget.addItem(item)
347
        return
348

  
349
    foundSymbolCount = 0
350

  
351
    # check if symbol file exists
352
    if not os.path.isfile(symbolPath):
353
        item = QListWidgetItem('{} file not found'.format(os.path.basename(symbolPath.replace('.png', ''))))
354
        item.setBackground(QColor('red'))
355
        listWidget.addItem(item)
356
        return
357
    #else:
358
    #    listWidget.addItem('Current symbol : ' + os.path.basename(symbolPath.replace('.png', '')))
359
    # up to here
360

  
361
    sym = cv2.imread(symbolPath, 1)
362
    symGray = cvtGrayImage(sym)
363
    sow, soh = symGray.shape[::-1] # symbol original w, h
364

  
365
    offsetDrawingArea=[]
366
    area = AppDocData.instance().getArea('Drawing')
367
    if area is not None:
368
        copiedBasePid = area.img.copy()
369
        offsetDrawingArea.append(area.x)
370
        offsetDrawingArea.append(area.y)
371
    else:
372
        offsetDrawingArea.append(0)
373
        offsetDrawingArea.append(0)
374
        if isDetectOnOrigin == 1:
375
            copiedBasePid = srcGray.copy()
327
    try:
328
        symId = targetSymbol.getId()
329
        symbolName = targetSymbol.getName()
330
        symbolType = targetSymbol.getType()
331
        symbolPath = targetSymbol.getPath()
332
        symbolThreshold = targetSymbol.getThreshold()
333
        symbolMinMatchCount = targetSymbol.getMinMatchCount()
334
        isDetectOnOrigin = targetSymbol.getIsDetectOnOrigin()
335
        symbolRotateCount = targetSymbol.getRotationCount()
336
        symbolOcrOption = targetSymbol.getOcrOption()
337
        isContainChild = targetSymbol.getIsContainChild()
338
        symbolOriginalPoint = targetSymbol.getOriginalPoint()
339
        symbolConnectionPoint = targetSymbol.getConnectionPoint()
340
        baseSymbol = targetSymbol.getBaseSymbol()
341
        additionalSymbol = targetSymbol.getAdditionalSymbol()
342
        isExceptDetect = targetSymbol.getIsExceptDetect()
343

  
344
        if isExceptDetect == 1:
345
            item = QListWidgetItem('{} file is not target'.format(os.path.basename(symbolPath.replace('.png', ''))))
346
            item.setBackground(QColor('green'))
347
            listWidget.addItem(item)
348
            return
349

  
350
        foundSymbolCount = 0
351

  
352
        # check if symbol file exists
353
        if not os.path.isfile(symbolPath):
354
            item = QListWidgetItem('{} file not found'.format(os.path.basename(symbolPath.replace('.png', ''))))
355
            item.setBackground(QColor('red'))
356
            listWidget.addItem(item)
357
            return
358
        #else:
359
        #    listWidget.addItem('Current symbol : ' + os.path.basename(symbolPath.replace('.png', '')))
360
        # up to here
361

  
362
        sym = cv2.imread(symbolPath, 1)
363
        symGray = cvtGrayImage(sym)
364
        sow, soh = symGray.shape[::-1] # symbol original w, h
365

  
366
        offsetDrawingArea=[]
367
        area = AppDocData.instance().getArea('Drawing')
368
        if area is not None:
369
            copiedBasePid = area.img.copy()
370
            offsetDrawingArea.append(area.x)
371
            offsetDrawingArea.append(area.y)
376 372
        else:
377
            copiedBasePid = ocrCompletedSrc.copy()
378
    srcWidth, srcHeight = copiedBasePid.shape[::-1]
373
            offsetDrawingArea.append(0)
374
            offsetDrawingArea.append(0)
375
            if isDetectOnOrigin == 1:
376
                copiedBasePid = srcGray.copy()
377
            else:
378
                copiedBasePid = ocrCompletedSrc.copy()
379
        srcWidth, srcHeight = copiedBasePid.shape[::-1]
379 380

  
380
    if srcWidth > 10000 or srcHeight > 10000:
381
        splitCount = 2 ## splitCount = 2^n
382
    else:
383
        splitCount = 1
381
        if srcWidth > 10000 or srcHeight > 10000:
382
            splitCount = 2 ## splitCount = 2^n
383
        else:
384
            splitCount = 1
384 385

  
385
    totalMpCount = 0
386
    while splitCount >= 1:
387
        splitWidth = srcWidth // splitCount
388
        splitHeight = srcHeight // splitCount
389
                
390
        ##Setting ROI List - [splitCount * splitCount] size
391
        splitRoiList = getSplitSrcList(copiedBasePid, splitCount, splitWidth, splitHeight)
392

  
393
        for roiIndex in range(len(splitRoiList)):
394
            roiItemSp = splitRoiList[roiIndex][0]
395
            roiItemEp = splitRoiList[roiIndex][1]
396
            roiItem = splitRoiList[roiIndex][2]
397

  
398
            symbolRotatedAngle = 0
399
            for rc in range(symbolRotateCount + 1): ## Rotation Count를 사용자 기준으로 받아서 1을 더한 후 사용
400
                ##Template Matching
401
                sw, sh = symGray.shape[::-1]
402
                roiw = (roiItemEp[0] - roiItemSp[0])
403
                roih = (roiItemEp[1] - roiItemSp[1])
404

  
405
                ## Case : Bigger Symbol than Split ROI
406
                if roiw < sw or roih < sh:
386
        totalMpCount = 0
387
        while splitCount >= 1:
388
            splitWidth = srcWidth // splitCount
389
            splitHeight = srcHeight // splitCount
390
                    
391
            ##Setting ROI List - [splitCount * splitCount] size
392
            splitRoiList = getSplitSrcList(copiedBasePid, splitCount, splitWidth, splitHeight)
393

  
394
            for roiIndex in range(len(splitRoiList)):
395
                roiItemSp = splitRoiList[roiIndex][0]
396
                roiItemEp = splitRoiList[roiIndex][1]
397
                roiItem = splitRoiList[roiIndex][2]
398

  
399
                symbolRotatedAngle = 0
400
                for rc in range(symbolRotateCount + 1): ## Rotation Count를 사용자 기준으로 받아서 1을 더한 후 사용
401
                    ##Template Matching
402
                    sw, sh = symGray.shape[::-1]
403
                    roiw = (roiItemEp[0] - roiItemSp[0])
404
                    roih = (roiItemEp[1] - roiItemSp[1])
405

  
406
                    ## Case : Bigger Symbol than Split ROI
407
                    if roiw < sw or roih < sh:
408
                        symGray = cv2.rotate(symGray, cv2.ROTATE_90_COUNTERCLOCKWISE)
409
                        symbolRotatedAngle = symbolRotatedAngle + 90
410

  
411
                        if baseSymbol is not None and additionalSymbol is not None:
412
                            additionalSymbol = getRotatedChildInfo(additionalSymbol)
413
                        continue
414
                    
415
                    ## get Rotated Original Point
416
                    originalPoint = getCalculatedOriginalPoint(additionalSymbol, symbolOriginalPoint, symbolRotatedAngle, sw, sh, sow, soh)
417
                    connectionPoint = getCalculatedConnectionPoint(symbolConnectionPoint, symbolRotatedAngle, sw, sh, sow, soh)
418

  
419
                    ## Template Matching
420
                    tmRes = cv2.matchTemplate(roiItem, symGray, cv2.TM_CCOEFF_NORMED)
421
                    loc = np.where(tmRes >= symbolThreshold)
422

  
423

  
424
                    for pt in zip(*loc[::-1]):
425
                        overlapArea = 0
426
                        mpCount = 0 # Match Point Count
427
                        symbolIndex = -1
428

  
429
                        searchedItemSp = (roiItemSp[0]+pt[0] + round(offsetDrawingArea[0]) + 1, roiItemSp[1]+pt[1] + round(offsetDrawingArea[1]) + 1)
430

  
431
                        for i in range(len(searchedSymbolList)):
432
                            overlapArea = contains(searchedSymbolList[i], searchedItemSp, sw, sh)
433
                            if overlapArea > ACCEPT_OVERLAY_AREA:
434
                                symbolIndex = i
435
                                break
436
                        
437

  
438
                        roi = roiItem[pt[1]:pt[1]+sh, pt[0]:pt[0]+sw]
439
                        mpCount = getMatchPointCount(roi, symGray)
440

  
441
                        if not (mpCount >= symbolMinMatchCount):
442
                            continue
443

  
444
                        currentHitRate = tmRes[pt[1], pt[0]]
445
                        ## 겹치는 영역이 기준값보다 작을 경우
446
                        if overlapArea <= ACCEPT_OVERLAY_AREA:
447
                            #if mpCount >= symbolMinMatchCount:
448
                            threadLock.acquire()
449
                            foundSymbolCount = foundSymbolCount + 1
450
                            addSearchedSymbol(symId, symbolName, symbolType
451
                                                , searchedItemSp, sw, sh, symbolThreshold, symbolMinMatchCount, currentHitRate, symbolRotatedAngle
452
                                                , isDetectOnOrigin, symbolRotateCount, symbolOcrOption, isContainChild
453
                                                , originalPoint, connectionPoint, baseSymbol, additionalSymbol,isExceptDetect)
454
                            threadLock.release()
455
                        ## 겹치는 영역이 기준값보다 클 경우
456
                        else:
457
                            if symbolIndex != -1 and symbolIndex < len(searchedSymbolList):
458
                                searchedSymbol = searchedSymbolList[symbolIndex]
459
                                ## 현재 심볼과 검출된 심볼이 같을 경우 Match Point가 더 높은 정보로 교체
460
                                if symbolName == searchedSymbol.getName():
461
                                    symbolHitRate = searchedSymbol.getHitRate()
462
                                    if symbolHitRate < currentHitRate:
463
                                        threadLock.acquire()
464
                                        searchedSymbolList[symbolIndex] = symbol.Symbol(symId, symbolName, symbolType
465
                                                                                        , searchedItemSp, sw, sh, symbolThreshold, symbolMinMatchCount, currentHitRate, symbolRotatedAngle
466
                                                                                        , isDetectOnOrigin, symbolRotateCount, symbolOcrOption, isContainChild
467
                                                                                        , originalPoint, connectionPoint, baseSymbol, additionalSymbol,isExceptDetect)
468
                                        threadLock.release()
469
                                ## 현재 심볼과 검출된 심볼이 같지 않을 경우 (포함)
470
                                else:
471
                                    ## 검출된 심볼 리스트 중에서 해당 영역에 같은 심볼이 있는지 여부 체크
472
                                    matches = [sym for sym in searchedSymbolList if sym.getName() == symbolName and contains(sym, searchedItemSp, sw, sh) > ACCEPT_OVERLAY_AREA]
473

  
474
                                    ## 현재 심볼과 검출된 심볼이 같을 경우 Match Point가 더 높은 정보로 교체
475
                                    if len(matches) != 0:
476
                                        for s in matches:
477
                                            symbolHitRate = s.getHitRate()
478
                                            if symbolHitRate < currentHitRate:
479
                                                threadLock.acquire()
480
                                                searchedSymbolList[searchedSymbolList.index(s)] = symbol.Symbol(symId, symbolName, symbolType
481
                                                                                                , searchedItemSp, sw, sh, symbolThreshold, symbolMinMatchCount, currentHitRate, symbolRotatedAngle
482
                                                                                                , isDetectOnOrigin, symbolRotateCount, symbolOcrOption, isContainChild
483
                                                                                                , originalPoint, connectionPoint, baseSymbol, additionalSymbol,isExceptDetect)
484
                                                threadLock.release()
485
                                    else:
486
                                        #if mpCount >= symbolMinMatchCount:
487
                                        if searchedSymbol.getIsContainChild() == 1:
488
                                            ## 특정 카테고리 심볼을 걸러냄 (ex - 9900 대 Drum)
489
                                            if (searchedSymbol.getId() // 100) == (symId // 100):
490
                                                continue
491
                                            else:
492
                                                threadLock.acquire()
493
                                                foundSymbolCount = foundSymbolCount + 1
494
                                                addSearchedSymbol(symId, symbolName, symbolType
495
                                                                    , searchedItemSp, sw, sh, symbolThreshold, currentHitRate, currentHitRate, symbolRotatedAngle
496
                                                                    , isDetectOnOrigin, symbolRotateCount, symbolOcrOption, isContainChild
497
                                                                    , originalPoint, connectionPoint, baseSymbol, additionalSymbol,isExceptDetect)
498
                                                threadLock.release()
499
                                    
500
                    ## Rotate Symbol
407 501
                    symGray = cv2.rotate(symGray, cv2.ROTATE_90_COUNTERCLOCKWISE)
408 502
                    symbolRotatedAngle = symbolRotatedAngle + 90
409 503

  
410
                    if baseSymbol is not None and additionalSymbol is not None:
504
                    if additionalSymbol is not None:
411 505
                        additionalSymbol = getRotatedChildInfo(additionalSymbol)
412
                    continue
413
                
414
                ## get Rotated Original Point
415
                originalPoint = getCalculatedOriginalPoint(additionalSymbol, symbolOriginalPoint, symbolRotatedAngle, sw, sh, sow, soh)
416
                connectionPoint = getCalculatedConnectionPoint(symbolConnectionPoint, symbolRotatedAngle, sw, sh, sow, soh)
417

  
418
                ## Template Matching
419
                tmRes = cv2.matchTemplate(roiItem, symGray, cv2.TM_CCOEFF_NORMED)
420
                loc = np.where(tmRes >= symbolThreshold)
421

  
422

  
423
                for pt in zip(*loc[::-1]):
424
                    overlapArea = 0
425
                    mpCount = 0 # Match Point Count
426
                    symbolIndex = -1
427 506

  
428
                    searchedItemSp = (roiItemSp[0]+pt[0] + round(offsetDrawingArea[0]) + 1, roiItemSp[1]+pt[1] + round(offsetDrawingArea[1]) + 1)
507
            splitCount = splitCount // 2
429 508

  
430
                    for i in range(len(searchedSymbolList)):
431
                        overlapArea = contains(searchedSymbolList[i], searchedItemSp, sw, sh)
432
                        if overlapArea > ACCEPT_OVERLAY_AREA:
433
                            symbolIndex = i
434
                            break
435
                    
436

  
437
                    roi = roiItem[pt[1]:pt[1]+sh, pt[0]:pt[0]+sw]
438
                    mpCount = getMatchPointCount(roi, symGray)
439

  
440
                    if not (mpCount >= symbolMinMatchCount):
441
                        continue
442

  
443
                    currentHitRate = tmRes[pt[1], pt[0]]
444
                    ## 겹치는 영역이 기준값보다 작을 경우
445
                    if overlapArea <= ACCEPT_OVERLAY_AREA:
446
                        #if mpCount >= symbolMinMatchCount:
447
                        threadLock.acquire()
448
                        foundSymbolCount = foundSymbolCount + 1
449
                        addSearchedSymbol(symId, symbolName, symbolType
450
                                            , searchedItemSp, sw, sh, symbolThreshold, symbolMinMatchCount, currentHitRate, symbolRotatedAngle
451
                                            , isDetectOnOrigin, symbolRotateCount, symbolOcrOption, isContainChild
452
                                            , originalPoint, connectionPoint, baseSymbol, additionalSymbol,isExceptDetect)
453
                        threadLock.release()
454
                    ## 겹치는 영역이 기준값보다 클 경우
455
                    else:
456
                        if symbolIndex != -1 and symbolIndex < len(searchedSymbolList):
457
                            searchedSymbol = searchedSymbolList[symbolIndex]
458
                            ## 현재 심볼과 검출된 심볼이 같을 경우 Match Point가 더 높은 정보로 교체
459
                            if symbolName == searchedSymbol.getName():
460
                                symbolHitRate = searchedSymbol.getHitRate()
461
                                if symbolHitRate < currentHitRate:
462
                                    threadLock.acquire()
463
                                    searchedSymbolList[symbolIndex] = symbol.Symbol(symId, symbolName, symbolType
464
                                                                                    , searchedItemSp, sw, sh, symbolThreshold, symbolMinMatchCount, currentHitRate, symbolRotatedAngle
465
                                                                                    , isDetectOnOrigin, symbolRotateCount, symbolOcrOption, isContainChild
466
                                                                                    , originalPoint, connectionPoint, baseSymbol, additionalSymbol,isExceptDetect)
467
                                    threadLock.release()
468
                            ## 현재 심볼과 검출된 심볼이 같지 않을 경우 (포함)
469
                            else:
470
                                ## 검출된 심볼 리스트 중에서 해당 영역에 같은 심볼이 있는지 여부 체크
471
                                matches = [sym for sym in searchedSymbolList if sym.getName() == symbolName and contains(sym, searchedItemSp, sw, sh) > ACCEPT_OVERLAY_AREA]
472

  
473
                                ## 현재 심볼과 검출된 심볼이 같을 경우 Match Point가 더 높은 정보로 교체
474
                                if len(matches) != 0:
475
                                    for s in matches:
476
                                        symbolHitRate = s.getHitRate()
477
                                        if symbolHitRate < currentHitRate:
478
                                            threadLock.acquire()
479
                                            searchedSymbolList[searchedSymbolList.index(s)] = symbol.Symbol(symId, symbolName, symbolType
480
                                                                                            , searchedItemSp, sw, sh, symbolThreshold, symbolMinMatchCount, currentHitRate, symbolRotatedAngle
481
                                                                                            , isDetectOnOrigin, symbolRotateCount, symbolOcrOption, isContainChild
482
                                                                                            , originalPoint, connectionPoint, baseSymbol, additionalSymbol,isExceptDetect)
483
                                            threadLock.release()
484
                                else:
485
                                    #if mpCount >= symbolMinMatchCount:
486
                                    if searchedSymbol.getIsContainChild() == 1:
487
                                        ## 특정 카테고리 심볼을 걸러냄 (ex - 9900 대 Drum)
488
                                        if (searchedSymbol.getId() // 100) == (symId // 100):
489
                                            continue
490
                                        else:
491
                                            threadLock.acquire()
492
                                            foundSymbolCount = foundSymbolCount + 1
493
                                            addSearchedSymbol(symId, symbolName, symbolType
494
                                                                , searchedItemSp, sw, sh, symbolThreshold, currentHitRate, currentHitRate, symbolRotatedAngle
495
                                                                , isDetectOnOrigin, symbolRotateCount, symbolOcrOption, isContainChild
496
                                                                , originalPoint, connectionPoint, baseSymbol, additionalSymbol,isExceptDetect)
497
                                            threadLock.release()
498
                                
499
                ## Rotate Symbol
500
                symGray = cv2.rotate(symGray, cv2.ROTATE_90_COUNTERCLOCKWISE)
501
                symbolRotatedAngle = symbolRotatedAngle + 90
502

  
503
                if additionalSymbol is not None:
504
                    additionalSymbol = getRotatedChildInfo(additionalSymbol)
505

  
506
        splitCount = splitCount // 2
507

  
508
    
509
    threadLock.acquire()
510
    srcName = os.path.splitext(os.path.basename(mainRes))[0]    
511
    listWidget.addItem('Found Symbol   : ' + os.path.basename(symbolPath.replace('.png', '')) + ' - (' + str(foundSymbolCount) + ')')
512
    threadLock.release()
509
        threadLock.acquire()
510
        srcName = os.path.splitext(os.path.basename(mainRes))[0] 
511
        listWidget.addItem('Found Symbol   : ' + os.path.basename(symbolPath.replace('.png', '')) + ' - (' + str(foundSymbolCount) + ')')
512
        threadLock.release()
513 513

  
514
    updateProgressSignal.emit(maxProgressValue)
514
        updateProgressSignal.emit(maxProgressValue)
515
    except Exception as ex:
516
        print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
515 517

  
516 518
'''
517 519
    @history    2018.05.17  Jeongwoo    Bitwise_not target changed (Original Image → Symbol Image)
......
1026 1028

  
1027 1029
                pool = futures.ThreadPoolExecutor(max_workers = THREAD_MAX_WORKER)
1028 1030
                for sym in searchedSymbolList:
1029
                    #threadLock.acquire()
1030 1031
                    pool.submit(removeDetectedSymbol, sym)
1031 1032
                    pool.submit(drawRectOnSrc, sym)
1032
                    #drawRectOnSrc()
1033
                    #threadLock.release()
1034 1033
                pool.shutdown(wait = True)
1035 1034
                
1036 1035
                global MIN_TEXT_SIZE
DTI_PID/DTI_PID/ProjectDialog.py
53 53
        options |= QFileDialog.ShowDirsOnly
54 54
        selectedDir = QFileDialog.getExistingDirectory(None, "프로젝트 경로 선택", os.getcwd() , options=options)
55 55
        if selectedDir:
56
            print(selectedDir)
57 56
            self.insertProjectInfo(selectedDir)
58 57
            
59 58
    def insertProjectInfo(self, dir):
DTI_PID/DTI_PID/QRecognitionDialog.py
32 32
    intReady = pyqtSignal(int)
33 33
    recognizeLine = pyqtSignal(str, QListWidget, QtImageViewer)
34 34
    drawDetectedItems = pyqtSignal(list, list, list)
35
    displayMessage = pyqtSignal(QListWidgetItem)
35 36
    updateProgress = pyqtSignal(int)
36 37

  
37 38
    '''
......
102 103
            self.startThread()
103 104

  
104 105
    '''
106
        @brief  add item to list widget
107
        @author humkyung
108
        @date   2018.06.19
109
    '''
110
    def addListItem(self, item):
111
        self.ui.listWidget.addItem(item)
112

  
113
    '''
105 114
        @brief  update progressbar with given value
106 115
        @author humkyung
107 116
        @date   2018.06.08
......
141 150
        self.obj.finished.connect(self.thread.quit)
142 151
        self.obj.drawDetectedItems.connect(self.drawDetectedItems)
143 152
        self.obj.recognizeLine.connect(recognizeLine)
153
        self.obj.displayMessage.connect(self.addListItem)
144 154
        self.obj.updateProgress.connect(self.updateProgress)
145 155

  
146 156
        # 4 - Connect Thread started signal to Worker operational slot method
......
185 195
    '''
186 196
    def drawDetectedItems(self, symbolList, textInfoList, noteTextInfoList):
187 197
        self.ui.progressBar.setValue(self.ui.progressBar.maximum())
188
        self.parent.drawDetectedItems(symbolList, textInfoList, noteTextInfoList)
198
        self.parent.drawDetectedItems(symbolList, textInfoList, noteTextInfoList)
DTI_PID/DTI_PID/TextItemFactory.py
26 26
    '''
27 27
        @history    2018.04.27  Jeongwoo    Add condition on elif-statement (delimiter != '' and lineNoConfig != '')
28 28
                    humkyung 2018.05.02 create engineering size text item if condition matches
29
                    humkyung 2018.06.19 set line no's color
29 30
    '''
30 31
    def createTextItem(self, text, delimiter = '', lineNoConfig = ''):
31 32
        import random
......
41 42
                item = QEngineeringNoteItem()
42 43
            elif (delimiter != '' and lineNoConfig != '') and self.isLineNo(text, delimiter, lineNoConfig):
43 44
                item = QEngineeringLineNoTextItem()
44
                colorIdx = random.randrange(0, 256)
45
                rgb = docData.colors[colorIdx]
46
                item.setColor(QColor(rgb.red, rgb.green, rgb.blue).name())
45
                # set color
46
                colorCount = len(docData.colors)
47
                if colorCount:
48
                    colorIdx = random.randrange(0, colorCount)
49
                    rgb = docData.colors[colorIdx]
50
                    item.setColor(QColor(rgb.red, rgb.green, rgb.blue).name())
51
                # up to here
47 52
            elif self.isSizeText(text, sizeDelimiter):
48 53
                item = QEngineeringSizeTextItem()
49 54
            elif self.isTagNoText(text):

내보내기 Unified diff

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