diff --git a/module/picker/schema.py b/module/picker/schema.py index 087befc..227e314 100644 --- a/module/picker/schema.py +++ b/module/picker/schema.py @@ -59,6 +59,10 @@ class PickerStudent: def modify(self) -> bool: return self._modify + @property + def weight(self) -> int: + return int(sum(1 for x in self._scores if x != 0) / self.total_time * 100) + def saved(self): self._modify = False diff --git a/ui/main.py b/ui/main.py index e3f9e96..1b87bd4 100644 --- a/ui/main.py +++ b/ui/main.py @@ -20,8 +20,8 @@ class MainWindow(MSFluentWindow): self.achievementInterface = AchievementWidget('Achievement Interface', self) self.defenseInterface = DefenseWidget('Defense Interface', self) self.aboutInterface = AboutWidget('About Interface', self) - self.pickerInterface = PickerWidget('Picker Interface', self) if not is_frozen(): + self.pickerInterface = PickerWidget('Picker Interface', self) self.testInterface = TestWidget('Test Interface', self) self.achievementInterface.error.connect(self.showError) @@ -33,8 +33,8 @@ class MainWindow(MSFluentWindow): def initNavigation(self): self.addSubInterface(self.achievementInterface, FluentIcon.SPEED_HIGH, '达成度') self.addSubInterface(self.defenseInterface, FluentIcon.FEEDBACK, '答辩') - self.addSubInterface(self.pickerInterface, FluentIcon.PEOPLE, '抽答') if not is_frozen(): + self.addSubInterface(self.pickerInterface, FluentIcon.PEOPLE, '抽答') self.addSubInterface(self.testInterface, FluentIcon.VIEW, '测试') self.addSubInterface(self.aboutInterface, FluentIcon.INFO, '关于', position=NavigationItemPosition.BOTTOM) diff --git a/ui/pyui/picker_ui.py b/ui/pyui/picker_ui.py index 8898a3c..da42493 100644 --- a/ui/pyui/picker_ui.py +++ b/ui/pyui/picker_ui.py @@ -1,6 +1,41 @@ +from PySide6.QtCore import Qt +from PySide6.QtWidgets import QVBoxLayout, QHBoxLayout +from qfluentwidgets import GroupHeaderCardWidget, PushButton, FluentIcon, PrimaryPushButton, IconWidget, BodyLabel + +from ui import MAIN_THEME_COLOR from ui.components.widget import Widget class PickerWidget(Widget): def __init__(self, key: str, parent=None): super().__init__(key, parent) + + self.card = GroupHeaderCardWidget(self) + self.vbox = QVBoxLayout(self) + self.chooseBtn = PushButton("打开") + self.startButton = PrimaryPushButton(FluentIcon.PLAY_SOLID, "抽签") + self.bottomLayout = QHBoxLayout() + self.hintIcon = IconWidget(FluentIcon.INFO.icon(color=MAIN_THEME_COLOR)) + self.hintLabel = BodyLabel("点击抽签按钮以开始抽签 👉") + + self.card.setTitle("输入选项") + self.chooseBtn.setFixedWidth(120) + self.startButton.setFixedWidth(120) + self.startButton.setEnabled(False) + + self.hintIcon.setFixedSize(16, 16) + self.hintIcon.autoFillBackground() + self.bottomLayout.setSpacing(10) + self.bottomLayout.setContentsMargins(24, 15, 24, 20) + self.bottomLayout.addWidget(self.hintIcon, 0, Qt.AlignLeft) + self.bottomLayout.addWidget(self.hintLabel, 0, Qt.AlignLeft) + self.bottomLayout.addStretch(1) + self.bottomLayout.addWidget(self.startButton, 0, Qt.AlignRight) + self.bottomLayout.setAlignment(Qt.AlignVCenter) + + self.group = self.card.addGroup(FluentIcon.DOCUMENT, "抽答名单", "选择抽答名单", self.chooseBtn) + self.group.setSeparatorVisible(True) + self.card.vBoxLayout.addLayout(self.bottomLayout) + + self.vbox.addWidget(self.card) + self.vbox.addStretch(1)