设置UI
(self)
| 670 | self.startCronScheduler() |
| 671 | |
| 672 | def setupUI(self): |
| 673 | """设置UI""" |
| 674 | self.layout = QGridLayout(self) |
| 675 | self.layout.setContentsMargins(0, 0, 0, 0) |
| 676 | |
| 677 | # 顶部按钮栏 |
| 678 | btnLayout = QHBoxLayout() |
| 679 | btnLayout.setSpacing(8) |
| 680 | |
| 681 | self.addTaskBtn = PrimaryPushButton(FIF.ADD, "添加任务", self) |
| 682 | self.addTaskBtn.clicked.connect(self.addTask) |
| 683 | btnLayout.addWidget(self.addTaskBtn) |
| 684 | |
| 685 | self.importBtn = PushButton(FIF.FOLDER_ADD, "导入配置", self) |
| 686 | self.importBtn.clicked.connect(self.importConfig) |
| 687 | btnLayout.addWidget(self.importBtn) |
| 688 | |
| 689 | self.exportBtn = PushButton(FIF.SAVE, "导出配置", self) |
| 690 | self.exportBtn.clicked.connect(self.exportConfig) |
| 691 | btnLayout.addWidget(self.exportBtn) |
| 692 | |
| 693 | btnLayout.addStretch(1) |
| 694 | |
| 695 | # 滚动区域 |
| 696 | self.scrollArea = MySmoothScrollArea(self) |
| 697 | self.scrollArea.setFrameShape(QFrame.NoFrame) |
| 698 | self.scrollArea.setFrameShadow(QFrame.Plain) |
| 699 | self.scrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) |
| 700 | self.scrollArea.setWidgetResizable(True) |
| 701 | self.scrollArea.setAlignment(Qt.AlignLeading | Qt.AlignLeft | Qt.AlignTop) |
| 702 | |
| 703 | self.scrollWidget = QWidget() |
| 704 | self.scrollLayout = QVBoxLayout(self.scrollWidget) |
| 705 | self.scrollLayout.setContentsMargins(0, 0, 0, 0) |
| 706 | self.scrollLayout.setSpacing(8) |
| 707 | self.scrollLayout.setAlignment(Qt.AlignTop) |
| 708 | |
| 709 | self.scrollArea.setWidget(self.scrollWidget) |
| 710 | |
| 711 | # 空状态提示 |
| 712 | self.emptyHintWidget = QWidget(self.scrollWidget) |
| 713 | emptyLayout = QVBoxLayout(self.emptyHintWidget) |
| 714 | emptyLayout.setAlignment(Qt.AlignCenter) |
| 715 | emptyLayout.setSpacing(12) |
| 716 | |
| 717 | emptyLabel = SubtitleLabel("暂无任务", self.emptyHintWidget) |
| 718 | emptyLabel.setAlignment(Qt.AlignCenter) |
| 719 | emptyLayout.addWidget(emptyLabel) |
| 720 | |
| 721 | emptyTip = BodyLabel("点击上方'添加任务'按钮创建新的定时任务", self.emptyHintWidget) |
| 722 | emptyTip.setAlignment(Qt.AlignCenter) |
| 723 | emptyLayout.addWidget(emptyTip) |
| 724 | |
| 725 | self.scrollLayout.addWidget(self.emptyHintWidget) |
| 726 | |
| 727 | # 添加到主布局 |
| 728 | topWidget = QWidget(self) |
| 729 | topWidget.setLayout(btnLayout) |
no test coverage detected