Add Acrobat style right tools panel
This commit is contained in:
@@ -22,7 +22,6 @@ from PySide6.QtWidgets import (
|
||||
QSplitter,
|
||||
QStatusBar,
|
||||
QToolBar,
|
||||
QWidget,
|
||||
QVBoxLayout,
|
||||
)
|
||||
|
||||
@@ -34,6 +33,7 @@ from pdfreaderlite.core.file_association import (
|
||||
from pdfreaderlite.core.document import EncryptedPdfError, FormField, PdfDocument, SearchMatch
|
||||
from pdfreaderlite.resources import pdf_icon_path, software_icon_path
|
||||
from pdfreaderlite.ui.pdf_viewer import PdfViewer
|
||||
from pdfreaderlite.ui.right_tools import RightToolsPanel
|
||||
from pdfreaderlite.ui.sidebar import Sidebar
|
||||
from pdfreaderlite.ui.signature_dialog import SignatureDialog
|
||||
|
||||
@@ -50,6 +50,7 @@ class MainWindow(QMainWindow):
|
||||
self.sidebar = Sidebar()
|
||||
self.search_box = QLineEdit()
|
||||
self.search_results = QListWidget()
|
||||
self.right_tools = RightToolsPanel(self.search_box, self.search_results)
|
||||
|
||||
self._build_window()
|
||||
self._build_actions()
|
||||
@@ -618,18 +619,11 @@ class MainWindow(QMainWindow):
|
||||
self.resize(1320, 860)
|
||||
self.setStatusBar(QStatusBar())
|
||||
|
||||
right_panel = QWidget()
|
||||
right_layout = QVBoxLayout(right_panel)
|
||||
right_layout.setContentsMargins(8, 8, 8, 8)
|
||||
right_layout.addWidget(self.search_box)
|
||||
right_layout.addWidget(self.search_results)
|
||||
right_panel.setMinimumWidth(260)
|
||||
|
||||
splitter = QSplitter()
|
||||
splitter.addWidget(self.sidebar)
|
||||
splitter.addWidget(self.viewer)
|
||||
splitter.addWidget(right_panel)
|
||||
splitter.setSizes([220, 830, 270])
|
||||
splitter.addWidget(self.right_tools)
|
||||
splitter.setSizes([220, 820, 320])
|
||||
self.setCentralWidget(splitter)
|
||||
|
||||
self.search_box.setPlaceholderText("搜索文本,按 Enter")
|
||||
@@ -778,6 +772,74 @@ class MainWindow(QMainWindow):
|
||||
help_menu.addAction(self.shortcuts_action)
|
||||
help_menu.addAction(self.open_log_dir_action)
|
||||
help_menu.addAction(self.about_action)
|
||||
self._build_right_tools_panel()
|
||||
|
||||
def _build_right_tools_panel(self) -> None:
|
||||
self.right_tools.add_section(
|
||||
"编辑 PDF",
|
||||
[
|
||||
self.add_text_action,
|
||||
self.insert_image_action,
|
||||
self.cover_action,
|
||||
self.undo_action,
|
||||
self.redo_action,
|
||||
],
|
||||
)
|
||||
self.right_tools.add_section(
|
||||
"注释",
|
||||
[
|
||||
self.highlight_action,
|
||||
self.underline_action,
|
||||
self.strikeout_action,
|
||||
self.note_action,
|
||||
self.rectangle_action,
|
||||
self.circle_action,
|
||||
self.line_action,
|
||||
self.arrow_action,
|
||||
self.annotation_list_action,
|
||||
],
|
||||
)
|
||||
self.right_tools.add_section(
|
||||
"页面",
|
||||
[
|
||||
self.rotate_action,
|
||||
self.delete_action,
|
||||
self.move_page_action,
|
||||
self.insert_blank_action,
|
||||
self.insert_pdf_action,
|
||||
self.extract_pages_action,
|
||||
self.split_pdf_action,
|
||||
self.merge_pdfs_action,
|
||||
],
|
||||
)
|
||||
self.right_tools.add_section(
|
||||
"签名与表单",
|
||||
[
|
||||
self.signature_action,
|
||||
self.draw_signature_action,
|
||||
self.form_fill_action,
|
||||
],
|
||||
)
|
||||
self.right_tools.add_section(
|
||||
"导出与安全",
|
||||
[
|
||||
self.export_current_image_action,
|
||||
self.export_pages_images_action,
|
||||
self.images_to_pdf_action,
|
||||
self.metadata_action,
|
||||
self.save_encrypted_action,
|
||||
self.remove_password_action,
|
||||
],
|
||||
)
|
||||
self.right_tools.add_section(
|
||||
"设置",
|
||||
[
|
||||
self.register_pdf_action,
|
||||
self.default_apps_action,
|
||||
self.open_log_dir_action,
|
||||
],
|
||||
)
|
||||
self.right_tools.finish()
|
||||
|
||||
def _build_toolbar(self) -> None:
|
||||
toolbar = QToolBar("主工具栏")
|
||||
|
||||
Reference in New Issue
Block a user