mirror of
https://github.com/KenanZhu/AutoLibrary.git
synced 2026-06-18 15:33:03 +08:00
refactor(gui): 统一 Qt 控件变量命名风格为 PascalCase
将所有 self.xxx 形式的 Qt 控件属性名以及 Qt 对象局部变量由 snake_case 重命名为 PascalCase,提升代码可读性和一致性。涉及 14 个文件,涵盖: - AutoScript 编排/编辑对话框子模块 - 配置/主窗口/用户树/座位图等核心界面组件 - 定时任务管理相关界面 - 状态标签/浏览器驱动下载对话框 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -57,81 +57,81 @@ class ConditionalBlock(QGroupBox):
|
||||
"margin-top: 5px; padding-top: 5px; }"
|
||||
)
|
||||
self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
|
||||
mainLayout = QVBoxLayout(self)
|
||||
mainLayout.setSpacing(6)
|
||||
mainLayout.setContentsMargins(8, 8, 8, 8)
|
||||
headerLayout = QHBoxLayout()
|
||||
headerLayout.setSpacing(8)
|
||||
self.typeCombo = QComboBox(self)
|
||||
self.typeCombo.addItem("IF", "IF")
|
||||
self.typeCombo.addItem("ELSE IF", "ELSE IF")
|
||||
self.typeCombo.addItem("ELSE", "ELSE")
|
||||
self.typeCombo.setFixedHeight(25)
|
||||
MainLayout = QVBoxLayout(self)
|
||||
MainLayout.setSpacing(6)
|
||||
MainLayout.setContentsMargins(8, 8, 8, 8)
|
||||
HeaderLayout = QHBoxLayout()
|
||||
HeaderLayout.setSpacing(8)
|
||||
self.TypeCombo = QComboBox(self)
|
||||
self.TypeCombo.addItem("IF", "IF")
|
||||
self.TypeCombo.addItem("ELSE IF", "ELSE IF")
|
||||
self.TypeCombo.addItem("ELSE", "ELSE")
|
||||
self.TypeCombo.setFixedHeight(25)
|
||||
if self.blockIndex == 0:
|
||||
self.typeCombo.setEnabled(False)
|
||||
headerLayout.addWidget(QLabel("类型:", self))
|
||||
headerLayout.addWidget(self.typeCombo)
|
||||
headerLayout.addStretch()
|
||||
self.deleteBlockBtn = QPushButton("删除此块", self)
|
||||
self.deleteBlockBtn.setStyleSheet("color: red;")
|
||||
self.deleteBlockBtn.setFixedHeight(25)
|
||||
headerLayout.addWidget(self.deleteBlockBtn)
|
||||
mainLayout.addLayout(headerLayout)
|
||||
self.conditionWidget = QWidget(self)
|
||||
self.conditionWidget.setSizePolicy(
|
||||
self.TypeCombo.setEnabled(False)
|
||||
HeaderLayout.addWidget(QLabel("类型:", self))
|
||||
HeaderLayout.addWidget(self.TypeCombo)
|
||||
HeaderLayout.addStretch()
|
||||
self.DeleteBlockBtn = QPushButton("删除此块", self)
|
||||
self.DeleteBlockBtn.setStyleSheet("color: red;")
|
||||
self.DeleteBlockBtn.setFixedHeight(25)
|
||||
HeaderLayout.addWidget(self.DeleteBlockBtn)
|
||||
MainLayout.addLayout(HeaderLayout)
|
||||
self.ConditionWidget = QWidget(self)
|
||||
self.ConditionWidget.setSizePolicy(
|
||||
QSizePolicy.Preferred, QSizePolicy.Preferred
|
||||
)
|
||||
condLayout = QVBoxLayout(self.conditionWidget)
|
||||
condLayout.setContentsMargins(4, 4, 4, 4)
|
||||
condLayout.setSpacing(6)
|
||||
self.condRowsLayout = QVBoxLayout()
|
||||
self.condRowsLayout.setSpacing(4)
|
||||
condLayout.addLayout(self.condRowsLayout)
|
||||
self.addCondBtn = QPushButton("+ 添加条件", self.conditionWidget)
|
||||
self.addCondBtn.setFixedHeight(25)
|
||||
condLayout.addWidget(self.addCondBtn)
|
||||
mainLayout.addWidget(self.conditionWidget)
|
||||
self.actionLabel = QLabel("执行步骤:", self)
|
||||
self.actionLabel.setFixedHeight(25)
|
||||
mainLayout.addWidget(self.actionLabel)
|
||||
self.actionsLayout = QVBoxLayout()
|
||||
self.actionsLayout.setSpacing(4)
|
||||
mainLayout.addLayout(self.actionsLayout)
|
||||
self.addActionBtn = QPushButton("+ 添加执行步骤", self)
|
||||
self.addActionBtn.setFixedHeight(25)
|
||||
mainLayout.addWidget(self.addActionBtn)
|
||||
CondLayout = QVBoxLayout(self.ConditionWidget)
|
||||
CondLayout.setContentsMargins(4, 4, 4, 4)
|
||||
CondLayout.setSpacing(6)
|
||||
self.CondRowsLayout = QVBoxLayout()
|
||||
self.CondRowsLayout.setSpacing(4)
|
||||
CondLayout.addLayout(self.CondRowsLayout)
|
||||
self.AddCondBtn = QPushButton("+ 添加条件", self.ConditionWidget)
|
||||
self.AddCondBtn.setFixedHeight(25)
|
||||
CondLayout.addWidget(self.AddCondBtn)
|
||||
MainLayout.addWidget(self.ConditionWidget)
|
||||
self.ActionLabel = QLabel("执行步骤:", self)
|
||||
self.ActionLabel.setFixedHeight(25)
|
||||
MainLayout.addWidget(self.ActionLabel)
|
||||
self.ActionsLayout = QVBoxLayout()
|
||||
self.ActionsLayout.setSpacing(4)
|
||||
MainLayout.addLayout(self.ActionsLayout)
|
||||
self.AddActionBtn = QPushButton("+ 添加执行步骤", self)
|
||||
self.AddActionBtn.setFixedHeight(25)
|
||||
MainLayout.addWidget(self.AddActionBtn)
|
||||
self.setUpdatesEnabled(True)
|
||||
|
||||
def connectSignals(
|
||||
self
|
||||
):
|
||||
|
||||
self.typeCombo.currentIndexChanged.connect(self.onTypeChanged)
|
||||
self.addCondBtn.clicked.connect(self.addConditionRow)
|
||||
self.addActionBtn.clicked.connect(self.addActionStep)
|
||||
self.TypeCombo.currentIndexChanged.connect(self.onTypeChanged)
|
||||
self.AddCondBtn.clicked.connect(self.addConditionRow)
|
||||
self.AddActionBtn.clicked.connect(self.addActionStep)
|
||||
|
||||
def addInitialConditionRow(
|
||||
self
|
||||
):
|
||||
|
||||
row = ConditionRowFrame(
|
||||
Row = ConditionRowFrame(
|
||||
self._varMgr, self.blockIndex,
|
||||
isFirst=True, parent=self
|
||||
)
|
||||
self._conditionRows.append(row)
|
||||
self.condRowsLayout.addWidget(row)
|
||||
self._conditionRows.append(Row)
|
||||
self.CondRowsLayout.addWidget(Row)
|
||||
|
||||
def addConditionRow(
|
||||
self
|
||||
):
|
||||
|
||||
row = ConditionRowFrame(
|
||||
Row = ConditionRowFrame(
|
||||
self._varMgr, self.blockIndex,
|
||||
isFirst=False, parent=self
|
||||
)
|
||||
row.deleteBtn.clicked.connect(lambda: self.removeConditionRow(row))
|
||||
self._conditionRows.append(row)
|
||||
self.condRowsLayout.addWidget(row)
|
||||
Row.DeleteBtn.clicked.connect(lambda: self.removeConditionRow(Row))
|
||||
self._conditionRows.append(Row)
|
||||
self.CondRowsLayout.addWidget(Row)
|
||||
|
||||
def removeConditionRow(
|
||||
self,
|
||||
@@ -140,7 +140,7 @@ class ConditionalBlock(QGroupBox):
|
||||
|
||||
if row in self._conditionRows and len(self._conditionRows) > 1:
|
||||
self._conditionRows.remove(row)
|
||||
self.condRowsLayout.removeWidget(row)
|
||||
self.CondRowsLayout.removeWidget(row)
|
||||
row.hide()
|
||||
row.deleteLater()
|
||||
|
||||
@@ -148,10 +148,10 @@ class ConditionalBlock(QGroupBox):
|
||||
self
|
||||
):
|
||||
|
||||
step = ActionStepFrame(self._varMgr, self.blockIndex, parent=self)
|
||||
step.deleteBtn.clicked.connect(lambda: self.removeActionStep(step))
|
||||
self._actionWidgets.append(step)
|
||||
self.actionsLayout.addWidget(step)
|
||||
Step = ActionStepFrame(self._varMgr, self.blockIndex, parent=self)
|
||||
Step.DeleteBtn.clicked.connect(lambda: self.removeActionStep(Step))
|
||||
self._actionWidgets.append(Step)
|
||||
self.ActionsLayout.addWidget(Step)
|
||||
|
||||
def removeActionStep(
|
||||
self,
|
||||
@@ -160,7 +160,7 @@ class ConditionalBlock(QGroupBox):
|
||||
|
||||
if step in self._actionWidgets:
|
||||
self._actionWidgets.remove(step)
|
||||
self.actionsLayout.removeWidget(step)
|
||||
self.ActionsLayout.removeWidget(step)
|
||||
step.hide()
|
||||
step.deleteLater()
|
||||
|
||||
@@ -168,7 +168,7 @@ class ConditionalBlock(QGroupBox):
|
||||
self
|
||||
) -> str:
|
||||
|
||||
return self.typeCombo.currentData()
|
||||
return self.TypeCombo.currentData()
|
||||
|
||||
def getConditionRows(
|
||||
self
|
||||
@@ -239,18 +239,18 @@ class ConditionalBlock(QGroupBox):
|
||||
prevType: str | None
|
||||
):
|
||||
|
||||
model = self.typeCombo.model()
|
||||
model = self.TypeCombo.model()
|
||||
if model is None:
|
||||
return
|
||||
for data in ("ELSE IF", "ELSE"):
|
||||
idx = self.typeCombo.findData(data)
|
||||
idx = self.TypeCombo.findData(data)
|
||||
if idx < 0:
|
||||
continue
|
||||
item = model.item(idx)
|
||||
shouldEnable = prevType != "ELSE"
|
||||
item.setEnabled(shouldEnable)
|
||||
if prevType == "ELSE" and self.typeCombo.currentData() in ("ELSE IF", "ELSE"):
|
||||
self.typeCombo.setCurrentIndex(0)
|
||||
if prevType == "ELSE" and self.TypeCombo.currentData() in ("ELSE IF", "ELSE"):
|
||||
self.TypeCombo.setCurrentIndex(0)
|
||||
|
||||
@Slot(int)
|
||||
def onTypeChanged(
|
||||
@@ -258,8 +258,8 @@ class ConditionalBlock(QGroupBox):
|
||||
_idx
|
||||
):
|
||||
|
||||
isCond = self.typeCombo.currentData() in ("IF", "ELSE IF")
|
||||
self.conditionWidget.setVisible(isCond)
|
||||
self.actionLabel.setText(
|
||||
isCond = self.TypeCombo.currentData() in ("IF", "ELSE IF")
|
||||
self.ConditionWidget.setVisible(isCond)
|
||||
self.ActionLabel.setText(
|
||||
"执行步骤:" if isCond else "ELSE 执行步骤:"
|
||||
)
|
||||
|
||||
@@ -40,7 +40,7 @@ class ALAutoScriptOrchDialog(QDialog):
|
||||
self.setupUi()
|
||||
self.connectSignals()
|
||||
self.addBlock()
|
||||
self.scrollLayout.addStretch()
|
||||
self.ScrollLayout.addStretch()
|
||||
|
||||
def setupUi(
|
||||
self
|
||||
@@ -49,33 +49,33 @@ class ALAutoScriptOrchDialog(QDialog):
|
||||
self.setWindowTitle("AutoScript 指令编排 - AutoLibrary")
|
||||
self.setMinimumSize(640, 600)
|
||||
self.setModal(True)
|
||||
mainLayout = QVBoxLayout(self)
|
||||
scroll = QScrollArea()
|
||||
scroll.setWidgetResizable(True)
|
||||
scroll.setFrameShape(QFrame.NoFrame)
|
||||
scrollContent = QWidget()
|
||||
self.scrollLayout = QVBoxLayout(scrollContent)
|
||||
self.scrollLayout.setSpacing(5)
|
||||
scroll.setWidget(scrollContent)
|
||||
mainLayout.addWidget(scroll)
|
||||
self.addBlockBtn = QPushButton("+ 添加判断块")
|
||||
self.addBlockBtn.setFixedHeight(25)
|
||||
mainLayout.addWidget(self.addBlockBtn)
|
||||
self.btnBox = QDialogButtonBox(
|
||||
MainLayout = QVBoxLayout(self)
|
||||
Scroll = QScrollArea()
|
||||
Scroll.setWidgetResizable(True)
|
||||
Scroll.setFrameShape(QFrame.NoFrame)
|
||||
ScrollContent = QWidget()
|
||||
self.ScrollLayout = QVBoxLayout(ScrollContent)
|
||||
self.ScrollLayout.setSpacing(5)
|
||||
Scroll.setWidget(ScrollContent)
|
||||
MainLayout.addWidget(Scroll)
|
||||
self.AddBlockBtn = QPushButton("+ 添加判断块")
|
||||
self.AddBlockBtn.setFixedHeight(25)
|
||||
MainLayout.addWidget(self.AddBlockBtn)
|
||||
self.BtnBox = QDialogButtonBox(
|
||||
QDialogButtonBox.StandardButton.Ok |
|
||||
QDialogButtonBox.StandardButton.Cancel
|
||||
)
|
||||
self.btnBox.button(QDialogButtonBox.StandardButton.Ok).setText("确定")
|
||||
self.btnBox.button(QDialogButtonBox.StandardButton.Cancel).setText("取消")
|
||||
mainLayout.addWidget(self.btnBox)
|
||||
self.BtnBox.button(QDialogButtonBox.StandardButton.Ok).setText("确定")
|
||||
self.BtnBox.button(QDialogButtonBox.StandardButton.Cancel).setText("取消")
|
||||
MainLayout.addWidget(self.BtnBox)
|
||||
|
||||
def connectSignals(
|
||||
self
|
||||
):
|
||||
|
||||
self.btnBox.accepted.connect(self.onAccept)
|
||||
self.btnBox.rejected.connect(self.reject)
|
||||
self.addBlockBtn.clicked.connect(self.addBlock)
|
||||
self.BtnBox.accepted.connect(self.onAccept)
|
||||
self.BtnBox.rejected.connect(self.reject)
|
||||
self.AddBlockBtn.clicked.connect(self.addBlock)
|
||||
|
||||
def updateBlockTypeRestrictions(
|
||||
self
|
||||
@@ -90,24 +90,24 @@ class ALAutoScriptOrchDialog(QDialog):
|
||||
self
|
||||
):
|
||||
|
||||
block = ConditionalBlock(
|
||||
Block = ConditionalBlock(
|
||||
len(self._blocks), self._varMgr, parent=self
|
||||
)
|
||||
block.deleteBlockBtn.clicked.connect(lambda: self.removeBlock(block))
|
||||
block.typeCombo.currentIndexChanged.connect(self.updateBlockTypeRestrictions)
|
||||
block.addActionStep()
|
||||
self._blocks.append(block)
|
||||
Block.DeleteBlockBtn.clicked.connect(lambda: self.removeBlock(Block))
|
||||
Block.TypeCombo.currentIndexChanged.connect(self.updateBlockTypeRestrictions)
|
||||
Block.addActionStep()
|
||||
self._blocks.append(Block)
|
||||
self.updateBlockTypeRestrictions()
|
||||
if self.scrollLayout.count() > 0:
|
||||
lastItem = self.scrollLayout.itemAt(
|
||||
self.scrollLayout.count() - 1
|
||||
if self.ScrollLayout.count() > 0:
|
||||
lastItem = self.ScrollLayout.itemAt(
|
||||
self.ScrollLayout.count() - 1
|
||||
)
|
||||
if lastItem and lastItem.spacerItem():
|
||||
self.scrollLayout.insertWidget(
|
||||
self.scrollLayout.count() - 1, block
|
||||
self.ScrollLayout.insertWidget(
|
||||
self.ScrollLayout.count() - 1, Block
|
||||
)
|
||||
return
|
||||
self.scrollLayout.addWidget(block)
|
||||
self.ScrollLayout.addWidget(Block)
|
||||
|
||||
def removeBlock(
|
||||
self,
|
||||
@@ -119,16 +119,16 @@ class ALAutoScriptOrchDialog(QDialog):
|
||||
return
|
||||
if block in self._blocks:
|
||||
self._blocks.remove(block)
|
||||
self.scrollLayout.removeWidget(block)
|
||||
self.ScrollLayout.removeWidget(block)
|
||||
block.hide()
|
||||
block.deleteLater()
|
||||
for i, blk in enumerate(self._blocks):
|
||||
blk.blockIndex = i
|
||||
if i == 0:
|
||||
blk.typeCombo.setEnabled(False)
|
||||
blk.typeCombo.setCurrentIndex(0)
|
||||
blk.TypeCombo.setEnabled(False)
|
||||
blk.TypeCombo.setCurrentIndex(0)
|
||||
else:
|
||||
blk.typeCombo.setEnabled(True)
|
||||
blk.TypeCombo.setEnabled(True)
|
||||
blk.refreshVarCombos()
|
||||
self.updateBlockTypeRestrictions()
|
||||
|
||||
|
||||
@@ -110,39 +110,39 @@ class _DateInputContainer(QWidget):
|
||||
self
|
||||
):
|
||||
|
||||
layout = QHBoxLayout(self)
|
||||
layout.setContentsMargins(0, 0, 0, 0)
|
||||
layout.setSpacing(4)
|
||||
self._modeCombo = QComboBox(self)
|
||||
self._modeCombo.addItem("相对日期", "relative")
|
||||
self._modeCombo.addItem("绝对日期", "absolute")
|
||||
self._modeCombo.setFixedHeight(25)
|
||||
self._stack = QStackedWidget(self)
|
||||
self._relCombo = QComboBox(self)
|
||||
Layout = QHBoxLayout(self)
|
||||
Layout.setContentsMargins(0, 0, 0, 0)
|
||||
Layout.setSpacing(4)
|
||||
self._ModeCombo = QComboBox(self)
|
||||
self._ModeCombo.addItem("相对日期", "relative")
|
||||
self._ModeCombo.addItem("绝对日期", "absolute")
|
||||
self._ModeCombo.setFixedHeight(25)
|
||||
self._Stack = QStackedWidget(self)
|
||||
self._RelCombo = QComboBox(self)
|
||||
for display, data in DATE_OPTIONS:
|
||||
self._relCombo.addItem(display, data)
|
||||
self._relCombo.setFixedHeight(25)
|
||||
self._stack.addWidget(self._relCombo)
|
||||
self._dateEdit = QDateEdit(self)
|
||||
self._dateEdit.setDisplayFormat("yyyy-MM-dd")
|
||||
self._dateEdit.setCalendarPopup(True)
|
||||
self._dateEdit.setFixedHeight(25)
|
||||
self._stack.addWidget(self._dateEdit)
|
||||
self._modeCombo.currentIndexChanged.connect(
|
||||
lambda i: self._stack.setCurrentIndex(i)
|
||||
self._RelCombo.addItem(display, data)
|
||||
self._RelCombo.setFixedHeight(25)
|
||||
self._Stack.addWidget(self._RelCombo)
|
||||
self._DateEdit = QDateEdit(self)
|
||||
self._DateEdit.setDisplayFormat("yyyy-MM-dd")
|
||||
self._DateEdit.setCalendarPopup(True)
|
||||
self._DateEdit.setFixedHeight(25)
|
||||
self._Stack.addWidget(self._DateEdit)
|
||||
self._ModeCombo.currentIndexChanged.connect(
|
||||
lambda i: self._Stack.setCurrentIndex(i)
|
||||
)
|
||||
layout.addWidget(self._modeCombo)
|
||||
layout.addWidget(self._stack)
|
||||
layout.addStretch()
|
||||
Layout.addWidget(self._ModeCombo)
|
||||
Layout.addWidget(self._Stack)
|
||||
Layout.addStretch()
|
||||
|
||||
def getValue(
|
||||
self
|
||||
) -> str:
|
||||
|
||||
mode = self._modeCombo.currentData()
|
||||
mode = self._ModeCombo.currentData()
|
||||
if mode == "relative":
|
||||
return self._relCombo.currentText()
|
||||
return self._dateEdit.date().toString("yyyy-MM-dd")
|
||||
return self._RelCombo.currentText()
|
||||
return self._DateEdit.date().toString("yyyy-MM-dd")
|
||||
|
||||
|
||||
class _TimeInputContainer(QWidget):
|
||||
@@ -153,19 +153,19 @@ class _TimeInputContainer(QWidget):
|
||||
):
|
||||
|
||||
super().__init__(parent)
|
||||
self._timeEdit = QTimeEdit(self)
|
||||
self._timeEdit.setDisplayFormat("HH:mm")
|
||||
self._timeEdit.setFixedHeight(25)
|
||||
self._TimeEdit = QTimeEdit(self)
|
||||
self._TimeEdit.setDisplayFormat("HH:mm")
|
||||
self._TimeEdit.setFixedHeight(25)
|
||||
|
||||
layout = QHBoxLayout(self)
|
||||
layout.setContentsMargins(0, 0, 0, 0)
|
||||
layout.addWidget(self._timeEdit)
|
||||
Layout = QHBoxLayout(self)
|
||||
Layout.setContentsMargins(0, 0, 0, 0)
|
||||
Layout.addWidget(self._TimeEdit)
|
||||
|
||||
def getValue(
|
||||
self
|
||||
) -> str:
|
||||
|
||||
return self._timeEdit.time().toString("HH:mm")
|
||||
return self._TimeEdit.time().toString("HH:mm")
|
||||
|
||||
|
||||
class _DateOffsetContainer(QWidget):
|
||||
@@ -176,20 +176,20 @@ class _DateOffsetContainer(QWidget):
|
||||
):
|
||||
|
||||
super().__init__(parent)
|
||||
self._spinBox = QSpinBox(self)
|
||||
self._spinBox.setRange(0, 99999)
|
||||
self._spinBox.setFixedHeight(25)
|
||||
self._unitCombo = QComboBox(self)
|
||||
self._SpinBox = QSpinBox(self)
|
||||
self._SpinBox.setRange(0, 99999)
|
||||
self._SpinBox.setFixedHeight(25)
|
||||
self._UnitCombo = QComboBox(self)
|
||||
for display, data in DATE_OFFSET_OPTIONS:
|
||||
self._unitCombo.addItem(display, data)
|
||||
self._unitCombo.setFixedHeight(25)
|
||||
self._UnitCombo.addItem(display, data)
|
||||
self._UnitCombo.setFixedHeight(25)
|
||||
|
||||
layout = QHBoxLayout(self)
|
||||
layout.setContentsMargins(0, 0, 0, 0)
|
||||
layout.setSpacing(4)
|
||||
layout.addWidget(self._spinBox)
|
||||
layout.addWidget(self._unitCombo)
|
||||
layout.addStretch()
|
||||
Layout = QHBoxLayout(self)
|
||||
Layout.setContentsMargins(0, 0, 0, 0)
|
||||
Layout.setSpacing(4)
|
||||
Layout.addWidget(self._SpinBox)
|
||||
Layout.addWidget(self._UnitCombo)
|
||||
Layout.addStretch()
|
||||
|
||||
def getValue(
|
||||
self
|
||||
@@ -201,8 +201,8 @@ class _DateOffsetContainer(QWidget):
|
||||
self
|
||||
) -> int:
|
||||
|
||||
val = self._spinBox.value()
|
||||
unit = self._unitCombo.currentData()
|
||||
val = self._SpinBox.value()
|
||||
unit = self._UnitCombo.currentData()
|
||||
if unit == "weeks":
|
||||
return val*7
|
||||
if unit == "months":
|
||||
@@ -220,14 +220,14 @@ class _TimeOffsetContainer(QWidget):
|
||||
):
|
||||
|
||||
super().__init__(parent)
|
||||
self._spinBox = QSpinBox(self)
|
||||
self._spinBox.setRange(0, 99999)
|
||||
self._spinBox.setSuffix(" 小时")
|
||||
self._spinBox.setFixedHeight(25)
|
||||
self._SpinBox = QSpinBox(self)
|
||||
self._SpinBox.setRange(0, 99999)
|
||||
self._SpinBox.setSuffix(" 小时")
|
||||
self._SpinBox.setFixedHeight(25)
|
||||
|
||||
layout = QHBoxLayout(self)
|
||||
layout.setContentsMargins(0, 0, 0, 0)
|
||||
layout.addWidget(self._spinBox)
|
||||
Layout = QHBoxLayout(self)
|
||||
Layout.setContentsMargins(0, 0, 0, 0)
|
||||
Layout.addWidget(self._SpinBox)
|
||||
|
||||
def getValue(
|
||||
self
|
||||
@@ -239,7 +239,7 @@ class _TimeOffsetContainer(QWidget):
|
||||
self
|
||||
) -> int:
|
||||
|
||||
return self._spinBox.value()
|
||||
return self._SpinBox.value()
|
||||
|
||||
|
||||
class VariableManager(QObject):
|
||||
@@ -364,11 +364,11 @@ def makeVarRefCombo(
|
||||
parent: QWidget = None
|
||||
) -> QComboBox:
|
||||
|
||||
cb = QComboBox(parent)
|
||||
cb.setFixedHeight(25)
|
||||
cb.setMinimumWidth(120)
|
||||
cb.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
|
||||
return cb
|
||||
Cb = QComboBox(parent)
|
||||
Cb.setFixedHeight(25)
|
||||
Cb.setMinimumWidth(120)
|
||||
Cb.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
|
||||
return Cb
|
||||
|
||||
def makeComboWidget(
|
||||
items,
|
||||
@@ -376,12 +376,12 @@ def makeComboWidget(
|
||||
parent: QWidget = None
|
||||
) -> QComboBox:
|
||||
|
||||
cb = QComboBox(parent)
|
||||
Cb = QComboBox(parent)
|
||||
for display, data in items:
|
||||
cb.addItem(display, data)
|
||||
cb.setFixedHeight(25)
|
||||
cb.setMinimumWidth(min_width)
|
||||
return cb
|
||||
Cb.addItem(display, data)
|
||||
Cb.setFixedHeight(25)
|
||||
Cb.setMinimumWidth(min_width)
|
||||
return Cb
|
||||
|
||||
def makeLabel(
|
||||
text: str,
|
||||
@@ -389,11 +389,11 @@ def makeLabel(
|
||||
width: int = None
|
||||
) -> QLabel:
|
||||
|
||||
lbl = QLabel(text, parent)
|
||||
lbl.setFixedHeight(25)
|
||||
Lbl = QLabel(text, parent)
|
||||
Lbl.setFixedHeight(25)
|
||||
if width:
|
||||
lbl.setFixedWidth(width)
|
||||
return lbl
|
||||
Lbl.setFixedWidth(width)
|
||||
return Lbl
|
||||
|
||||
def getValueFromWidget(
|
||||
w: QWidget
|
||||
|
||||
@@ -66,42 +66,42 @@ class ConditionRowFrame(QFrame):
|
||||
self.setFrameShape(QFrame.StyledPanel)
|
||||
self.setFrameShadow(QFrame.Raised)
|
||||
self.setFixedHeight(32)
|
||||
layout = QHBoxLayout(self)
|
||||
layout.setContentsMargins(2, 2, 2, 2)
|
||||
layout.setSpacing(4)
|
||||
Layout = QHBoxLayout(self)
|
||||
Layout.setContentsMargins(2, 2, 2, 2)
|
||||
Layout.setSpacing(4)
|
||||
if self._isFirst:
|
||||
self.logicCombo = None
|
||||
self.LogicCombo = None
|
||||
else:
|
||||
self.logicCombo = makeComboWidget(LOGIC_OPTIONS, min_width=110, parent=self)
|
||||
layout.addWidget(self.logicCombo)
|
||||
self.leftVarCombo = QComboBox(self)
|
||||
self.leftVarCombo.setFixedHeight(25)
|
||||
self.leftVarCombo.setMinimumWidth(120)
|
||||
self.leftVarCombo.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
|
||||
self.LogicCombo = makeComboWidget(LOGIC_OPTIONS, min_width=110, parent=self)
|
||||
Layout.addWidget(self.LogicCombo)
|
||||
self.LeftVarCombo = QComboBox(self)
|
||||
self.LeftVarCombo.setFixedHeight(25)
|
||||
self.LeftVarCombo.setMinimumWidth(120)
|
||||
self.LeftVarCombo.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
|
||||
self.populateLeftVarCombo()
|
||||
layout.addWidget(self.leftVarCombo)
|
||||
self.opCombo = makeComboWidget(COMPARE_OPTIONS, min_width=80, parent=self)
|
||||
layout.addWidget(self.opCombo)
|
||||
self._compTypeCombo = makeComboWidget([
|
||||
Layout.addWidget(self.LeftVarCombo)
|
||||
self.OpCombo = makeComboWidget(COMPARE_OPTIONS, min_width=80, parent=self)
|
||||
Layout.addWidget(self.OpCombo)
|
||||
self._CompTypeCombo = makeComboWidget([
|
||||
("特定值", "literal"),
|
||||
("变量", "variable"),
|
||||
], min_width=70, parent=self)
|
||||
layout.addWidget(self._compTypeCombo)
|
||||
self.rhsStack = QStackedWidget(self)
|
||||
self.rhsStack.setFixedHeight(25)
|
||||
Layout.addWidget(self._CompTypeCombo)
|
||||
self.RhsStack = QStackedWidget(self)
|
||||
self.RhsStack.setFixedHeight(25)
|
||||
self.initLiteralStack()
|
||||
self.rhsVarCombo = makeVarRefCombo(self)
|
||||
self.rhsStack.addWidget(self.rhsVarCombo)
|
||||
self.rhsStack.setCurrentIndex(0)
|
||||
layout.addWidget(self.rhsStack)
|
||||
self.RhsVarCombo = makeVarRefCombo(self)
|
||||
self.RhsStack.addWidget(self.RhsVarCombo)
|
||||
self.RhsStack.setCurrentIndex(0)
|
||||
Layout.addWidget(self.RhsStack)
|
||||
if not self._isFirst:
|
||||
self.deleteBtn = QPushButton("×", self)
|
||||
self.deleteBtn.setFixedSize(25, 25)
|
||||
self.deleteBtn.setStyleSheet("color: red; font-weight: bold;")
|
||||
layout.addWidget(self.deleteBtn)
|
||||
self.DeleteBtn = QPushButton("×", self)
|
||||
self.DeleteBtn.setFixedSize(25, 25)
|
||||
self.DeleteBtn.setStyleSheet("color: red; font-weight: bold;")
|
||||
Layout.addWidget(self.DeleteBtn)
|
||||
else:
|
||||
self.deleteBtn = None
|
||||
layout.addStretch()
|
||||
self.DeleteBtn = None
|
||||
Layout.addStretch()
|
||||
self.setUpdatesEnabled(True)
|
||||
|
||||
def populateLeftVarCombo(
|
||||
@@ -111,53 +111,53 @@ class ConditionRowFrame(QFrame):
|
||||
wasBool = self._isBoolMode
|
||||
boolName = None
|
||||
if wasBool:
|
||||
data = self.leftVarCombo.currentData()
|
||||
data = self.LeftVarCombo.currentData()
|
||||
if data:
|
||||
boolName = data[0]
|
||||
self._varMgr.populateCombo(self.leftVarCombo)
|
||||
self._varMgr.populateCombo(self.LeftVarCombo)
|
||||
# Append boolean literal sentinels at the end
|
||||
self.leftVarCombo.insertSeparator(self.leftVarCombo.count())
|
||||
self.leftVarCombo.addItem("true", ("true", "Boolean"))
|
||||
self.leftVarCombo.addItem("false", ("false", "Boolean"))
|
||||
self.LeftVarCombo.insertSeparator(self.LeftVarCombo.count())
|
||||
self.LeftVarCombo.addItem("true", ("true", "Boolean"))
|
||||
self.LeftVarCombo.addItem("false", ("false", "Boolean"))
|
||||
if wasBool and boolName:
|
||||
for ci in range(self.leftVarCombo.count()):
|
||||
d = self.leftVarCombo.itemData(ci)
|
||||
for ci in range(self.LeftVarCombo.count()):
|
||||
d = self.LeftVarCombo.itemData(ci)
|
||||
if d and d[0] == boolName:
|
||||
self.leftVarCombo.setCurrentIndex(ci)
|
||||
self.LeftVarCombo.setCurrentIndex(ci)
|
||||
break
|
||||
|
||||
def populateRHSVarCombo(
|
||||
self
|
||||
):
|
||||
|
||||
self._varMgr.populateCombo(self.rhsVarCombo)
|
||||
self._varMgr.populateCombo(self.RhsVarCombo)
|
||||
|
||||
def initLiteralStack(
|
||||
self
|
||||
):
|
||||
|
||||
self.literalStack = QStackedWidget(self)
|
||||
self.literalStack.setFixedHeight(25)
|
||||
self.LiteralStack = QStackedWidget(self)
|
||||
self.LiteralStack.setFixedHeight(25)
|
||||
self._literalWidgets = {}
|
||||
for vt in getTypeOrder():
|
||||
w = makeValueWidget(vt, self.literalStack)
|
||||
self._literalWidgets[vt] = w
|
||||
self.literalStack.addWidget(w)
|
||||
self.literalStack.setCurrentWidget(self._literalWidgets.get("String"))
|
||||
self.rhsStack.addWidget(self.literalStack)
|
||||
W = makeValueWidget(vt, self.LiteralStack)
|
||||
self._literalWidgets[vt] = W
|
||||
self.LiteralStack.addWidget(W)
|
||||
self.LiteralStack.setCurrentWidget(self._literalWidgets.get("String"))
|
||||
self.RhsStack.addWidget(self.LiteralStack)
|
||||
|
||||
def connectSignals(
|
||||
self
|
||||
):
|
||||
|
||||
self.leftVarCombo.currentIndexChanged.connect(self.onLeftVarChanged)
|
||||
self._compTypeCombo.currentIndexChanged.connect(self.onCompTypeChanged)
|
||||
self.LeftVarCombo.currentIndexChanged.connect(self.onLeftVarChanged)
|
||||
self._CompTypeCombo.currentIndexChanged.connect(self.onCompTypeChanged)
|
||||
|
||||
def getLogic(
|
||||
self
|
||||
) -> str:
|
||||
|
||||
return self.logicCombo.currentData() if self.logicCombo else ""
|
||||
return self.LogicCombo.currentData() if self.LogicCombo else ""
|
||||
|
||||
def updateRHSLiteralWidget(
|
||||
self,
|
||||
@@ -166,13 +166,13 @@ class ConditionRowFrame(QFrame):
|
||||
|
||||
if vartype not in self._literalWidgets:
|
||||
vartype = "String"
|
||||
self.literalStack.setCurrentWidget(self._literalWidgets[vartype])
|
||||
self.LiteralStack.setCurrentWidget(self._literalWidgets[vartype])
|
||||
|
||||
def toScript(
|
||||
self
|
||||
) -> str:
|
||||
|
||||
data = self.leftVarCombo.currentData()
|
||||
data = self.LeftVarCombo.currentData()
|
||||
if self._isBoolMode and data:
|
||||
return data[0]
|
||||
if not data:
|
||||
@@ -183,12 +183,12 @@ class ConditionRowFrame(QFrame):
|
||||
name = "datenow()"
|
||||
elif name == "CURRENT_TIME":
|
||||
name = "timenow()"
|
||||
opSym = self.opCombo.currentData()
|
||||
opSym = self.OpCombo.currentData()
|
||||
if self._rawRhsExpr:
|
||||
return f"{name} {opSym} {self._rawRhsExpr}"
|
||||
isVarRef = (self._compTypeCombo.currentData() == "variable")
|
||||
isVarRef = (self._CompTypeCombo.currentData() == "variable")
|
||||
if isVarRef:
|
||||
rd = self.rhsVarCombo.currentData()
|
||||
rd = self.RhsVarCombo.currentData()
|
||||
if rd:
|
||||
rhsName = rd[0]
|
||||
if rhsName == "CURRENT_DATE":
|
||||
@@ -196,7 +196,7 @@ class ConditionRowFrame(QFrame):
|
||||
elif rhsName == "CURRENT_TIME":
|
||||
rhsName = "timenow()"
|
||||
return f"{name} {opSym} {rhsName}"
|
||||
rhsText = self.rhsVarCombo.currentText().strip()
|
||||
rhsText = self.RhsVarCombo.currentText().strip()
|
||||
if rhsText:
|
||||
return f"{name} {opSym} {rhsText}"
|
||||
return ""
|
||||
@@ -223,15 +223,15 @@ class ConditionRowFrame(QFrame):
|
||||
self._rawRhsExpr = ""
|
||||
if idx < 0:
|
||||
return
|
||||
data = self.leftVarCombo.itemData(idx)
|
||||
data = self.LeftVarCombo.itemData(idx)
|
||||
if not data:
|
||||
return
|
||||
name, vartype = data
|
||||
isBool = name in ("true", "false")
|
||||
self._isBoolMode = isBool
|
||||
self.opCombo.setVisible(not isBool)
|
||||
self._compTypeCombo.setVisible(not isBool)
|
||||
self.rhsStack.setVisible(not isBool)
|
||||
self.OpCombo.setVisible(not isBool)
|
||||
self._CompTypeCombo.setVisible(not isBool)
|
||||
self.RhsStack.setVisible(not isBool)
|
||||
if not isBool:
|
||||
self.updateRHSLiteralWidget(vartype)
|
||||
|
||||
@@ -242,8 +242,8 @@ class ConditionRowFrame(QFrame):
|
||||
):
|
||||
|
||||
self._rawRhsExpr = ""
|
||||
isVar = (self._compTypeCombo.currentData() == "variable")
|
||||
self.rhsStack.setCurrentIndex(1 if isVar else 0)
|
||||
isVar = (self._CompTypeCombo.currentData() == "variable")
|
||||
self.RhsStack.setCurrentIndex(1 if isVar else 0)
|
||||
if isVar:
|
||||
self.populateRHSVarCombo()
|
||||
|
||||
@@ -273,52 +273,52 @@ class ActionStepFrame(QFrame):
|
||||
self.setFrameShape(QFrame.StyledPanel)
|
||||
self.setFrameShadow(QFrame.Raised)
|
||||
self.setFixedHeight(35)
|
||||
layout = QHBoxLayout(self)
|
||||
layout.setContentsMargins(2, 2, 2, 2)
|
||||
layout.setSpacing(4)
|
||||
self.opTypeCombo = makeComboWidget(ACTION_OPTIONS, min_width=70, parent=self)
|
||||
layout.addWidget(self.opTypeCombo)
|
||||
layout.addWidget(makeLabel("设置", self))
|
||||
self.targetCombo = QComboBox(self)
|
||||
self.targetCombo.setFixedHeight(25)
|
||||
self.targetCombo.setMinimumWidth(120)
|
||||
Layout = QHBoxLayout(self)
|
||||
Layout.setContentsMargins(2, 2, 2, 2)
|
||||
Layout.setSpacing(4)
|
||||
self.OpTypeCombo = makeComboWidget(ACTION_OPTIONS, min_width=70, parent=self)
|
||||
Layout.addWidget(self.OpTypeCombo)
|
||||
Layout.addWidget(makeLabel("设置", self))
|
||||
self.TargetCombo = QComboBox(self)
|
||||
self.TargetCombo.setFixedHeight(25)
|
||||
self.TargetCombo.setMinimumWidth(120)
|
||||
self.populateTargetCombo()
|
||||
layout.addWidget(self.targetCombo)
|
||||
layout.addWidget(makeLabel("为", self))
|
||||
self.valueSrcCombo = makeComboWidget([
|
||||
Layout.addWidget(self.TargetCombo)
|
||||
Layout.addWidget(makeLabel("为", self))
|
||||
self.ValueSrcCombo = makeComboWidget([
|
||||
("特定值", "literal"),
|
||||
("变量", "variable"),
|
||||
], min_width=70, parent=self)
|
||||
layout.addWidget(self.valueSrcCombo)
|
||||
self.valueStack = QStackedWidget(self)
|
||||
self.valueStack.setFixedHeight(25)
|
||||
Layout.addWidget(self.ValueSrcCombo)
|
||||
self.ValueStack = QStackedWidget(self)
|
||||
self.ValueStack.setFixedHeight(25)
|
||||
self.initValueStacks()
|
||||
layout.addWidget(self.valueStack)
|
||||
self.existingVarCombo = makeVarRefCombo(self)
|
||||
self.existingVarCombo.setVisible(False)
|
||||
layout.addWidget(self.existingVarCombo)
|
||||
self.deleteBtn = QPushButton("×", self)
|
||||
self.deleteBtn.setFixedSize(25, 25)
|
||||
self.deleteBtn.setStyleSheet("color: red; font-weight: bold;")
|
||||
layout.addWidget(self.deleteBtn)
|
||||
Layout.addWidget(self.ValueStack)
|
||||
self.ExistingVarCombo = makeVarRefCombo(self)
|
||||
self.ExistingVarCombo.setVisible(False)
|
||||
Layout.addWidget(self.ExistingVarCombo)
|
||||
self.DeleteBtn = QPushButton("×", self)
|
||||
self.DeleteBtn.setFixedSize(25, 25)
|
||||
self.DeleteBtn.setStyleSheet("color: red; font-weight: bold;")
|
||||
Layout.addWidget(self.DeleteBtn)
|
||||
self.setUpdatesEnabled(True)
|
||||
|
||||
def populateTargetCombo(
|
||||
self
|
||||
):
|
||||
|
||||
self.targetCombo.blockSignals(True)
|
||||
self.targetCombo.clear()
|
||||
self.TargetCombo.blockSignals(True)
|
||||
self.TargetCombo.clear()
|
||||
for p in getPresetVars():
|
||||
if p["name"] in ("CURRENT_TIME", "CURRENT_DATE"):
|
||||
continue
|
||||
info = self._varMgr.getInfoByName(p["name"])
|
||||
if info:
|
||||
self.targetCombo.addItem(
|
||||
self.TargetCombo.addItem(
|
||||
info["display"],
|
||||
(info["name"], info["type"])
|
||||
)
|
||||
self.targetCombo.blockSignals(False)
|
||||
self.TargetCombo.blockSignals(False)
|
||||
|
||||
def initValueStacks(
|
||||
self
|
||||
@@ -327,45 +327,45 @@ class ActionStepFrame(QFrame):
|
||||
self._literalWidgets = {}
|
||||
self._offsetWidgets = {}
|
||||
for vt in getTypeOrder():
|
||||
self._literalWidgets[vt] = makeValueWidget(vt, self.valueStack)
|
||||
self.valueStack.addWidget(self._literalWidgets[vt])
|
||||
self._literalWidgets[vt] = makeValueWidget(vt, self.ValueStack)
|
||||
self.ValueStack.addWidget(self._literalWidgets[vt])
|
||||
if getArithType(vt):
|
||||
self._offsetWidgets[vt] = makeOffsetWidget(vt, self.valueStack)
|
||||
self.valueStack.addWidget(self._offsetWidgets[vt])
|
||||
self._offsetWidgets[vt] = makeOffsetWidget(vt, self.ValueStack)
|
||||
self.ValueStack.addWidget(self._offsetWidgets[vt])
|
||||
else:
|
||||
lbl = QLabel("(不支持该操作)", self.valueStack)
|
||||
lbl.setFixedHeight(25)
|
||||
self._offsetWidgets[vt] = lbl
|
||||
self.valueStack.addWidget(lbl)
|
||||
Lbl = QLabel("(不支持该操作)", self.ValueStack)
|
||||
Lbl.setFixedHeight(25)
|
||||
self._offsetWidgets[vt] = Lbl
|
||||
self.ValueStack.addWidget(Lbl)
|
||||
|
||||
def connectSignals(
|
||||
self
|
||||
):
|
||||
|
||||
self.opTypeCombo.currentIndexChanged.connect(self.onOpTypeChanged)
|
||||
self.targetCombo.currentIndexChanged.connect(self.onTargetChanged)
|
||||
self.valueSrcCombo.currentIndexChanged.connect(self.onValueSrcChanged)
|
||||
self.OpTypeCombo.currentIndexChanged.connect(self.onOpTypeChanged)
|
||||
self.TargetCombo.currentIndexChanged.connect(self.onTargetChanged)
|
||||
self.ValueSrcCombo.currentIndexChanged.connect(self.onValueSrcChanged)
|
||||
|
||||
def getTargetName(
|
||||
self
|
||||
) -> str:
|
||||
|
||||
data = self.targetCombo.currentData()
|
||||
data = self.TargetCombo.currentData()
|
||||
return data[0] if data else ""
|
||||
|
||||
def updateValueWidget(
|
||||
self
|
||||
):
|
||||
|
||||
op = self.opTypeCombo.currentData()
|
||||
op = self.OpTypeCombo.currentData()
|
||||
isArith = (op in ("add", "sub"))
|
||||
actualType = self._currentTargetType
|
||||
if isArith and actualType in self._offsetWidgets:
|
||||
self.valueStack.setCurrentWidget(self._offsetWidgets[actualType])
|
||||
self.ValueStack.setCurrentWidget(self._offsetWidgets[actualType])
|
||||
elif actualType in self._literalWidgets:
|
||||
self.valueStack.setCurrentWidget(self._literalWidgets[actualType])
|
||||
self.ValueStack.setCurrentWidget(self._literalWidgets[actualType])
|
||||
else:
|
||||
self.valueStack.setCurrentWidget(self._literalWidgets.get("String"))
|
||||
self.ValueStack.setCurrentWidget(self._literalWidgets.get("String"))
|
||||
|
||||
def toScript(
|
||||
self
|
||||
@@ -375,7 +375,7 @@ class ActionStepFrame(QFrame):
|
||||
"""
|
||||
|
||||
target = self.getTargetName()
|
||||
op = self.opTypeCombo.currentData()
|
||||
op = self.OpTypeCombo.currentData()
|
||||
if op == "pass":
|
||||
return " -- pass"
|
||||
if not target:
|
||||
@@ -386,19 +386,19 @@ class ActionStepFrame(QFrame):
|
||||
encoded = encodeValueStr(rawVal, vartype)
|
||||
return f" {target} = {encoded}"
|
||||
elif op == "add":
|
||||
if vartype == "Date" and hasattr(self.valueStack.currentWidget(), "getOffsetDays"):
|
||||
days = self.valueStack.currentWidget().getOffsetDays()
|
||||
if vartype == "Date" and hasattr(self.ValueStack.currentWidget(), "getOffsetDays"):
|
||||
days = self.ValueStack.currentWidget().getOffsetDays()
|
||||
return f" {target} = dateadd({target}, {days})"
|
||||
if vartype == "Time" and hasattr(self.valueStack.currentWidget(), "getOffsetHours"):
|
||||
hours = self.valueStack.currentWidget().getOffsetHours()
|
||||
if vartype == "Time" and hasattr(self.ValueStack.currentWidget(), "getOffsetHours"):
|
||||
hours = self.ValueStack.currentWidget().getOffsetHours()
|
||||
return f" {target} = timeadd({target}, {hours})"
|
||||
return f" {target} = {target} + {rawVal}"
|
||||
elif op == "sub":
|
||||
if vartype == "Date" and hasattr(self.valueStack.currentWidget(), "getOffsetDays"):
|
||||
days = self.valueStack.currentWidget().getOffsetDays()
|
||||
if vartype == "Date" and hasattr(self.ValueStack.currentWidget(), "getOffsetDays"):
|
||||
days = self.ValueStack.currentWidget().getOffsetDays()
|
||||
return f" {target} = dateadd({target}, -{days})"
|
||||
if vartype == "Time" and hasattr(self.valueStack.currentWidget(), "getOffsetHours"):
|
||||
hours = self.valueStack.currentWidget().getOffsetHours()
|
||||
if vartype == "Time" and hasattr(self.ValueStack.currentWidget(), "getOffsetHours"):
|
||||
hours = self.ValueStack.currentWidget().getOffsetHours()
|
||||
return f" {target} = timeadd({target}, -{hours})"
|
||||
return f" {target} = {target} - {rawVal}"
|
||||
return ""
|
||||
@@ -407,10 +407,10 @@ class ActionStepFrame(QFrame):
|
||||
self
|
||||
) -> str:
|
||||
|
||||
if self.valueSrcCombo.currentData() == "variable":
|
||||
data = self.existingVarCombo.currentData()
|
||||
if self.ValueSrcCombo.currentData() == "variable":
|
||||
data = self.ExistingVarCombo.currentData()
|
||||
return data[0] if data else ""
|
||||
w = self.valueStack.currentWidget()
|
||||
w = self.ValueStack.currentWidget()
|
||||
if w:
|
||||
return getValueFromWidget(w)
|
||||
return ""
|
||||
@@ -419,15 +419,15 @@ class ActionStepFrame(QFrame):
|
||||
self
|
||||
):
|
||||
|
||||
currentData = self.targetCombo.currentData()
|
||||
currentData = self.TargetCombo.currentData()
|
||||
self.populateTargetCombo()
|
||||
if currentData:
|
||||
for i in range(self.targetCombo.count()):
|
||||
d = self.targetCombo.itemData(i)
|
||||
for i in range(self.TargetCombo.count()):
|
||||
d = self.TargetCombo.itemData(i)
|
||||
if d and d[0] == currentData[0]:
|
||||
self.targetCombo.setCurrentIndex(i)
|
||||
self.TargetCombo.setCurrentIndex(i)
|
||||
break
|
||||
self._varMgr.populateCombo(self.existingVarCombo)
|
||||
self._varMgr.populateCombo(self.ExistingVarCombo)
|
||||
|
||||
@Slot(int)
|
||||
def onTargetChanged(
|
||||
@@ -437,13 +437,13 @@ class ActionStepFrame(QFrame):
|
||||
|
||||
if idx < 0:
|
||||
return
|
||||
data = self.targetCombo.itemData(idx)
|
||||
data = self.TargetCombo.itemData(idx)
|
||||
if not data:
|
||||
return
|
||||
_, vartype = data
|
||||
self._currentTargetType = vartype
|
||||
self.updateValueWidget()
|
||||
self.onValueSrcChanged(self.valueSrcCombo.currentIndex())
|
||||
self.onValueSrcChanged(self.ValueSrcCombo.currentIndex())
|
||||
|
||||
@Slot(int)
|
||||
def onOpTypeChanged(
|
||||
@@ -459,10 +459,10 @@ class ActionStepFrame(QFrame):
|
||||
idx
|
||||
):
|
||||
|
||||
isVar = (self.valueSrcCombo.currentData() == "variable")
|
||||
self.valueStack.setVisible(not isVar)
|
||||
self.existingVarCombo.setVisible(isVar)
|
||||
isVar = (self.ValueSrcCombo.currentData() == "variable")
|
||||
self.ValueStack.setVisible(not isVar)
|
||||
self.ExistingVarCombo.setVisible(isVar)
|
||||
if isVar:
|
||||
self._varMgr.populateCombo(self.existingVarCombo)
|
||||
self._varMgr.populateCombo(self.ExistingVarCombo)
|
||||
else:
|
||||
self.updateValueWidget()
|
||||
|
||||
Reference in New Issue
Block a user