答题纸对应与讲义录入界面适配数据库切换

This commit is contained in:
weiye.wang 2024-06-16 22:25:52 +08:00
parent 736356a46c
commit eacf0380a0
4 changed files with 20 additions and 8 deletions

View File

@ -121,11 +121,11 @@ class MyWindow(QMainWindow,Ui_MainWindow):
self.layout_hqth.addWidget(self.hqth) #以上三行为初始化“获取题号”tab self.layout_hqth.addWidget(self.hqth) #以上三行为初始化“获取题号”tab
self.layout_jglr = QVBoxLayout(self.tab_jglr) self.layout_jglr = QVBoxLayout(self.tab_jglr)
self.jglr = MyWindow_jglr() self.jglr = MyWindow_jglr(self.database)
self.layout_jglr.addWidget(self.jglr) #以上三行为初始化“讲义结构编号录入”tab self.layout_jglr.addWidget(self.jglr) #以上三行为初始化“讲义结构编号录入”tab
self.layout_dtlr = QVBoxLayout(self.tab_dtlr) self.layout_dtlr = QVBoxLayout(self.tab_dtlr)
self.dtlr = MyWindow_dtlr() self.dtlr = MyWindow_dtlr(self.database)
self.layout_dtlr.addWidget(self.dtlr) #以上三行为初始化“答题纸对应信息录入”tab self.layout_dtlr.addWidget(self.dtlr) #以上三行为初始化“答题纸对应信息录入”tab
self.layout_jysc = QVBoxLayout(self.tab_jysc) self.layout_jysc = QVBoxLayout(self.tab_jysc)
@ -196,7 +196,9 @@ class MyWindow(QMainWindow,Ui_MainWindow):
self.sjlb.setdbname, self.sjlb.setdbname,
self.fnsc.setdbname, self.fnsc.setdbname,
self.pxnd.setdbname, self.pxnd.setdbname,
self.xxdr.setdbname self.xxdr.setdbname,
self.jglr.setdbname,
self.dtlr.setdbname
]: #在列表中的tab里传送数据库名的连接 ]: #在列表中的tab里传送数据库名的连接
self.sendDBname.connect(func) self.sendDBname.connect(func)
def sendValue(self): def sendValue(self):

View File

@ -18,9 +18,10 @@ def getindices(string):
class MyWindow_dtlr(QWidget,Ui_Form): class MyWindow_dtlr(QWidget,Ui_Form):
def __init__(self): def __init__(self,database_name):
super().__init__() super().__init__()
self.setupUi(self) self.setupUi(self)
self.database_name = database_name
self.bind() self.bind()
def bind(self): def bind(self):
self.label_next.setVisible(False) self.label_next.setVisible(False)
@ -29,6 +30,10 @@ class MyWindow_dtlr(QWidget,Ui_Form):
self.lineEdit_structure.textChanged.connect(self.setindex) self.lineEdit_structure.textChanged.connect(self.setindex)
self.comboBox_index.activated.connect(self.activateexec) self.comboBox_index.activated.connect(self.activateexec)
self.pushButton_exec.clicked.connect(self.exec) self.pushButton_exec.clicked.connect(self.exec)
def setdbname(self,string):
self.database_name = string
# print(self.database_name)
def setindex(self): def setindex(self):
self.comboBox_index.clear() self.comboBox_index.clear()
@ -126,7 +131,7 @@ class MyWindow_dtlr(QWidget,Ui_Form):
if __name__ == '__main__': if __name__ == '__main__':
app = QApplication([]) app = QApplication([])
windows = MyWindow() windows = MyWindow_dtlr("tikutest")
windows.show() windows.show()
app.exec() app.exec()

View File

@ -54,7 +54,7 @@ class MyWindow_xxdr(QWidget,Ui_Form):
def setdbname(self,string): def setdbname(self,string):
self.database_name = string self.database_name = string
print(self.database_name) # print(self.database_name)
def getDirPath(self): #选取文件夹中的所有符合答题纸特征的.zip文件并放置在tableWidget中 def getDirPath(self): #选取文件夹中的所有符合答题纸特征的.zip文件并放置在tableWidget中
dirpath = QFileDialog.getExistingDirectory(self,"选择文件夹") dirpath = QFileDialog.getExistingDirectory(self,"选择文件夹")

View File

@ -4,9 +4,10 @@ from database_tools_2 import *
class MyWindow_jglr(QWidget,Ui_Form): class MyWindow_jglr(QWidget,Ui_Form):
def __init__(self): def __init__(self,database_name):
super().__init__() super().__init__()
self.setupUi(self) self.setupUi(self)
self.database_name = database_name
self.bind() self.bind()
def bind(self): def bind(self):
self.label_next.setVisible(False) self.label_next.setVisible(False)
@ -14,6 +15,10 @@ class MyWindow_jglr(QWidget,Ui_Form):
self.lineEdit_structure.textChanged.connect(self.unvisible) self.lineEdit_structure.textChanged.connect(self.unvisible)
self.comboBox_grade.currentIndexChanged.connect(self.unvisible) self.comboBox_grade.currentIndexChanged.connect(self.unvisible)
self.comboBox_semester.currentIndexChanged.connect(self.unvisible) self.comboBox_semester.currentIndexChanged.connect(self.unvisible)
def setdbname(self,string):
self.database_name = string
# print(self.database_name)
def unvisible(self): def unvisible(self):
self.label_next.setVisible(False) self.label_next.setVisible(False)
@ -105,7 +110,7 @@ class MyWindow_jglr(QWidget,Ui_Form):
if __name__ == '__main__': if __name__ == '__main__':
app = QApplication([]) app = QApplication([])
windows = MyWindow() windows = MyWindow_jglr("tikutest")
windows.show() windows.show()
app.exec() app.exec()