mirror of
https://github.com/woodchen-ink/video2gif.git
synced 2025-07-18 13:42:03 +08:00
chore(workflow): update Python version to 3.11 and modify dependencies
Update Python version in GitHub Actions workflow to 3.11 and adjust dependencies, including excluding tkinterdnd2 and adding fallback support.
This commit is contained in:
parent
b0d557166f
commit
2bfb144320
9
.github/workflows/release.yml
vendored
9
.github/workflows/release.yml
vendored
@ -43,7 +43,7 @@ jobs:
|
|||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: '3.10'
|
python-version: '3.11'
|
||||||
|
|
||||||
- name: Download FFmpeg
|
- name: Download FFmpeg
|
||||||
run: |
|
run: |
|
||||||
@ -86,7 +86,7 @@ jobs:
|
|||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: '3.10'
|
python-version: '3.11'
|
||||||
|
|
||||||
- name: Download FFmpeg
|
- name: Download FFmpeg
|
||||||
run: |
|
run: |
|
||||||
@ -107,7 +107,10 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install -r requirements.txt
|
# 安装基本依赖,排除tkinterdnd2
|
||||||
|
pip install ffmpeg-python Pillow
|
||||||
|
# 尝试安装tkinterdnd2,但允许失败
|
||||||
|
pip install tkinterdnd2 || echo "tkinterdnd2 installation failed, continuing without it"
|
||||||
pip install pyinstaller
|
pip install pyinstaller
|
||||||
|
|
||||||
# 创建启动器脚本
|
# 创建启动器脚本
|
||||||
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
__pycache__/gui.cpython-311.pyc
|
28
gui.py
28
gui.py
@ -8,7 +8,14 @@ import webbrowser
|
|||||||
from threading import Thread
|
from threading import Thread
|
||||||
import ffmpeg
|
import ffmpeg
|
||||||
import traceback # 用于打印详细错误信息
|
import traceback # 用于打印详细错误信息
|
||||||
from tkinterdnd2 import * # 导入拖放支持
|
|
||||||
|
try:
|
||||||
|
from tkinterdnd2 import *
|
||||||
|
|
||||||
|
SUPPORT_DND = True
|
||||||
|
except ImportError:
|
||||||
|
SUPPORT_DND = False
|
||||||
|
print("Warning: tkinterdnd2 not available, drag and drop support will be disabled")
|
||||||
|
|
||||||
|
|
||||||
class FFmpegInstaller:
|
class FFmpegInstaller:
|
||||||
@ -263,10 +270,17 @@ class FFmpegInstaller:
|
|||||||
class VideoToGifConverter:
|
class VideoToGifConverter:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.check_ffmpeg_installation()
|
self.check_ffmpeg_installation()
|
||||||
self.root = TkinterDnD.Tk() # 使用支持拖放的Tk
|
|
||||||
|
# 根据是否支持拖放来创建不同的根窗口
|
||||||
|
if SUPPORT_DND:
|
||||||
|
self.root = TkinterDnD.Tk()
|
||||||
|
else:
|
||||||
|
self.root = tk.Tk()
|
||||||
|
|
||||||
self.root.title("视频转GIF工具")
|
self.root.title("视频转GIF工具")
|
||||||
|
|
||||||
# 启用文件拖放
|
# 只在支持拖放时启用相关功能
|
||||||
|
if SUPPORT_DND:
|
||||||
self.root.drop_target_register(DND_FILES)
|
self.root.drop_target_register(DND_FILES)
|
||||||
self.root.dnd_bind("<<Drop>>", self.handle_drop)
|
self.root.dnd_bind("<<Drop>>", self.handle_drop)
|
||||||
|
|
||||||
@ -461,6 +475,14 @@ class VideoToGifConverter:
|
|||||||
# 状态标签
|
# 状态标签
|
||||||
self.status_label = ttk.Label(self.root, text="就绪")
|
self.status_label = ttk.Label(self.root, text="就绪")
|
||||||
self.status_label.pack(pady=5)
|
self.status_label.pack(pady=5)
|
||||||
|
# 如果不支持拖放,添加提示
|
||||||
|
if not SUPPORT_DND:
|
||||||
|
ttk.Label(
|
||||||
|
self.file_frame,
|
||||||
|
text="注意:当前版本不支持拖放功能,请使用'选择视频'按钮",
|
||||||
|
wraplength=300,
|
||||||
|
foreground="red",
|
||||||
|
).pack(pady=5)
|
||||||
|
|
||||||
def browse_output(self):
|
def browse_output(self):
|
||||||
directory = filedialog.askdirectory()
|
directory = filedialog.askdirectory()
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
# 核心依赖
|
# 核心依赖
|
||||||
ffmpeg-python>=0.2.0 # FFmpeg Python绑定
|
ffmpeg-python>=0.2.0 # FFmpeg Python绑定
|
||||||
Pillow>=9.0.0 # 图像处理库(如果需要预览或其他图像处理功能)
|
Pillow>=9.0.0 # 图像处理库
|
||||||
|
|
||||||
# GUI增强(可选)
|
# GUI增强
|
||||||
ttkthemes>=3.2.0 # 美化GUI主题
|
tkinterdnd2>=0.4.2 # 修改为最新的可用版本
|
||||||
ttkwidgets>=0.12.0 # 额外的tkinter部件
|
|
||||||
|
|
||||||
# 开发工具(可选)
|
|
||||||
pytest>=7.0.0 # 测试框架
|
|
||||||
black>=22.0.0 # 代码格式化
|
|
||||||
flake8>=4.0.0 # 代码检查
|
|
||||||
tkinterdnd2>=3.9.0 # 拖放支持
|
|
Loading…
x
Reference in New Issue
Block a user