Skip to content

Commit

Permalink
fix issue with editor actions for old ROPs
Browse files Browse the repository at this point in the history
particularly for Update OP
  • Loading branch information
t3kt committed May 8, 2024
1 parent b5345ae commit c594fbe
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/tools/editorTools/editorActions.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,9 @@ def _loadTypeFields():

def _createVarRefGroup(text: str):
def getVariableObjs(ctx: ActionContext):
info = ROPInfo(ctx.primaryOp)
if not info.isROP:
opState = EditorROPState(ctx.primaryOp).tryGetRopState()
if not opState:
return []
opState = info.opDefExt.getRopState()
return opState.variables or []
def isValid(ctx: ActionContext) -> bool:
return bool(getVariableObjs(ctx))
Expand Down Expand Up @@ -129,15 +128,16 @@ def test(o: OP):
info = ROPInfo(o)
if not info.isROP or info.opType == _RopTypes.assignAttribute:
return False
return bool(info.opDefExt.getRopState().attributes)
opState = EditorROPState(o).tryGetRopState()
return bool(opState and opState.attributes)
class _LockPars(OpInit):
def init(self, o: COMP, ctx: ActionContext):
o.par.Attributename.readOnly = True
o.par.Datatype.readOnly = True
select = RopSelect(test=test)
def getActions(ctx: ActionContext) -> List[Action]:
info = ROPInfo(ctx.primaryOp)
if not info.isROP:
if not info.isROP or not info.opDefExt:
return []
opState = info.opDefExt.getRopState()
return [
Expand Down

0 comments on commit c594fbe

Please sign in to comment.