1
1
mirror of https://github.com/KenanZhu/AutoLibrary.git synced 2026-06-18 07:23:03 +08:00

refactor(style): 统一项目代码风格,整理导入顺序、间距规范与方法排列

- GUI 模块统一 QtCore → QtGui → QtWidgets 导入排列,各类独占一行按字母排序
- 统一类间两空行、类内方法间一空行、函数间一空行的间距规范
- 统一方法排列顺序:__init__ → setupUi → connectSignals → public → Slot → private
- 统一 _widgets 中 ConditionRowFrame/ActionStepFrame 方法命名(populate* / toScript / updateValueWidget)
- LibTimeSelector 迁入 operators/abs 抽象层

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-24 13:14:27 +08:00
parent a03ab38279
commit 5e898180c7
42 changed files with 780 additions and 1008 deletions
-15
View File
@@ -45,7 +45,6 @@ _DEFAULT_BY_TYPE: dict[str, str | int | float | bool] = {
"Boolean": False,
}
def _getLua(
):
"""
@@ -59,7 +58,6 @@ def _getLua(
_registerHelpers(_lua)
return _lua
def _sandbox(
lua,
) -> None:
@@ -92,7 +90,6 @@ def _sandbox(
end
""")
def _registerHelpers(
lua,
) -> None:
@@ -154,7 +151,6 @@ def _registerHelpers(
end
""")
def _navigatePath(
data: dict,
key_path: list,
@@ -171,7 +167,6 @@ def _navigatePath(
return default
return d.get(key_path[-1], default)
def _assignPath(
data: dict,
key_path: list,
@@ -186,7 +181,6 @@ def _assignPath(
d = d.setdefault(key, {})
d[key_path[-1]] = value
def _pyTypeToASType(
value
) -> str:
@@ -204,7 +198,6 @@ def _pyTypeToASType(
return "String"
return "Unknown"
def _checkDateFormat(
date_str: str,
var_name: str = "",
@@ -223,7 +216,6 @@ def _checkDateFormat(
f"应为 YYYY-MM-DD"
)
def _checkTimeFormat(
time_str: str,
var_name: str = "",
@@ -242,7 +234,6 @@ def _checkTimeFormat(
f"应为 HH:MM"
)
def _checkType(
var_name: str,
var_type: str,
@@ -306,7 +297,6 @@ def _checkType(
)
return
def addTargetVar(
name: str,
var_type: str,
@@ -328,7 +318,6 @@ def addTargetVar(
"key_path": key_path,
}
def resetEngine(
) -> None:
"""
@@ -340,7 +329,6 @@ def resetEngine(
_TARGET_VARS = {}
_lua = None
def _push(
target_data: dict,
) -> None:
@@ -384,7 +372,6 @@ def _push(
raw = _DEFAULT_BY_TYPE.get(vt, False)
g[var_name] = raw
def _pull(
target_data: dict,
) -> None:
@@ -413,7 +400,6 @@ def _pull(
_checkType(var_name, vt, lua_val)
_assignPath(target_data, info["key_path"], lua_val)
def _cleanLuaError(
raw_msg: str
) -> str:
@@ -427,7 +413,6 @@ def _cleanLuaError(
msg = msg[:stack_idx].strip()
return msg
def execute(
script_text: str,
target_data: dict,