Polish Acrobat-style interface
This commit is contained in:
+141
-19
@@ -3,7 +3,7 @@ from __future__ import annotations
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
from PySide6.QtCore import QSignalBlocker, QSettings, QStandardPaths, Qt, QUrl
|
||||
from PySide6.QtCore import QSize, QSignalBlocker, QSettings, QStandardPaths, Qt, QUrl
|
||||
from PySide6.QtGui import QAction, QDesktopServices, QIcon, QKeySequence, QPainter
|
||||
from PySide6.QtPrintSupport import QPrintDialog, QPrinter
|
||||
from PySide6.QtWidgets import (
|
||||
@@ -854,8 +854,13 @@ class MainWindow(QMainWindow):
|
||||
self.setWindowIcon(QIcon(software_icon_path().as_posix()))
|
||||
self.resize(1320, 860)
|
||||
self.setStatusBar(QStatusBar())
|
||||
self.search_box.setObjectName("searchBox")
|
||||
self.search_results.setObjectName("searchResults")
|
||||
self.tab_widget.setObjectName("documentTabs")
|
||||
self.right_tools.setObjectName("rightToolsPanel")
|
||||
|
||||
splitter = QSplitter()
|
||||
splitter.setObjectName("mainSplitter")
|
||||
splitter.addWidget(self.tab_widget)
|
||||
splitter.addWidget(self.right_tools)
|
||||
splitter.setSizes([1040, 320])
|
||||
@@ -1111,36 +1116,63 @@ class MainWindow(QMainWindow):
|
||||
|
||||
def _build_toolbar(self) -> None:
|
||||
toolbar = QToolBar("主工具栏")
|
||||
toolbar.setObjectName("mainToolBar")
|
||||
toolbar.setMovable(False)
|
||||
toolbar.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
|
||||
toolbar.setFloatable(False)
|
||||
toolbar.setAllowedAreas(Qt.ToolBarArea.TopToolBarArea)
|
||||
toolbar.setIconSize(QSize(18, 18))
|
||||
toolbar.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextOnly)
|
||||
self.addToolBar(Qt.ToolBarArea.TopToolBarArea, toolbar)
|
||||
|
||||
for action in [
|
||||
self.open_action,
|
||||
self.save_action,
|
||||
self.save_as_action,
|
||||
self.print_action,
|
||||
]:
|
||||
toolbar.addAction(action)
|
||||
toolbar.addSeparator()
|
||||
for action in [
|
||||
self.undo_action,
|
||||
self.redo_action,
|
||||
self.print_action,
|
||||
self.export_current_image_action,
|
||||
]:
|
||||
toolbar.addAction(action)
|
||||
toolbar.addSeparator()
|
||||
for action in [
|
||||
self.previous_action,
|
||||
self.next_action,
|
||||
]:
|
||||
toolbar.addAction(action)
|
||||
toolbar.addSeparator()
|
||||
for action in [
|
||||
self.zoom_out_action,
|
||||
self.zoom_in_action,
|
||||
]:
|
||||
toolbar.addAction(action)
|
||||
zoom_label = QLabel("缩放")
|
||||
zoom_label.setObjectName("toolbarLabel")
|
||||
toolbar.addWidget(zoom_label)
|
||||
toolbar.addWidget(self.zoom_slider)
|
||||
toolbar.addWidget(self.zoom_percent_input)
|
||||
toolbar.addSeparator()
|
||||
for action in [
|
||||
self.fit_width_action,
|
||||
self.fit_page_action,
|
||||
self.go_to_page_action,
|
||||
]:
|
||||
toolbar.addAction(action)
|
||||
toolbar.addSeparator()
|
||||
for action in [
|
||||
self.highlight_action,
|
||||
self.underline_action,
|
||||
self.strikeout_action,
|
||||
self.note_action,
|
||||
self.select_object_action,
|
||||
self.freehand_action,
|
||||
]:
|
||||
toolbar.addAction(action)
|
||||
toolbar.addSeparator()
|
||||
for action in [
|
||||
self.add_text_action,
|
||||
self.place_text_action,
|
||||
self.insert_image_action,
|
||||
@@ -1148,14 +1180,23 @@ class MainWindow(QMainWindow):
|
||||
self.signature_action,
|
||||
self.place_signature_action,
|
||||
self.draw_signature_action,
|
||||
]:
|
||||
toolbar.addAction(action)
|
||||
toolbar.addSeparator()
|
||||
for action in [
|
||||
self.rectangle_action,
|
||||
self.circle_action,
|
||||
self.arrow_action,
|
||||
]:
|
||||
toolbar.addAction(action)
|
||||
toolbar.addSeparator()
|
||||
for action in [
|
||||
self.rotate_action,
|
||||
self.delete_action,
|
||||
self.move_page_action,
|
||||
self.page_manager_action,
|
||||
self.insert_blank_action,
|
||||
self.export_current_image_action,
|
||||
]:
|
||||
toolbar.addAction(action)
|
||||
|
||||
@@ -1706,29 +1747,110 @@ class MainWindow(QMainWindow):
|
||||
if self.dark_mode:
|
||||
self.setStyleSheet(
|
||||
"""
|
||||
QMainWindow { background: #242424; color: #eeeeee; }
|
||||
QMenuBar, QMenu, QToolBar {
|
||||
background: #303030; color: #eeeeee; border-color: #444444;
|
||||
QMainWindow { background: #242628; color: #f1f1f1; }
|
||||
QMenuBar, QMenu {
|
||||
background: #2f3235; color: #f1f1f1; border-color: #464a4f;
|
||||
}
|
||||
QToolButton { padding: 6px 8px; color: #eeeeee; }
|
||||
QLineEdit {
|
||||
padding: 7px; background: #1f1f1f; color: #eeeeee;
|
||||
border: 1px solid #565656; border-radius: 3px;
|
||||
QMenuBar::item:selected, QMenu::item:selected { background: #3f6fb5; color: #ffffff; }
|
||||
QToolBar#mainToolBar {
|
||||
background: #303235; border-bottom: 1px solid #45494d;
|
||||
padding: 4px 8px; spacing: 2px;
|
||||
}
|
||||
QListWidget, QTabWidget::pane {
|
||||
background: #1f1f1f; color: #eeeeee; border: 1px solid #4a4a4a;
|
||||
QToolBar#mainToolBar::separator {
|
||||
background: #50545a; width: 1px; margin: 6px 8px;
|
||||
}
|
||||
QStatusBar { background: #303030; color: #eeeeee; }
|
||||
QToolButton {
|
||||
color: #f1f1f1; background: transparent; border: 1px solid transparent;
|
||||
border-radius: 4px; padding: 5px 9px;
|
||||
}
|
||||
QToolButton:hover, QPushButton#rightToolButton:hover { background: #3c4045; border-color: #555a60; }
|
||||
QToolButton:checked, QPushButton#rightToolButton:checked { background: #244a78; border-color: #4f89c8; }
|
||||
QLabel#toolbarLabel { color: #cfd3d8; padding-left: 4px; }
|
||||
QLineEdit, QSpinBox {
|
||||
padding: 6px 8px; background: #202225; color: #f1f1f1;
|
||||
border: 1px solid #555a60; border-radius: 4px;
|
||||
}
|
||||
QSlider::groove:horizontal { height: 4px; background: #555a60; border-radius: 2px; }
|
||||
QSlider::handle:horizontal { background: #5b9be3; width: 14px; margin: -5px 0; border-radius: 7px; }
|
||||
QTabWidget::pane { background: #26282b; border: 1px solid #45494d; }
|
||||
QTabBar::tab {
|
||||
background: #303235; color: #dfe3e7; border: 1px solid #45494d;
|
||||
padding: 7px 14px; margin-right: 2px;
|
||||
}
|
||||
QTabBar::tab:selected { background: #26282b; border-bottom-color: #26282b; }
|
||||
QSplitter::handle { background: #34373b; }
|
||||
QWidget#rightToolsPanel { background: #2b2e31; border-left: 1px solid #44484d; }
|
||||
QFrame#toolSection { background: #313438; border: 1px solid #44484d; border-radius: 6px; }
|
||||
QLabel#toolSectionTitle { color: #f1f1f1; font-weight: 600; padding: 2px 4px 6px 4px; }
|
||||
QPushButton#rightToolButton {
|
||||
color: #f1f1f1; text-align: left; padding: 7px 8px;
|
||||
border: 1px solid transparent; border-radius: 4px; background: transparent;
|
||||
}
|
||||
QListWidget, QListWidget#searchResults, QListWidget#thumbnailList {
|
||||
background: #202225; color: #f1f1f1; border: 1px solid #45494d; border-radius: 4px;
|
||||
}
|
||||
QListWidget::item { padding: 6px; border-radius: 4px; }
|
||||
QListWidget::item:selected { background: #244a78; color: #ffffff; }
|
||||
QScrollArea#pdfCanvas { background: #1f2022; border: none; }
|
||||
QLabel#emptyPage { background: #2d3034; color: #cfd3d8; padding: 28px; border: 1px solid #464a4f; }
|
||||
QLabel#pdfPage { background: #ffffff; color: #202020; padding: 0; border: 1px solid #53575c; }
|
||||
QStatusBar { background: #303235; color: #dfe3e7; border-top: 1px solid #45494d; }
|
||||
"""
|
||||
)
|
||||
else:
|
||||
self.setStyleSheet(
|
||||
"""
|
||||
QMainWindow { background: #ededed; }
|
||||
QToolBar { background: #f8f8f8; border-bottom: 1px solid #d2d2d2; spacing: 4px; }
|
||||
QToolButton { padding: 6px 8px; }
|
||||
QLineEdit { padding: 7px; border: 1px solid #b9b9b9; border-radius: 3px; }
|
||||
QListWidget { background: #ffffff; border: 1px solid #d0d0d0; }
|
||||
QMainWindow { background: #e6e7e9; color: #202124; }
|
||||
QMenuBar, QMenu {
|
||||
background: #ffffff; color: #202124; border-color: #d6d8dc;
|
||||
}
|
||||
QMenuBar::item:selected, QMenu::item:selected { background: #dbeafe; color: #0f3f7a; }
|
||||
QToolBar#mainToolBar {
|
||||
background: #f7f8fa; border-bottom: 1px solid #cfd2d7;
|
||||
padding: 4px 8px; spacing: 2px;
|
||||
}
|
||||
QToolBar#mainToolBar::separator {
|
||||
background: #c7cad0; width: 1px; margin: 6px 8px;
|
||||
}
|
||||
QToolButton {
|
||||
color: #25272a; background: transparent; border: 1px solid transparent;
|
||||
border-radius: 4px; padding: 5px 9px;
|
||||
}
|
||||
QToolButton:hover, QPushButton#rightToolButton:hover { background: #eceff3; border-color: #c9cdd3; }
|
||||
QToolButton:pressed, QPushButton#rightToolButton:pressed { background: #dfe6f1; }
|
||||
QToolButton:checked, QPushButton#rightToolButton:checked { background: #dbeafe; border-color: #6aa3dc; color: #0f3f7a; }
|
||||
QLabel#toolbarLabel { color: #5b6067; padding-left: 4px; }
|
||||
QLineEdit, QSpinBox {
|
||||
padding: 6px 8px; background: #ffffff; color: #202124;
|
||||
border: 1px solid #b9bec6; border-radius: 4px;
|
||||
}
|
||||
QLineEdit:focus, QSpinBox:focus { border-color: #4f8bd3; }
|
||||
QSlider::groove:horizontal { height: 4px; background: #c6cbd2; border-radius: 2px; }
|
||||
QSlider::handle:horizontal { background: #2d73c5; width: 14px; margin: -5px 0; border-radius: 7px; }
|
||||
QTabWidget::pane { background: #f1f2f4; border: 1px solid #cfd2d7; }
|
||||
QTabBar::tab {
|
||||
background: #e8eaed; color: #303236; border: 1px solid #cfd2d7;
|
||||
padding: 7px 14px; margin-right: 2px;
|
||||
}
|
||||
QTabBar::tab:selected { background: #f8f9fb; border-bottom-color: #f8f9fb; }
|
||||
QSplitter::handle { background: #d2d5da; }
|
||||
QWidget#rightToolsPanel { background: #f4f5f7; border-left: 1px solid #cfd2d7; }
|
||||
QFrame#toolSection { background: #ffffff; border: 1px solid #d8dbe0; border-radius: 6px; }
|
||||
QLabel#toolSectionTitle { color: #25272a; font-weight: 600; padding: 2px 4px 6px 4px; }
|
||||
QPushButton#rightToolButton {
|
||||
color: #25272a; text-align: left; padding: 7px 8px;
|
||||
border: 1px solid transparent; border-radius: 4px; background: transparent;
|
||||
}
|
||||
QListWidget, QListWidget#searchResults, QListWidget#thumbnailList {
|
||||
background: #ffffff; color: #202124; border: 1px solid #cfd2d7; border-radius: 4px;
|
||||
}
|
||||
QListWidget::item { padding: 6px; border-radius: 4px; }
|
||||
QListWidget::item:hover { background: #f0f3f8; }
|
||||
QListWidget::item:selected { background: #dbeafe; color: #0f3f7a; }
|
||||
QScrollArea#pdfCanvas { background: #cfd2d7; border: none; }
|
||||
QLabel#emptyPage { background: #f8f9fb; color: #5f6368; padding: 28px; border: 1px solid #d3d6dc; }
|
||||
QLabel#pdfPage { background: #ffffff; color: #202020; padding: 0; border: 1px solid #b7bbc2; }
|
||||
QStatusBar { background: #f7f8fa; color: #44484f; border-top: 1px solid #cfd2d7; }
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user