58 self.SetSizer(main_sizer) |
58 self.SetSizer(main_sizer) |
59 |
59 |
60 self.Controller = None |
60 self.Controller = None |
61 self.VarType = None |
61 self.VarType = None |
62 self.Default = False |
62 self.Default = False |
|
63 self.VariableName = None |
63 |
64 |
64 def __del__(self): |
65 def __del__(self): |
65 self.Controller = None |
66 self.Controller = None |
66 |
67 |
67 def SetController(self, controller): |
68 def SetController(self, controller): |
119 location = "%Q" + location |
122 location = "%Q" + location |
120 else: |
123 else: |
121 location = "%M" + location |
124 location = "%M" + location |
122 |
125 |
123 self.Location.SetValue(location) |
126 self.Location.SetValue(location) |
124 self.VariableName = infos["name"] |
127 self.VariableName = infos["var_name"] |
125 self.VarType = infos["IEC_type"] |
128 self.VarType = infos["IEC_type"] |
126 |
129 |
127 self.Location.SetFocus() |
130 self.Location.SetFocus() |
128 |
131 |
129 def OnLocationChar(self, event): |
132 def OnLocationChar(self, event): |
174 def EndEditInternal(self, row, col, grid, old_loc): |
177 def EndEditInternal(self, row, col, grid, old_loc): |
175 loc = self.CellControl.GetValue() |
178 loc = self.CellControl.GetValue() |
176 changed = loc != old_loc |
179 changed = loc != old_loc |
177 if changed: |
180 if changed: |
178 name = self.CellControl.GetName() |
181 name = self.CellControl.GetName() |
179 old_name = self.Table.GetValueByName(row, 'Name') |
182 if name is not None: |
180 self.Table.SetValueByName(row, 'Name', name) |
183 message = self.Table.Parent.CheckVariableName(name, row) |
181 self.Table.Parent.OnVariableNameChange(old_name, name) |
184 if message is not None: |
|
185 wx.CallAfter(self.Table.Parent.ShowErrorMessage, message) |
|
186 return None |
|
187 old_name = self.Table.GetValueByName(row, 'Name') |
|
188 self.Table.SetValueByName(row, 'Name', name) |
|
189 self.Table.Parent.OnVariableNameChange(old_name, name) |
182 self.Table.SetValueByName(row, 'Location', loc) |
190 self.Table.SetValueByName(row, 'Location', loc) |
183 self.Table.SetValueByName(row, 'Type', self.CellControl.GetVarType()) |
191 var_type = self.CellControl.GetVarType() |
|
192 if var_type is not None: |
|
193 self.Table.SetValueByName(row, 'Type', var_type) |
184 self.CellControl.Disable() |
194 self.CellControl.Disable() |
185 return changed |
195 return changed |
186 |
196 |
187 if wx.VERSION >= (3, 0, 0): |
197 if wx.VERSION >= (3, 0, 0): |
188 def EndEdit(self, row, col, grid, oldval): |
198 def EndEdit(self, row, col, grid, oldval): |