1
1
mirror of https://github.com/KenanZhu/AutoLibrary.git synced 2026-06-22 17:33: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
+5 -11
View File
@@ -42,7 +42,6 @@ class ALAutoScriptOrchDialog(QDialog):
self.addBlock()
self.scrollLayout.addStretch()
def setupUi(
self
):
@@ -70,7 +69,6 @@ class ALAutoScriptOrchDialog(QDialog):
self.btnBox.button(QDialogButtonBox.StandardButton.Cancel).setText("取消")
mainLayout.addWidget(self.btnBox)
def connectSignals(
self
):
@@ -79,8 +77,7 @@ class ALAutoScriptOrchDialog(QDialog):
self.btnBox.rejected.connect(self.reject)
self.addBlockBtn.clicked.connect(self.addBlock)
def _updateBlockTypeRestrictions(
def updateBlockTypeRestrictions(
self
):
@@ -89,7 +86,6 @@ class ALAutoScriptOrchDialog(QDialog):
block.setPrevBlockType(prevType)
prevType = block.getBlockType()
def addBlock(
self
):
@@ -98,10 +94,10 @@ class ALAutoScriptOrchDialog(QDialog):
len(self._blocks), self._varMgr, parent=self
)
block.deleteBlockBtn.clicked.connect(lambda: self.removeBlock(block))
block.typeCombo.currentIndexChanged.connect(self._updateBlockTypeRestrictions)
block.typeCombo.currentIndexChanged.connect(self.updateBlockTypeRestrictions)
block.addActionStep()
self._blocks.append(block)
self._updateBlockTypeRestrictions()
self.updateBlockTypeRestrictions()
if self.scrollLayout.count() > 0:
lastItem = self.scrollLayout.itemAt(
self.scrollLayout.count() - 1
@@ -113,7 +109,6 @@ class ALAutoScriptOrchDialog(QDialog):
return
self.scrollLayout.addWidget(block)
def removeBlock(
self,
block: ConditionalBlock
@@ -135,8 +130,7 @@ class ALAutoScriptOrchDialog(QDialog):
else:
blk.typeCombo.setEnabled(True)
blk.refreshVarCombos()
self._updateBlockTypeRestrictions()
self.updateBlockTypeRestrictions()
def getScript(
self
@@ -151,7 +145,7 @@ class ALAutoScriptOrchDialog(QDialog):
blockType = block.getBlockType()
if blockType == "IF" and prevType is not None:
parts.append("end")
lines = block.toScriptLines()
lines = block.toScript()
parts.extend(lines)
prevType = blockType
if self._blocks and self._blocks[0].getBlockType() == "IF":