--- a/controls/LocationCellEditor.py Thu Mar 28 14:06:53 2019 +0100
+++ b/controls/LocationCellEditor.py Tue Apr 02 09:46:58 2019 +0200
@@ -80,6 +80,9 @@
return self.Location.GetValue()
+ return self.VariableName @@ -118,6 +121,7 @@
location = "%M" + location
self.Location.SetValue(location)
+ self.VariableName = infos["name"] self.VarType = infos["IEC_type"]
@@ -171,6 +175,10 @@
loc = self.CellControl.GetValue()
+ name = self.CellControl.GetName() + old_name = self.Table.GetValueByName(row, 'Name') + self.Table.SetValueByName(row, 'Name', name) + self.Table.Parent.OnVariableNameChange(old_name, name) self.Table.SetValueByName(row, 'Location', loc)
self.Table.SetValueByName(row, 'Type', self.CellControl.GetVarType())
self.CellControl.Disable()
--- a/controls/VariablePanel.py Thu Mar 28 14:06:53 2019 +0100
+++ b/controls/VariablePanel.py Tue Apr 02 09:46:58 2019 +0200
@@ -150,6 +150,7 @@
def SetValue(self, row, col, value):
+ print("SetValue",row, col, value) if col < len(self.colnames):
colname = self.GetColLabelValue(col, False)
@@ -788,6 +789,14 @@
+ def OnVariableNameChange(self, old_name, new_name): + """ propagate renaming of variable to the rest of the project """ + self.Controler.UpdateEditedElementUsedVariable(self.TagName, old_name, new_name) + self.Controler.BufferProject() + wx.CallAfter(self.ParentWindow.RefreshView, False) + self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, PAGETITLES, POUINSTANCEVARIABLESPANEL, LIBRARYTREE) def OnVariablesGridCellChange(self, event):
row, col = event.GetRow(), event.GetCol()
colname = self.Table.GetColLabelValue(col, False)
@@ -806,11 +815,7 @@
old_value = self.Table.GetOldValue()
- self.Controler.UpdateEditedElementUsedVariable(self.TagName, old_value, value)
- self.Controler.BufferProject()
- wx.CallAfter(self.ParentWindow.RefreshView, False)
- self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, PAGETITLES, POUINSTANCEVARIABLESPANEL, LIBRARYTREE)
+ self.OnVariableNameChange(old_value, value)