프로젝트

일반

사용자정보

개정판 ef4f8932

IDef4f8932fe712b9e1ab3bf727b9f96ae06196b33
상위 d4324515
하위 ffecb5ba

함의성이(가) 4년 이상 전에 추가함

issue #563: add default code on replace code table, distance order step

Change-Id: I3c6ac20a66a6cd80c60897dfd75d67f7049f53d8

차이점 보기:

DTI_PID/DTI_PID/CodeTableDialog.py
496 496
                    if not self.inst:
497 497
                        code = table.item(row, 1).text()
498 498
                    else:
499
                        code = table.item(row, 2).text()
499
                        texts = [table.item(row, 1).text(), table.item(row, 2).text(), table.item(row, 3).text()]
500
                        code = False if len([text for text in texts if text == '']) >= 2 else True
500 501
                    if not code:
501 502
                        result = False
502 503
                if result:
......
592 593
                else:
593 594
                    table.resizeColumnToContents(3)
594 595
            elif self.inst:
595
                item = table.item(row, 2)
596
                if not item: return
597
                code = item.text()
598
                if code == '': return
596
                item1 = table.item(row, 1)
597
                item2 = table.item(row, 2)
598
                item3 = table.item(row, 3)
599
                if not item1 or not item2 or not item3:
600
                    return
599 601

  
600 602
                self.checkRowAndAddRow(tabText, table)
601 603
                self.setCurrentCode(table, tabText)
DTI_PID/DTI_PID/OcrResultDialog.py
112 112
        else:
113 113
            self.ui.comboBoxOCRData.selectedIndex = 0
114 114

  
115
        
116
        configs = app_doc_data.getConfigs('Text Size', 'Min Text Size')
117
        minSize = int(configs[0].value) if 1 == len(configs) else 15
118

  
115 119
        if not self._text_item:
116
            if format == QOcrResultDialog.Format.Normal and self.boundingBox.height() > self.boundingBox.width():
120
            if format == QOcrResultDialog.Format.Normal and self.boundingBox.height() > self.boundingBox.width() and self.boundingBox.height() > minSize * 3:
117 121
                self.rotateImage(False)
118 122

  
119 123
            self.detect_text()
DTI_PID/DTI_PID/Shapes/EngineeringAbstractItem.py
305 305
            #App.mainWnd().addMessage.emit(MessageType.Error, str(self.uid) + self.name + message)
306 306
            App.mainWnd().addMessage.emit(MessageType.Error, message)
307 307

  
308
    def EvaluatedTable(self, old_code, table_name):
309
        """ return new attribute code """
310
        from AppDocData import AppDocData
311
        from CodeTables import CodeTable
312

  
313
        try:
314
            found = CodeTable.instance(table_name).find_match_exactly(old_code)
315

  
316
            return found if found else ''
317
        except Exception as ex:
318
            from App import App
319
            from AppDocData import MessageType
320

  
321
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
322
                                                          sys.exc_info()[-1].tb_lineno)
323
            App.mainWnd().addMessage.emit(MessageType.Error, message)
324

  
308 325
    def EvaluatedLineNo(self, prop):
309 326
        """ return line no attr """
310 327
        from EngineeringLineNoTextItem import QEngineeringLineNoTextItem
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py
1995 1995
            if len(items) != 1:
1996 1996
                return ''
1997 1997
            else:
1998
                items = [item.name for item in items[0] if issubclass(type(item), SymbolSvgItem)]
1998
                items = [item for item in items[0] if issubclass(type(item), SymbolSvgItem)]
1999 1999

  
2000 2000
            table = CodeTable.instance(code_name, inst=True)
2001 2001

  
2002
            new_codes = []
2003
            for item in items:
2004
                for value in table.values:
2005
                    if old_code in value[1] and item.name in value[2]:
2006
                        dx = item.origin[0] - self.origin[0]
2007
                        dy = item.origin[1] - self.origin[1]
2008
                        length = math.sqrt(dx*dx + dy*dy)
2009
                        new_codes.append([length, value[3]])
2010
                        
2002 2011
            for value in table.values:
2003
                if old_code in value[1] and [item for item in value[2] if item in items]:
2004
                    return value[3]
2012
                if old_code in value[1] and len(value[2]) == 1 and value[2][0] == '':
2013
                    new_codes.append([sys.maxsize, value[3]])
2005 2014

  
2006
            return old_code
2015
            if new_codes:
2016
                return sorted(new_codes, key=lambda param: param[0])[0][1]
2017
            else:
2018
                return old_code
2007 2019
        except Exception as ex:
2008 2020
            from App import App
2009 2021
            from AppDocData import MessageType
......
2013 2025
            #App.mainWnd().addMessage.emit(MessageType.Error, str(self.uid) + self.name + message)
2014 2026
            App.mainWnd().addMessage.emit(MessageType.Error, message)
2015 2027

  
2016
    def EvaluatedTable(self, old_code, table_name):
2017
        """ return new attribute code """
2018
        from AppDocData import AppDocData
2019
        from CodeTables import CodeTable
2020

  
2021
        try:
2022
            found = CodeTable.instance(table_name).find_match_exactly(old_code)
2023

  
2024
            return found if found else ''
2025
        except Exception as ex:
2026
            from App import App
2027
            from AppDocData import MessageType
2028

  
2029
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
2030
                                                          sys.exc_info()[-1].tb_lineno)
2031
            App.mainWnd().addMessage.emit(MessageType.Error, message)
2032

  
2033 2028
def recursiveChangeAttributes(node, attName, attValue):
2034 2029
    while not node.isNull():
2035 2030
        if node.isElement():
......
2048 2043
    @author     Jeongwoo
2049 2044
    @date       2018.06.18
2050 2045
'''
2051

  
2052

  
2053 2046
class Transfer(QObject):
2054 2047
    on_pos_changed = pyqtSignal(QGraphicsItem)
2055 2048
    onRemoved = pyqtSignal(QGraphicsItem)
DTI_PID/DTI_PID/tesseract_ocr_module.py
87 87
        oCRLang = language
88 88

  
89 89
        configs = app_doc_data.getConfigs('Text Size', 'Min Text Size')
90
        minSize = int(configs[0].value) if 1 == len(configs) else 30
90
        minSize = int(configs[0].value) if 1 == len(configs) else 15
91 91
        configs = app_doc_data.getConfigs('Text Size', 'Max Text Size')
92 92
        maxSize = int(configs[0].value) if 1 == len(configs) else 60
93 93
        # allowed single chars

내보내기 Unified diff

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