프로젝트

일반

사용자정보

개정판 0a77ad35

ID0a77ad35cf0ae25a010d71882676b8e363ec2b9f
상위 789742ab
하위 9ea02c5c

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

issue #563: inst code table on going test

Change-Id: I5fd074896adab257a8442794828bd35d2a410cb9

차이점 보기:

DTI_PID/DTI_PID/CodeTables.py
14 14
                    'VALVEOPERCODES', 'RESERVEDWORDS', 'DICTIONARY', 'EQPTAGNAMES']
15 15
    ALLOWABLES = [('1', 'I', 'l'), ('0', 'O'), ('8', 'B'), ('2', 'Z'), ('S', 's', '5')] # must sort long string first ex ('II', '"') for multi-chars, now possible single
16 16

  
17
    def __init__(self, name, values):
17
    def __init__(self, name, values, inst=False):
18 18
        self.name = name
19
        if self.name != "NOMINALDIAMETER":
19
        if self.name != "NOMINALDIAMETER" and not inst:
20 20
            self.values = []
21 21
            for x in values:
22 22
                allowable = x[3].replace(' ', '').split(',')
......
26 26
                    self.values.append((x[0], x[1], x[2], [allowable[0]] + sorted(allowable[1:], key=lambda param:len(param), reverse=True)))
27 27

  
28 28
            self.values = sorted(self.values, key=lambda param:len(param[1]), reverse=True)
29
        elif inst:
30
            self.values = []
31
            for x in values:
32
                symbols = [symbol.strip() for symbol in x[2].split(',')]
33
                self.values.append((x[0], x[1], symbols, x[3]))
29 34
        else:
30 35
            self.values = values
31 36

  
......
109 114
            return None
110 115

  
111 116
    @staticmethod
112
    def instance(table_name, symbol_attribute_uid=None, custom_table_uid=None):
117
    def instance(table_name, symbol_attribute_uid=None, custom_table_uid=None, inst_table_uid=None, inst=False):
113 118
        """ return instance has given table name """
114 119

  
115 120
        from NominalPipeSize import NominalPipeSizeTable
......
146 151
                CodeTable.TABLES[custom_table_uid] = CodeTable(custom_table_uid, values)
147 152
                return CodeTable.TABLES[custom_table_uid]
148 153

  
149
        elif _table_name not in CodeTable.TABLES:
154
        elif _table_name == 'INSTCODES' and inst_table_uid:
155
            # replace code table setting
156
            if inst_table_uid in CodeTable.TABLES:
157
                return CodeTable.TABLES[inst_table_uid]
158
            else:
159
                appDocData = AppDocData.instance()
160
                values = appDocData.getCodeTable(_table_name, False, inst_table_uid=inst_table_uid, inst=True)
161
                CodeTable.TABLES[inst_table_uid] = CodeTable(inst_table_uid, values, inst=True)
162
                return CodeTable.TABLES[inst_table_uid]
163

  
164
        elif _table_name not in CodeTable.TABLES and not inst:
150 165
            # custom code table using
151 166
            appDocData = AppDocData.instance()
152 167
            values = appDocData.getCodeTable(_table_name, False, custom=True)
153 168
            CodeTable.TABLES[_table_name] = CodeTable(custom_table_uid, values)
154 169
            return CodeTable.TABLES[_table_name]
170
        
171
        elif _table_name not in CodeTable.TABLES and inst:
172
            # custom code table using
173
            appDocData = AppDocData.instance()
174
            values = appDocData.getCodeTable(_table_name, False, inst=True)
175
            CodeTable.TABLES[_table_name] = CodeTable(custom_table_uid, values, inst=True)
176
            return CodeTable.TABLES[_table_name]
155 177

  
156 178
        return CodeTable.TABLES[_table_name]
157 179

  

내보내기 Unified diff

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