개정판 ddbedd67
issue #1198: Loop 생성 결과를 하단에 표시함
Change-Id: I9f46f369e3387bf487818a6209cc60c592c60b20
HYTOS/HYTOS/Commands/HydroCalculationCommand.py | ||
---|---|---|
77 | 77 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
78 | 78 |
print('{}'.format(message)) |
79 | 79 |
finally: |
80 |
loop.name = 'Loop{}'.format(len(self.loops) + 1) |
|
80 | 81 |
self.loops.append(loop) |
81 | 82 |
|
82 | 83 |
return res |
HYTOS/HYTOS/MainWindow.py | ||
---|---|---|
673 | 673 |
""" generate loop """ |
674 | 674 |
cmd = HydroCalculationCommand(self.graphicsView) |
675 | 675 |
cmd.execute(None) |
676 |
self.display_loops(cmd.loops) |
|
676 | 677 |
|
677 | 678 |
self.load_HMB() |
678 | 679 |
finally: |
679 | 680 |
self.progress.setValue(self.progress.maximum()) |
680 | 681 |
self.progress.hide() |
681 |
|
|
682 | 682 |
except Exception as ex: |
683 | 683 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
684 | 684 |
self.addMessage.emit(MessageType.Error, message) |
685 |
|
|
686 |
def display_loops(self, loops): |
|
687 |
""" display loops """ |
|
688 |
drawing = AppDocData.instance().activeDrawing |
|
689 |
if drawing is None: return |
|
690 |
|
|
691 |
if loops: |
|
692 |
self.tableWidgetLoop.clear() |
|
693 |
self.tableWidgetLoop.setColumnCount(len(loops)) |
|
694 |
|
|
695 |
max_rows = 0 |
|
696 |
for col in range(len(loops)): |
|
697 |
rows = len(loops[col].items) |
|
698 |
max_rows = max(max_rows, rows) |
|
699 |
self.tableWidgetLoop.setRowCount(max_rows + 1) |
|
700 |
|
|
701 |
item = QTableWidgetItem(loops[col].name) |
|
702 |
item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter) |
|
703 |
self.tableWidgetLoop.setItem(0, col, item) |
|
704 |
for row in range(len(loops[col].items)): |
|
705 |
item = QTableWidgetItem(str(loops[col].items[row])) |
|
706 |
item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter) |
|
707 |
self.tableWidgetLoop.setItem(row + 1, col, item) |
|
708 |
|
|
685 | 709 |
''' |
686 | 710 |
@brief configuration |
687 | 711 |
''' |
HYTOS/HYTOS/MainWindow_UI.py | ||
---|---|---|
86 | 86 |
self.dockWidgetHMBList.setObjectName("dockWidgetHMBList") |
87 | 87 |
self.dockWidgetContents_3 = QtWidgets.QWidget() |
88 | 88 |
self.dockWidgetContents_3.setObjectName("dockWidgetContents_3") |
89 |
self.gridLayout_5 = QtWidgets.QGridLayout(self.dockWidgetContents_3) |
|
89 |
self.gridLayout_3 = QtWidgets.QGridLayout(self.dockWidgetContents_3) |
|
90 |
self.gridLayout_3.setObjectName("gridLayout_3") |
|
91 |
self.tabWidget = QtWidgets.QTabWidget(self.dockWidgetContents_3) |
|
92 |
self.tabWidget.setTabPosition(QtWidgets.QTabWidget.South) |
|
93 |
self.tabWidget.setTabShape(QtWidgets.QTabWidget.Rounded) |
|
94 |
self.tabWidget.setObjectName("tabWidget") |
|
95 |
self.tabStreamData = QtWidgets.QWidget() |
|
96 |
self.tabStreamData.setObjectName("tabStreamData") |
|
97 |
self.gridLayout_5 = QtWidgets.QGridLayout(self.tabStreamData) |
|
90 | 98 |
self.gridLayout_5.setObjectName("gridLayout_5") |
91 |
self.horizontalLayout = QtWidgets.QHBoxLayout() |
|
92 |
self.horizontalLayout.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint) |
|
93 |
self.horizontalLayout.setSpacing(6) |
|
94 |
self.horizontalLayout.setObjectName("horizontalLayout") |
|
95 |
self.tableWidgetHMB = QtWidgets.QTableWidget(self.dockWidgetContents_3) |
|
99 |
self.tableWidgetHMB = QtWidgets.QTableWidget(self.tabStreamData) |
|
96 | 100 |
self.tableWidgetHMB.setObjectName("tableWidgetHMB") |
97 | 101 |
self.tableWidgetHMB.setColumnCount(0) |
98 | 102 |
self.tableWidgetHMB.setRowCount(0) |
99 |
self.horizontalLayout.addWidget(self.tableWidgetHMB) |
|
100 |
self.horizontalLayout.setStretch(0, 88) |
|
101 |
self.gridLayout_5.addLayout(self.horizontalLayout, 0, 1, 1, 1) |
|
103 |
self.gridLayout_5.addWidget(self.tableWidgetHMB, 0, 0, 1, 1) |
|
104 |
self.tabWidget.addTab(self.tabStreamData, "") |
|
105 |
self.tabLoop = QtWidgets.QWidget() |
|
106 |
self.tabLoop.setObjectName("tabLoop") |
|
107 |
self.gridLayout_6 = QtWidgets.QGridLayout(self.tabLoop) |
|
108 |
self.gridLayout_6.setObjectName("gridLayout_6") |
|
109 |
self.tableWidgetLoop = QtWidgets.QTableWidget(self.tabLoop) |
|
110 |
self.tableWidgetLoop.setFrameShape(QtWidgets.QFrame.StyledPanel) |
|
111 |
self.tableWidgetLoop.setObjectName("tableWidgetLoop") |
|
112 |
self.tableWidgetLoop.setColumnCount(0) |
|
113 |
self.tableWidgetLoop.setRowCount(0) |
|
114 |
self.tableWidgetLoop.horizontalHeader().setVisible(False) |
|
115 |
self.tableWidgetLoop.verticalHeader().setVisible(False) |
|
116 |
self.gridLayout_6.addWidget(self.tableWidgetLoop, 0, 0, 1, 1) |
|
117 |
self.tabWidget.addTab(self.tabLoop, "") |
|
118 |
self.gridLayout_3.addWidget(self.tabWidget, 0, 0, 1, 1) |
|
102 | 119 |
self.dockWidgetHMBList.setWidget(self.dockWidgetContents_3) |
103 | 120 |
MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(8), self.dockWidgetHMBList) |
104 | 121 |
self.toolBar = QtWidgets.QToolBar(MainWindow) |
... | ... | |
426 | 443 |
self.toolBar.addAction(self.actionFitWindow) |
427 | 444 |
|
428 | 445 |
self.retranslateUi(MainWindow) |
446 |
self.tabWidget.setCurrentIndex(0) |
|
429 | 447 |
QtCore.QMetaObject.connectSlotsByName(MainWindow) |
430 | 448 |
|
431 | 449 |
def retranslateUi(self, MainWindow): |
... | ... | |
440 | 458 |
self.dockWidgetDrawingExplorer.setWindowTitle(_translate("MainWindow", "Drawing Explorer")) |
441 | 459 |
self.treeWidgetDrawingList.setSortingEnabled(True) |
442 | 460 |
self.dockWidgetHMBList.setWindowTitle(_translate("MainWindow", "HMB List")) |
461 |
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabStreamData), _translate("MainWindow", "Stream Data")) |
|
462 |
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabLoop), _translate("MainWindow", "Loop")) |
|
443 | 463 |
self.toolBar.setWindowTitle(_translate("MainWindow", "Main Toolbar")) |
444 | 464 |
self.actionClose.setText(_translate("MainWindow", "Exit")) |
445 | 465 |
self.actionClose.setToolTip(_translate("MainWindow", "Exit")) |
HYTOS/HYTOS/Shapes/EngineeringLoopItem.py | ||
---|---|---|
33 | 33 |
""" return string represent loop item """ |
34 | 34 |
return '{}'.format(self.items) |
35 | 35 |
|
36 |
@property |
|
37 |
def name(self): |
|
38 |
return self._name |
|
39 |
|
|
40 |
@name.setter |
|
41 |
def name(self, value): |
|
42 |
self._name = value |
|
43 |
|
|
36 | 44 |
class Transfer(QObject): |
37 | 45 |
onRemoved = pyqtSignal(QGraphicsItem) |
38 | 46 |
|
HYTOS/HYTOS/UI/MainWindow.ui | ||
---|---|---|
173 | 173 |
<number>8</number> |
174 | 174 |
</attribute> |
175 | 175 |
<widget class="QWidget" name="dockWidgetContents_3"> |
176 |
<layout class="QGridLayout" name="gridLayout_5">
|
|
177 |
<item row="0" column="1">
|
|
178 |
<layout class="QHBoxLayout" name="horizontalLayout" stretch="88">
|
|
179 |
<property name="spacing">
|
|
180 |
<number>6</number>
|
|
176 |
<layout class="QGridLayout" name="gridLayout_3">
|
|
177 |
<item row="0" column="0">
|
|
178 |
<widget class="QTabWidget" name="tabWidget">
|
|
179 |
<property name="tabPosition">
|
|
180 |
<enum>QTabWidget::South</enum>
|
|
181 | 181 |
</property> |
182 |
<property name="sizeConstraint">
|
|
183 |
<enum>QLayout::SetDefaultConstraint</enum>
|
|
182 |
<property name="tabShape">
|
|
183 |
<enum>QTabWidget::Rounded</enum>
|
|
184 | 184 |
</property> |
185 |
<item> |
|
186 |
<widget class="QTableWidget" name="tableWidgetHMB"/> |
|
187 |
</item> |
|
188 |
</layout> |
|
185 |
<property name="currentIndex"> |
|
186 |
<number>0</number> |
|
187 |
</property> |
|
188 |
<widget class="QWidget" name="tabStreamData"> |
|
189 |
<attribute name="title"> |
|
190 |
<string>Stream Data</string> |
|
191 |
</attribute> |
|
192 |
<layout class="QGridLayout" name="gridLayout_5"> |
|
193 |
<item row="0" column="0"> |
|
194 |
<widget class="QTableWidget" name="tableWidgetHMB"/> |
|
195 |
</item> |
|
196 |
</layout> |
|
197 |
</widget> |
|
198 |
<widget class="QWidget" name="tabLoop"> |
|
199 |
<attribute name="title"> |
|
200 |
<string>Loop</string> |
|
201 |
</attribute> |
|
202 |
<layout class="QGridLayout" name="gridLayout_6"> |
|
203 |
<item row="0" column="0"> |
|
204 |
<widget class="QTableWidget" name="tableWidgetLoop"> |
|
205 |
<property name="frameShape"> |
|
206 |
<enum>QFrame::StyledPanel</enum> |
|
207 |
</property> |
|
208 |
<attribute name="horizontalHeaderVisible"> |
|
209 |
<bool>false</bool> |
|
210 |
</attribute> |
|
211 |
<attribute name="verticalHeaderVisible"> |
|
212 |
<bool>false</bool> |
|
213 |
</attribute> |
|
214 |
</widget> |
|
215 |
</item> |
|
216 |
</layout> |
|
217 |
</widget> |
|
218 |
</widget> |
|
189 | 219 |
</item> |
190 | 220 |
</layout> |
191 | 221 |
</widget> |
내보내기 Unified diff