Skip to content

ShengSir1/SharpChmod

Repository files navigation

SharpChmod

SharpChmod 是一个 Linux 文件权限计算器,用 Python Tkinter 编写。它可以帮助你快速计算 chmod 权限值,并生成可复制的 chmod 命令。

功能

  • 勾选所有者、用户组、其他人的读 / 写 / 执行权限
  • 输入八进制权限,例如 7556444755
  • 输入符号权限,例如 rwxr-xr-xrw-r--r--
  • 支持 setuidsetgidsticky 特殊权限位
  • 自动生成 chmod 命令
  • 一键复制命令
  • 常用权限预设
  • 说明区域支持滚动,窗口变小时也能查看完整内容

双击运行

如果当前电脑已经安装 Python 3,推荐双击:

start_chmod_calculator.pyw

如果 .pyw 没反应,可以双击备用启动器:

start_chmod_calculator.vbs

备用启动器会依次尝试使用 pywpypythonwpython 启动程序。

命令行运行

在项目目录中执行:

py -3 chmod_calculator.py

或:

python chmod_calculator.py

没有 Python 环境怎么办

如果目标电脑没有安装 Python,不能直接运行 .py / .pyw 文件。

这种情况需要使用打包后的 exe:

dist\SharpChmod.exe

只要 exe 已经打包完成,目标电脑不需要安装 Python,双击 SharpChmod.exe 即可运行。

重新打包 exe

如果修改了源码,需要重新生成 exe,可以安装并使用 PyInstaller:

py -3 -m pip install pyinstaller
py -3 -m PyInstaller --onefile --windowed --name SharpChmod chmod_calculator.py

打包完成后,程序会生成在:

dist\SharpChmod.exe

如果项目里已经有 SharpChmod.spec,也可以使用:

py -3 -m PyInstaller SharpChmod.spec

测试

运行单元测试:

py -3 -m unittest test_chmod_calculator.py

语法检查:

py -3 -m py_compile chmod_calculator.py start_chmod_calculator.pyw test_chmod_calculator.py

文件说明

  • chmod_calculator.py:主程序
  • start_chmod_calculator.pyw:无控制台窗口启动器
  • start_chmod_calculator.vbs:Windows 备用双击启动器
  • test_chmod_calculator.py:权限计算逻辑测试
  • SharpChmod.spec:PyInstaller 打包配置
  • dist\SharpChmod.exe:打包后的可执行文件

About

一个使用 Python Tkinter 编写的 Linux chmod 文件权限计算器,支持八进制权限、rwx 符号权限、特殊权限位、chmod 命令生成和 exe 打包。

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors