From e4e5d8d55846d885726ef9f240efa5eefdd1eb40 Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Sun, 27 Aug 2023 23:06:18 +0800 Subject: [PATCH] Opt: [ALAS] Turn type lock to type state --- module/config/argument/args.json | 33 +++++++++++++++++++++++----- module/config/argument/argument.yaml | 5 ++++- module/config/argument/override.yaml | 4 +++- module/config/config_generated.py | 2 +- module/config/config_updater.py | 5 ++++- module/config/i18n/en-US.json | 4 +++- module/config/i18n/ja-JP.json | 4 +++- module/config/i18n/zh-CN.json | 4 +++- module/config/i18n/zh-TW.json | 4 +++- 9 files changed, 51 insertions(+), 14 deletions(-) diff --git a/module/config/argument/args.json b/module/config/argument/args.json index f9f511d6d..ce81f0db1 100644 --- a/module/config/argument/args.json +++ b/module/config/argument/args.json @@ -124,9 +124,14 @@ "Restart": { "Scheduler": { "Enable": { - "type": "checkbox", + "type": "state", "value": true, - "display": "disabled" + "option": [ + true + ], + "option_bold": [ + true + ] }, "NextRun": { "type": "datetime", @@ -149,7 +154,11 @@ "Scheduler": { "Enable": { "type": "checkbox", - "value": false + "value": false, + "option": [ + true, + false + ] }, "NextRun": { "type": "datetime", @@ -363,7 +372,11 @@ "Scheduler": { "Enable": { "type": "checkbox", - "value": false + "value": false, + "option": [ + true, + false + ] }, "NextRun": { "type": "datetime", @@ -777,7 +790,11 @@ "Scheduler": { "Enable": { "type": "checkbox", - "value": false + "value": false, + "option": [ + true, + false + ] }, "NextRun": { "type": "datetime", @@ -800,7 +817,11 @@ "Scheduler": { "Enable": { "type": "checkbox", - "value": false + "value": false, + "option": [ + true, + false + ] }, "NextRun": { "type": "datetime", diff --git a/module/config/argument/argument.yaml b/module/config/argument/argument.yaml index d4a54ae7a..b4760f46f 100644 --- a/module/config/argument/argument.yaml +++ b/module/config/argument/argument.yaml @@ -5,7 +5,10 @@ # ==================== Alas ==================== Scheduler: - Enable: false + Enable: + type: checkbox + value: false + option: [ true, false] NextRun: 2020-01-01 00:00:00 Command: Alas ServerUpdate: diff --git a/module/config/argument/override.yaml b/module/config/argument/override.yaml index a8737200c..4c7d9ca12 100644 --- a/module/config/argument/override.yaml +++ b/module/config/argument/override.yaml @@ -15,8 +15,10 @@ Alas: Restart: Scheduler: Enable: + type: state value: true - display: disabled + option: [ true, ] + option_bold: [ true, ] ServerUpdate: 04:00 # ==================== Farm ==================== diff --git a/module/config/config_generated.py b/module/config/config_generated.py index bac4da7b9..affa95b62 100644 --- a/module/config/config_generated.py +++ b/module/config/config_generated.py @@ -10,7 +10,7 @@ class GeneratedConfig: """ # Group `Scheduler` - Scheduler_Enable = False + Scheduler_Enable = False # True, False Scheduler_NextRun = datetime.datetime(2020, 1, 1, 0, 0) Scheduler_Command = 'Alas' Scheduler_ServerUpdate = '04:00' diff --git a/module/config/config_updater.py b/module/config/config_updater.py index 3150c9b4d..3b0dbeea9 100644 --- a/module/config/config_updater.py +++ b/module/config/config_updater.py @@ -216,7 +216,10 @@ class ConfigGenerator: if not check_override(p, v): continue if isinstance(v, dict): - if deep_get(v, keys='type') in ['lock']: + typ = v.get('type') + if typ == 'state': + pass + elif typ == 'lock': deep_default(v, keys='display', value="disabled") elif deep_get(v, keys='value') is not None: deep_default(v, keys='display', value='hide') diff --git a/module/config/i18n/en-US.json b/module/config/i18n/en-US.json index 447870665..18df6ed87 100644 --- a/module/config/i18n/en-US.json +++ b/module/config/i18n/en-US.json @@ -42,7 +42,9 @@ }, "Enable": { "name": "Enable Task", - "help": "Join this task to scheduler.\nTask commission, research, reward are force to enable." + "help": "Join this task to scheduler.\nTask commission, research, reward are force to enable.", + "True": "Enabled", + "False": "False" }, "NextRun": { "name": "Next Run", diff --git a/module/config/i18n/ja-JP.json b/module/config/i18n/ja-JP.json index 343ba5bd6..58adc1d2a 100644 --- a/module/config/i18n/ja-JP.json +++ b/module/config/i18n/ja-JP.json @@ -42,7 +42,9 @@ }, "Enable": { "name": "Scheduler.Enable.name", - "help": "Scheduler.Enable.help" + "help": "Scheduler.Enable.help", + "True": "True", + "False": "False" }, "NextRun": { "name": "Scheduler.NextRun.name", diff --git a/module/config/i18n/zh-CN.json b/module/config/i18n/zh-CN.json index 685be4cd8..5735d26f6 100644 --- a/module/config/i18n/zh-CN.json +++ b/module/config/i18n/zh-CN.json @@ -42,7 +42,9 @@ }, "Enable": { "name": "启用该功能", - "help": "将这个任务加入调度器" + "help": "将这个任务加入调度器", + "True": "已启用", + "False": "False" }, "NextRun": { "name": "下一次运行时间", diff --git a/module/config/i18n/zh-TW.json b/module/config/i18n/zh-TW.json index 3c3c381a1..a53fb576b 100644 --- a/module/config/i18n/zh-TW.json +++ b/module/config/i18n/zh-TW.json @@ -42,7 +42,9 @@ }, "Enable": { "name": "啟用該功能", - "help": "將這個任務加入調度器\n委託、科研、收穫任務是強制打開的" + "help": "將這個任務加入調度器\n委託、科研、收穫任務是強制打開的", + "True": "已啟用", + "False": "False" }, "NextRun": { "name": "下一次執行時間",