DesktopTools
桌面端小工具
进度和计划
进度和计划 可在查看: 此处
同时计划中包含了需求原型, 以及最一开始的代码实现原型, 有兴趣可以查看😄
功能介绍
工作时长统计
- 工作时长
- 按键记录
- 疲惫提醒-强制锁屏😄
粘贴板操作
- 时间转换
- 表格数据格式化
- dict json 格式化
- TODO
- 无限粘贴板
- 自定义kv存储
工作时长统计原理
检测鼠标以及键盘移动/输入,判断正在工作中. macOS因隐私权限问题,需要额外设置,具体详参此处
实现
编程语言
Python(不会卡的太死lol)
所用库/包
- PyQt5: 实现简单界面(不想用其它包,卡的比较死^_^.....弃用,因为其授权协议问题,虽然我的是MIT不要紧,但是用了它我的协议就被升级...虽然PySide6也会升级本项目授权,但比PyQt5要好.)
- PySide6: 实现简单界面(不想用其它包,卡的不死^_^, 有MIT的实现方式欢迎改造)
- pynput: 监控鼠标键盘
- sqlalchemy: 数据库ORM,手拼字符累了,试试新东西
- yapf: 代码格式化
使用
PyPi
# 源码
git clone git@github.com:IanVzs/Halahayawa.git DesktopTools
cd DesktopTools/
make build
DesktopTools
# pypi
pip install DesktopTools[ui]
# 可选 -i https://pypi.tuna.tsinghua.edu.cn/simple
DesktopTools
源码
git clone git@github.com:IanVzs/Halahayawa.git DesktopTools
cd DesktopTools/
mkdir env
python3 -m venv ./env
source ~/env/bin/activate
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
make run # or python test.py
可根据实际情况进行适当调整
-i https://pypi.tuna.tsinghua.edu.cn/simple是使用国内pip清华源, 如果有timeout的情况可自行搜索其他源来使用,或者不使用国内源pip install -r requirements.txt
可执行程序
下载地址
在releases的Assets中, 目前只上传了windowsx64版本。
windows打包
--icon经测必须使用绝对路径.
pyinstaller --specpath=executable_files --distpath=executable_files --hidden-import=pynput.keyboard._xorg --hidden-import=pynput.mouse._xorg --hidden-import=sqlalchemy.sql.default_comparator --hidden-import=sqlalchemy.ext.baked --icon="C:\\Users\\{USERNAME}\\Desktop\\Halahayawa\\DesktopTools\\harry_potter.ico" -w -D --clean .\test.py
# cp harry_potter.ico executable_files/halahayawa 复制harry_potter.ico到程序目录
linux打包
pyinstaller --specpath=executable_files --distpath=executable_files --hidden-import=pynput.keyboard._xorg --hidden-import=pynput.mouse._xorg --hidden-import=sqlalchemy.sql.default_comparator -w -D --clean test.py
Poetry介绍
pip 管理
安装方式: pip install poetry
添加依赖
是的,Poetry提供了多种方式来自动添加依赖库。其中一种方式是使用命令poetry add,该命令允许您在不编辑pyproject.toml文件的情况下添加新的依赖项。例如,要添加requests包,版本为^2.25.1,可以运行以下命令:poetry add requests "^2.25.1"。这将会自动更新pyproject.toml文件并安装所需的依赖项。
另外,如果您已经安装了一个包,并且想要将其添加到项目中作为依赖项,可以使用poetry add命令并指定包的名称或路径。例如,要将已经安装的numpy包添加到项目中,可以运行以下命令:poetry add numpy --dev。这将在pyproject.toml文件中添加numpy作为开发依赖项,并更新虚拟环境以包含此包。
总之,Poetry提供了多种自动添加依赖项的方式,使得管理依赖项变得更加方便和高效。
手动添加依赖
要增加依赖库,可以按照以下步骤在pyproject.toml文件中进行:
- 打开
pyproject.toml文件。 - 找到
[tool.poetry.dependencies]部分,这是声明项目所需依赖的位置。 - 在该部分下方添加一个新的依赖项,格式为
包名 = 版本号。例如,如果要添加requests包,版本为^2.25.1,则可以将以下行添加到文件中:
[tool.poetry.dependencies]
requests = "^2.25.1"
- 保存文件并关闭。
需要注意的是,当您添加新的依赖项时,Poetry会自动更新项目的虚拟环境以包含这些依赖项。因此,在添加新依赖后,请运行poetry install以更新项目的虚拟环境。
Metadata
Release files for DesktopTools 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| desktoptools-0.1.5.tar.gz | 56.9 kB | Without provenance | Details for desktoptools-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| desktoptools-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for desktoptools-0.1.5-py3-none-any.whl |
Total release size: 120.5 kB
Release files / desktoptools-0.1.5.tar.gz
| Download URL | desktoptools-0.1.5.tar.gz |
|---|---|
| Size | 56.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c14f0c667c737b687526ce95e098ca9dd9341cdd2ab4ebea40970d5cfc2c9df6
|
|
BLAKE2b-256 checksum How to use checksums |
b9d65924865688eb1eab7abb0316b9224d8973e0f65b72839156788697123d6d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure
|
Release files / desktoptools-0.1.5-py3-none-any.whl
| Download URL | desktoptools-0.1.5-py3-none-any.whl |
|---|---|
| Size | 63.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7605e53215df922b49d420d5443d0a887d175afd417cb7baa48c3e924a4421a1
|
|
BLAKE2b-256 checksum How to use checksums |
1ee70c67bbeec74cbf2a58ee8196be3f24bcd6f648eb18d27c65de9ead7f1d4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure
|
Security for DesktopTools 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.