# HG changeset patch
# User Andrey Skvortsov <andrej.skvortzov@gmail.com>
# Date 1473417564 -10800
# Node ID 3519eee2bdf671ba83d53fe5dfe072a41da2e5b0
# Parent  e44950d4c2182906063a265092370ffdbf7d3d03# Parent  fef49488b5c74977f03dbf4f1455b6bd2b2e4c1f
Merged in Surkovsv/beremiz (pull request #2)

fix bug with non-editable names and types of FB local variables in POU's written in ST or IL

diff -r e44950d4c218 -r 3519eee2bdf6 controls/VariablePanel.py
--- a/controls/VariablePanel.py	Mon Sep 05 16:47:34 2016 +0300
+++ b/controls/VariablePanel.py	Fri Sep 09 13:39:24 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()