Skip to content

Commit 2f73d25

Browse files
committed
Config Editor Launch .exe Fix & .ico to .svg
1 parent 844b538 commit 2f73d25

7 files changed

Lines changed: 75 additions & 31 deletions

File tree

.github/workflows/Nuitka Packaging (Config Editor).yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- uses: actions/checkout@v6
1616

1717
- name: Set up Python (3.8, x64)
18-
uses: actions/setup-python@v5
18+
uses: actions/setup-python@v6
1919
with:
2020
python-version: '3.8'
2121
architecture: 'x64'

.github/workflows/Nuitka Packaging (Main Program).yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- uses: actions/checkout@v6
1919

2020
- name: Set up Python (3.8, x64)
21-
uses: actions/setup-python@v5
21+
uses: actions/setup-python@v6
2222
with:
2323
python-version: '3.8'
2424
architecture: 'x64'
@@ -78,11 +78,7 @@ jobs:
7878
foreach ($program in $programs) {
7979
if (Test-Path $program) {
8080
Write-Host "Packaging $program with version $version..."
81-
if ($program -like "*Core*" ) {
82-
python -m nuitka --standalone --follow-imports --python-flag="-S" --main="$program" --remove-output --windows-icon-from-ico="PythonLight.ico" --file-version="$version" --product-name="Office-Backup-Utilities" --company-name="TonyV2Intl" --product-version="$version" --copyright="Copyright (C) 2026 TonyV2Intl" --onefile --msvc=14.0
83-
} else {
84-
python -m nuitka --standalone --follow-imports --python-flag="-S" --main="$program" --remove-output --windows-icon-from-ico="PythonLight.ico" --file-version="$version" --product-name="Office-Backup-Utilities" --company-name="TonyV2Intl" --product-version="$version" --copyright="Copyright (C) 2026 TonyV2Intl" --onefile --include-data-files=./PythonLight.ico=PythonLight.ico --msvc=14.0
85-
}
81+
python -m nuitka --standalone --follow-imports --python-flag="-S" --main="$program" --remove-output --windows-icon-from-ico="PythonLight.ico" --file-version="$version" --product-name="Office-Backup-Utilities" --company-name="TonyV2Intl" --product-version="$version" --copyright="Copyright (C) 2026 TonyV2Intl" --onefile --msvc=14.0
8682
} else {
8783
Write-Warning "File $program not found, skipping..."
8884
}

ConfigEditor.py

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ class ConfigEditor:
88
def __init__(self, root):
99
self.root = root
1010
self.root.title("Office Backup Utility Config Editor")
11-
self.root.geometry("700x400")
11+
self.root.geometry("700x450")
1212
self.root.resizable(True, True)
1313
# 设置窗口最小尺寸
14-
self.root.minsize(600, 400)
14+
self.root.minsize(700, 450)
1515

1616
# 使用系统默认字体
1717
self.font = None
@@ -102,7 +102,7 @@ def create_widgets(self):
102102
button_frame.pack(side=tk.RIGHT, padx=5, pady=5, fill=tk.Y)
103103

104104
# 其他按钮
105-
ttk.Button(button_frame, text="启动", command=self.start_program, takefocus=False,width=5).pack(side=tk.RIGHT, padx=5, fill=tk.Y)
105+
ttk.Button(button_frame, text="一键启动", command=self.start_program, takefocus=False, width=10).pack(side=tk.RIGHT, padx=5, fill=tk.Y)
106106
# 键名显示模式切换按钮
107107
initial_text = "切换到原始键名" if self.key_name_mode == "simple" else "切换到简明键名"
108108
self.key_name_button = ttk.Button(button_frame, text=initial_text, command=self.toggle_key_name_mode, takefocus=False)
@@ -875,25 +875,42 @@ def start_program(self):
875875

876876
# 根据版本确定程序文件
877877
program_files = {
878-
"5.0": "OfficebackupSingle5.0.py",
879-
"6.0": "Officebackup6.0.py",
880-
"6.0Core": "Officebackup6.0Core.py"
878+
"5.0": "OfficebackupSingle5.0",
879+
"6.0": "Officebackup6.0",
880+
"6.0Core": "Officebackup6.0Core"
881881
}
882882

883883
if version in program_files:
884-
program_file = program_files[version]
885-
if os.path.exists(program_file):
886-
# 启动程序
884+
base_name = program_files[version]
885+
# 优先尝试启动 py 文件
886+
py_file = f"{base_name}.py"
887+
if os.path.exists(py_file):
888+
# 启动 py 文件
887889
try:
888890
import subprocess
889-
subprocess.Popen(["python", program_file])
891+
subprocess.Popen(["python", py_file])
892+
self.status_var.set(f"已启动{version}版本程序")
893+
messagebox.showinfo("成功", f"已启动{version}版本程序")
894+
return
895+
except Exception as e:
896+
messagebox.showerror("错误", f"启动程序失败: {str(e)}")
897+
self.status_var.set("启动程序失败")
898+
return
899+
900+
# 如果 py 文件不存在,尝试启动 exe 文件
901+
exe_file = f"{base_name}.exe"
902+
if os.path.exists(exe_file):
903+
# 启动 exe 文件
904+
try:
905+
import subprocess
906+
subprocess.Popen([exe_file])
890907
self.status_var.set(f"已启动{version}版本程序")
891908
messagebox.showinfo("成功", f"已启动{version}版本程序")
892909
except Exception as e:
893910
messagebox.showerror("错误", f"启动程序失败: {str(e)}")
894911
self.status_var.set("启动程序失败")
895912
else:
896-
messagebox.showerror("错误", f"程序文件不存在: {program_file}")
913+
messagebox.showerror("错误", f"程序文件不存在: {py_file}{exe_file}")
897914
self.status_var.set("程序文件不存在")
898915
else:
899916
messagebox.showerror("错误", "无效的版本")

Officebackup6.0.py

Lines changed: 31 additions & 12 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)