Пример #1
0
class StartResultWindow(QtGui.QMainWindow):
	def __init__(self, parent=None):
		QtGui.QWidget.__init__(self, parent)
		self.ui = Ui_Results()
		self.ui.setupUi(self)
		a = QtGui.QTreeWidgetItem(self.ui.treeWidget)
	def addTable(self,key,columns):
		table = QtGui.QTreeWidgetItem(self.ui.treeWidget)
		table.setText(0, key)
		table.setText(1, columns)
Пример #2
0
def Results():
    global true, n, false
    window = QtWidgets.QDialog()
    ui = Ui_Results()
    ui.setupUi(window)

    def done():
        global true, n
        true = str(true)
        n = str(n)
        d = 'Ваш результат: ' + true + ' правильных из ' + n + '.'
        ui.results.setText(d)
        otvet = ''
        if false == 0:
            ui.textEdit.setPlainText('Ошибок нет!Ты молодец)')
        else:
            for i in range(k):
                m = str(slova[i] + ' -> ' + 'вы написали ' + str(oshibki[i]) +
                        ',а правильно:' + str(verniy[i]) + '\n')
                otvet = otvet + m
            ui.textEdit.setPlainText(otvet)

        def main_menu():
            window.close()
            MainWindow.show()

        def again_test():
            window.close()
            Question()

        ui.main_menu.clicked.connect(main_menu)
        ui.again.clicked.connect(again_test)

    window.show()
    done()
    window.exec_()
Пример #3
0
	def __init__(self, parent=None):
		QtGui.QWidget.__init__(self, parent)
		self.ui = Ui_Results()
		self.ui.setupUi(self)
		a = QtGui.QTreeWidgetItem(self.ui.treeWidget)
Пример #4
0
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(824, 505)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.gridLayout_2 = QtGui.QGridLayout(self.centralwidget)
        self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
        self.gridLayout = QtGui.QGridLayout()
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.verticalLayout_9 = QtGui.QVBoxLayout()
        self.verticalLayout_9.setObjectName(_fromUtf8("verticalLayout_9"))
        self.gridLayout.addLayout(self.verticalLayout_9, 3, 3, 1, 1)
        self.verticalLayout_10 = QtGui.QVBoxLayout()
        self.verticalLayout_10.setObjectName(_fromUtf8("verticalLayout_10"))
        self.execute_button = QtGui.QPushButton(self.centralwidget)
        self.execute_button.setEnabled(False)
        self.execute_button.setToolTip(_fromUtf8(""))
        self.execute_button.setObjectName(_fromUtf8("execute_button"))
        self.verticalLayout_10.addWidget(self.execute_button)
        self.gridLayout.addLayout(self.verticalLayout_10, 3, 4, 1, 1)
        self.verticalLayout_11 = QtGui.QVBoxLayout()
        self.verticalLayout_11.setObjectName(_fromUtf8("verticalLayout_11"))
        self.gridLayout.addLayout(self.verticalLayout_11, 3, 5, 1, 1)
        self.verticalLayout_8 = QtGui.QVBoxLayout()
        self.verticalLayout_8.setObjectName(_fromUtf8("verticalLayout_8"))
        self.gridLayout.addLayout(self.verticalLayout_8, 3, 2, 1, 1)
        self.verticalLayout_7 = QtGui.QVBoxLayout()
        self.verticalLayout_7.setObjectName(_fromUtf8("verticalLayout_7"))
        self.generated_query_label = QtGui.QLabel(self.centralwidget)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Times New Roman"))
        font.setPointSize(10)
        self.generated_query_label.setFont(font)
        self.generated_query_label.setScaledContents(True)
        self.generated_query_label.setObjectName(
            _fromUtf8("generated_query_label"))
        self.verticalLayout_7.addWidget(self.generated_query_label)
        self.gridLayout.addLayout(self.verticalLayout_7, 2, 0, 1, 1)
        self.verticalLayout_12 = QtGui.QVBoxLayout()
        self.verticalLayout_12.setObjectName(_fromUtf8("verticalLayout_12"))
        self.gridLayout.addLayout(self.verticalLayout_12, 3, 0, 1, 1)
        self.verticalLayout_3 = QtGui.QVBoxLayout()
        self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3"))
        self.main_title = QtGui.QLabel(self.centralwidget)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Times New Roman"))
        font.setPointSize(16)
        self.main_title.setFont(font)
        self.main_title.setObjectName(_fromUtf8("main_title"))
        self.verticalLayout_3.addWidget(self.main_title)
        self.gridLayout.addLayout(self.verticalLayout_3, 0, 0, 1, 6)
        self.verticalLayout_4 = QtGui.QVBoxLayout()
        self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4"))
        self.input_query_label = QtGui.QLabel(self.centralwidget)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Times New Roman"))
        font.setPointSize(10)
        self.input_query_label.setFont(font)
        self.input_query_label.setObjectName(_fromUtf8("input_query_label"))
        self.verticalLayout_4.addWidget(self.input_query_label)
        self.gridLayout.addLayout(self.verticalLayout_4, 1, 0, 1, 1)
        self.verticalLayout_5 = QtGui.QVBoxLayout()
        self.verticalLayout_5.setObjectName(_fromUtf8("verticalLayout_5"))
        self.input_query = QtGui.QLineEdit(self.centralwidget)
        self.input_query.setObjectName(_fromUtf8("input_query"))
        self.verticalLayout_5.addWidget(self.input_query)
        self.gridLayout.addLayout(self.verticalLayout_5, 1, 1, 1, 4)
        self.translate_button = QtGui.QPushButton(self.centralwidget)
        self.translate_button.setToolTip(_fromUtf8(""))
        self.translate_button.setObjectName(_fromUtf8("translate_button"))
        self.gridLayout.addWidget(self.translate_button, 3, 1, 1, 1)
        self.verticalLayout_6 = QtGui.QVBoxLayout()
        self.verticalLayout_6.setObjectName(_fromUtf8("verticalLayout_6"))
        self.generated_query = QtGui.QLabel(self.centralwidget)
        self.generated_query.setText(_fromUtf8(""))
        self.generated_query.setObjectName(_fromUtf8("generated_query"))
        self.verticalLayout_6.addWidget(self.generated_query)
        self.gridLayout.addLayout(self.verticalLayout_6, 2, 1, 1, 4)
        self.gridLayout_2.addLayout(self.gridLayout, 0, 0, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 824, 25))
        self.menubar.setObjectName(_fromUtf8("menubar"))
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName(_fromUtf8("statusbar"))
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        self.translate_button.clicked.connect(self.animateClick)
        self.execute_button.clicked.connect(self.animateClick2)
        MainWindow.show()

    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(
            _translate("MainWindow", "Natural Language Query Processing",
                       None))
        self.execute_button.setText(_translate("MainWindow", "Execute", None))
        self.generated_query_label.setText(
            _translate(
                "MainWindow",
                "<html><head/><body><p><span style=\" font-weight:600;\">Generated Query:</span></p></body></html>",
                None))
        self.main_title.setText(
            _translate(
                "MainWindow",
                "<html><head/><body><p align=\"center\"><span style=\" font-weight:600;\">Natural Language Query Processing</span></p></body></html>",
                None))
        self.input_query_label.setText(
            _translate(
                "MainWindow",
                "<html><head/><body><p><span style=\" font-weight:600;\">Input Query:</span></p></body></html>",
                None))
        self.translate_button.setText(
            _translate("MainWindow", "Translate", None))

    def animateClick(self):
        query = self.input_query.text()
        InvalidQuery = "Invalid Query. Please provide appropriate information."
        lp = NLPChecker()
        self.final_query = lp.execute(query)
        print(self.final_query)
        self.generated_query.setText(self.final_query)
        if self.final_query == InvalidQuery:
            self.execute_button.setEnabled(False)
        else:
            self.execute_button.setEnabled(True)

    def animateClick2(self):
        self.dialog = Ui_Results()
        self.w = QtGui.QDialog()
        self.dialog.setupUi(self.w, self.final_query)
        self.w.show()
Пример #5
0
 def animateClick2(self):
     self.dialog = Ui_Results()
     self.w = QtGui.QDialog()
     self.dialog.setupUi(self.w, self.final_query)
     self.w.show()
Пример #6
0
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(824, 505)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.gridLayout_2 = QtGui.QGridLayout(self.centralwidget)
        self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
        self.gridLayout = QtGui.QGridLayout()
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.verticalLayout_9 = QtGui.QVBoxLayout()
        self.verticalLayout_9.setObjectName(_fromUtf8("verticalLayout_9"))
        self.gridLayout.addLayout(self.verticalLayout_9, 3, 3, 1, 1)
        self.verticalLayout_10 = QtGui.QVBoxLayout()
        self.verticalLayout_10.setObjectName(_fromUtf8("verticalLayout_10"))
        self.execute_button = QtGui.QPushButton(self.centralwidget)
        self.execute_button.setEnabled(False)
        self.execute_button.setToolTip(_fromUtf8(""))
        self.execute_button.setObjectName(_fromUtf8("execute_button"))
        self.verticalLayout_10.addWidget(self.execute_button)
        self.gridLayout.addLayout(self.verticalLayout_10, 3, 4, 1, 1)
        self.verticalLayout_11 = QtGui.QVBoxLayout()
        self.verticalLayout_11.setObjectName(_fromUtf8("verticalLayout_11"))
        self.gridLayout.addLayout(self.verticalLayout_11, 3, 5, 1, 1)
        self.verticalLayout_8 = QtGui.QVBoxLayout()
        self.verticalLayout_8.setObjectName(_fromUtf8("verticalLayout_8"))
        self.gridLayout.addLayout(self.verticalLayout_8, 3, 2, 1, 1)
        self.verticalLayout_7 = QtGui.QVBoxLayout()
        self.verticalLayout_7.setObjectName(_fromUtf8("verticalLayout_7"))
        self.generated_query_label = QtGui.QLabel(self.centralwidget)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Times New Roman"))
        font.setPointSize(10)
        self.generated_query_label.setFont(font)
        self.generated_query_label.setScaledContents(True)
        self.generated_query_label.setObjectName(_fromUtf8("generated_query_label"))
        self.verticalLayout_7.addWidget(self.generated_query_label)
        self.gridLayout.addLayout(self.verticalLayout_7, 2, 0, 1, 1)
        self.verticalLayout_12 = QtGui.QVBoxLayout()
        self.verticalLayout_12.setObjectName(_fromUtf8("verticalLayout_12"))
        self.gridLayout.addLayout(self.verticalLayout_12, 3, 0, 1, 1)
        self.verticalLayout_3 = QtGui.QVBoxLayout()
        self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3"))
        self.main_title = QtGui.QLabel(self.centralwidget)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Times New Roman"))
        font.setPointSize(16)
        self.main_title.setFont(font)
        self.main_title.setObjectName(_fromUtf8("main_title"))
        self.verticalLayout_3.addWidget(self.main_title)
        self.gridLayout.addLayout(self.verticalLayout_3, 0, 0, 1, 6)
        self.verticalLayout_4 = QtGui.QVBoxLayout()
        self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4"))
        self.input_query_label = QtGui.QLabel(self.centralwidget)
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Times New Roman"))
        font.setPointSize(10)
        self.input_query_label.setFont(font)
        self.input_query_label.setObjectName(_fromUtf8("input_query_label"))
        self.verticalLayout_4.addWidget(self.input_query_label)
        self.gridLayout.addLayout(self.verticalLayout_4, 1, 0, 1, 1)
        self.verticalLayout_5 = QtGui.QVBoxLayout()
        self.verticalLayout_5.setObjectName(_fromUtf8("verticalLayout_5"))
        self.input_query = QtGui.QLineEdit(self.centralwidget)
        self.input_query.setObjectName(_fromUtf8("input_query"))
        self.verticalLayout_5.addWidget(self.input_query)
        self.gridLayout.addLayout(self.verticalLayout_5, 1, 1, 1, 4)
        self.translate_button = QtGui.QPushButton(self.centralwidget)
        self.translate_button.setToolTip(_fromUtf8(""))
        self.translate_button.setObjectName(_fromUtf8("translate_button"))
        self.gridLayout.addWidget(self.translate_button, 3, 1, 1, 1)
        self.verticalLayout_6 = QtGui.QVBoxLayout()
        self.verticalLayout_6.setObjectName(_fromUtf8("verticalLayout_6"))
        self.generated_query = QtGui.QLabel(self.centralwidget)
        self.generated_query.setText(_fromUtf8(""))
        self.generated_query.setObjectName(_fromUtf8("generated_query"))
        self.verticalLayout_6.addWidget(self.generated_query)
        self.gridLayout.addLayout(self.verticalLayout_6, 2, 1, 1, 4)
        self.gridLayout_2.addLayout(self.gridLayout, 0, 0, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 824, 25))
        self.menubar.setObjectName(_fromUtf8("menubar"))
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName(_fromUtf8("statusbar"))
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        self.translate_button.clicked.connect(self.animateClick)
        self.execute_button.clicked.connect(self.animateClick2)
        MainWindow.show()


    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(_translate("MainWindow", "Natural Language Query Processing", None))
        self.execute_button.setText(_translate("MainWindow", "Execute", None))
        self.generated_query_label.setText(_translate("MainWindow", "<html><head/><body><p><span style=\" font-weight:600;\">Generated Query:</span></p></body></html>", None))
        self.main_title.setText(_translate("MainWindow", "<html><head/><body><p align=\"center\"><span style=\" font-weight:600;\">Natural Language Query Processing</span></p></body></html>", None))
        self.input_query_label.setText(_translate("MainWindow", "<html><head/><body><p><span style=\" font-weight:600;\">Input Query:</span></p></body></html>", None))
        self.translate_button.setText(_translate("MainWindow", "Translate", None))



    def animateClick(self):
        query = self.input_query.text()
        InvalidQuery = "Invalid Query. Please provide appropriate information."
        lp = NLPChecker()
        self.final_query = lp.execute(query)
        print (self.final_query)
        self.generated_query.setText(self.final_query)
        if self.final_query == InvalidQuery:
            self.execute_button.setEnabled(False)
        else:
            self.execute_button.setEnabled(True)

    def animateClick2(self):
        self.dialog = Ui_Results()
        self.w = QtGui.QDialog()
        self.dialog.setupUi(self.w, self.final_query)
        self.w.show()
Пример #7
0
 def animateClick2(self):
     self.dialog = Ui_Results()
     self.w = QtGui.QDialog()
     self.dialog.setupUi(self.w, self.final_query)
     self.w.show()