fix bug with non-editable names and types of FB local variables in POU's written in ST or IL
authorSergey Surkov <surkovsv93@gmail.com>
Fri, 09 Sep 2016 13:33:49 +0300
changeset 1522 fef49488b5c7
parent 1518 a656ccb868d4
child 1523 3519eee2bdf6
child 1530 24d8e8c233bd
fix bug with non-editable names and types of FB local variables in POU's written in ST or IL
controls/VariablePanel.py
--- a/controls/VariablePanel.py	Tue Aug 23 10:24:47 2016 +0500
+++ b/controls/VariablePanel.py	Fri Sep 09 13:33:49 2016 +0300
@@ -144,6 +144,14 @@
     def GetOldValue(self):
         return self.old_value
 
+    def _GetRowEdit(self, row):
+        row_edit = self.GetValueByName(row, "Edit")
+        var_type = self.Parent.GetTagName()
+        bodytype = self.Parent.Controler.GetEditedElementBodyType(var_type)
+        if bodytype in ["ST", "IL"]:
+            row_edit = True;
+        return row_edit
+
     def _updateColAttrs(self, grid):
         """
         wx.grid.Grid -> update the column attributes to add the
@@ -171,7 +179,7 @@
                             editor.SetParameters(",".join(map(_, options)))
                         else:
                             grid.SetReadOnly(row, col, True)
-                    elif col != 0 and self.GetValueByName(row, "Edit"):
+                    elif col != 0 and self._GetRowEdit(row):
                         grid.SetReadOnly(row, col, False)
                         if colname == "Name":
                             editor = wx.grid.GridCellTextEditor()