Skip to content

Commit 3ad6746

Browse files
authored
Add files via upload
1 parent 5c1f3dd commit 3ad6746

File tree

10 files changed

+2102
-0
lines changed

10 files changed

+2102
-0
lines changed

.gitignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
.Python
7+
build/
8+
develop-eggs/
9+
dist/
10+
downloads/
11+
eggs/
12+
.eggs/
13+
lib/
14+
lib64/
15+
parts/
16+
sdist/
17+
var/
18+
wheels/
19+
*.egg-info/
20+
.installed.cfg
21+
*.egg
22+
23+
# Virtual Environment
24+
venv/
25+
env/
26+
ENV/
27+
28+
# IDE
29+
.idea/
30+
.vscode/
31+
*.swp
32+
*.swo
33+
34+
# Logs
35+
*.log
36+
37+
# User-specific files
38+
*.bak
39+
*.tmp
40+
41+
# Program specific
42+
CursorResetPlus/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Your Name
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

build.py

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
import os
2+
import sys
3+
import shutil
4+
from cx_Freeze import setup, Executable
5+
import ttkthemes
6+
import site
7+
import pkgutil
8+
import tkinter
9+
import _tkinter
10+
11+
# 获取tkinter库路径
12+
tcl_path = os.path.dirname(_tkinter.__file__)
13+
tcl_lib = os.path.join(tcl_path, 'tcl8.6')
14+
tk_lib = os.path.join(tcl_path, 'tk8.6')
15+
16+
# 获取ttkthemes的主题文件路径
17+
themes_path = os.path.join(os.path.dirname(ttkthemes.__file__), "themes")
18+
19+
# 获取所有主题文件
20+
theme_files = []
21+
for root, dirs, files in os.walk(themes_path):
22+
for file in files:
23+
full_path = os.path.join(root, file)
24+
rel_path = os.path.relpath(full_path, os.path.dirname(ttkthemes.__file__))
25+
theme_files.append((full_path, os.path.join("lib", "ttkthemes", rel_path)))
26+
27+
# 获取所有PIL插件
28+
pil_plugins = []
29+
plugin_dir = os.path.join(os.path.dirname(pkgutil.get_loader("PIL").get_filename()), "plugins")
30+
if os.path.exists(plugin_dir):
31+
for file in os.listdir(plugin_dir):
32+
if file.endswith('.py'):
33+
pil_plugins.append(f"PIL.{os.path.splitext(file)[0]}")
34+
35+
# 添加TCL/TK库文件
36+
tcl_tk_files = []
37+
if os.path.exists(tcl_lib):
38+
for root, dirs, files in os.walk(tcl_lib):
39+
for file in files:
40+
full_path = os.path.join(root, file)
41+
rel_path = os.path.relpath(full_path, tcl_lib)
42+
tcl_tk_files.append((full_path, os.path.join("lib", "tcl8.6", rel_path)))
43+
44+
if os.path.exists(tk_lib):
45+
for root, dirs, files in os.walk(tk_lib):
46+
for file in files:
47+
full_path = os.path.join(root, file)
48+
rel_path = os.path.relpath(full_path, tk_lib)
49+
tcl_tk_files.append((full_path, os.path.join("lib", "tk8.6", rel_path)))
50+
51+
# 依赖项
52+
build_exe_options = {
53+
"packages": [
54+
"tkinter",
55+
"ttkthemes",
56+
"psutil",
57+
"requests",
58+
"PIL",
59+
"json",
60+
"uuid",
61+
"logging",
62+
"webbrowser",
63+
"threading",
64+
"datetime",
65+
"platform",
66+
"shutil",
67+
"ctypes",
68+
"urllib3",
69+
"idna",
70+
"certifi",
71+
"chardet",
72+
"win32api",
73+
"win32con",
74+
"win32gui",
75+
] + pil_plugins,
76+
"includes": [
77+
"tkinter.ttk",
78+
"PIL._tkinter_finder",
79+
"ttkthemes.themed_tk",
80+
"pkg_resources",
81+
"appdirs",
82+
],
83+
"include_files": [
84+
("cursor_reset_plus.manifest", "cursor_reset_plus.manifest"),
85+
("LICENSE", "LICENSE"),
86+
("README.md", "README.md"),
87+
("requirements.txt", "requirements.txt"),
88+
("icon.ico", "icon.ico"),
89+
] + theme_files + tcl_tk_files,
90+
"include_msvcr": True,
91+
"zip_include_packages": "*",
92+
"zip_exclude_packages": [],
93+
"excludes": ["test", "unittest", "pdb", "pydev", "pydevd"],
94+
"optimize": 2,
95+
"build_exe": "dist/CursorResetPlus"
96+
}
97+
98+
# 目标文件
99+
base = None
100+
if sys.platform == "win32":
101+
base = "Win32GUI" # 使用Windows GUI
102+
103+
# 创建可执行文件
104+
setup(
105+
name="Cursor Reset Plus",
106+
version="2.0.0",
107+
description="Cursor Reset Plus - 重置 Cursor IDE 设备标识的跨平台工具",
108+
options={"build_exe": build_exe_options},
109+
executables=[
110+
Executable(
111+
"cursor_reset_plus.py",
112+
base=base,
113+
target_name="CursorResetPlus.exe",
114+
icon="icon.ico" if os.path.exists("icon.ico") else None,
115+
manifest="cursor_reset_plus.manifest",
116+
shortcut_name="Cursor Reset Plus",
117+
shortcut_dir="DesktopFolder",
118+
copyright="Copyright © 2024",
119+
uac_admin=True # 请求管理员权限
120+
)
121+
]
122+
)

0 commit comments

Comments
 (0)