diff --git a/ui/pyui/defense_ui.py b/ui/pyui/defense_ui.py index 0019d5a..a1dfb91 100644 --- a/ui/pyui/defense_ui.py +++ b/ui/pyui/defense_ui.py @@ -26,6 +26,7 @@ from module.worker import DTGWorker from ui import MAIN_THEME_COLOR from ui.components.infobar import ProgressInfoBar from ui.components.widget import Widget, MyGroupHeaderCardWidget +from ui.pyui.sub.defense import ODModeExportSettings, ODModeSettings from utils.function import open_template @@ -320,17 +321,17 @@ class DPMode(QWidget): self.errorSignal.emit(title, content) -class DOMode(SimpleCardWidget): +class DOMode(QWidget): def __init__(self, parent=None): super().__init__(parent) self.vbox = QVBoxLayout(self) self.vbox.setContentsMargins(0, 0, 0, 0) - self.label = DisplayLabel("🚧", self) - self.label.setAlignment(Qt.AlignCenter) + self.odSettings = ODModeSettings(self) + self.odExportSettings = ODModeExportSettings(self) - self.vbox.addStretch(1) - self.vbox.addWidget(self.label) + self.vbox.addWidget(self.odSettings) + self.vbox.addWidget(self.odExportSettings) self.vbox.addStretch(1) diff --git a/ui/pyui/sub/defense.py b/ui/pyui/sub/defense.py new file mode 100644 index 0000000..b1d3fd8 --- /dev/null +++ b/ui/pyui/sub/defense.py @@ -0,0 +1,88 @@ +# Copyright (c) 2025 Jeffrey Hsu - JITToolBox +# # +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# # +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# # +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +from PySide6.QtWidgets import QHBoxLayout +from qfluentwidgets import PushButton, HyperlinkButton, SpinBox, LineEdit, PrimaryPushButton, FluentIcon, \ + GroupHeaderCardWidget + +from ui.components.widget import MyGroupHeaderCardWidget + + +class ODModeSettings(MyGroupHeaderCardWidget): + def __init__(self, parent=None): + super().__init__(parent) + self.setTitle('输入选项') + + self.sBtn = PushButton('打开', self) + self.sBtnTemplate = HyperlinkButton('', '下载模板') + + self.qBtn = PushButton('打开', self) + self.bBtnTemplate = HyperlinkButton('', '下载模板') + + self.qNumber = SpinBox(self) + self.qNumber.setRange(0, 999) + + self.defenseNameLineEdit = LineEdit(self) + self.defenseNameLineEdit.setPlaceholderText('输入答辩名称') + + self.so = SpinBox(self) + self.so.setRange(0, 999) + + self.sname = LineEdit(self) + self.sname.setPlaceholderText('姓名') + + self.startBtn = PrimaryPushButton(FluentIcon.PLAY_SOLID, '开始') + + self.init_layout() + + def init_layout(self): + self.sBtn.setFixedWidth(120) + self.qBtn.setFixedWidth(120) + self.defenseNameLineEdit.setFixedWidth(360) + self.so.setFixedWidth(120) + self.sname.setFixedWidth(120) + self.qNumber.setFixedWidth(120) + self.startBtn.setFixedWidth(120) + + hbox1 = QHBoxLayout(self) + hbox1.addWidget(self.sBtnTemplate) + hbox1.addWidget(self.sBtn) + hbox2 = QHBoxLayout(self) + hbox2.addWidget(self.bBtnTemplate) + hbox2.addWidget(self.qBtn) + + self.stuGroup = self.addGroup(FluentIcon.DOCUMENT, '学生名单', '选择学生名单文件', hbox1) + self.qGroup = self.addGroup(FluentIcon.DOCUMENT, '题库', '选择题库文件', hbox2) + self.addGroup(FluentIcon.SETTING, '题目数量', '输入题目数量', self.qNumber) + self.addGroup(FluentIcon.SETTING, '答辩名称', '输入答辩名称', self.defenseNameLineEdit) + self.addGroup(FluentIcon.SETTING, '答辩序号', '输入答辩序号', self.so) + self.addGroup(FluentIcon.SETTING, '学生姓名', '输入学生姓名', self.sname) + + +class ODModeExportSettings(GroupHeaderCardWidget): + def __init__(self, parent=None): + super().__init__(parent) + + self.setTitle('导出选项') + self.exportFilename = LineEdit(self) + self.exportBtn = PrimaryPushButton(FluentIcon.PLAY_SOLID, '导出') + + self.init_layout() + + def init_layout(self): + self.exportFilename.setPlaceholderText('输入导出的文件名') + self.exportFilename.setFixedWidth(360) + self.exportBtn.setFixedWidth(120) + + self.addGroup(FluentIcon.DOCUMENT, '导出文件名', '输入导出文件名', self.exportFilename)