프로젝트

일반

사용자정보

개정판 a8ffd808

IDa8ffd8085134e81d4ebb554d084288112c02579f
상위 08433949
하위 ac2e45b1

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

issue #1489: stream no setting ui on going

Change-Id: I13a38d862bcce43b7e44e8de588f7ce29c19f85a

차이점 보기:

DTI_PID/DTI_PID/StreamlineDialog.py
18 18
        QStandardItemModel.__init__(self, parent, *args)
19 19

  
20 20
        self._need_to_pick_backcolor = QColor(255, 0, 255)
21
        self._target_drawing_backcolor = QColor(0, 255, 0)
22
        self._new_data_backcolor = Qt.yellow
21
        self._target_drawing_backcolor = QColor(Qt.green)
22
        self._new_data_backcolor = QColor(Qt.yellow)
23 23

  
24 24
    def data(self, index, role):
25 25
        if not index.isValid():
......
34 34
                    return self._need_to_pick_backcolor
35 35
                elif hasattr(item, '_new') and item._new:
36 36
                    return self._new_data_backcolor
37

  
37 38
            elif index.column() in [0]:
38 39
                app_doc_data = AppDocData.instance()
39 40
                uid = item.data(Qt.UserRole)
......
42 43

  
43 44
        return super(FromToModel, self).data(index, role)
44 45

  
46
class HmbModel(QStandardItemModel):
47
    def __init__(self, parent=None, *args):
48
        QStandardItemModel.__init__(self, parent, *args)
49

  
50
        self._target_drawing_backcolor = QColor(Qt.green)
51
        self._new_data_backcolor = QColor(Qt.yellow)
52

  
53
    def data(self, index, role):
54
        if not index.isValid():
55
            return None
56

  
57
        if role in [Qt.BackgroundRole]:
58
            item = super(HmbModel, self).item(index.row(), index.column())
59

  
60
            if index.column() in [1]:
61
                stream_no = item.text()
62

  
63
                if hasattr(item, '_new') and item._new:
64
                    return self._new_data_backcolor
65

  
66
                elif stream_no:
67
                    app_doc_data = AppDocData.instance()
68
                    rows = app_doc_data.get_stream_from_to(stream_no=stream_no)
69
                    if rows:
70
                        for row_ in rows:
71
                            if row_['Drawing_UID'] == app_doc_data.activeDrawing.UID:
72
                                return self._target_drawing_backcolor
73

  
74
        return super(HmbModel, self).data(index, role)
75

  
45 76

  
46 77
class FromToWidget(QWidget):
47 78
    def __init__(self, parent, column: int, from_to: str = ''):
......
107 138
        if not hmbs:
108 139
            return
109 140

  
110
        model = QStandardItemModel()
141
        model= HmbModel()
111 142
        header = ['UID', 'Stream No']
112 143

  
113 144
        for hmb in hmbs:
......
228 259
        self.ui.tableViewFromTo.setIndexWidget(i, to_button)
229 260
        self._from_to_widgets[to_button] = (i.row(), 2)
230 261

  
262
        row = self.ui.tableViewStreamNo.selectionModel().currentIndex().row()
263
        self.ui.tableViewStreamNo.model().item(row, 1)._new = True
264

  
231 265
    def on_del_from_to(self):
232 266
        """delete selected from/to"""
233 267
        current = self.ui.tableViewFromTo.selectionModel().currentIndex()
234 268
        self.ui.tableViewFromTo.model().removeRow(current.row())
235 269

  
270
        row = self.ui.tableViewStreamNo.selectionModel().currentIndex().row()
271
        self.ui.tableViewStreamNo.model().item(row, 1)._new = True
272

  
236 273
    def on_select_comp(self, column: int):
237 274
        """select from or to component"""
238 275
        from App import App

내보내기 Unified diff