diff --git a/工具v2/Ui_获取小闲平台使用数据.py b/工具v2/Ui_获取小闲平台使用数据.py new file mode 100644 index 00000000..70bd44ac --- /dev/null +++ b/工具v2/Ui_获取小闲平台使用数据.py @@ -0,0 +1,73 @@ +# -*- 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, QCheckBox, QLabel, QLineEdit, + QPushButton, QSizePolicy, QWidget) + +class Ui_Form(object): + def setupUi(self, Form): + if not Form.objectName(): + Form.setObjectName(u"Form") + Form.resize(700, 140) + self.pushButton_selectfilepath = QPushButton(Form) + self.pushButton_selectfilepath.setObjectName(u"pushButton_selectfilepath") + self.pushButton_selectfilepath.setGeometry(QRect(100, 40, 75, 24)) + self.label = QLabel(Form) + self.label.setObjectName(u"label") + self.label.setGeometry(QRect(10, 40, 91, 16)) + self.label_2 = QLabel(Form) + self.label_2.setObjectName(u"label_2") + self.label_2.setGeometry(QRect(10, 10, 54, 16)) + self.lineEdit_date = QLineEdit(Form) + self.lineEdit_date.setObjectName(u"lineEdit_date") + self.lineEdit_date.setGeometry(QRect(80, 10, 132, 20)) + self.label_3 = QLabel(Form) + self.label_3.setObjectName(u"label_3") + self.label_3.setGeometry(QRect(230, 10, 81, 16)) + self.label_filepath = QLabel(Form) + self.label_filepath.setObjectName(u"label_filepath") + self.label_filepath.setGeometry(QRect(10, 70, 681, 16)) + self.pushButton_exec = QPushButton(Form) + self.pushButton_exec.setObjectName(u"pushButton_exec") + self.pushButton_exec.setGeometry(QRect(620, 100, 75, 24)) + self.checkBox_appendflag = QCheckBox(Form) + self.checkBox_appendflag.setObjectName(u"checkBox_appendflag") + self.checkBox_appendflag.setGeometry(QRect(520, 100, 91, 20)) + self.label_4 = QLabel(Form) + self.label_4.setObjectName(u"label_4") + self.label_4.setGeometry(QRect(330, 10, 81, 16)) + self.lineEdit_threshold = QLineEdit(Form) + self.lineEdit_threshold.setObjectName(u"lineEdit_threshold") + self.lineEdit_threshold.setGeometry(QRect(420, 10, 113, 20)) + + self.retranslateUi(Form) + + QMetaObject.connectSlotsByName(Form) + # setupUi + + def retranslateUi(self, Form): + Form.setWindowTitle(QCoreApplication.translate("Form", u"\u83b7\u53d6\u5c0f\u95f2\u5e73\u53f0\u4f7f\u7528\u6570\u636e", None)) + self.pushButton_selectfilepath.setText(QCoreApplication.translate("Form", u"\u9009\u62e9\u6587\u4ef6", None)) + self.label.setText(QCoreApplication.translate("Form", u"\u4e0b\u8f7d\u7684.zip\u6587\u4ef6", None)) + self.label_2.setText(QCoreApplication.translate("Form", u"\u65e5\u671f", None)) + self.label_3.setText(QCoreApplication.translate("Form", u"(yyyymmdd)", None)) + self.label_filepath.setText(QCoreApplication.translate("Form", u"\u9009\u62e9\u6587\u4ef6\u540e, \u8fd9\u91cc\u5c06\u663e\u793a\u6587\u4ef6\u8def\u5f84", None)) + self.pushButton_exec.setText(QCoreApplication.translate("Form", u"\u8fd0\u884c", None)) + self.checkBox_appendflag.setText(QCoreApplication.translate("Form", u"Append\u6a21\u5f0f", None)) + self.label_4.setText(QCoreApplication.translate("Form", u"\u63d0\u4ea4\u6bd4\u4f8b\u4e0b\u9650", None)) + # retranslateUi + diff --git a/工具v2/获取小闲平台使用数据.py b/工具v2/获取小闲平台使用数据.py new file mode 100644 index 00000000..b9c32026 --- /dev/null +++ b/工具v2/获取小闲平台使用数据.py @@ -0,0 +1,89 @@ +from PySide6.QtWidgets import QWidget, QApplication, QFileDialog +from Ui_获取小闲平台使用数据 import Ui_Form +from database_tools import * +import shutil,zipfile + +class MyWindow(QWidget,Ui_Form): + def __init__(self): + super().__init__() + self.setupUi(self) + self.bind() + self.zipfilepath = "" + + def bind(self): + self.pushButton_selectfilepath.clicked.connect(self.getFilePath) + self.pushButton_exec.clicked.connect(self.exec) + + def getFilePath(self): + pathlist = QFileDialog.getOpenFileName(self,"选择文件",".","zip文件(*.zip);;所有文件(*)") + self.label_filepath.setText(pathlist[0]) + self.zipfilepath = pathlist[0] + + def exec(self): + date = self.lineEdit_date.text() + threshold = float(self.lineEdit_threshold.text()) + if not len(date.strip()) == 8: + self.lineEdit_date.setText("日期格式有误") + elif not threshold >= 0 or not threshold <= 1: + self.lineEdit_threshold.setText("阈值有误") + else: + tempdir = "临时文件/zips" + statsfilename = "小题分_按学号(数学).xlsx" + answersheetseekingpath = "../备课组" + try: + shutil.rmtree(tempdir) + except: + pass + makedir(tempdir) + xiaoxianpid = ParseZipname(self.zipfilepath) + paperinfo = FindPaper(xiaoxianpid, answersheetseekingpath) + gradename = paperinfo[1] + idlist = paperinfo[2] + + zf = zipfile.ZipFile(self.zipfilepath) + zf.extractall(tempdir) #解压zip文件中的所有内容到tempdir + + # papertype = CheckPaperType(tempdir,statsfilename) + statsfilepathlist = FindFile(tempdir,statsfilename) + validcols,marks = generateColIndexandMarks(statsfilepathlist,statsfilename,paperinfo) + dfcurrent = pd.read_excel(os.path.join(statsfilepathlist[0],statsfilename)) + correspondence_dict = generateIDtoUsageCorrespondence(idlist,validcols,dfcurrent.iloc[1,validcols]) + output = CalculateUsages(statsfilepathlist,statsfilename,gradename,threshold,marks,correspondence_dict,validcols,date) + if CheckUsagesValidity(output) == 0: + if not self.checkBox_appendflag.isChecked(): + SaveTextFile(output,"文本文件/metadata.txt") + print("数据文件已输出至metadata.txt") + self.label_filepath.setText("数据文件已输出至metadata.txt") + os.system("code 文本文件/metadata.txt") + else: + AppendTextFile("\n\n"+output,"文本文件/metadata.txt") + print("数据文件已添加至metadata.txt") + self.label_filepath.setText("数据文件已添加至metadata.txt") + os.system("code 文本文件/metadata.txt") + + + else: + print("数据有误, 可能需要检查每一题的满分数据") + self.label_filepath.setText("数据有误, 可能需要检查每一题的满分数据") + + + + + # def ShowFilePath(self): # 选择文件 + # pathlist = QFileDialog.getOpenFileName(self, "选择文件这是标题", ".", "All Files (*);;py文件(*.py *.pyd))") + # self.label_FilePath.setText(pathlist[0]) + # def getDir(self): # 选择文件夹 + # dir = QFileDialog.getExistingDirectory(None, "选择文件夹") + # self.label_FilePath.setText(dir) + + + + + + +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..afc5770f --- /dev/null +++ b/工具v2/获取小闲平台使用数据.ui @@ -0,0 +1,143 @@ + + + Form + + + + 0 + 0 + 700 + 140 + + + + 获取小闲平台使用数据 + + + + + 100 + 40 + 75 + 24 + + + + 选择文件 + + + + + + 10 + 40 + 91 + 16 + + + + 下载的.zip文件 + + + + + + 10 + 10 + 54 + 16 + + + + 日期 + + + + + + 80 + 10 + 132 + 20 + + + + + + + 230 + 10 + 81 + 16 + + + + (yyyymmdd) + + + + + + 10 + 70 + 681 + 16 + + + + 选择文件后, 这里将显示文件路径 + + + + + + 620 + 100 + 75 + 24 + + + + 运行 + + + + + + 520 + 100 + 91 + 20 + + + + Append模式 + + + + + + 330 + 10 + 81 + 16 + + + + 提交比例下限 + + + + + + 420 + 10 + 113 + 20 + + + + + + +