删除提问功能、替换答辩模板
This commit is contained in:
@@ -17,6 +17,7 @@ import pathlib
|
|||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
|
||||||
from docx import Document
|
from docx import Document
|
||||||
|
from docx.enum.text import WD_BREAK
|
||||||
from docx.shared import Cm, Mm
|
from docx.shared import Cm, Mm
|
||||||
|
|
||||||
from module.schema import Course, Student
|
from module.schema import Course, Student
|
||||||
@@ -37,10 +38,11 @@ class DocPaper:
|
|||||||
section.right_margin = Cm(2)
|
section.right_margin = Cm(2)
|
||||||
|
|
||||||
def add_paper(self, course: Course, student: Student):
|
def add_paper(self, course: Course, student: Student):
|
||||||
temp_table = self._template.tables[0]
|
new_table = deepcopy(self._template.tables[0])
|
||||||
new_table = deepcopy(temp_table)
|
|
||||||
para = self._doc.add_paragraph()
|
para = self._doc.add_paragraph()
|
||||||
para._p.addprevious(new_table._element)
|
para._p.addprevious(new_table._element)
|
||||||
|
para.add_run().add_break(WD_BREAK.PAGE)
|
||||||
|
|
||||||
data_list = {
|
data_list = {
|
||||||
'%CNAME%': course.name,
|
'%CNAME%': course.name,
|
||||||
@@ -48,9 +50,7 @@ class DocPaper:
|
|||||||
'%SNAME%': student.name,
|
'%SNAME%': student.name,
|
||||||
'%NO%': student.no,
|
'%NO%': student.no,
|
||||||
'%SO%': student.so,
|
'%SO%': student.so,
|
||||||
'%Q1%': student.picked_questions[0].topic,
|
'%Q%': '\n'.join([f'\t{idx + 1}、{i.topic}' for idx, i in enumerate(student.picked_questions)])
|
||||||
'%Q2%': student.picked_questions[1].topic,
|
|
||||||
'%Q3%': student.picked_questions[2].topic
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# 替换表格中的占位符
|
# 替换表格中的占位符
|
||||||
|
|||||||
Binary file not shown.
@@ -109,3 +109,12 @@ class MyGroupHeaderCardWidget(GroupHeaderCardWidget):
|
|||||||
self.groupLayout.addWidget(group)
|
self.groupLayout.addWidget(group)
|
||||||
self.groupWidgets.append(group)
|
self.groupWidgets.append(group)
|
||||||
return group
|
return group
|
||||||
|
|
||||||
|
|
||||||
|
class NotImplementedWidget(QWidget):
|
||||||
|
def __init__(self, parent=None):
|
||||||
|
super().__init__(parent)
|
||||||
|
self.layout = QVBoxLayout(self)
|
||||||
|
self.label = DisplayLabel("🚧", self)
|
||||||
|
self.label.setAlignment(Qt.AlignCenter)
|
||||||
|
self.layout.addWidget(self.label)
|
||||||
|
|||||||
10
ui/main.py
10
ui/main.py
@@ -20,7 +20,7 @@ from ui import MAIN_THEME_COLOR, BLUE_BACKGROUND_COLOR
|
|||||||
from ui.pyui.about_ui import AboutWidget
|
from ui.pyui.about_ui import AboutWidget
|
||||||
from ui.pyui.achievement_ui import AchievementWidget
|
from ui.pyui.achievement_ui import AchievementWidget
|
||||||
from ui.pyui.defense_ui import DefenseWidget
|
from ui.pyui.defense_ui import DefenseWidget
|
||||||
from ui.pyui.picker_ui import PickerWidget
|
# from ui.pyui.picker_ui import PickerWidget
|
||||||
from ui.pyui.test_ui import TestWidget
|
from ui.pyui.test_ui import TestWidget
|
||||||
from utils.function import RELEASE_ENV
|
from utils.function import RELEASE_ENV
|
||||||
|
|
||||||
@@ -35,21 +35,21 @@ class MainWindow(MSFluentWindow):
|
|||||||
self.achievementInterface = AchievementWidget('Achievement Interface', self)
|
self.achievementInterface = AchievementWidget('Achievement Interface', self)
|
||||||
self.defenseInterface = DefenseWidget('Defense Interface', self)
|
self.defenseInterface = DefenseWidget('Defense Interface', self)
|
||||||
self.aboutInterface = AboutWidget('About Interface', self)
|
self.aboutInterface = AboutWidget('About Interface', self)
|
||||||
self.pickerInterface = PickerWidget('Picker Interface', self)
|
# self.pickerInterface = PickerWidget('Picker Interface', self)
|
||||||
if not RELEASE_ENV:
|
if not RELEASE_ENV:
|
||||||
self.testInterface = TestWidget('Test Interface', self)
|
self.testInterface = TestWidget('Test Interface', self)
|
||||||
|
|
||||||
self.achievementInterface.error.connect(self.showError)
|
self.achievementInterface.error.connect(self.showError)
|
||||||
self.defenseInterface.errorSignal.connect(self.showError)
|
self.defenseInterface.errorSignal.connect(self.showError)
|
||||||
self.pickerInterface.errorSignal.connect(self.showError)
|
# self.pickerInterface.errorSignal.connect(self.showError)
|
||||||
|
|
||||||
self.initNavigation()
|
self.initNavigation()
|
||||||
self.initWindow()
|
self.initWindow()
|
||||||
|
|
||||||
def initNavigation(self):
|
def initNavigation(self):
|
||||||
self.addSubInterface(self.achievementInterface, FluentIcon.SPEED_HIGH, '达成度')
|
self.addSubInterface(self.achievementInterface, FluentIcon.SPEED_HIGH, '达成度')
|
||||||
self.addSubInterface(self.defenseInterface, FluentIcon.FEEDBACK, '答辩题目')
|
self.addSubInterface(self.defenseInterface, FluentIcon.FEEDBACK, '答辩')
|
||||||
self.addSubInterface(self.pickerInterface, FluentIcon.PEOPLE, '提问')
|
# self.addSubInterface(self.pickerInterface, FluentIcon.PEOPLE, '提问')
|
||||||
if not RELEASE_ENV:
|
if not RELEASE_ENV:
|
||||||
self.addSubInterface(self.testInterface, FluentIcon.VIEW, '测试')
|
self.addSubInterface(self.testInterface, FluentIcon.VIEW, '测试')
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class InputSettingCard(MyGroupHeaderCardWidget):
|
|||||||
self.setBorderRadius(8)
|
self.setBorderRadius(8)
|
||||||
self.btnHBoxLayout = QHBoxLayout(self)
|
self.btnHBoxLayout = QHBoxLayout(self)
|
||||||
|
|
||||||
self.openTemplateButton = HyperlinkButton("", "下载模板")
|
self.openTemplateButton = HyperlinkButton("", "模板下载")
|
||||||
self.chooseFileButton = PushButton("打开")
|
self.chooseFileButton = PushButton("打开")
|
||||||
|
|
||||||
self.chooseFileButton.setFixedWidth(120)
|
self.chooseFileButton.setFixedWidth(120)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ from qfluentwidgets import GroupHeaderCardWidget, PushButton, IconWidget, BodyLa
|
|||||||
from module.worker import DTGWorker
|
from module.worker import DTGWorker
|
||||||
from ui import MAIN_THEME_COLOR
|
from ui import MAIN_THEME_COLOR
|
||||||
from ui.components.infobar import ProgressInfoBar
|
from ui.components.infobar import ProgressInfoBar
|
||||||
from ui.components.widget import Widget, MyGroupHeaderCardWidget
|
from ui.components.widget import Widget, MyGroupHeaderCardWidget, NotImplementedWidget
|
||||||
from ui.pyui.sub.defense import ODModeExportSettings, ODModeSettings
|
from ui.pyui.sub.defense import ODModeExportSettings, ODModeSettings
|
||||||
from utils.function import open_template
|
from utils.function import open_template
|
||||||
|
|
||||||
@@ -65,9 +65,9 @@ class InitSettingCard(MyGroupHeaderCardWidget):
|
|||||||
|
|
||||||
self.sBtnHBoxLayout = QHBoxLayout(self)
|
self.sBtnHBoxLayout = QHBoxLayout(self)
|
||||||
self.qBtnHBoxLayout = QHBoxLayout(self)
|
self.qBtnHBoxLayout = QHBoxLayout(self)
|
||||||
self.sTemplateButton = HyperlinkButton("", "下载模板")
|
self.sTemplateButton = HyperlinkButton("", "模板下载")
|
||||||
self.chooseStudentButton = PushButton("打开")
|
self.chooseStudentButton = PushButton("打开")
|
||||||
self.qTemplateButton = HyperlinkButton("", "下载模板")
|
self.qTemplateButton = HyperlinkButton("", "模板下载")
|
||||||
self.chooseQuestionButton = PushButton("打开")
|
self.chooseQuestionButton = PushButton("打开")
|
||||||
|
|
||||||
self.chooseStudentButton.setFixedWidth(120)
|
self.chooseStudentButton.setFixedWidth(120)
|
||||||
@@ -345,7 +345,7 @@ class DefenseWidget(Widget):
|
|||||||
self.stack = QStackedWidget(self)
|
self.stack = QStackedWidget(self)
|
||||||
self.menu = SegmentedWidget(self)
|
self.menu = SegmentedWidget(self)
|
||||||
self.dpMode = DPMode(self)
|
self.dpMode = DPMode(self)
|
||||||
self.doMode = DOMode(self)
|
self.doMode = NotImplementedWidget(self)
|
||||||
|
|
||||||
self.addSubInterface(self.dpMode, 'DPMode', '书面答辩')
|
self.addSubInterface(self.dpMode, 'DPMode', '书面答辩')
|
||||||
self.addSubInterface(self.doMode, 'DOMode', '口头答辩')
|
self.addSubInterface(self.doMode, 'DOMode', '口头答辩')
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class PickStudentMode(QWidget):
|
|||||||
self.vbox.setContentsMargins(0, 0, 0, 0)
|
self.vbox.setContentsMargins(0, 0, 0, 0)
|
||||||
self.btnHBox = QHBoxLayout(self)
|
self.btnHBox = QHBoxLayout(self)
|
||||||
|
|
||||||
self.openTemplateBtn = HyperlinkButton("", "下载模板")
|
self.openTemplateBtn = HyperlinkButton("", "模板下载")
|
||||||
self.chooseBtn = PushButton("打开")
|
self.chooseBtn = PushButton("打开")
|
||||||
self.startButton = PrimaryPushButton(FluentIcon.PLAY_SOLID, "开始")
|
self.startButton = PrimaryPushButton(FluentIcon.PLAY_SOLID, "开始")
|
||||||
self.bottomLayout = QHBoxLayout()
|
self.bottomLayout = QHBoxLayout()
|
||||||
|
|||||||
@@ -25,10 +25,10 @@ class ODModeSettings(MyGroupHeaderCardWidget):
|
|||||||
self.setTitle('输入选项')
|
self.setTitle('输入选项')
|
||||||
|
|
||||||
self.sBtn = PushButton('打开', self)
|
self.sBtn = PushButton('打开', self)
|
||||||
self.sBtnTemplate = HyperlinkButton('', '下载模板')
|
self.sBtnTemplate = HyperlinkButton('', '模板下载')
|
||||||
|
|
||||||
self.qBtn = PushButton('打开', self)
|
self.qBtn = PushButton('打开', self)
|
||||||
self.bBtnTemplate = HyperlinkButton('', '下载模板')
|
self.bBtnTemplate = HyperlinkButton('', '模板下载')
|
||||||
|
|
||||||
self.qNumber = SpinBox(self)
|
self.qNumber = SpinBox(self)
|
||||||
self.qNumber.setRange(0, 999)
|
self.qNumber.setRange(0, 999)
|
||||||
|
|||||||
Reference in New Issue
Block a user