From f61e0665f7ab1795db449d05a62a4be0fb2dcea9 Mon Sep 17 00:00:00 2001 From: MistEO Date: Wed, 18 Dec 2024 12:03:38 +0800 Subject: [PATCH] chore: missing rename --- docs/en_us/1.1-QuickStarted.md | 4 ++-- docs/en_us/NodeJS/J1.1-QuickStarted.md | 6 +++--- ...1.1-\345\277\253\351\200\237\345\274\200\345\247\213.md" | 4 ++-- ...1.1-\345\277\253\351\200\237\345\274\200\345\247\213.md" | 6 +++--- sample/nodejs/main.ts | 2 +- sample/python/__main__.py | 2 +- source/MaaFramework/API/MaaTasker.cpp | 2 +- source/MaaFramework/API/MaaTypes.h | 2 +- source/MaaFramework/Tasker/Tasker.cpp | 2 +- source/MaaFramework/Tasker/Tasker.h | 2 +- source/binding/NodeJS/release/maa-node/src/maa.d.ts | 2 +- source/binding/NodeJS/release/maa-node/src/tasker.ts | 4 ++-- source/binding/NodeJS/src/instance/tasker.cpp | 4 ++-- source/binding/Python/maa/tasker.py | 2 +- test/nodejs/binding.ts | 2 +- test/python/binding_test.py | 6 +++--- 16 files changed, 26 insertions(+), 26 deletions(-) diff --git a/docs/en_us/1.1-QuickStarted.md b/docs/en_us/1.1-QuickStarted.md index 97eb779ea..798aed401 100644 --- a/docs/en_us/1.1-QuickStarted.md +++ b/docs/en_us/1.1-QuickStarted.md @@ -85,7 +85,7 @@ You can use low-code as a "wrapper" for invocation or register custom callbacks. # This is pseudo code, for reference only, and cannot be run directly # "Recognize and click the start button", "Recognize and click the confirmation icon" and so on are all logic in Json def main(): - detail = tasker.post_pipeline("Recognize and click the start button").wait().get() + detail = tasker.post_task("Recognize and click the start button").wait().get() if detail.completed: tasker.controller.post_click(100, 100).wait() @@ -95,7 +95,7 @@ def main(): save_to_file(image) tasker.resource.register_custom_action("MyAction", MyAction()) - tasker.post_pipeline("Recognize and click the confirmation icon").wait() + tasker.post_task("Recognize and click the confirmation icon").wait() image: np.ndarray = tasker.controller.post_screencap().wait().get() ``` diff --git a/docs/en_us/NodeJS/J1.1-QuickStarted.md b/docs/en_us/NodeJS/J1.1-QuickStarted.md index 45b29e0cb..f733be63f 100644 --- a/docs/en_us/NodeJS/J1.1-QuickStarted.md +++ b/docs/en_us/NodeJS/J1.1-QuickStarted.md @@ -76,7 +76,7 @@ async function main() { // Launch task. Task1 is declared in pipeline/Task.json if (await tskr - .post_pipeline('Task1') + .post_task('Task1') .wait().success) { console.log('success!') } @@ -87,7 +87,7 @@ main() ## Alter Resource Behavior on NodeJS Side -Take a look at this code `await tskr.post_pipeline('task', 'Task1').wait()` +Take a look at this code `await tskr.post_task('task', 'Task1').wait()` Function `post` can be called with three params. The third one is an object, which has exact the same structure to json in `pipeline`, and will override the original `pipeline`. Thus, you can pass an object here to control the task (even create new task). @@ -97,7 +97,7 @@ Function `post` can be called with three params. The third one is an object, whi // 通过第三个参数, 创建了一个新的任务Task2, 然后执行它 // 此处创建的任务仅在当前执行中有效 await tskr - .post_pipeline('Task2', { + .post_task('Task2', { Task2: { next: [ 'Task1' diff --git "a/docs/zh_cn/1.1-\345\277\253\351\200\237\345\274\200\345\247\213.md" "b/docs/zh_cn/1.1-\345\277\253\351\200\237\345\274\200\345\247\213.md" index 4ac8aa4d5..76d336345 100644 --- "a/docs/zh_cn/1.1-\345\277\253\351\200\237\345\274\200\345\247\213.md" +++ "b/docs/zh_cn/1.1-\345\277\253\351\200\237\345\274\200\345\247\213.md" @@ -85,7 +85,7 @@ class MyAction(CustomAction): # 此处为伪代码,仅供参考思路,无法直接运行 # "识别并点击开始按钮", "识别并点击确认图标" 等均为 Json 中的逻辑 def main(): - detail = tasker.post_pipeline("识别并点击开始按钮").wait().get() + detail = tasker.post_task("识别并点击开始按钮").wait().get() if detail.completed: tasker.controller.post_click(100, 100).wait() @@ -95,7 +95,7 @@ def main(): save_to_file(image) tasker.resource.register_custom_action("MyAction", MyAction()) - tasker.post_pipeline("识别并点击确认图标").wait() + tasker.post_task("识别并点击确认图标").wait() image: np.ndarray = tasker.controller.post_screencap().wait().get() ``` diff --git "a/docs/zh_cn/NodeJS/J1.1-\345\277\253\351\200\237\345\274\200\345\247\213.md" "b/docs/zh_cn/NodeJS/J1.1-\345\277\253\351\200\237\345\274\200\345\247\213.md" index f9edd3b02..e9ee1bdfc 100644 --- "a/docs/zh_cn/NodeJS/J1.1-\345\277\253\351\200\237\345\274\200\345\247\213.md" +++ "b/docs/zh_cn/NodeJS/J1.1-\345\277\253\351\200\237\345\274\200\345\247\213.md" @@ -76,7 +76,7 @@ async function main() { // 执行任务, Task1定义在pipeline/Task.json if (await tskr - .post_pipeline('Task1') + .post_task('Task1') .wait().success) { console.log('success!') } @@ -87,7 +87,7 @@ main() ## 在JS侧影响资源行为 -注意执行任务的这段代码`await tskr.post_pipeline('task', 'Task1').wait()` +注意执行任务的这段代码`await tskr.post_task('task', 'Task1').wait()` `post`函数可以传入第三个参数, 该参数是一个对象, 其结构和`pipeline`下的json完全一致, 会覆盖在原有的`pipeline`之上. 因此, 可以通过在此处传入一个对象来实现控制任务(甚至创建新的任务). @@ -95,7 +95,7 @@ main() // 通过第三个参数, 创建了一个新的任务Task2, 然后执行它 // 此处创建的任务仅在当前执行中有效 await tskr - .post_pipeline('Task2', { + .post_task('Task2', { Task2: { next: [ 'Task1' diff --git a/sample/nodejs/main.ts b/sample/nodejs/main.ts index e16a7b624..94e6070cb 100644 --- a/sample/nodejs/main.ts +++ b/sample/nodejs/main.ts @@ -76,7 +76,7 @@ async function main() { res.register_custom_recognizer('MyRec', my_reco) - let task_detail = await tskr.post_pipeline('StartUpAndClickButton').wait().get() + let task_detail = await tskr.post_task('StartUpAndClickButton').wait().get() tskr.destroy() ctrl.destroy() diff --git a/sample/python/__main__.py b/sample/python/__main__.py index 3f97c1bd2..ce70af748 100644 --- a/sample/python/__main__.py +++ b/sample/python/__main__.py @@ -43,7 +43,7 @@ def main(): resource.register_custom_recognition("MyRec", MyRecongition()) - task_detail = tasker.post_pipeline("StartUpAndClickButton").wait().get() + task_detail = tasker.post_task("StartUpAndClickButton").wait().get() # do something with task_detail diff --git a/source/MaaFramework/API/MaaTasker.cpp b/source/MaaFramework/API/MaaTasker.cpp index 40ff39b32..3a21a9a12 100644 --- a/source/MaaFramework/API/MaaTasker.cpp +++ b/source/MaaFramework/API/MaaTasker.cpp @@ -89,7 +89,7 @@ MaaTaskId MaaTaskerPostTask(MaaTasker* tasker, const char* entry, const char* pi return MaaInvalidId; } - return tasker->post_pipeline(entry, ov_opt->as_object()); + return tasker->post_task(entry, ov_opt->as_object()); } MaaStatus MaaTaskerStatus(const MaaTasker* tasker, MaaTaskId id) diff --git a/source/MaaFramework/API/MaaTypes.h b/source/MaaFramework/API/MaaTypes.h index 6defb39a9..201cb91ec 100644 --- a/source/MaaFramework/API/MaaTypes.h +++ b/source/MaaFramework/API/MaaTypes.h @@ -77,7 +77,7 @@ struct MaaTasker virtual bool set_option(MaaTaskerOption key, MaaOptionValue value, MaaOptionValueSize val_size) = 0; - virtual MaaTaskId post_pipeline(const std::string& entry, const json::object& pipeline_override) = 0; + virtual MaaTaskId post_task(const std::string& entry, const json::object& pipeline_override) = 0; virtual MaaStatus status(MaaTaskId task_id) const = 0; virtual MaaStatus wait(MaaTaskId task_id) const = 0; diff --git a/source/MaaFramework/Tasker/Tasker.cpp b/source/MaaFramework/Tasker/Tasker.cpp index 64d75f3ae..df4100433 100644 --- a/source/MaaFramework/Tasker/Tasker.cpp +++ b/source/MaaFramework/Tasker/Tasker.cpp @@ -69,7 +69,7 @@ bool Tasker::set_option(MaaTaskerOption key, MaaOptionValue value, MaaOptionValu return false; } -MaaTaskId Tasker::post_pipeline(const std::string& entry, const json::object& pipeline_override) +MaaTaskId Tasker::post_task(const std::string& entry, const json::object& pipeline_override) { LogInfo << VAR(entry) << VAR(pipeline_override); diff --git a/source/MaaFramework/Tasker/Tasker.h b/source/MaaFramework/Tasker/Tasker.h index 5578e2568..f47609ff1 100644 --- a/source/MaaFramework/Tasker/Tasker.h +++ b/source/MaaFramework/Tasker/Tasker.h @@ -30,7 +30,7 @@ class Tasker : public MaaTasker virtual bool set_option(MaaTaskerOption key, MaaOptionValue value, MaaOptionValueSize val_size) override; - virtual MaaTaskId post_pipeline(const std::string& entry, const json::object& pipeline_override) override; + virtual MaaTaskId post_task(const std::string& entry, const json::object& pipeline_override) override; virtual MaaStatus status(MaaTaskId task_id) const override; virtual MaaStatus wait(MaaTaskId task_id) const override; diff --git a/source/binding/NodeJS/release/maa-node/src/maa.d.ts b/source/binding/NodeJS/release/maa-node/src/maa.d.ts index 83a00b4f7..82b18d9bb 100644 --- a/source/binding/NodeJS/release/maa-node/src/maa.d.ts +++ b/source/binding/NodeJS/release/maa-node/src/maa.d.ts @@ -244,7 +244,7 @@ export declare function tasker_bind_controller( controller: ControllerHandle | null ): boolean export declare function tasker_inited(handle: TaskerHandle): boolean -export declare function tasker_post_pipeline( +export declare function tasker_post_task( handle: TaskerHandle, entry: string, pipeline_override: string diff --git a/source/binding/NodeJS/release/maa-node/src/tasker.ts b/source/binding/NodeJS/release/maa-node/src/tasker.ts index 9ed301fd1..e0f881e6b 100644 --- a/source/binding/NodeJS/release/maa-node/src/tasker.ts +++ b/source/binding/NodeJS/release/maa-node/src/tasker.ts @@ -117,11 +117,11 @@ export class TaskerBase { } } - post_pipeline(entry: string, param: Record = {}) { + post_task(entry: string, param: Record = {}) { return new TaskJob( this, this.#source, - maa.tasker_post_pipeline(this.handle, entry, JSON.stringify(param)) + maa.tasker_post_task(this.handle, entry, JSON.stringify(param)) ) } diff --git a/source/binding/NodeJS/src/instance/tasker.cpp b/source/binding/NodeJS/src/instance/tasker.cpp index 8b0886a5d..d4f543b84 100644 --- a/source/binding/NodeJS/src/instance/tasker.cpp +++ b/source/binding/NodeJS/src/instance/tasker.cpp @@ -85,7 +85,7 @@ bool tasker_inited(Napi::External info) return MaaTaskerInited(info.Data()->handle); } -MaaTaskId tasker_post_pipeline(Napi::External info, std::string entry, std::string overr) +MaaTaskId tasker_post_task(Napi::External info, std::string entry, std::string overr) { return MaaTaskerPostTask(info.Data()->handle, entry.c_str(), overr.c_str()); } @@ -208,7 +208,7 @@ void load_instance_tasker(Napi::Env env, Napi::Object& exports, Napi::External Controller: def inited(self) -> bool: return bool(Library.framework.MaaTaskerInited(self._handle)) - def post_pipeline(self, entry: str, pipeline_override: Dict = {}) -> JobWithResult: + def post_task(self, entry: str, pipeline_override: Dict = {}) -> JobWithResult: taskid = Library.framework.MaaTaskerPostTask( self._handle, *Tasker._gen_post_param(entry, pipeline_override), diff --git a/test/nodejs/binding.ts b/test/nodejs/binding.ts index ef9720cd7..4652092ec 100644 --- a/test/nodejs/binding.ts +++ b/test/nodejs/binding.ts @@ -141,7 +141,7 @@ async function api_test() { } } - let detail = await tasker.post_pipeline('Entry', ppover).wait().get() + let detail = await tasker.post_task('Entry', ppover).wait().get() if (!detail) { console.log('pipeline failed') process.exit(1) diff --git a/test/python/binding_test.py b/test/python/binding_test.py index 50c571748..b5974c9b6 100644 --- a/test/python/binding_test.py +++ b/test/python/binding_test.py @@ -122,7 +122,7 @@ def api_test(): r2.post_bundle("C:/_maafw_testing_/aaabbbccc").wait() t1 = Tasker() t2 = Tasker() - t2.post_pipeline("Entry", {}).wait() + t2.post_task("Entry", {}).wait() resource = Resource(MyNotificationHandler()) print(f"resource: {resource}") @@ -158,14 +158,14 @@ def api_test(): }, } - detail = tasker.post_pipeline("Entry", ppover).wait().get() + detail = tasker.post_task("Entry", ppover).wait().get() if detail: print(f"pipeline detail: {detail}") else: print("pipeline failed") raise RuntimeError("pipeline failed") - tasker.post_pipeline("Entry", ppover) + tasker.post_task("Entry", ppover) stopped = tasker.post_stop().wait().succeeded if not stopped: raise RuntimeError("post_stop failed")