Skip to content

Commit cb905db

Browse files
committed
feat: 添加更新功能、主题管理和测试脚本
- 新增更新管理器、下载器和相关测试脚本 - 实现系统主题自动检测和同步功能 - 添加多个测试脚本验证更新流程和主题切换 - 更新CI工作流版本号至2.0.0B2 - 新增QSS样式文件支持深色/浅色主题 - 修复构建脚本中的平台检测逻辑 - 改进更新应用脚本的文件处理逻辑 - 新增更新功能
1 parent 57b6152 commit cb905db

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+4338
-871
lines changed

.DS_Store

0 Bytes
Binary file not shown.

.github/workflows/build.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,12 @@ jobs:
2929
if: github.event_name == 'push'
3030
uses: softprops/action-gh-release@v2
3131
with:
32-
tag_name: 2.0.0B1
33-
name: 2.0.0 Beta 1
32+
tag_name: 2.0.0B2
33+
name: 2.0.0 Beta 2
3434
body: ${{ github.event.head_commit.message }}
3535
prerelease: true
3636
files: |
3737
./dist/Converter_arm64_darwin.zip
38-
./dist/convert.bin
39-
./dist/convertzip.bin
4038
build_intel:
4139
name: Build Intel
4240
runs-on: macos-13
@@ -59,10 +57,10 @@ jobs:
5957
if: github.event_name == 'push'
6058
uses: softprops/action-gh-release@v2
6159
with:
62-
tag_name: 2.0.0B1
63-
name: 2.0.0 Beta 1
60+
tag_name: 2.0.0B2
61+
name: 2.0.0 Beta 2
6462
body: ${{ github.event.head_commit.message }}
6563
prerelease: true
6664
files: |
67-
./dist/Converter_intel.zip
65+
./dist/Converter_intel_darwin.zip
6866

AppIcond.icns

1.42 MB
Binary file not shown.
136 Bytes
Binary file not shown.
643 Bytes
Binary file not shown.

__pycache__/con.cpython-313.pyc

528 Bytes
Binary file not shown.
-6.34 KB
Binary file not shown.
28.6 KB
Binary file not shown.
-3.5 KB
Binary file not shown.

build_nk.py

Lines changed: 5 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ def compile_gui():
3232
"--macos-create-app-bundle", # Create macOS app bundle
3333
"--macos-app-icon=" + os.path.join(current_dir,"AppIcon.icns"), # App icon
3434
"--include-data-file=" + os.path.join(current_dir,"zip.png")+ f"=./zip.png",
35+
"--include-data-file=" + os.path.join(current_dir,"update","update_apply.command")+ f"=./update_apply.command",
3536
"--include-data-file=" + os.path.join(current_dir,"zipd.png")+ f"=./zipd.png",
3637
"--include-data-file=" + os.path.join(current_dir,"AppIcon.png")+ f"=./AppIcon.png",
3738
"--include-data-file=" + os.path.join(current_dir,"AppIcond.png")+ f"=./AppIcond.png",
39+
"--include-data-dir="+os.path.join(current_dir,"qss")+"=./qss",
3840
"--macos-app-name=Converter", # App name
3941
"--macos-app-mode=gui",
4042
"--macos-app-version=2.0",
@@ -74,86 +76,7 @@ def compile_gui():
7476
print(f"Unexpected error during compilation: {e}")
7577
return False
7678

77-
def compile_cli():
78-
"""Compile the CLI application using Nuitka"""
79-
print("Compiling CLI application with Nuitka...")
80-
81-
# Get the current directory
82-
current_dir = os.path.dirname(os.path.abspath(__file__))
83-
84-
# Define the main script to compile
85-
main_script = os.path.join(current_dir, "support", "convert.py")
86-
87-
# Check if the main script exists
88-
if not os.path.exists(main_script):
89-
print(f"Error: Main script not found at {main_script}")
90-
return False
91-
92-
# Nuitka compilation command for CLI
93-
cmd = [
94-
sys.executable, "-m", "nuitka",
95-
"--standalone", # Create standalone executable
96-
"--onefile", # Create single file executable
97-
"--output-dir=dist", # Output directory
98-
"--remove-output", # Remove build directory after compilation
99-
"--quiet", # Reduce output verbosity
100-
main_script
101-
]
102-
103-
try:
104-
print("Running Nuitka compilation for CLI...")
105-
result = subprocess.run(cmd, check=True, capture_output=True, text=True)
106-
print("CLI Compilation successful!")
107-
print("Executable created in dist/ directory")
108-
return True
109-
except subprocess.CalledProcessError as e:
110-
print("CLI Compilation failed!")
111-
print(f"Error: {e}")
112-
print(f"stderr: {e.stderr}")
113-
return False
114-
except Exception as e:
115-
print(f"Unexpected error during CLI compilation: {e}")
116-
return False
117-
def compile_cli_zip():
118-
"""Compile the CLI application using Nuitka"""
119-
print("Compiling CLI (Zip_Converter) application with Nuitka...")
120-
121-
# Get the current directory
122-
current_dir = os.path.dirname(os.path.abspath(__file__))
123-
124-
# Define the main script to compile
125-
main_script = os.path.join(current_dir, "support", "convertzip.py")
126-
127-
# Check if the main script exists
128-
if not os.path.exists(main_script):
129-
print(f"Error: Main script not found at {main_script}")
130-
return False
131-
132-
# Nuitka compilation command for CLI
133-
cmd = [
134-
sys.executable, "-m", "nuitka",
135-
"--standalone", # Create standalone executable
136-
"--onefile", # Create single file executable
137-
"--output-dir=dist", # Output directory
138-
"--remove-output", # Remove build directory after compilation
139-
"--quiet", # Reduce output verbosity
140-
main_script
141-
]
142-
143-
try:
144-
print("Running Nuitka compilation for CLI...")
145-
result = subprocess.run(cmd, check=True, capture_output=True, text=True)
146-
print("CLI Compilation successful!")
147-
print("Executable created in dist/ directory")
148-
return True
149-
except subprocess.CalledProcessError as e:
150-
print("CLI Compilation failed!")
151-
print(f"Error: {e}")
152-
print(f"stderr: {e.stderr}")
153-
return False
154-
except Exception as e:
155-
print(f"Unexpected error during CLI compilation: {e}")
156-
return False
79+
15780

15881
def main():
15982
print("PNG to ICNS Converter - Compilation Script")
@@ -167,21 +90,14 @@ def main():
16790
# Compile both versions
16891
gui_success = compile_gui()
16992
print()
170-
cli_success = compile_cli()
171-
print()
172-
zip_success = compile_cli_zip()
93+
17394
print("\n" + "=" * 40)
174-
if gui_success and cli_success and zip_success:
95+
if gui_success:
17596
print("All compilations completed successfully!")
17697
print("Executables are located in the 'dist' directory:")
17798
print("- GUI application: dist/launcher.app")
178-
print("- CLI application: dist/convert.bin")
17999
else:
180100
print("Some compilations failed. Please check the error messages above.")
181101
if not gui_success:
182102
print("- GUI compilation failed")
183-
if not cli_success:
184-
print("- CLI compilation failed")
185-
if not zip_success:
186-
print("- CLI (Zip_Converter) compilation failed")
187103

0 commit comments

Comments
 (0)