프로젝트

일반

사용자정보

개정판 762819ff

ID762819ffb0a744c5d9098aa5c44b47c0d5e58a71
상위 4a90fb87
하위 8c9f96ef

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

issue #000: separate case

Change-Id: I65075f933155ea72a201d9811cb37879edecf408

차이점 보기:

DTI_PID/DTI_PID/Commands/SetStreamNoCommand.py
34 34
        self._symbols = []
35 35
        self._instrument = []
36 36
        self._lines = []
37
        self.delimiter = '!-!'
37 38

  
38 39
    def find_item(self, scene, uid):
39 40
        items = [item for item in scene.items() if hasattr(item, 'uid') and str(item.uid) == str(uid)]
......
87 88
                    _attrs[key] = ''
88 89

  
89 90
    def set_stream_no_item(self, item, stream_no):
90
        _attrs = item.getAttributes(findOwner=True)
91
        for key, value in _attrs.items():
92
            if key.Attribute == 'Stream No':
93
                _attrs[key] = stream_no
94
                return True
95
        return False
91
        try:
92
            _attrs = item.getAttributes(findOwner=True)
93
            done = False
94
            for key, value in _attrs.items():
95
                if key.Attribute == 'Stream No':
96
                    _attrs[key] = stream_no.split(self.delimiter)[0]
97
                    done = True
98
                elif key.Attribute == 'Case':
99
                    _attrs[key] = stream_no.split(self.delimiter)[1] if self.delimiter in stream_no else ''
100

  
101
            return done
102
        except Exception as ex:
103
            from App import App
104
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
105
                                                           sys.exc_info()[-1].tb_lineno)
106
            App.mainWnd().addMessage.emit(MessageType.Error, message)
107
            return False
96 108

  
97 109
    def check_stream_no_attribute(self, item):
98 110
        """ return stream no if item has stream no attribute else return False """
99 111
        _attrs = item.getAttributes(findOwner=True)
112
        stream_no = ''
113
        case = ''
114
        find = False
100 115
        for key, value in _attrs.items():
101 116
            if key.Attribute == 'Stream No':
117
                find = True
102 118
                if value:
103
                    return value
119
                    stream_no = value
104 120
                elif value == '' or value == None:
105 121
                    return None
106
                else:
107
                    return False
122

  
123
            elif key.Attribute == 'Case':
124
                case = value if value else ''
125

  
126
        if not find:
127
            return False
128

  
129
        if stream_no + case:
130
            return stream_no + self.delimiter + case
108 131

  
109 132
    def find_connected_objects(self, start, to=None, primary=False, include_signal=True):
110 133
        visited = [start]
......
194 217

  
195 218
        except Exception as ex:
196 219
            from App import App
197

  
198 220
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
199 221
                                                           sys.exc_info()[-1].tb_lineno)
200 222
            App.mainWnd().addMessage.emit(MessageType.Error, message)
......
236 258

  
237 259
            for row in rows:
238 260
                stream_no = QEngineeringLineNoTextItem()
239
                stream_no.setPlainText(row['Stream_No'] + '_' + row['Case'])
261
                stream_no.setPlainText(row['Stream_No'] + self.delimiter + row['Case'])
240 262

  
241 263
                from_item = self.find_item(scene, row['From_Component_UID'])
242 264
                to_item = self.find_item(scene, row['To_Component_UID'])
......
266 288
                            if stream_no:
267 289
                                self.set_stream_no_item(inst, stream_no)
268 290
                else:
269
                    # on going
291
                    # on going?
270 292
                    pass
271 293
            # up to here
272 294
            
DTI_PID/DTI_PID/LineListDialog.py
332 332

  
333 333
                model_datas = []
334 334
                for row_data in row_datas:
335
                    stream_no = row_data[1].stream_no.split('_')[0] if '_' in row_data[1].stream_no else row_data[1].stream_no
336
                    case = row_data[1].stream_no.split('_')[1] if '_' in row_data[1].stream_no else ''
335
                    stream_no = row_data[1].stream_no
336
                    case = row_data[1].case if row_data[1].case else ''
337 337
                    matches = [hmb_data for hmb_data in hmb_datas if hmb_data.stream_no == stream_no]
338 338
                    hmb_data = None
339 339

  
DTI_PID/DTI_PID/Shapes/EngineeringAbstractItem.py
458 458

  
459 459
        return None
460 460

  
461
    @property
462
    def case(self):
463
        matches = [attr for attr in self.attrs if attr.Attribute.upper() == 'CASE']
464
        if matches:
465
            return self.attrs[matches[0]]
466

  
467
        return None
468

  
461 469
    '''
462 470
    @stream_no.setter
463 471
    def stream_no(self, value):

내보내기 Unified diff

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