# HG changeset patch # User Andrey Skvortsov # Date 1462520146 -10800 # Node ID 7272baadd7f617819c174145f1e9907e575580c9 # Parent 7aaf850d8d1c2bb98862e7e6c90222c9b0dbe403 fix issue that was impossible to remove local instance of functional block if pou is written in ST or IL diff -r 7aaf850d8d1c -r 7272baadd7f6 controls/VariablePanel.py --- a/controls/VariablePanel.py Thu Apr 28 16:54:01 2016 +0300 +++ b/controls/VariablePanel.py Fri May 06 10:35:46 2016 +0300 @@ -584,7 +584,7 @@ setattr(self.VariablesGrid, "_AddRow", _AddVariable) def _DeleteVariable(row): - if self.Table.GetValueByName(row, "Edit"): + if _GetRowEdit(row): self.Values.remove(self.Table.GetRow(row)) self.SaveValues() if self.ElementType == "resource": @@ -603,6 +603,14 @@ return row setattr(self.VariablesGrid, "_MoveRow", _MoveVariable) + def _GetRowEdit(row): + row_edit = False + if self: + row_edit = self.Table.GetValueByName(row, "Edit") + bodytype = self.Controler.GetEditedElementBodyType(self.TagName) + row_edit = row_edit or (bodytype in ["ST", "IL"]) + return row_edit + def _RefreshButtons(): if self: table_length = len(self.Table.data) @@ -611,7 +619,7 @@ row = 0 if table_length > 0: row = self.VariablesGrid.GetGridCursorRow() - row_edit = self.Table.GetValueByName(row, "Edit") + row_edit = _GetRowEdit(row) self.AddButton.Enable(not self.Debug) self.DeleteButton.Enable(not self.Debug and (table_length > 0 and row_edit)) self.UpButton.Enable(not self.Debug and (table_length > 0 and row > 0 and self.Filter == "All"))