A PyQt5-based lightweight text editor
Project description
云记 (Yunji Editor)
云记是一款基于 PyQt5 的轻量文本编辑器,支持常见的纯文本编辑、查找替换、Python 语法高亮、命令行启动和简单插件扩展。
功能
- 打开、保存、另存为
- 新建窗口
- 撤销、重做、剪切、复制、粘贴
- 查找、替换、全部替换
- Python 语法高亮(
.py/.pyw) - 显示行号、设置行号颜色
- 自动换行
- 字体设置、正文颜色设置
- 命令行打开文件或目录,支持
--version、--plugin-dir、--no-plugins - 简单插件机制:从插件目录加载带有
activate(editor)的.py文件 - 状态栏显示路径、行列、编码、文件大小、缩放比例和插入/改写模式
快捷键
Ctrl+O:打开文件Ctrl+S:保存文件Ctrl+Shift+S:另存为Ctrl+N:新建窗口Ctrl+Z:撤销Ctrl+Y:重做Ctrl+X:剪切Ctrl+C:复制Ctrl+V:粘贴Ctrl+F:查找Ctrl+H:替换Ctrl+B:加粗Ctrl+I:斜体
安装和运行
从源码运行
pip install -r requirements.txt
python -m yunji.editor
以可编辑模式安装
pip install -e .
yunji
打开指定文件或目录
yunji path/to/file.txt
yunji path/to/project
yunji --version
yunji --no-plugins
yunji --plugin-dir ./plugins path/to/file.py
插件
Yunji 会自动扫描以下插件目录:
- 当前工作目录下的
plugins/ - 用户主目录下的
.yunji/plugins/
插件是普通 Python 文件,可提供 activate(editor) 函数:
def activate(editor):
editor.statusBar().showMessage("插件已加载", 3000)
也可以通过命令行指定额外插件目录:
yunji --plugin-dir ./plugins
开发
运行测试:
python -m pytest
GUI 测试默认跳过。如需在支持 Qt GUI 的环境中运行:
YUNJI_RUN_GUI_TESTS=1 python -m pytest
Windows PowerShell:
$env:YUNJI_RUN_GUI_TESTS = "1"
python -m pytest
项目结构
yunji/
editor.py # 主窗口和应用入口
text_editor.py # 文本编辑控件与行号区域
find_replace.py # 查找/替换对话框
find_service.py # 查找/替换纯逻辑
syntax_highlighter.py # Python 语法高亮
plugin_manager.py # 插件发现和加载
file_io.py # 文件读取和大小格式化
images/ # 图标资源
打包
项目使用 pyproject.toml 管理打包元数据,可构建 wheel:
python -m pip wheel . --no-deps -w dist
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
yunji-0.5.0.tar.gz
(70.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
yunji-0.5.0-py3-none-any.whl
(68.8 kB
view details)
File details
Details for the file yunji-0.5.0.tar.gz.
File metadata
- Download URL: yunji-0.5.0.tar.gz
- Upload date:
- Size: 70.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c77fc185bec1436dc22eea8261979816b22be880b5dea06c00f591ddca5feb7d
|
|
| MD5 |
3d8348ec806c1f7292e08aab9048e288
|
|
| BLAKE2b-256 |
27b7e069a35aea0fc1c14b1f9a13bd5d407f8a7e7be4c8ff9230c8eda0e810aa
|
File details
Details for the file yunji-0.5.0-py3-none-any.whl.
File metadata
- Download URL: yunji-0.5.0-py3-none-any.whl
- Upload date:
- Size: 68.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
898b492c59ea81f3c0cbf823df97c8a65420266dd43f24d23f79ac713dfe0f54
|
|
| MD5 |
301ec5a4cf00e34a8f4683a8563384f7
|
|
| BLAKE2b-256 |
5c04579d1340638ab76bffff4c60ac93b72ae81b9c85bbc8dc5df56cdacc3dbd
|