Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
55e3489
refactor: 添加获取资源路径函数,exe旁边找不到的时候回退到MEIPASS
ShadowLemoon Apr 6, 2026
e2bdac1
refactor: 使用onedir模式避免反复解压
ShadowLemoon Apr 6, 2026
ad5083e
ci: 更新打包流程适应目录打包形式
ShadowLemoon Apr 7, 2026
21dec9a
feat: 同步从MEIPASS获取资源的变动
ShadowLemoon Apr 7, 2026
ce04c5b
refactor: yaml回退移到config层
ShadowLemoon Apr 7, 2026
60ede42
feat: 从GitHub拉取更新
ShadowLemoon Apr 28, 2026
2491e3e
perf: 读取yaml返回深拷贝
ShadowLemoon May 1, 2026
c276a3a
ci: 修复上传
ShadowLemoon May 1, 2026
2aed4ac
feat: 添加检查更新
ShadowLemoon May 1, 2026
9e331f2
feat: 后台更新ghproxy链接
ShadowLemoon May 1, 2026
2ff3681
fix: address GitHub update review feedback
ShadowLemoon May 1, 2026
788714b
fix: 获取不到图像的时候不创建图像组件
ShadowLemoon May 2, 2026
84dd56b
fix: yaml失效缓存
ShadowLemoon May 2, 2026
23e8a6b
Merge branch 'main' into refactor/onedir
ShadowLemoon May 5, 2026
fe4d514
chore: 删除一个令人误解的提示
ShadowLemoon May 5, 2026
952f5d2
同步框架
ShadowLemoon May 5, 2026
91526f1
fix: 修复传入None的时候走系统代理
ShadowLemoon May 5, 2026
2b014b8
feat: 使用通用下载器并添加取消功能
ShadowLemoon May 5, 2026
d347c06
chore: 添加自更新提示
ShadowLemoon May 5, 2026
1ca4e93
fix(one_dragon): 强化代理刷新与下载检查
ShadowLemoon May 6, 2026
749fef7
fix(script_chainer): 避免重复自动刷新 ghproxy
ShadowLemoon May 6, 2026
f6d7d42
fix(one_dragon): 保持 onedir 的 YAML 兼容性
ShadowLemoon May 6, 2026
3117b83
feat(one_dragon): 同步框架变更
ShadowLemoon May 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,28 +136,32 @@ jobs:
cd deploy
pyinstaller "OneDragon ScriptChainer.spec"
pyinstaller "OneDragon ScriptChainer Runner.spec"
Copy-Item "dist/OneDragon ScriptChainer Runner.exe" -Destination "dist/OneDragon ScriptChainer/" -Force

- name: Upload Editor
if: ${{ env.CREATE_RELEASE == 'false' }}
uses: actions/upload-artifact@v4
with:
name: Editor
path: deploy/dist/OneDragon ScriptChainer.exe
name: Editor-r${{ github.run_number }}
include-hidden-files: true
path: deploy/dist/OneDragon ScriptChainer/

- name: Upload Runner
if: ${{ env.CREATE_RELEASE == 'false' }}
uses: actions/upload-artifact@v4
with:
name: Runner
name: Runner-r${{ github.run_number }}
include-hidden-files: true
path: deploy/dist/OneDragon ScriptChainer Runner.exe

- name: Upload Dist
if: ${{ env.CREATE_RELEASE == 'true' }}
uses: actions/upload-artifact@v4
with:
name: dist
include-hidden-files: true
if-no-files-found: error
path: deploy/dist
path: deploy/dist/OneDragon ScriptChainer/

release:
runs-on: windows-latest
Expand All @@ -173,7 +177,7 @@ jobs:
uses: actions/download-artifact@v4
with:
name: dist
path: .
path: OneDragon ScriptChainer

- name: Prepare release packages
shell: pwsh
Expand All @@ -182,8 +186,7 @@ jobs:
run: |
$version = $env:RELEASE_VERSION

# 在根目录打包两个 exe
Compress-Archive -Path "OneDragon ScriptChainer.exe","OneDragon ScriptChainer Runner.exe" -DestinationPath "OneDragon-ScriptChainer-$version.zip" -Force
Compress-Archive -Path "OneDragon ScriptChainer" -DestinationPath "OneDragon-ScriptChainer-$version.zip" -Force


- name: Generate Changelog
Expand Down Expand Up @@ -310,10 +313,12 @@ jobs:
### 使用方法

1. 下载 `OneDragon-ScriptChainer-${{ needs.build.outputs.version }}.zip`
2. 解压到任意目录
2. 设置中可以自更新。如需手动更新,请先删除旧版的 `.runtime` 文件夹,再解压覆盖
3. 运行 `OneDragon ScriptChainer.exe` 创建和编辑脚本链
4. 运行 `OneDragon ScriptChainer Runner.exe` 执行脚本链

> 注意:`OneDragon ScriptChainer.exe` 所在目录包含运行时依赖(`.runtime` 文件夹),请勿单独移动该文件。

### 命令行参数

`OneDragon ScriptChainer.exe` 支持以下参数:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ __pycache__/
.log/
config/script_chain/
config/custom.yml
config/push.yml
config/push.yml
config/env.yml
1 change: 0 additions & 1 deletion config/project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ github_ssh_repository: "[email protected]:OneDragon-Anything/OneDragon-ScriptChaine
gitee_https_repository: "https://gitee.com/OneDragon-Anything/OneDragon-ScriptChainer.git"
gitee_ssh_repository: "[email protected]:OneDragon-Anything/OneDragon-ScriptChainer.git"
project_git_branch: "main"
requirements: "requirements-prod.txt"
screen_standard_width: 1920
screen_standard_height: 1080
pip_source: "https://pypi.tuna.tsinghua.edu.cn/simple"
Expand Down
2 changes: 1 addition & 1 deletion deploy/OneDragon ScriptChainer Runner.spec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ a = Analysis(
['..\\src\\script_chainer\\win_exe\\script_runner.py'],
pathex=[],
binaries=[],
datas=[('../config/project.yml', 'config')],
datas=[('../config/project.yml', 'resources/config')],
hiddenimports=[],
hookspath=[],
hooksconfig={},
Expand Down
19 changes: 14 additions & 5 deletions deploy/OneDragon ScriptChainer.spec
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ a = Analysis(
pathex=[],
binaries=[],
datas=[
('../config/project.yml', 'config'),
('../assets', 'assets')
('../config/project.yml', 'resources/config'),
('../assets', 'resources/assets')
],
hiddenimports=[],
hookspath=[],
Expand All @@ -22,16 +22,14 @@ pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[],
exclude_binaries=True,
name='OneDragon ScriptChainer',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
Expand All @@ -40,4 +38,15 @@ exe = EXE(
entitlements_file=None,
uac_admin=False,
icon=['..\\assets\\ui\\editor_icon.ico'],
contents_directory='.runtime',
)

coll = COLLECT(
exe,
a.binaries,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='OneDragon ScriptChainer',
)
94 changes: 69 additions & 25 deletions src/one_dragon/base/config/yaml_config.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
import os
import shutil
from typing import Optional, List

from one_dragon.base.config.yaml_operator import YamlOperator
from one_dragon.utils import os_utils


class YamlConfig(YamlOperator):

def __init__(self,
module_name: str,
instance_idx: Optional[int] = None,
sub_dir: Optional[List[str]] = None,
sample: bool = False, copy_from_sample: bool = False,
is_mock: bool = False):
self.instance_idx: Optional[int] = instance_idx
def __init__(
self,
module_name: str,
backup_module_name: str | None = None,
instance_idx: int | None = None,
sub_dir: list[str] | None = None,
sample: bool = False, copy_from_sample: bool = False,
read_sample_only: bool = False,
is_mock: bool = False
):
self.instance_idx: int | None = instance_idx
"""传入时 该配置为一个的脚本实例独有的配置"""

self.sub_dir: Optional[List[str]] = sub_dir
self.sub_dir: list[str] | None = sub_dir
"""配置所在的子目录"""

self.module_name: str = module_name
"""配置文件名称"""

self.backup_module_name: str | None = backup_module_name
"""备用的配置文件名称 主要用于配置文件改名时做迁移使用"""

self.is_mock: bool = is_mock
"""mock情况下 不读取文件 也不会实际保存 用于测试"""

Expand All @@ -32,52 +38,90 @@ def __init__(self,
self._copy_from_sample: bool = copy_from_sample
"""配置文件不存在时 是否从sample文件中读取"""

YamlOperator.__init__(self, self._get_yaml_file_path())
self._read_sample_only: bool = read_sample_only
"""是否只读取sample文件(即使.yml文件存在也只读sample)"""
Comment thread
coderabbitai[bot] marked this conversation as resolved.

file_path, write_file_path, copy_on_write_source_path = self._get_yaml_file_paths()
YamlOperator.__init__(self, file_path)
self._write_file_path = write_file_path
self._copy_on_write_source_path = copy_on_write_source_path

def _get_yaml_file_path(self) -> Optional[str]:
def _get_yaml_file_paths(self) -> tuple[str | None, str | None, str | None]:
"""
获取配置文件的路径
如果只有sample文件,就复制一个到实例文件夹下
获取配置文件的读取路径、写入路径
:return:
"""
if self.is_mock:
return None
return None, None, None
sub_dir = ['config']
if self.instance_idx is not None:
sub_dir.append('%02d' % self.instance_idx)
if self.sub_dir is not None:
sub_dir = sub_dir + self.sub_dir

yml_path = os.path.join(os_utils.get_path_under_work_dir(*sub_dir), f'{self.module_name}.yml')
sample_yml_path = os.path.join(os_utils.get_path_under_work_dir(*sub_dir), f'{self.module_name}.sample.yml')
usage_yml_path = sample_yml_path if self._sample and not os.path.exists(yml_path) else yml_path
use_sample = self._sample and not os.path.exists(yml_path)
dir_path = os_utils.get_path_under_work_dir(*sub_dir)

yml_path = os.path.join(dir_path, f'{self.module_name}.yml')
sample_yml_path = os.path.join(dir_path, f'{self.module_name}.sample.yml')

# 只读sample文件模式
if self._read_sample_only and os.path.exists(sample_yml_path):
return sample_yml_path, sample_yml_path, None

# 指定文件存在时 直接使用
if os.path.exists(yml_path):
return yml_path, yml_path, None

if use_sample and self._copy_from_sample:
shutil.copyfile(sample_yml_path, yml_path)
usage_yml_path = yml_path
# 备用文件存在时 复制使用
if self.backup_module_name is not None:
backup_yml_path = os.path.join(dir_path, f'{self.backup_module_name}.yml')
if os.path.exists(backup_yml_path):
shutil.copyfile(backup_yml_path, yml_path)
return yml_path, yml_path, None

return usage_yml_path
# 最后看是否有示例文件
if self._sample and os.path.exists(sample_yml_path):
if self._copy_from_sample:
shutil.copyfile(sample_yml_path, yml_path)
return yml_path, yml_path, None
return sample_yml_path, yml_path, sample_yml_path

# 冻结环境回退到 MEIPASS/resources
frozen_path = os_utils.get_resource_path(*sub_dir, f'{self.module_name}.yml')
if os.path.exists(frozen_path):
return frozen_path, yml_path, frozen_path

return yml_path, yml_path, None

def _get_yaml_file_path(self) -> str | None:
file_path, write_file_path, copy_on_write_source_path = self._get_yaml_file_paths()
self._write_file_path = write_file_path
self._copy_on_write_source_path = copy_on_write_source_path
return file_path

@property
def is_sample(self) -> bool:
"""
是否样例文件
:return:
"""
if self.file_path is None:
return False
return self.file_path.endswith('.sample.yml')

def get_prop_adapter(self, prop: str,
getter_convert: Optional[str] = None,
setter_convert: Optional[str] = None):
getter_convert: str | None = None,
setter_convert: str | None = None):
"""
获取一个配置适配器
:param prop: 配置字段
:param getter_convert: 获取时的转换器
:param setter_convert: 设置时的转换器
:return:
"""
from one_dragon_qt.widgets.setting_card.yaml_config_adapter import YamlConfigAdapter
from one_dragon_qt.widgets.setting_card.yaml_config_adapter import (
YamlConfigAdapter,
)
return YamlConfigAdapter(
config=self,
field=prop,
Expand Down
Loading
Loading