-
Notifications
You must be signed in to change notification settings - Fork 0
/
cfgi_ui.py
142 lines (135 loc) · 9.36 KB
/
cfgi_ui.py
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(756, 785)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.gridLayout_5 = QtWidgets.QGridLayout(self.centralwidget)
self.gridLayout_5.setObjectName("gridLayout_5")
self.gridLayout_4 = QtWidgets.QGridLayout()
self.gridLayout_4.setSizeConstraint(QtWidgets.QLayout.SetFixedSize)
self.gridLayout_4.setObjectName("gridLayout_4")
self.test_pushButton = QtWidgets.QPushButton(self.centralwidget)
self.test_pushButton.setObjectName("test_pushButton")
self.gridLayout_4.addWidget(self.test_pushButton, 0, 1, 1, 1)
self.result_textBrowser = QtWidgets.QTextBrowser(self.centralwidget)
self.result_textBrowser.setObjectName("result_textBrowser")
self.gridLayout_4.addWidget(self.result_textBrowser, 2, 0, 1, 2)
self.label_11 = QtWidgets.QLabel(self.centralwidget)
self.label_11.setObjectName("label_11")
self.gridLayout_4.addWidget(self.label_11, 1, 0, 1, 2)
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setObjectName("label")
self.gridLayout_4.addWidget(self.label, 0, 0, 1, 1)
self.gridLayout_5.addLayout(self.gridLayout_4, 4, 0, 1, 1)
self.gridLayout_3 = QtWidgets.QGridLayout()
self.gridLayout_3.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint)
self.gridLayout_3.setObjectName("gridLayout_3")
self.label_8 = QtWidgets.QLabel(self.centralwidget)
self.label_8.setMinimumSize(QtCore.QSize(0, 16))
self.label_8.setObjectName("label_8")
self.gridLayout_3.addWidget(self.label_8, 0, 0, 1, 1)
self.label_10 = QtWidgets.QLabel(self.centralwidget)
self.label_10.setMinimumSize(QtCore.QSize(0, 16))
self.label_10.setObjectName("label_10")
self.gridLayout_3.addWidget(self.label_10, 1, 0, 1, 1)
self.label_9 = QtWidgets.QLabel(self.centralwidget)
self.label_9.setMinimumSize(QtCore.QSize(0, 16))
self.label_9.setObjectName("label_9")
self.gridLayout_3.addWidget(self.label_9, 2, 0, 1, 1)
self.gridLayout_5.addLayout(self.gridLayout_3, 2, 0, 1, 1)
self.gridLayout = QtWidgets.QGridLayout()
self.gridLayout.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint)
self.gridLayout.setContentsMargins(-1, -1, -1, 0)
self.gridLayout.setSpacing(0)
self.gridLayout.setObjectName("gridLayout")
self.input_pushButton = QtWidgets.QPushButton(self.centralwidget)
self.input_pushButton.setMinimumSize(QtCore.QSize(0, 10))
self.input_pushButton.setObjectName("input_pushButton")
self.gridLayout.addWidget(self.input_pushButton, 3, 3, 1, 1)
self.lhs_edit = QtWidgets.QLineEdit(self.centralwidget)
self.lhs_edit.setMinimumSize(QtCore.QSize(81, 0))
self.lhs_edit.setObjectName("lhs_edit")
self.gridLayout.addWidget(self.lhs_edit, 3, 0, 1, 1)
self.label_2 = QtWidgets.QLabel(self.centralwidget)
self.label_2.setObjectName("label_2")
self.gridLayout.addWidget(self.label_2, 3, 1, 1, 1)
self.rhs_edit = QtWidgets.QLineEdit(self.centralwidget)
self.rhs_edit.setMinimumSize(QtCore.QSize(81, 0))
self.rhs_edit.setObjectName("rhs_edit")
self.gridLayout.addWidget(self.rhs_edit, 3, 2, 1, 1)
self.label_5 = QtWidgets.QLabel(self.centralwidget)
self.label_5.setMinimumSize(QtCore.QSize(0, 20))
self.label_5.setObjectName("label_5")
self.gridLayout.addWidget(self.label_5, 2, 0, 1, 4)
self.label_7 = QtWidgets.QLabel(self.centralwidget)
self.label_7.setMinimumSize(QtCore.QSize(0, 20))
self.label_7.setObjectName("label_7")
self.gridLayout.addWidget(self.label_7, 1, 0, 1, 4)
self.label_12 = QtWidgets.QLabel(self.centralwidget)
self.label_12.setMinimumSize(QtCore.QSize(0, 20))
self.label_12.setObjectName("label_12")
self.gridLayout.addWidget(self.label_12, 0, 0, 1, 4)
self.gridLayout_5.addLayout(self.gridLayout, 0, 0, 1, 1)
self.test_TextEdit = QtWidgets.QPlainTextEdit(self.centralwidget)
self.test_TextEdit.setObjectName("test_TextEdit")
self.gridLayout_5.addWidget(self.test_TextEdit, 3, 0, 1, 1)
self.gridLayout_2 = QtWidgets.QGridLayout()
self.gridLayout_2.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint)
self.gridLayout_2.setObjectName("gridLayout_2")
self.rules_textBrowser = QtWidgets.QTextBrowser(self.centralwidget)
self.rules_textBrowser.setObjectName("rules_textBrowser")
self.gridLayout_2.addWidget(self.rules_textBrowser, 1, 0, 1, 1)
self.label_4 = QtWidgets.QLabel(self.centralwidget)
self.label_4.setMinimumSize(QtCore.QSize(0, 20))
self.label_4.setObjectName("label_4")
self.gridLayout_2.addWidget(self.label_4, 0, 0, 1, 1)
self.Confirm_Button = QtWidgets.QPushButton(self.centralwidget)
self.Confirm_Button.setObjectName("Confirm_Button")
self.gridLayout_2.addWidget(self.Confirm_Button, 2, 0, 1, 1)
self.gridLayout_5.addLayout(self.gridLayout_2, 1, 0, 1, 1)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 756, 18))
self.menubar.setObjectName("menubar")
self.menuContext_Free_Grammar_Interpreter = QtWidgets.QMenu(self.menubar)
self.menuContext_Free_Grammar_Interpreter.setObjectName("menuContext_Free_Grammar_Interpreter")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.menuContext_Free_Grammar_Interpreter.addSeparator()
self.menubar.addAction(self.menuContext_Free_Grammar_Interpreter.menuAction())
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
MainWindow.setTabOrder(self.lhs_edit, self.rhs_edit)
MainWindow.setTabOrder(self.rhs_edit, self.input_pushButton)
MainWindow.setTabOrder(self.input_pushButton, self.rules_textBrowser)
MainWindow.setTabOrder(self.rules_textBrowser, self.test_pushButton)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.test_pushButton.setText(_translate("MainWindow", "Check"))
self.label_11.setText(_translate("MainWindow", "<html><head/><body><p><span style=\" font-size:10pt; font-weight:600; color:#55aaff;\">Result</span></p></body></html>"))
self.label.setText(_translate("MainWindow", "<html><head/><body><p><span style=\" font-size:10pt; font-weight:600; color:#55aaff;\">Test string</span></p></body></html>"))
self.label_8.setText(_translate("MainWindow", "<html><head/><body><p><span style=\" font-size:12pt; font-weight:600; color:#aa55ff;\">Test/Output</span></p></body></html>"))
self.label_10.setText(_translate("MainWindow", "<html><head/><body><p><span style=\" font-family:\'Times New Roman\'; color:#55aaff;\">●</span><span style=\" color:#55aaff;\"> An empty line will corresponds to the empty string</span></p></body></html>"))
self.label_9.setText(_translate("MainWindow", "<html><head/><body><p><span style=\" font-family:\'Times New Roman\'; color:#55aaff;\">●</span><span style=\" color:#55aaff;\"> Input test strings one per line</span></p></body></html>"))
self.input_pushButton.setText(_translate("MainWindow", "+"))
self.label_2.setText(_translate("MainWindow", "<html><head/><body><p align=\"center\"><span style=\" font-size:16pt; font-weight:600; color:#55aaff;\">→</span></p></body></html>"))
self.label_5.setText(_translate("MainWindow", "<html><head/><body><p><span style=\" color:#55aaff;\">● Use ε to fill in as an empty text field corresponding to NULL symbol, | (left pipe symbol) for "OR" </span></p></body></html>"))
self.label_7.setText(_translate("MainWindow", "<html><head/><body><p><span style=\" font-family:\'Times New Roman\'; color:#55aaff;\">● </span><span style=\" color:#55aaff;\">The input is case-sensitive and whitespace is not ignored</span></p></body></html>"))
self.label_12.setText(_translate("MainWindow", "<html><head/><body><p><span style=\" font-size:12pt; font-weight:600; color:#aa55ff;\">Input</span></p></body></html>"))
self.label_4.setText(_translate("MainWindow", "<html><head/><body><p><span style=\" font-size:12pt; font-weight:600; color:#aa55ff;\">All rules of the grammar</span></p></body></html>"))
self.Confirm_Button.setText(_translate("MainWindow", "Confirm"))
self.menuContext_Free_Grammar_Interpreter.setTitle(_translate("MainWindow", "Context Free Grammar Interpreter"))
if __name__ == "__main__":
import sys
# create application object
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())