52 lines
1.4 KiB
Python
52 lines
1.4 KiB
Python
from PySide6.QtWidgets import QMainWindow, QApplication, QFileDialog, QWidget
|
|
from Ui_Qt面板 import *
|
|
from Ui_寻找空闲题号 import *
|
|
import os
|
|
from database_tools import *
|
|
|
|
|
|
class MyWindow(QMainWindow,Ui_MainWindow):
|
|
def __init__(self):
|
|
super().__init__()
|
|
self.setupUi(self)
|
|
self.bind()
|
|
|
|
def bind(self):
|
|
self.subwindow = kxthWindow()
|
|
self.action_kxth.triggered.connect(lambda: self.subwindow.show())
|
|
|
|
|
|
|
|
|
|
class kxthWindow(QWidget,Ui_Form):
|
|
def __init__(self):
|
|
super().__init__()
|
|
self.setupUi(self)
|
|
self.bind()
|
|
self.lineEdit_FilePath.setText(os.path.join(os.path.dirname(os.getcwd()),"题库0.3","Problems.json"))
|
|
self.ShowAvailable()
|
|
|
|
|
|
def bind(self):
|
|
self.pushButton_SelectFilepath.clicked.connect(self.getFilePathandShow)
|
|
|
|
def ShowAvailable(self):
|
|
self.jsonpath = self.lineEdit_FilePath.text()
|
|
pro_dict = load_dict(self.jsonpath)
|
|
self.label_Available.setText(spareIDs(pro_dict))
|
|
|
|
def getFilePathandShow(self):
|
|
pathlist = QFileDialog.getOpenFileName(self,"选择文件",".","json文件(*.json);;所有文件(*)")
|
|
self.lineEdit_FilePath.setText(pathlist[0])
|
|
self.ShowAvailable()
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
app = QApplication([])
|
|
windows = MyWindow()
|
|
windows.show()
|
|
app.exec()
|
|
|