'update'
This commit is contained in:
@@ -105,9 +105,11 @@ class IBookExportApp(CoverMixin, FinishedBooksMixin, QWidget):
|
||||
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)
|
||||
|
||||
# iPad 数据包导出按钮
|
||||
if hasattr(self, 'ipad_export_btn'):
|
||||
try:
|
||||
@@ -116,11 +118,13 @@ class IBookExportApp(CoverMixin, FinishedBooksMixin, QWidget):
|
||||
pass
|
||||
self.listwidget.currentRowChanged.connect(self.update_book_info)
|
||||
self.listwidget.installEventFilter(self)
|
||||
|
||||
# ====== 封面标签 ======
|
||||
if all(hasattr(self, n) for n in ('cover_label_1','cover_label_2','cover_label_3')):
|
||||
self._cover_labels = [self.cover_label_1, self.cover_label_2, self.cover_label_3]
|
||||
else:
|
||||
self._cover_labels = [getattr(self, 'book_cover_label', QLabel('封面', self))]
|
||||
|
||||
for lab in self._cover_labels:
|
||||
lab.setMinimumWidth(180)
|
||||
lab.setMaximumWidth(180)
|
||||
@@ -130,8 +134,10 @@ class IBookExportApp(CoverMixin, FinishedBooksMixin, QWidget):
|
||||
lab.setFocusPolicy(_QtFP.FocusPolicy.NoFocus)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# 封面高度是否弹性跟随文本区(默认 False: 固定算法,不扩张)
|
||||
self.cover_elastic = False
|
||||
|
||||
# 调整文本区域弹性:宽度随可用空间扩展,高度优先扩展
|
||||
try:
|
||||
from PyQt6.QtWidgets import QSizePolicy as _QSP
|
||||
@@ -145,6 +151,7 @@ class IBookExportApp(CoverMixin, FinishedBooksMixin, QWidget):
|
||||
lab.setMinimumHeight(10)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
self.cover_ratio = 1.2
|
||||
self._export_tab_index = None
|
||||
self.book_toc_textedit.setPlainText("书籍信息 / 简评")
|
||||
@@ -155,6 +162,7 @@ class IBookExportApp(CoverMixin, FinishedBooksMixin, QWidget):
|
||||
self._cover_pixmaps_original = []
|
||||
# 恢复窗口尺寸
|
||||
self._restore_window_geometry()
|
||||
|
||||
# 设置封面标签对齐
|
||||
try:
|
||||
from PyQt6.QtCore import Qt as _QtAlign
|
||||
@@ -162,18 +170,22 @@ class IBookExportApp(CoverMixin, FinishedBooksMixin, QWidget):
|
||||
lab.setAlignment(_QtAlign.AlignmentFlag.AlignHCenter | _QtAlign.AlignmentFlag.AlignTop)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# 应用全局字体(含苹方支持)
|
||||
try:
|
||||
self._apply_global_font()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# 初始封面 + 首本书信息 (及 AI 简评触发)
|
||||
self._load_initial()
|
||||
|
||||
# 已读书籍网格
|
||||
try:
|
||||
self._populate_finished_books_grid()
|
||||
except Exception as e:
|
||||
print('警告: 已读书籍网格填充失败', e)
|
||||
|
||||
# 滚动区域策略 & 事件过滤
|
||||
if hasattr(self, 'finished_scroll_area'):
|
||||
from PyQt6.QtCore import Qt as _Qt
|
||||
@@ -183,6 +195,7 @@ class IBookExportApp(CoverMixin, FinishedBooksMixin, QWidget):
|
||||
self.finished_scroll_area.viewport().installEventFilter(self)
|
||||
except Exception as _e_vp:
|
||||
print('信息: 安装 viewport 事件过滤器失败', _e_vp)
|
||||
|
||||
# Tab 切换监听 (C + A 方案)
|
||||
from PyQt6.QtWidgets import QTabWidget
|
||||
try:
|
||||
@@ -193,6 +206,7 @@ class IBookExportApp(CoverMixin, FinishedBooksMixin, QWidget):
|
||||
self._detect_export_tab_index()
|
||||
except Exception as _e_tab:
|
||||
print('信息: 连接 tab 切换失败', _e_tab)
|
||||
|
||||
# 首次显示后再排一次
|
||||
from PyQt6.QtCore import QTimer
|
||||
QTimer.singleShot(80, self._relayout_finished_grid)
|
||||
@@ -403,7 +417,7 @@ class IBookExportApp(CoverMixin, FinishedBooksMixin, QWidget):
|
||||
export_dir = getattr(config, "EXPORT_NOTES_DIR", os.getcwd())
|
||||
if not os.path.exists(export_dir):
|
||||
os.makedirs(export_dir)
|
||||
out_path = os.path.join(export_dir, f"notes_{shortname}-{ts}.md")
|
||||
out_path = os.path.join(export_dir, f"{shortname}-{ts}.md")
|
||||
self.exporter.export_booksnote_to_md(selected_booksnote, selected_booksinfo, out_path)
|
||||
QMessageBox.information(self, "导出成功", f"已导出到:{out_path}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user