diff --git a/module/achievement/doc.py b/module/achievement/doc.py index b01b050..d4d5778 100644 --- a/module/achievement/doc.py +++ b/module/achievement/doc.py @@ -1,4 +1,4 @@ -# Copyright (c) 2025 Jeffrey Hsu - JITToolBox +# Copyright (c) 2025-2026 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 @@ -155,10 +155,14 @@ class DocxWriter: for performance in self.excel_reader.achievement_level[r_index]: non_none_count = 3 - performance.scores.count(None) if non_none_count > 1: - cell_start = table.cell(row, col_span) - cell_end = table.cell(row, col_span + non_none_count - 1) - cell_start.merge(cell_end) - col_span += non_none_count + try: + cell_start = table.cell(row, col_span) + cell_end = table.cell(row, col_span + non_none_count - 1) + cell_start.merge(cell_end) + except IndexError: + self.signal(f"单元格合并失败:({row}, {col_span}),需要自行检查表格准确性", + LOGLEVEL.WARNING) + col_span += non_none_count start = rows - X + 3 + self.excel_reader.kpi_number if len(self.excel_reader.class_list) == 1: @@ -257,7 +261,7 @@ class DocxWriter: table.cell(i, 4).merge(table.cell(i, 5)) table.cell(i, 1).width = Cm(7.42) table.cell(i, 2).width = Cm(7.42) - table.cell(i, 4).width = Cm(7.41) + table.cell(i, 4).width = Cm(7.41) case 8 | 10: table.cell(i - 1, 0).merge(table.cell(i, 0)) table.cell(i, 1).width = Cm(11.23) @@ -267,8 +271,8 @@ class DocxWriter: case _: cell_start = table.cell(i, 1) cell_end = table.cell(i, cols - 1) - cell_start.merge(cell_end) - # 填充数据 + cell_start.merge(cell_end) + # 填充数据 self.put_data_to_table(table, self.excel_reader.get_word_template_part_3) # 应用样式 @@ -370,7 +374,7 @@ class DocxWriter: special_cell = [ (1, 1), (2, 1), - (3, 1), + (3, 1), (4, 1), (5, 1), (6, 1), diff --git a/ui/pyui/achievement_ui.py b/ui/pyui/achievement_ui.py index 1479ae2..f4e814a 100644 --- a/ui/pyui/achievement_ui.py +++ b/ui/pyui/achievement_ui.py @@ -1,4 +1,4 @@ -# Copyright (c) 2025 Jeffrey Hsu - JITToolBox +# Copyright (c) 2025-2026 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 @@ -20,7 +20,7 @@ from typing import Callable, Literal from PySide6.QtCore import Qt, Signal, QThread from PySide6.QtWidgets import QVBoxLayout, QFileDialog, QHBoxLayout from qfluentwidgets import GroupHeaderCardWidget, FluentIcon, PushButton, LineEdit, IconWidget, BodyLabel, \ - PrimaryPushButton, SwitchButton, HyperlinkButton + PrimaryPushButton, SwitchButton, HyperlinkButton, InfoBar, InfoBarPosition from module import LOGLEVEL from module.worker import ARGWorker @@ -259,3 +259,13 @@ class AchievementWidget(Widget): def show_info(self, content: str, level: str): if level == LOGLEVEL.INFO: self.pib.set_title(content) + elif level == LOGLEVEL.WARNING: + InfoBar.warning( + title='提示', + content=content, + orient=Qt.Horizontal, + isClosable=True, + position=InfoBarPosition.TOP_RIGHT, + duration=5000, + parent=self + )