개정판 906e5da8
issue #000: hmb stream no add del test
Change-Id: I0263c70f425890cd87cafffe2df1369ae1ce963e
DTI_PID/DTI_PID/HMBDialog.py | ||
---|---|---|
78 | 78 |
|
79 | 79 |
def add_stream_no(self): |
80 | 80 |
from StreamNoAddDialog import QStreamNoAddDialog |
81 |
from HMBTable import HMBData, StreamData |
|
82 |
import uuid |
|
81 | 83 |
|
82 | 84 |
if self.hmbs: |
83 | 85 |
stream_nos = [hmb.stream_no for hmb in self.hmbs] |
84 | 86 |
dlg = QStreamNoAddDialog(self, stream_nos) |
85 | 87 |
if QDialog.Accepted == dlg.exec_(): |
86 | 88 |
new_stream_no = dlg.stream_no |
89 |
target_row = dlg.target_row |
|
90 |
|
|
91 |
uid = str(uuid.uuid4()) |
|
92 |
hmb = HMBData(uid) |
|
93 |
hmb.stream_no = new_stream_no |
|
94 |
hmb.hfrom = '' |
|
95 |
hmb.hto = '' |
|
96 |
|
|
97 |
hmb_datas = [] |
|
98 |
for datas in self.hmbs[0].datas: |
|
99 |
hmb_data = [] |
|
100 |
for data in datas: |
|
101 |
hmb_data.append(StreamData(data.name, data.unit, '', data.index, data.phase, data.case)) |
|
102 |
hmb_datas.append(hmb_data) |
|
103 |
|
|
104 |
hmb.datas = hmb_datas |
|
105 |
self.hmbs.insert(target_row, hmb) |
|
106 |
|
|
107 |
for _view in self.views: |
|
108 |
items = [QStandardItem(uid), QStandardItem(new_stream_no)] |
|
109 |
model = _view.model() |
|
110 |
for index in range(len(hmb_datas)): |
|
111 |
items.append(QStandardItem('')) |
|
112 |
model.insertRow(target_row, items) |
|
87 | 113 |
|
88 | 114 |
def delete_stream_no(self): |
89 |
pass |
|
115 |
if self.hmbs: |
|
116 |
tab = self.ui.tabWidget.currentWidget() |
|
117 |
tab_index = self.tabs.index(tab) |
|
118 |
view = self.views[tab_index] |
|
119 |
indexes = view.selectedIndexes() |
|
120 |
|
|
121 |
if len(indexes) != 1: |
|
122 |
return |
|
123 |
|
|
124 |
row = indexes[0].row() |
|
125 |
for _view in self.views: |
|
126 |
_view.model().takeRow(row) |
|
127 |
|
|
128 |
self.hmbs.pop(row) |
|
90 | 129 |
|
91 | 130 |
def dataChanged(self, *args): |
92 | 131 |
""" when cell data change update hmb data""" |
... | ... | |
127 | 166 |
|
128 | 167 |
def fill_hmb_data(self): |
129 | 168 |
"""load hmb data and fill table view""" |
130 |
import uuid |
|
131 | 169 |
|
132 | 170 |
try: |
133 | 171 |
hmbs = AppDocData.instance().get_hmb_data(None) |
DTI_PID/DTI_PID/StreamNoAddDialog.py | ||
---|---|---|
23 | 23 |
self.stream_nos = stream_nos |
24 | 24 |
self.stream_no = '' |
25 | 25 |
|
26 |
self.ui.spinBox.setMinimum = 1 |
|
27 |
self.ui.spinBox.setMaximum = len(stream_nos) + 1 |
|
28 |
self.target_row = len(stream_nos) + 1 |
|
29 |
|
|
26 | 30 |
#self.ui.buttonBox.bu.clicked.connect(self.accept) |
27 | 31 |
#self.ui.pushButtonClose.clicked.connect(self.reject) |
28 | 32 |
|
29 | 33 |
def accept(self): |
30 | 34 |
self.stream_no = self.ui.lineEditStreamNo.text() |
35 |
self.target_row = self.ui.spinBox.value() |
|
31 | 36 |
if self.stream_no and self.stream_no not in self.stream_nos: |
32 | 37 |
QDialog.accept(self) |
33 | 38 |
else: |
DTI_PID/DTI_PID/StreamNoAddDialog_UI.py | ||
---|---|---|
11 | 11 |
class Ui_StreamNoAddDialog(object): |
12 | 12 |
def setupUi(self, StreamNoAddDialog): |
13 | 13 |
StreamNoAddDialog.setObjectName("StreamNoAddDialog") |
14 |
StreamNoAddDialog.resize(314, 96)
|
|
14 |
StreamNoAddDialog.resize(314, 102)
|
|
15 | 15 |
icon = QtGui.QIcon() |
16 | 16 |
icon.addPixmap(QtGui.QPixmap(":/newPrefix/ID2.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
17 | 17 |
StreamNoAddDialog.setWindowIcon(icon) |
... | ... | |
26 | 26 |
self.lineEditStreamNo = QtWidgets.QLineEdit(StreamNoAddDialog) |
27 | 27 |
self.lineEditStreamNo.setObjectName("lineEditStreamNo") |
28 | 28 |
self.gridLayout.addWidget(self.lineEditStreamNo, 0, 1, 1, 1) |
29 |
self.label_2 = QtWidgets.QLabel(StreamNoAddDialog) |
|
30 |
self.label_2.setObjectName("label_2") |
|
31 |
self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1) |
|
32 |
self.spinBox = QtWidgets.QSpinBox(StreamNoAddDialog) |
|
33 |
self.spinBox.setObjectName("spinBox") |
|
34 |
self.gridLayout.addWidget(self.spinBox, 1, 1, 1, 1) |
|
29 | 35 |
self.gridLayout_2.addLayout(self.gridLayout, 0, 0, 1, 1) |
30 | 36 |
self.buttonBox = QtWidgets.QDialogButtonBox(StreamNoAddDialog) |
31 | 37 |
self.buttonBox.setOrientation(QtCore.Qt.Horizontal) |
... | ... | |
42 | 48 |
_translate = QtCore.QCoreApplication.translate |
43 | 49 |
StreamNoAddDialog.setWindowTitle(_translate("StreamNoAddDialog", "Add Stream No")) |
44 | 50 |
self.label.setText(_translate("StreamNoAddDialog", "Stream No : ")) |
51 |
self.label_2.setText(_translate("StreamNoAddDialog", "Row : ")) |
|
45 | 52 |
|
46 | 53 |
import MainWindow_rc |
47 | 54 |
|
DTI_PID/DTI_PID/UI/StreamNoAddDialog.ui | ||
---|---|---|
7 | 7 |
<x>0</x> |
8 | 8 |
<y>0</y> |
9 | 9 |
<width>314</width> |
10 |
<height>96</height>
|
|
10 |
<height>102</height>
|
|
11 | 11 |
</rect> |
12 | 12 |
</property> |
13 | 13 |
<property name="windowTitle"> |
... | ... | |
33 | 33 |
<item row="0" column="1"> |
34 | 34 |
<widget class="QLineEdit" name="lineEditStreamNo"/> |
35 | 35 |
</item> |
36 |
<item row="1" column="0"> |
|
37 |
<widget class="QLabel" name="label_2"> |
|
38 |
<property name="text"> |
|
39 |
<string>Row : </string> |
|
40 |
</property> |
|
41 |
</widget> |
|
42 |
</item> |
|
43 |
<item row="1" column="1"> |
|
44 |
<widget class="QSpinBox" name="spinBox"/> |
|
45 |
</item> |
|
36 | 46 |
</layout> |
37 | 47 |
</item> |
38 | 48 |
<item row="1" column="0"> |
내보내기 Unified diff