16 Star 134 Fork 44

neucrack / COMTool

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
LGPL-3.0

COMTool

English | 中文

GitHub PyPI GitHub Workflow Status GitHub repo size GitHub Repo stars

GitHub all releases PyPI - Downloads SourceForge

跨平台开源串口调试助手,使用 python 编写


Windows Linux Raspberry Pi macOS
comtool Windows screenshot comtool linux screenshot comtool Raspberry Pi screenshot
白色主题 黑色主题 协议插件 TCP/UDP 终端 图表绘制
comtool white theme comtool dark theme comtool protocol plugin tcp udp plugin terminal plugin graph

截图可能不是最新的版本, 最新的版本只会更好用更好看

特性

  • 跨平台 (Windows, Linux, macOS, Raspberry Pi)(使用 python 编写,只要你的平台支持 python)
  • 可靠,界面不会卡死
  • 多语言支持
  • 多主题支持,支持自定义主题
  • 多种字符编码格式支持,比如 ASII,GBK(Chinese),UTF-8,UTF-16
  • 自动保存设置(退出保存)
  • 多种连接方式支持,同时支持编写连接插件
    • 串口 支持
      • 串口自动检测,支持记住上次使用的串口号
      • 串口断线自动重连
      • 波特率(随意设置)、校验、停止位、流控等设置支持
      • rtsdtr 手动控制
    • TCP/UDP 支持,包括客户端和服务端模式支持
    • SSH 客户端支持
  • 插件支持(插件开发请看docs/plugins_zh.md)),内置插件如下:
    • 调试插件,基本收发数据调试
      • 基础收发功能(字符(ASCII) 和 十六进制(HEX))
      • 收发计数
      • 清空接收缓冲区支持
      • 自动换行
      • 定时发送
      • 发送记录保存和再次选中发送
      • 自定义常用发送内容,一键发送
      • 两种常用换行符CR LF(\r\n) 和 LF(\n) 支持
      • 快捷键比如 Ctrl+Enter 发送数据
      • 转义字符支持,比如 \r \n \t \x
      • 收发记录,以及添加时间戳和记录到文件功能
      • 发送文件
      • unix 终端风格颜色支持,比如\x1b[33;42mhello\x1b[0mhello2
    • 协议插件,可自定义收发协议
      • 自定义协议编解码支持
      • 自定义快捷键发送
    • 终端插件, 基本终端功能
    • 图表插件
      • 支持动态添加图表控件,添加你需要的控件
      • 实时显示折线图,支持自定义协议头(支持转移符)
      • 自定义按钮来发送数据,支持自定义快捷键

安装

有两种安装方式:

安装可执行程序(无需安装,直接执行)

Windows

  • releasesourceforge 下载最新的可执行文件
  • 解压.zip文件,点击comtool.exe运行

另外你也可以使用 scoop 安装, 由 StudentWeis 维护

scoop bucket add Nightly https://github.com/StudentWeis/Nightly
scoop install comtool

Linux

Linux版本太多,我们只为ubuntu编译二进制。 其他发行版请从 pypi 或源码安装。 如果你有什么好的跨平台打包想法,比如 flatpak 或 appimage,你可以贡献一个 PR 或添加一个 issue 来告诉我如何可以做到

Arch Linux 及其衍生版本可以通过 AUR 仓库在线安装:(目前由 taotieren 维护):

# 发行版
yay -S python-comtool
# 开发版
yay -S python-comtool-git
  • release 页面或 sourceforge 下载最新版本
  • 如果不想使用sudo命令自动软件,则需要将当前用户添加到dialout
sudo usermod -a -G dialout $USER
grep 'dialout' /etc/group
reboot #must reboot to take effect
  • 解压.zip文件,双击comtool运行

树莓派

打开终端,先用包管理器安装依赖:

sudo apt install git python3-pyqt5 python3-numpy

先用包管理器安装 pyqt5 numpy 等包更容易安装。 后面如果 pip 安装过程中某个包遇到了错误,也可以先尝试用系统自带的包管理器安装对应的包。 找到包名的技巧就是用sudo apt-cache search 包名 | grep 包名 来搜索包名,然后安装

然后用 pip 安装剩下的包:

git clone https://github.com/Neutree/COMTool.git --depth=1
cd COMTool
pip3 install . --verbose
# 或者
# python setup.py bdist_wheel
# sudo pip3 install dist/COMTool-*.*.*-py3-none-any.whl --verbose
  • 如果不想使用sudo命令自动软件,则需要将当前用户添加到dialout
sudo usermod -a -G dialout $USER
grep 'dialout' /etc/group
reboot #must reboot to take effect

然后通过命令启动

comtool

macOS

如果你想同时打开多个comtool,只需要右键 dock 栏图标,选择新建窗口即可。

另外也可以打开终端并输入

open -n /Application/comtool.app

或者

cd /Applicatioin/comtool.app/Contents/MacOS
./comtool

因为程序没有开发者签名,所以第一次打开时会警告,需要到设置 -> 安全和隐私 -> 通用 看到提示comtool 点击 仍要打开即可

Windows Defender 显示 comtool 可执行程序是恶意软件?

如果你的软件是从这里下载的,没关系,这是打包产生的问题,所有的源码和打包脚本都在这里,连打包过程都是用github action完全自动化,没有人手动打包。

如果你仍然担心,只需下载源代码,然后使用 python运行或自己打包。

当然,如果你找到更好的打包方式,请来 issue 告诉我们。

以 python 包形式安装

对于开发者,或者没有你的平台的预编译软件, 可以使用这种方式安装

  • 先安装 Python3

    • 如果是 windowsmacOS下载 python3
    • 如果 linux: 比如ubuntusudo apt install python3 python3-pip, macOS brew install python3 python3-pip
  • 确保你有pip

pip3 --version
# 或者
pip --version

如果没有这个命令,安装

python3 -m ensurepip
  • 然后从 pypi 安装:
pip3 install comtool
comtool

在国内,为了下载速度更快, 你可以用 tuna 镜像更快地下载:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple comtool
  • 也可以直接从 github 安装
pip3 install git+https://github.com/Neutree/COMTool
  • 或者你也可以下载源码,然后从源码安装
    • 下载源码,在网页下载git clone https://github.com/Neutree/COMTool.git
    • 安装
cd COMTool
pip install .

或者自己构建 wheel 可执行文件

pip3 install wheel
python setup.py bdist_wheel
pip install dist/COMTool-*.*.*-py3-none-any.whl
comtool
  • 如果 pip 安装过程中遇到了错误,比如最容易出错的pyqt5,也可以先尝试用系统自带的包管理器安装对应的包,比如
sudo apt install python3-pyqt5 python3-numpy

要知道包名的技巧就是用sudo apt-cache search 包名 | grep 包名 来搜索包名,然后安装

  • 如果不想使用sudo命令自动软件,则需要将当前用户添加到dialout
sudo usermod -a -G dialout $USER
grep 'dialout' /etc/group
reboot #must reboot to take effect

Linux 手动添加程序图标到开始菜单

  • 复制 tool/comtool.desktop 文件到/usr/share/applications目录(可能需要 root 权限)
  • 修改/usr/share/applications/comtool.desktop,替换里面的图标路径 Icon=/usr/local/COMTool/assets/logo.ico 为实际的图标路径或者你喜欢的图标,保存即可
  • 在开始菜单里面就可以找到 comtool 应用了

打包成可执行文件

pip3 install pyinstaller
python pack.py
cd dist
ls

打包前最好创建一个虚拟环境,这样打包出来的可执行文件会小很多 pip install virtualenv virtualenv venv source venv/bin/activate # linux venv/Scripts/activate # windows 如果遇到 因为在此系统上禁止运行脚本, 可以临时允许当前终端执行脚本 Set-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned 然后pip install pyinstallerpython pack.py

开发

  1. 安装 python(>=3.8)pip3

Linux:

sudo apt install python3 python3-pip

Windows: 下载 python3

  1. 安装pyserialPyQt5等包(在requirements.txt中列出)
cd COMTool
pip3 install -r requirements.txt

在树莓派上,可以通过 apt 命令安装 python3-pyqt5

sudo pip3 install --upgrade pyserial
sudo apt install python3-pyqt5
  1. 克隆项目
git clone https://github.com/Neutree/COMTool.git
  1. 撸码、解决错误或添加新的特性

推荐使用 PyCharm IDE 或 vscode 开始

运行方法: 需要先生成翻译所需要的二进制文件(.mo)

python COMTool/i18n.py finish

然后执行主程序即可

python COMTool/Main.py
  1. 创建合并请求

快速编写你自己的插件

参考 docs/plugins.md

添加翻译

  • 先安装环境(requirments.txt中的python pip包)
apt install python3 python3-pip
pip3 install -r requirements.txt
  • 如果你需要添加新语言,否则跳过此步骤

i18n.py 中添加语言

locales=["en", "zh_CN", "zh_TW", "ja"]

将你的语言附加到此列表中,可以在 此处wikipedia,例如zh_CN表示中国大陆,对应的语言是简体汉字,zh_TW表示中国台湾,语言是繁体字,你也可以只用zh来使用中文简体字

  • 生成翻译文件
python i18n.py prepare

此命令将在 locales 文件夹中生成 .po 文件

  • 手动翻译

然后翻译.po文件,这是一个叫gettext的标准翻译文件格式,可以直接手动改文件,也可以利用网上的工具

  • 生成二进制翻译文件

为了让程序读得更快,文本文件.po应该转换成二进制文件.mo,运行命令:

python i18n.py finish

然后你可以看到locales/<locale>/LC_MESSAGES/messages.mo文件

  • 测试

运行应用程序,你会看到新的翻译

  • 合并请求

创建 PR 以将你的更改合并到 comtool 仓库

自定义主题

在源码或者二进制程序目录下的assets/qss目录中,从style-dark.qss或者style-light.qss复制一个文件,文件名为style-xxx.qss,这里xxx就是主题的名字,这样软件里就能检测到这个主题了。 然后根据你的喜好修改qss文件即可, qsscss语法类似,不过支持得不是很完全,css语法能不能用以实际效果为准哈哈。 欢迎提交主题代码(PR)

另外软件没有为主题刻意优化过,class 和 id 可能都是随手写的,所以不保证未来的代码能完全兼容现在的 qss。

问题和意见

创建 issue

开源协议

LGPL-3.0 许可证

以库的方式使用了以下开源项目:

赞赏

如果项目帮助到你了,可以请作者喝杯下午茶~

GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2016-2022 Neucrack CZD666666@gmail.com Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking thethe Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.

简介

Cross platform Serial Assistant ( 跨平台 串口调试助手 串口助手 网络调试助手 终端工具 linux windows macOS Raspberry Pi ) 展开 收起
取消

发行版 (2)

全部

贡献者

全部

近期动态

加载更多
不能加载更多了
Python
1
https://gitee.com/neutree/comtool.git
git@gitee.com:neutree/comtool.git
neutree
comtool
COMTool
master

搜索帮助