'update'
This commit is contained in:
@@ -68,6 +68,46 @@ class IBookExportApp(CoverMixin, FinishedBooksMixin, QWidget):
|
||||
self.sorted_assetids = sorted(self.assetid2name.keys(), key=lambda aid: self.assetid2lastopen[aid], reverse=True)
|
||||
for aid in self.sorted_assetids:
|
||||
self.listwidget.addItem(f"{self.assetid2name[aid]} [{self.assetid2lastopen[aid]}]")
|
||||
# 更新左侧提示标签文本与样式(白色黑体,底色 #4c221b)
|
||||
try:
|
||||
total_books = len(self.sorted_assetids)
|
||||
if hasattr(self, 'label') and isinstance(self.label, QLabel):
|
||||
self.label.setText(f"请选择要导出的书籍【{total_books}本】:")
|
||||
self.label.setStyleSheet("QLabel { background-color: #4c221b; color: #ffffff; font-family: 'STHeiti, Heiti SC, SimHei'; font-weight: bold; padding:4px 6px; border-radius:4px; }")
|
||||
except Exception as _e_lbl:
|
||||
print('信息: 设置导出提示标签样式失败:', _e_lbl)
|
||||
# 调整导出 & 配置按钮为同一行 + 圆角胶囊风格
|
||||
try:
|
||||
from PyQt6.QtWidgets import QHBoxLayout, QWidget
|
||||
if hasattr(self, 'export_btn') and hasattr(self, 'config_btn'):
|
||||
# 如果还在原父布局中(垂直),则新建一行容器
|
||||
parent_layout = self.export_btn.parentWidget().layout() if self.export_btn.parentWidget() else None
|
||||
if parent_layout and self.export_btn in [parent_layout.itemAt(i).widget() for i in range(parent_layout.count()) if parent_layout.itemAt(i).widget()]:
|
||||
# 创建水平布局并放置两个按钮
|
||||
row_container = QWidget(self)
|
||||
h = QHBoxLayout(row_container); h.setContentsMargins(0,0,0,0); h.setSpacing(12)
|
||||
# 取出旧按钮(避免重复显示)
|
||||
self.export_btn.setParent(row_container)
|
||||
self.config_btn.setParent(row_container)
|
||||
h.addWidget(self.export_btn)
|
||||
h.addWidget(self.config_btn)
|
||||
parent_layout.addWidget(row_container)
|
||||
# 设置样式
|
||||
pill_css = (
|
||||
"QPushButton { border:none; color:#ffffff; padding:6px 22px; font-size:14px; font-weight:600; border-radius:22px; }"
|
||||
"QPushButton#export_btn { background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #63a9ff, stop:1 #388bff); }"
|
||||
"QPushButton#config_btn { background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #7ed957, stop:1 #4caf50); }"
|
||||
"QPushButton:hover { filter: brightness(1.08); }"
|
||||
"QPushButton:pressed { filter: brightness(0.92); }"
|
||||
"QPushButton:disabled { background:#888888; color:#dddddd; }"
|
||||
)
|
||||
# 仅作用于这两个按钮:分别附加 objectName 选择器
|
||||
self.export_btn.setObjectName('export_btn')
|
||||
self.config_btn.setObjectName('config_btn')
|
||||
self.export_btn.setStyleSheet(pill_css)
|
||||
self.config_btn.setStyleSheet(pill_css)
|
||||
except Exception as _e_pill:
|
||||
print('信息: 设置按钮行/样式失败:', _e_pill)
|
||||
# ====== 信号 ======
|
||||
self.export_btn.clicked.connect(self.export_notes)
|
||||
self.config_btn.clicked.connect(self.show_config)
|
||||
@@ -575,6 +615,13 @@ class IBookExportApp(CoverMixin, FinishedBooksMixin, QWidget):
|
||||
('近7天', week_hours, 'h', '#f4b2c2'),
|
||||
('日均', day_avg_minutes, 'm', '#b9b542'),
|
||||
]
|
||||
# 新增:今年已读完书籍数量气泡(单位:book)
|
||||
try:
|
||||
finished_books = self.manager.get_finished_books_this_year()
|
||||
finished_count = len(finished_books)
|
||||
bubble_metrics.append(('已读', finished_count, 'book', '#6aa84f'))
|
||||
except Exception as e:
|
||||
print('信息: 获取已读书籍数量失败:', e)
|
||||
bubble_widget = BubbleMetricsWidget(bubble_metrics)
|
||||
bubble_widget.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
|
||||
self.bubbleLayout.addWidget(bubble_widget)
|
||||
|
||||
Reference in New Issue
Block a user