Add application and document icons
This commit is contained in:
@@ -28,6 +28,8 @@ PDFReaderLite 是一个面向 Windows 的轻量 PDF 阅读与编辑工具,目
|
|||||||
- 提取指定页面
|
- 提取指定页面
|
||||||
- 按页拆分 PDF
|
- 按页拆分 PDF
|
||||||
- 合并多个 PDF
|
- 合并多个 PDF
|
||||||
|
- 程序图标
|
||||||
|
- PDF 文档图标资源
|
||||||
|
|
||||||
## 本地开发
|
## 本地开发
|
||||||
|
|
||||||
|
|||||||
@@ -8,5 +8,7 @@ if (-not (Test-Path ".\.venv\Scripts\python.exe")) {
|
|||||||
.\.venv\Scripts\python.exe -m PyInstaller `
|
.\.venv\Scripts\python.exe -m PyInstaller `
|
||||||
--onefile `
|
--onefile `
|
||||||
--windowed `
|
--windowed `
|
||||||
|
--icon resources\icons\icon_software.ico `
|
||||||
|
--add-data "resources\icons;resources\icons" `
|
||||||
--name PDFReaderLite `
|
--name PDFReaderLite `
|
||||||
main.py
|
main.py
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from PySide6.QtGui import QIcon
|
||||||
from PySide6.QtWidgets import QApplication
|
from PySide6.QtWidgets import QApplication
|
||||||
|
|
||||||
|
from pdfreaderlite.resources import software_icon_path
|
||||||
from pdfreaderlite.ui.main_window import MainWindow
|
from pdfreaderlite.ui.main_window import MainWindow
|
||||||
|
|
||||||
|
|
||||||
@@ -11,6 +13,7 @@ def main() -> int:
|
|||||||
app = QApplication(sys.argv)
|
app = QApplication(sys.argv)
|
||||||
app.setApplicationName("PDFReaderLite")
|
app.setApplicationName("PDFReaderLite")
|
||||||
app.setOrganizationName("PDFReaderLite")
|
app.setOrganizationName("PDFReaderLite")
|
||||||
|
app.setWindowIcon(QIcon(software_icon_path().as_posix()))
|
||||||
|
|
||||||
window = MainWindow()
|
window = MainWindow()
|
||||||
window.show()
|
window.show()
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
|
def resource_path(relative_path: str) -> Path:
|
||||||
|
base_path = Path(getattr(sys, "_MEIPASS", Path(__file__).resolve().parents[1]))
|
||||||
|
return base_path / relative_path
|
||||||
|
|
||||||
|
|
||||||
|
def software_icon_path() -> Path:
|
||||||
|
return resource_path("resources/icons/icon_software.ico")
|
||||||
|
|
||||||
|
|
||||||
|
def pdf_icon_path() -> Path:
|
||||||
|
return resource_path("resources/icons/icon_pdf.ico")
|
||||||
@@ -3,7 +3,7 @@ from __future__ import annotations
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from PySide6.QtCore import QSettings, Qt
|
from PySide6.QtCore import QSettings, Qt
|
||||||
from PySide6.QtGui import QAction, QKeySequence
|
from PySide6.QtGui import QAction, QIcon, QKeySequence
|
||||||
from PySide6.QtWidgets import (
|
from PySide6.QtWidgets import (
|
||||||
QFileDialog,
|
QFileDialog,
|
||||||
QInputDialog,
|
QInputDialog,
|
||||||
@@ -20,6 +20,7 @@ from PySide6.QtWidgets import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
from pdfreaderlite.core.document import PdfDocument, SearchMatch
|
from pdfreaderlite.core.document import PdfDocument, SearchMatch
|
||||||
|
from pdfreaderlite.resources import software_icon_path
|
||||||
from pdfreaderlite.ui.pdf_viewer import PdfViewer
|
from pdfreaderlite.ui.pdf_viewer import PdfViewer
|
||||||
from pdfreaderlite.ui.sidebar import Sidebar
|
from pdfreaderlite.ui.sidebar import Sidebar
|
||||||
|
|
||||||
@@ -223,6 +224,7 @@ class MainWindow(QMainWindow):
|
|||||||
|
|
||||||
def _build_window(self) -> None:
|
def _build_window(self) -> None:
|
||||||
self.setWindowTitle("PDFReaderLite")
|
self.setWindowTitle("PDFReaderLite")
|
||||||
|
self.setWindowIcon(QIcon(software_icon_path().as_posix()))
|
||||||
self.resize(1320, 860)
|
self.resize(1320, 860)
|
||||||
self.setStatusBar(QStatusBar())
|
self.setStatusBar(QStatusBar())
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 44 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 720 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 93 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.0 MiB |
Reference in New Issue
Block a user