新增 试卷列表 功能
This commit is contained in:
parent
a7941d69c8
commit
15b309ebbc
|
|
@ -94,6 +94,9 @@ class Ui_MainWindow(object):
|
|||
self.tab_hqth = QWidget()
|
||||
self.tab_hqth.setObjectName(u"tab_hqth")
|
||||
self.tabWidget_shiyong.addTab(self.tab_hqth, "")
|
||||
self.tab_sjlb = QWidget()
|
||||
self.tab_sjlb.setObjectName(u"tab_sjlb")
|
||||
self.tabWidget_shiyong.addTab(self.tab_sjlb, "")
|
||||
self.tabWidget_main.addTab(self.tab_shiyong, "")
|
||||
self.tab_beikezu = QWidget()
|
||||
self.tab_beikezu.setObjectName(u"tab_beikezu")
|
||||
|
|
@ -202,10 +205,10 @@ class Ui_MainWindow(object):
|
|||
|
||||
self.retranslateUi(MainWindow)
|
||||
|
||||
self.tabWidget_main.setCurrentIndex(0)
|
||||
self.tabWidget_main.setCurrentIndex(2)
|
||||
self.tabWidget_luru.setCurrentIndex(0)
|
||||
self.tabWidget_weihu.setCurrentIndex(0)
|
||||
self.tabWidget_shiyong.setCurrentIndex(0)
|
||||
self.tabWidget_shiyong.setCurrentIndex(5)
|
||||
self.tabWidget_beikezu.setCurrentIndex(0)
|
||||
self.tabWidget_latex.setCurrentIndex(0)
|
||||
self.tabWidget_mubiaojichu.setCurrentIndex(0)
|
||||
|
|
@ -226,11 +229,12 @@ class Ui_MainWindow(object):
|
|||
self.tabWidget_weihu.setTabText(self.tabWidget_weihu.indexOf(self.tab_dygg), QCoreApplication.translate("MainWindow", u"\u5355\u5143\u6302\u94a9", None))
|
||||
self.tabWidget_weihu.setTabText(self.tabWidget_weihu.indexOf(self.tab_tqda), QCoreApplication.translate("MainWindow", u"\u63d0\u53d6\u7b54\u6848", None))
|
||||
self.tabWidget_main.setTabText(self.tabWidget_main.indexOf(self.tab_weihu), QCoreApplication.translate("MainWindow", u"\u7ef4\u62a4", None))
|
||||
self.tabWidget_shiyong.setTabText(self.tabWidget_shiyong.indexOf(self.tab_sxth), QCoreApplication.translate("MainWindow", u"\u5173\u952e\u5b57\u7b5b\u9009\u9898\u53f7", None))
|
||||
self.tabWidget_shiyong.setTabText(self.tabWidget_shiyong.indexOf(self.tab_ndsx), QCoreApplication.translate("MainWindow", u"\u6b63\u786e\u7387\u7b5b\u9009\u9898\u53f7", None))
|
||||
self.tabWidget_shiyong.setTabText(self.tabWidget_shiyong.indexOf(self.tab_sxth), QCoreApplication.translate("MainWindow", u"\u5173\u952e\u5b57\u9009\u9898", None))
|
||||
self.tabWidget_shiyong.setTabText(self.tabWidget_shiyong.indexOf(self.tab_ndsx), QCoreApplication.translate("MainWindow", u"\u6b63\u786e\u7387\u9009\u9898", None))
|
||||
self.tabWidget_shiyong.setTabText(self.tabWidget_shiyong.indexOf(self.tab_xtby), QCoreApplication.translate("MainWindow", u"\u9009\u9898\u7f16\u8bd1", None))
|
||||
self.tabWidget_shiyong.setTabText(self.tabWidget_shiyong.indexOf(self.tab_sctp), QCoreApplication.translate("MainWindow", u"\u9898\u53f7\u751f\u6210\u56fe\u7247", None))
|
||||
self.tabWidget_shiyong.setTabText(self.tabWidget_shiyong.indexOf(self.tab_sctp), QCoreApplication.translate("MainWindow", u"\u751f\u6210\u56fe\u7247", None))
|
||||
self.tabWidget_shiyong.setTabText(self.tabWidget_shiyong.indexOf(self.tab_hqth), QCoreApplication.translate("MainWindow", u"\u83b7\u53d6\u9898\u53f7", None))
|
||||
self.tabWidget_shiyong.setTabText(self.tabWidget_shiyong.indexOf(self.tab_sjlb), QCoreApplication.translate("MainWindow", u"\u8bd5\u5377\u5217\u8868", None))
|
||||
self.tabWidget_main.setTabText(self.tabWidget_main.indexOf(self.tab_shiyong), QCoreApplication.translate("MainWindow", u"\u4f7f\u7528", None))
|
||||
self.tabWidget_beikezu.setTabText(self.tabWidget_beikezu.indexOf(self.tab_jglr), QCoreApplication.translate("MainWindow", u"\u8bb2\u4e49\u7ed3\u6784\u7f16\u53f7\u5f55\u5165", None))
|
||||
self.tabWidget_beikezu.setTabText(self.tabWidget_beikezu.indexOf(self.tab_dtlr), QCoreApplication.translate("MainWindow", u"\u7b54\u9898\u7eb8\u5bf9\u5e94\u4fe1\u606f\u5f55\u5165", None))
|
||||
|
|
|
|||
|
|
@ -0,0 +1,72 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
################################################################################
|
||||
## Form generated from reading UI file '试卷列表.ui'
|
||||
##
|
||||
## Created by: Qt User Interface Compiler version 6.6.2
|
||||
##
|
||||
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||
################################################################################
|
||||
|
||||
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
|
||||
QMetaObject, QObject, QPoint, QRect,
|
||||
QSize, QTime, QUrl, Qt)
|
||||
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
|
||||
QFont, QFontDatabase, QGradient, QIcon,
|
||||
QImage, QKeySequence, QLinearGradient, QPainter,
|
||||
QPalette, QPixmap, QRadialGradient, QTransform)
|
||||
from PySide6.QtWidgets import (QApplication, QHeaderView, QLabel, QPushButton,
|
||||
QSizePolicy, QTableWidget, QTableWidgetItem, QWidget)
|
||||
|
||||
class Ui_Form(object):
|
||||
def setupUi(self, Form):
|
||||
if not Form.objectName():
|
||||
Form.setObjectName(u"Form")
|
||||
Form.resize(760, 490)
|
||||
self.tableWidget_papers = QTableWidget(Form)
|
||||
if (self.tableWidget_papers.columnCount() < 3):
|
||||
self.tableWidget_papers.setColumnCount(3)
|
||||
__qtablewidgetitem = QTableWidgetItem()
|
||||
self.tableWidget_papers.setHorizontalHeaderItem(0, __qtablewidgetitem)
|
||||
__qtablewidgetitem1 = QTableWidgetItem()
|
||||
self.tableWidget_papers.setHorizontalHeaderItem(1, __qtablewidgetitem1)
|
||||
__qtablewidgetitem2 = QTableWidgetItem()
|
||||
self.tableWidget_papers.setHorizontalHeaderItem(2, __qtablewidgetitem2)
|
||||
self.tableWidget_papers.setObjectName(u"tableWidget_papers")
|
||||
self.tableWidget_papers.setGeometry(QRect(200, 40, 541, 421))
|
||||
self.label = QLabel(Form)
|
||||
self.label.setObjectName(u"label")
|
||||
self.label.setGeometry(QRect(210, 20, 71, 16))
|
||||
self.pushButton_shanghaigaokao = QPushButton(Form)
|
||||
self.pushButton_shanghaigaokao.setObjectName(u"pushButton_shanghaigaokao")
|
||||
self.pushButton_shanghaigaokao.setGeometry(QRect(20, 40, 75, 24))
|
||||
self.pushButton_quanguogaokao = QPushButton(Form)
|
||||
self.pushButton_quanguogaokao.setObjectName(u"pushButton_quanguogaokao")
|
||||
self.pushButton_quanguogaokao.setGeometry(QRect(110, 40, 75, 24))
|
||||
self.pushButton_monikao = QPushButton(Form)
|
||||
self.pushButton_monikao.setObjectName(u"pushButton_monikao")
|
||||
self.pushButton_monikao.setGeometry(QRect(20, 80, 75, 24))
|
||||
self.pushButton_xuexiaokaoshi = QPushButton(Form)
|
||||
self.pushButton_xuexiaokaoshi.setObjectName(u"pushButton_xuexiaokaoshi")
|
||||
self.pushButton_xuexiaokaoshi.setGeometry(QRect(110, 80, 75, 24))
|
||||
|
||||
self.retranslateUi(Form)
|
||||
|
||||
QMetaObject.connectSlotsByName(Form)
|
||||
# setupUi
|
||||
|
||||
def retranslateUi(self, Form):
|
||||
Form.setWindowTitle(QCoreApplication.translate("Form", u"\u5404\u79cd\u8bd5\u5377\u5217\u8868", None))
|
||||
___qtablewidgetitem = self.tableWidget_papers.horizontalHeaderItem(0)
|
||||
___qtablewidgetitem.setText(QCoreApplication.translate("Form", u"\u8bd5\u5377\u540d", None));
|
||||
___qtablewidgetitem1 = self.tableWidget_papers.horizontalHeaderItem(1)
|
||||
___qtablewidgetitem1.setText(QCoreApplication.translate("Form", u"\u9898\u53f7", None));
|
||||
___qtablewidgetitem2 = self.tableWidget_papers.horizontalHeaderItem(2)
|
||||
___qtablewidgetitem2.setText(QCoreApplication.translate("Form", u"\u5907\u6ce8", None));
|
||||
self.label.setText(QCoreApplication.translate("Form", u"\u8bd5\u5377\u4e0e\u9898\u53f7", None))
|
||||
self.pushButton_shanghaigaokao.setText(QCoreApplication.translate("Form", u"\u4e0a\u6d77\u9ad8\u8003", None))
|
||||
self.pushButton_quanguogaokao.setText(QCoreApplication.translate("Form", u"\u5168\u56fd\u9ad8\u8003", None))
|
||||
self.pushButton_monikao.setText(QCoreApplication.translate("Form", u"\u6a21\u62df\u8003", None))
|
||||
self.pushButton_xuexiaokaoshi.setText(QCoreApplication.translate("Form", u"\u5b66\u6821\u8003\u8bd5", None))
|
||||
# retranslateUi
|
||||
|
||||
|
|
@ -29,6 +29,7 @@ from 修改目标内容 import MyWindow_xgmb
|
|||
from 删除使用记录 import MyWindow_scjl
|
||||
from 删除课时目标关系 import MyWindow_scgx
|
||||
from 新增目标关系 import MyWindow_xzgx
|
||||
from 试卷列表 import MyWindow_sjlb
|
||||
from database_tools_2 import *
|
||||
|
||||
class MyWindow(QMainWindow,Ui_MainWindow):
|
||||
|
|
@ -157,6 +158,10 @@ class MyWindow(QMainWindow,Ui_MainWindow):
|
|||
self.xzgx = MyWindow_xzgx(self.database)
|
||||
self.layout_xzgx.addWidget(self.xzgx) #以上三行为初始化"新增课时目标关系"tab
|
||||
|
||||
self.layout_sjlb = QVBoxLayout(self.tab_sjlb)
|
||||
self.sjlb = MyWindow_sjlb(self.database)
|
||||
self.layout_sjlb.addWidget(self.sjlb) #以上三行为初始化"试卷列表"tab
|
||||
|
||||
|
||||
|
||||
for func in [
|
||||
|
|
@ -178,7 +183,8 @@ class MyWindow(QMainWindow,Ui_MainWindow):
|
|||
self.xgmb.setdbname,
|
||||
self.scjl.setdbname,
|
||||
self.scgx.setdbname,
|
||||
self.xzgx.setdbname
|
||||
self.xzgx.setdbname,
|
||||
self.sjlb.setdbname
|
||||
]: #在列表中的tab里传送数据库名的连接
|
||||
self.sendDBname.connect(func)
|
||||
def sendValue(self):
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
<enum>QTabWidget::Triangular</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_luru">
|
||||
<attribute name="title">
|
||||
|
|
@ -138,16 +138,16 @@
|
|||
<enum>QTabWidget::Triangular</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>5</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_sxth">
|
||||
<attribute name="title">
|
||||
<string>关键字筛选题号</string>
|
||||
<string>关键字选题</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_ndsx">
|
||||
<attribute name="title">
|
||||
<string>正确率筛选题号</string>
|
||||
<string>正确率选题</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_xtby">
|
||||
|
|
@ -157,7 +157,7 @@
|
|||
</widget>
|
||||
<widget class="QWidget" name="tab_sctp">
|
||||
<attribute name="title">
|
||||
<string>题号生成图片</string>
|
||||
<string>生成图片</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_hqth">
|
||||
|
|
@ -165,6 +165,11 @@
|
|||
<string>获取题号</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_sjlb">
|
||||
<attribute name="title">
|
||||
<string>试卷列表</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_beikezu">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
from PySide6.QtWidgets import QWidget, QApplication, QFileDialog, QPushButton, QTableWidgetItem
|
||||
from Ui_试卷列表 import Ui_Form
|
||||
from database_tools_2 import *
|
||||
|
||||
class MyWindow_sjlb(QWidget,Ui_Form):
|
||||
def __init__(self,database_name):
|
||||
super().__init__()
|
||||
self.database_name = database_name
|
||||
self.setupUi(self)
|
||||
self.bind()
|
||||
def setdbname(self,string):
|
||||
self.database_name = string
|
||||
try:
|
||||
self.db.close()
|
||||
except:
|
||||
pass
|
||||
self.db = connect(hostname=db_host, port=db_port, username= db_user, pwd= db_pwd, db=self.database_name)
|
||||
# print(self.database_name)
|
||||
def bind(self):
|
||||
self.tableWidget_papers.setColumnWidth(0,230)
|
||||
self.tableWidget_papers.setColumnWidth(1,120)
|
||||
self.tableWidget_papers.setColumnWidth(2,190)
|
||||
for self.button in self.findChildren(QPushButton):
|
||||
self.button.clicked.connect(self.generate_idexp)
|
||||
self.db = connect(hostname=db_host, port=db_port, username= db_user, pwd= db_pwd, db=self.database_name)
|
||||
def generate_idexp(self):
|
||||
self.tableWidget_papers.clearContents()
|
||||
self.tableWidget_papers.setRowCount(0)
|
||||
buttontext = self.sender().text()
|
||||
# print(buttontext)
|
||||
self.mycursor = self.db.cursor()
|
||||
self.mycursor.execute("SELECT name,idexp,remark FROM papers WHERE genre = %s;",(buttontext,))
|
||||
ret_list = self.mycursor.fetchall()
|
||||
self.tableWidget_papers.setRowCount(len(ret_list))
|
||||
count = 0
|
||||
for ret in ret_list:
|
||||
name,idexp,remark = ret
|
||||
self.tableWidget_papers.setItem(count,0,QTableWidgetItem(name))
|
||||
self.tableWidget_papers.setItem(count,1,QTableWidgetItem(idexp))
|
||||
self.tableWidget_papers.setItem(count,2,QTableWidgetItem(remark))
|
||||
count += 1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = QApplication([])
|
||||
windows = MyWindow_sjlb("tiku")
|
||||
windows.show()
|
||||
app.exec()
|
||||
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Form</class>
|
||||
<widget class="QWidget" name="Form">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>760</width>
|
||||
<height>490</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>各种试卷列表</string>
|
||||
</property>
|
||||
<widget class="QTableWidget" name="tableWidget_papers">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>200</x>
|
||||
<y>40</y>
|
||||
<width>541</width>
|
||||
<height>421</height>
|
||||
</rect>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>试卷名</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>题号</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>备注</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>210</x>
|
||||
<y>20</y>
|
||||
<width>71</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>试卷与题号</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_shanghaigaokao">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>40</y>
|
||||
<width>75</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>上海高考</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_quanguogaokao">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>40</y>
|
||||
<width>75</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>全国高考</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_monikao">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>80</y>
|
||||
<width>75</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>模拟考</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_xuexiaokaoshi">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>80</y>
|
||||
<width>75</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>学校考试</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue