프로젝트

일반

사용자정보

개정판 878d0b2d

ID878d0b2dc68855259483f8436391e67251add61f
상위 2adcd5e7
하위 b13b7f59

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

issue #563: inst add conditions test

Change-Id: I9feced616e2a194da37ad7cd97dd4fb580fdfb0f

차이점 보기:

DTI_PID/DTI_PID/CodeTableDialog.py
500 500
                    if not self.inst:
501 501
                        code = table.item(row, 1).text()
502 502
                    else:
503
                        texts = [table.item(row, 1).text(), table.item(row, 2).text(), table.item(row, 3).text()]
504
                        code = False if len([text for text in texts if text == '']) >= 2 else True
503
                        texts = [[table.item(row, 1).text(), table.item(row, 2).text(), table.item(row, 3).text()], \
504
                                    [table.item(row, 4).text(), table.item(row, 5).text()]]
505
                        code = True if len([text for text in texts[0] if text == '']) <= 2 and len([text for text in texts[1] if text == '']) <= 1 else False
505 506
                    if not code:
506 507
                        result = False
507 508
                if result:
......
511 512
                    table.setItem(rowCount, 1, QTableWidgetItem(''))
512 513
                    table.setItem(rowCount, 2, QTableWidgetItem(''))
513 514
                    table.setItem(rowCount, 3, QTableWidgetItem(''))
515
                    if self.inst:
516
                        table.setItem(rowCount, 4, QTableWidgetItem(''))
517
                        table.setItem(rowCount, 5, QTableWidgetItem(''))
518
                        table.setItem(rowCount, 6, QTableWidgetItem(''))
514 519
                    table.cellChanged.connect(self.cellValueChanged)
515 520
            else:
516 521
                columnCount = table.columnCount()
......
597 602
                else:
598 603
                    table.resizeColumnToContents(3)
599 604
            elif self.inst:
600
                item1 = table.item(row, 1)
601
                item2 = table.item(row, 2)
602
                item3 = table.item(row, 3)
603
                if not item1 or not item2 or not item3:
604
                    return
605

  
606 605
                self.checkRowAndAddRow(tabText, table)
607 606
                self.setCurrentCode(table, tabText)
608 607
            else:
......
905 904
        @author     kyouho
906 905
        @date       2018.07.12
907 906
    '''
908

  
909 907
    def saveCommonCodeData(self, tableName):
910 908
        datas = []
911 909
        try:
DTI_PID/DTI_PID/CodeTables.py
28 28
            self.values = sorted(self.values, key=lambda param:len(param[1]), reverse=True)
29 29
        elif inst:
30 30
            self.values = []
31
            for x in values:
31
            for x in values: # uid, old code, symbol, attribute, new code, expression, priority
32 32
                olds = [old.strip() for old in x[1].split(',')]
33 33
                symbols = [symbol.strip() for symbol in x[2].split(',')]
34
                self.values.append((x[0], olds, symbols, x[3]))
34
                attrs = [attr.strip() for attr in x[3].split(',')]
35
                self.values.append((x[0], olds, symbols, attrs, x[4], x[5], x[6]))
35 36
        else:
36 37
            self.values = values
37 38

  
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py
1997 1997
        import re
1998 1998

  
1999 1999
        try:
2000
            code = old_code
2000 2001
            start_item = None
2001 2002
            if self.iType == 19:    # Labels - Symbol
2002 2003
                matches = [assoc for assoc in self.associations() if issubclass(type(assoc), SymbolSvgItem)]
......
2025 2026
                    # symbol
2026 2027
                    if not [line_type for line_type in line_types if line_type in value[2]]:
2027 2028
                        for item in items:
2028
                            match = re.search(value[1][0], old_code, re.DOTALL)
2029
                            if (old_code in value[1] or (match and match.start() is 0 and match.end() is len(old_code))) \
2029
                            match = re.search(value[1][0], code, re.DOTALL)
2030
                            if (code in value[1] or (match and match.start() is 0 and match.end() is len(code))) \
2030 2031
                                and item.name in value[2]:
2031 2032
                                dx = item.origin[0] - self.origin[0]
2032 2033
                                dy = item.origin[1] - self.origin[1]
......
2037 2038
                                    new_codes.append([length if not value[6] else value[6], eval(value[5])])
2038 2039
                    # line
2039 2040
                    else:
2041
                        match = re.search(value[1][0], code, re.DOTALL)
2040 2042
                        types = [conn.connectedItem.lineType for conn in self.connectors if conn.connectedItem and type(conn.connectedItem) is QEngineeringLineItem]
2041
                        if [line_type for line_type in value[2] if line_type in types]:
2043
                        if (code in value[1] or (match and match.start() is 0 and match.end() is len(code))) and \
2044
                            [line_type for line_type in value[2] if line_type in types]:
2042 2045
                            if not value[5]:
2043 2046
                                new_codes.append([0 if not value[6] else value[6], value[4]])
2044 2047
                            else:
......
2056 2059
                # symbol + attribute
2057 2060
                elif value[2][0] and value[3][0]:
2058 2061
                    for item in items:
2059
                        match = re.search(value[1][0], old_code, re.DOTALL)
2060
                        if (old_code in value[1] or (match and match.start() is 0 and match.end() is len(old_code))) \
2062
                        match = re.search(value[1][0], code, re.DOTALL)
2063
                        if (code in value[1] or (match and match.start() is 0 and match.end() is len(code))) \
2061 2064
                            and item.name in value[2]:
2062 2065
                            dx = item.origin[0] - self.origin[0]
2063 2066
                            dy = item.origin[1] - self.origin[1]
......
2072 2075
                        
2073 2076
            # default
2074 2077
            for value in table.values:
2075
                if old_code in value[1] and len(value[2]) == 1 and len(value[3]) == 1 and value[2][0] == '' and value[3][0] == '':
2078
                match = re.search(value[1][0], code, re.DOTALL)
2079
                if (code in value[1] or (match and match.start() is 0 and match.end() is len(code))) and len(value[2]) == 1 and len(value[3]) == 1 and value[2][0] == '' and value[3][0] == '':
2076 2080
                    if not value[5]:
2077 2081
                        new_codes.append([sys.maxsize if not value[6] else value[6], value[4]])
2078 2082
                    else:
......
2081 2085
            if new_codes:
2082 2086
                return sorted(new_codes, key=lambda param: param[0])[0][1]
2083 2087
            else:
2084
                return old_code
2088
                return code
2085 2089
        except Exception as ex:
2086 2090
            from App import App
2087 2091
            from AppDocData import MessageType
DTI_PID/DTI_PID/SymbolAttrCodeTableDialog.py
77 77
                        uid = table.item(row, 0).text() if table.item(row, 0).text() else str(uuid.uuid4())
78 78
                        code = table.item(row, 1).text().split(',') if table.item(row, 1) is not None else []
79 79
                        symbols = table.item(row, 2).text().split(',') if table.item(row, 3) is not None else []
80
                        newCode = table.item(row, 3).text() if table.item(row, 1) else ''
81

  
82
                        texts = [table.item(row, 1).text(), table.item(row, 2).text(), table.item(row, 3).text()]
83
                        if False if len([text for text in texts if text == '']) >= 2 else True:
84
                            self.code_data.append((uid, code, symbols, newCode))
80
                        attrs = table.item(row, 3).text().split(',') if table.item(row, 3) is not None else []
81
                        newCode = table.item(row, 4).text() if table.item(row, 1) else ''
82
                        expression = table.item(row, 5).text() if table.item(row, 1) else ''
83
                        priority = table.item(row, 6).text() if table.item(row, 1) else ''
84

  
85
                        texts = [[table.item(row, 1).text(), table.item(row, 2).text(), table.item(row, 3).text()], \
86
                                    [table.item(row, 4).text(), table.item(row, 5).text()]]
87
                        if True if len([text for text in texts[0] if text == '']) <= 2 and len([text for text in texts[1] if text == '']) <= 1 else False:
88
                            self.code_data.append((uid, code, symbols, attrs, newCode, expression, priority))
85 89

  
86 90
            self.isAccepted = True
87 91
            QDialog.accept(self)

내보내기 Unified diff

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