Skip to main content

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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yunji-0.5.0-py3-none-any.whl (68.8 kB view details)

Uploaded Python 3

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

Hashes for yunji-0.5.0.tar.gz
Algorithm Hash digest
SHA256 c77fc185bec1436dc22eea8261979816b22be880b5dea06c00f591ddca5feb7d
MD5 3d8348ec806c1f7292e08aab9048e288
BLAKE2b-256 27b7e069a35aea0fc1c14b1f9a13bd5d407f8a7e7be4c8ff9230c8eda0e810aa

See more details on using hashes here.

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

Hashes for yunji-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 898b492c59ea81f3c0cbf823df97c8a65420266dd43f24d23f79ac713dfe0f54
MD5 301ec5a4cf00e34a8f4683a8563384f7
BLAKE2b-256 5c04579d1340638ab76bffff4c60ac93b72ae81b9c85bbc8dc5df56cdacc3dbd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page