Skip to content

中国語の翻訳をREADMEに追加 #256

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CONTRIBUTING.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# 为 PyQtDarkTheme 做出贡献

欢迎你,感谢你对 PyQtDarkTheme 的关注和贡献!

我们欢迎一切形式的贡献,包括错误报告、错误修复、文档改进、功能增强以及新的想法。

## 创建开发环境

你可以从阅读以下内容开始:

- [贡献指南](https://pyqtdarktheme.readthedocs.io/en/latest/contributing.html)
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
# PyQtDarkTheme

[简体中文](README.zh.md)

PyQtDarkTheme applies a flat dark theme to QtWidgets application. There's a light theme too. Color balanced from the dark theme for easy viewing in daylight.

Check out the [complete documentation](https://pyqtdarktheme.readthedocs.io).

**Project status**

[![PyPI Latest Release](https://img.shields.io/pypi/v/pyqtdarktheme.svg?color=orange)](https://pypi.org/project/pyqtdarktheme/)
[![Python Versions](https://img.shields.io/pypi/pyversions/pyqtdarktheme.svg?color=blue)](https://www.python.org/downloads/)
[![Qt Versions](https://img.shields.io/badge/Qt-5%20|%206-blue.svg?&logo=Qt&logoWidth=18&logoColor=white)](https://www.qt.io/qt-for-python)
[![License](https://img.shields.io/github/license/5yutan5/PyQtDarkTheme.svg?color=green)](https://github.com/5yutan5/PyQtDarkTheme/blob/main/LICENSE.txt/)

**Tests**

[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/5yutan5/PyQtDarkTheme/main.svg)](https://results.pre-commit.ci/latest/github/5yutan5/PyQtDarkTheme/main)
[![codecov](https://codecov.io/gh/5yutan5/PyQtDarkTheme/branch/main/graph/badge.svg?token=RTS8O0V6SF)](https://codecov.io/gh/5yutan5/PyQtDarkTheme)
[![Documentation Status](https://readthedocs.org/projects/pyqtdarktheme/badge/?version=latest)](https://pyqtdarktheme.readthedocs.io/en/latest/?badge=latest)
Expand Down
161 changes: 161 additions & 0 deletions README.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# PyQtDarkTheme

PyQtDarkTheme 能够对 QtWidgets 应用程序应用深色主题。也有一个浅色主题。拥有从浅色主题中获得的色彩平衡,方便在日光下查看。

请查阅[完整文档中文版](https://pyqtdarkthemecn.readthedocs.io)获取更多信息。

**项目状态**

[![PyPI 最新发布版本](https://img.shields.io/pypi/v/pyqtdarktheme.svg?color=orange)](https://pypi.org/project/pyqtdarktheme/)
[![Python 版本](https://img.shields.io/pypi/pyversions/pyqtdarktheme.svg?color=blue)](https://www.python.org/downloads/)
[![Qt 版本](https://img.shields.io/badge/Qt-5%20|%206-blue.svg?&logo=Qt&logoWidth=18&logoColor=white)](https://www.qt.io/qt-for-python)
[![许可证](https://img.shields.io/github/license/5yutan5/PyQtDarkTheme.svg?color=green)](https://github.com/5yutan5/PyQtDarkTheme/blob/main/LICENSE.txt/)

**测试**

[![pre-commit.ci 状态](https://results.pre-commit.ci/badge/github/5yutan5/PyQtDarkTheme/main.svg)](https://results.pre-commit.ci/latest/github/5yutan5/PyQtDarkTheme/main)
[![codecov](https://codecov.io/gh/5yutan5/PyQtDarkTheme/branch/main/graph/badge.svg?token=RTS8O0V6SF)](https://codecov.io/gh/5yutan5/PyQtDarkTheme)
[![文档状态](https://readthedocs.org/projects/pyqtdarktheme/badge/?version=latest)](https://pyqtdarktheme.readthedocs.io/en/latest/?badge=latest)

## 特性

- 简约的深色和浅色主题
- 支持 PySide 和 PyQt
- 与操作系统的主题同步 (Mac、Windows、Linux)
- 解决不同 Qt 版本之间的风格差异
- 提供深色/浅色主题的 QPalette
- 覆盖 Qt 旧的标准图标

## 主题

### 深色主题

![深色主题的部件展示](https://raw.githubusercontent.com/5yutan5/PyQtDarkTheme/main/images/widget_gallery_dark.png)

### 浅色主题

![浅色主题的部件展示](https://raw.githubusercontent.com/5yutan5/PyQtDarkTheme/main/images/widget_gallery_light.png)

## 需求

- [Python 3.7+](https://www.python.org/downloads/)
- Qt 5.15+
- PySide6, PyQt6, PyQt5 或者 PySide2

## 安装方法

- 最新发布版本

```plaintext
pip install pyqtdarktheme
```

- 最新开发版本

```plaintext
pip install git+https://github.com/5yutan5/PyQtDarkTheme.git@main
```

## 使用方式

```Python
import sys

from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton

import qdarktheme

app = QApplication(sys.argv)
# 在你的 Qt 应用上应用完整的暗色主题。
qdarktheme.setup_theme()

main_win = QMainWindow()
push_button = QPushButton("PyQtDarkTheme!")
main_win.setCentralWidget(push_button)

main_win.show()

app.exec()
```
更多信息可以在我们的文档中找到:

- [使用指南](https://pyqtdarktheme.readthedocs.io/en/latest/how_to_use.html)

### 启用 HiDPI

```Python
# enable_hi_dpi() 必须在 QApplication 的实例化之前调用。
qdarktheme.enable_hi_dpi()
app = QApplication(sys.argv)
qdarktheme.setup_theme()
```

对于 Qt6 绑定,HiDPI “能够自动工作”而不需要使用此函数。

### 浅色主题

```Python
qdarktheme.setup_theme("light")
```

### 与操作系统的主题和强调色同步

```Python
qdarktheme.setup_theme("auto")
```

![与操作系统主题同步](https://raw.githubusercontent.com/5yutan5/PyQtDarkTheme/main/images/sync_with_os_theme.gif)

在macOS上,qdarktheme还可以与强调色同步。
![与操作系统强调色同步](https://raw.githubusercontent.com/5yutan5/PyQtDarkTheme/main/images/sync_with_os_accent.gif)

### 定制颜色

你可以定制主题颜色。

```python
# 定制强调色。
qdarktheme.setup_theme(custom_colors={"primary": "#D0BCFF"})
```

所有可定制颜色的列表,请见主题颜色参考:

- [主题颜色](https://pyqtdarktheme.readthedocs.io/en/latest/reference/theme_color.html)

### 锐利的框边

你可以更改角落的样式。

```python
# 默认是 "rounded".
stylesheet = qdarktheme.setup_theme(corner_shape="sharp")
```

### QPalette 和样式表

你也可以只加载 QPalette 和样式表。`qdarktheme.setup_theme` 内部使用以下函数。

```Python
palette = qdarktheme.load_palette(theme="dark")
stylesheet = qdarktheme.load_stylesheet(theme="dark")
```
## 示例

要查看所有 Qt 部件,请运行:

```plaintext
python -m qdarktheme.widget_gallery
```
## 许可证

PyQtDarkTheme 为的 svg 文件源自 [Material design icons](https://fonts.google.com/icons)(Apache License Version 2.0)。Qt 样式表原为 [QDarkStyleSheet](https://github.com/ColinDuquesnoy/QDarkStyleSheet)的分支(MIT License)。其他文件都受到 PyQtDarkTheme 的 MIT 许可证保护。强调色检测器(qdarktheme/_os_appearance/_accent/_mac_detect) 的设计灵感源自[darkdetect](https://github.com/albertosottile/darkdetect)(3-clause BSD License)。

## 贡献方式

所有的贡献,包括错误报告,错误修复,文档改进,增强、创意等均受到欢迎。你可以从阅读这个开始:

- [贡献指南](https://pyqtdarktheme.readthedocs.io/en/latest/contributing.html)

## 变更记录

请见[发布记录](https://github.com/5yutan5/PyQtDarkTheme/releases)。
34 changes: 17 additions & 17 deletions docs/source/contributing.rst
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
Contributing Guide
贡献指南
==================

All contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are welcome.
所有的贡献、错误报告、错误修复、文档改进、增强和想法都是受欢迎的。

Local development
本地开发
-----------------

These are the basic steps needed to start developing on PyQtDarkTheme.
以下是开始在 PyQtDarkTheme 上开发所需的基本步骤。

#. Clone PyQtDarkTheme
You will first need to clone the repository using git and place yourself in its directory:
1. 克隆 PyQtDarkTheme
首先,你需要使用 git 克隆仓库并进入其目录:

.. code-block:: bash

$ git@github.com:5yutan5/PyQtDarkTheme.git
$ cd PyQtDarkTheme
#. Install Poetry
You will need Poetry to start contributing on the PyQtDarkTheme codebase. Refer to the `Poetry documentation <https://python-poetry.org/docs/#installation>`__ to start using Poetry.
#. Create a virtual environment
Now, you will need to install the required dependency for PyQtDarkTheme with Poetry and install Qt bindings(PySide or PyQt) with pip.
2. 安装 Poetry
你需要 Poetry 来开始在 PyQtDarkTheme 代码库上贡献。参考 `Poetry 文档 <https://python-poetry.org/docs/#installation>`__ 来开始使用 Poetry
3. 创建虚拟环境
现在,你需要用 Poetry 安装 PyQtDarkTheme 所需的依赖,并用 pip 安装 Qt 绑定(PySide PyQt)。

.. code-block:: bash

$ poetry install
$ poetry run pip install PySide6

#. Run Pytest
You need to be sure that the current tests are passing on your machine:
4. 运行 Pytest
你需要确保当前的测试在你的机器上通过:

.. code-block:: bash

$ poetry run pytest tests
#. Setup pre-commit
To make sure that you don't accidentally commit code that does not follow the coding style, you can install a pre-commit hook that will check that everything is in order:
5. 设置 pre-commit
为了确保你不会意外地提交不符合编码风格的代码,你可以安装一个 pre-commit 钩子,它会检查一切是否正常:

.. code-block:: bash

$ poetry run pre-commit install
#. Check Qt theme
You can check dark/light theme with built-in app.
6. 检查 Qt 主题
你可以使用内置应用检查深色/浅色主题。

.. code-block:: bash

$ poetry run python -m qdarktheme.widget_gallery
$ poetry run python -m qdarktheme.widget_gallery
Loading