--- a/controls/VariablePanel.py Mon Apr 23 11:16:40 2012 +0200
+++ b/controls/VariablePanel.py Fri Apr 27 01:55:45 2012 +0200
@@ -551,19 +551,20 @@
setattr(self.VariablesGrid, "_MoveRow", _MoveVariable)
def _RefreshButtons():
- table_length = len(self.Table.data)
- row_class = None
- row_edit = True
- row = 0
- if table_length > 0:
- row = self.VariablesGrid.GetGridCursorRow()
- row_edit = self.Table.GetValueByName(row, "Edit")
- if self.PouIsUsed:
- row_class = self.Table.GetValueByName(row, "Class")
- self.AddButton.Enable(not self.Debug and (not self.PouIsUsed or self.Filter not in ["Interface", "Input", "Output", "InOut"]))
- self.DeleteButton.Enable(not self.Debug and (table_length > 0 and row_edit and row_class not in ["Input", "Output", "InOut"]))
- self.UpButton.Enable(not self.Debug and (table_length > 0 and row > 0 and self.Filter == "All" and row_class not in ["Input", "Output", "InOut"]))
- self.DownButton.Enable(not self.Debug and (table_length > 0 and row < table_length - 1 and self.Filter == "All" and row_class not in ["Input", "Output", "InOut"]))
+ if self:
+ table_length = len(self.Table.data)
+ row_class = None
+ row_edit = True
+ row = 0
+ if table_length > 0:
+ row = self.VariablesGrid.GetGridCursorRow()
+ row_edit = self.Table.GetValueByName(row, "Edit")
+ if self.PouIsUsed:
+ row_class = self.Table.GetValueByName(row, "Class")
+ self.AddButton.Enable(not self.Debug and (not self.PouIsUsed or self.Filter not in ["Interface", "Input", "Output", "InOut"]))
+ self.DeleteButton.Enable(not self.Debug and (table_length > 0 and row_edit and row_class not in ["Input", "Output", "InOut"]))
+ self.UpButton.Enable(not self.Debug and (table_length > 0 and row > 0 and self.Filter == "All" and row_class not in ["Input", "Output", "InOut"]))
+ self.DownButton.Enable(not self.Debug and (table_length > 0 and row < table_length - 1 and self.Filter == "All" and row_class not in ["Input", "Output", "InOut"]))
setattr(self.VariablesGrid, "RefreshButtons", _RefreshButtons)
self.VariablesGrid.SetRowLabelSize(0)