Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from PySide2.QtWidgets import QDialog, QPushButton, QVBoxLayout, QCheckBox,\
QFrame, QFormLayout
from PySide2.QtCore import Qt, Signal
from b_asic import SFG
class ShowPCWindow(QDialog):
pc = Signal()
def __init__(self, window):
super(ShowPCWindow, self).__init__()
self._window = window
self.check_box_list = []
self.setWindowFlags(Qt.WindowTitleHint | Qt.WindowCloseButtonHint)
self.setWindowTitle("Show PC")
self.dialog_layout = QVBoxLayout()
self.pc_btn = QPushButton("Show PC")
self.pc_btn.clicked.connect(self.show_precedence_graph)
self.dialog_layout.addWidget(self.pc_btn)
self.setLayout(self.dialog_layout)
def add_sfg_to_dialog(self):
sfg_layout = QVBoxLayout()
options_layout = QFormLayout()
for sfg in self._window.sfg_list:
check_box = QCheckBox()
options_layout.addRow(sfg.name, check_box)
self.check_box_list.append(check_box)
sfg_layout.addLayout(options_layout)
frame = QFrame()
frame.setFrameShape(QFrame.HLine)
frame.setFrameShadow(QFrame.Sunken)
self.dialog_layout.addWidget(frame)
self.dialog_layout.addLayout(sfg_layout)
def show_precedence_graph(self):
for i, check_box in enumerate(self.check_box_list):
if check_box.isChecked():
self._window.logger.info("Creating a precedence chart from " + self._window.sfg_list[i].name)
self._window.sfg_list[i].show_precedence_graph()
break
self.accept()
self.pc.emit()