diff --git a/工具v2/Ui_寻找空闲题号.py b/工具v2/Ui_寻找空闲题号.py new file mode 100644 index 00000000..61cc01d9 --- /dev/null +++ b/工具v2/Ui_寻找空闲题号.py @@ -0,0 +1,48 @@ +# -*- 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, QFrame, QLabel, QLineEdit, + QPushButton, QSizePolicy, QWidget) + +class Ui_Form(object): + def setupUi(self, Form): + if not Form.objectName(): + Form.setObjectName(u"Form") + Form.resize(400, 300) + self.pushButton_SelectFilepath = QPushButton(Form) + self.pushButton_SelectFilepath.setObjectName(u"pushButton_SelectFilepath") + self.pushButton_SelectFilepath.setGeometry(QRect(20, 20, 75, 24)) + self.lineEdit_FilePath = QLineEdit(Form) + self.lineEdit_FilePath.setObjectName(u"lineEdit_FilePath") + self.lineEdit_FilePath.setGeometry(QRect(20, 50, 361, 20)) + self.label_Available = QLabel(Form) + self.label_Available.setObjectName(u"label_Available") + self.label_Available.setGeometry(QRect(20, 80, 361, 201)) + self.label_Available.setFrameShape(QFrame.StyledPanel) + self.label_Available.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignTop) + + self.retranslateUi(Form) + + QMetaObject.connectSlotsByName(Form) + # setupUi + + def retranslateUi(self, Form): + Form.setWindowTitle(QCoreApplication.translate("Form", u"\u5bfb\u627e\u7a7a\u95f2\u9898\u53f7", None)) + self.pushButton_SelectFilepath.setText(QCoreApplication.translate("Form", u"\u9009\u62e9\u6587\u4ef6", None)) + self.label_Available.setText(QCoreApplication.translate("Form", u"TextLabel", None)) + # retranslateUi + diff --git a/工具v2/寻找空闲题号.py b/工具v2/寻找空闲题号.py index 846a9c99..c085003c 100644 --- a/工具v2/寻找空闲题号.py +++ b/工具v2/寻找空闲题号.py @@ -1,5 +1,37 @@ +from PySide6.QtWidgets import QWidget, QApplication, QFileDialog +from Ui_寻找空闲题号 import Ui_Form from database_tools import * -pro_dict = load_dict(r"..\题库0.3\Problems.json") -print(spareIDs(pro_dict)) + +class MyWindow(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]) + + + + + + +if __name__ == '__main__': + app = QApplication([]) + windows = MyWindow() + windows.show() + app.exec() diff --git a/工具v2/寻找空闲题号.ui b/工具v2/寻找空闲题号.ui new file mode 100644 index 00000000..224e0bc2 --- /dev/null +++ b/工具v2/寻找空闲题号.ui @@ -0,0 +1,61 @@ + + + Form + + + + 0 + 0 + 400 + 300 + + + + 寻找空闲题号 + + + + + 20 + 20 + 75 + 24 + + + + 选择文件 + + + + + + 20 + 50 + 361 + 20 + + + + + + + 20 + 80 + 361 + 201 + + + + QFrame::StyledPanel + + + TextLabel + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + diff --git a/工具v2/寻找空闲题号_old.py b/工具v2/寻找空闲题号_old.py new file mode 100644 index 00000000..846a9c99 --- /dev/null +++ b/工具v2/寻找空闲题号_old.py @@ -0,0 +1,5 @@ +from database_tools import * + +pro_dict = load_dict(r"..\题库0.3\Problems.json") +print(spareIDs(pro_dict)) +