# HG changeset patch # User laurent # Date 1260970604 -3600 # Node ID 5ff24ccff2c7a09499803fa18e185e683b046855 # Parent d1c9517c0fe0859509c21de89fedfc3189ef9842 Disable Up and Down buttons when not useful diff -r d1c9517c0fe0 -r 5ff24ccff2c7 VariablePanel.py --- a/VariablePanel.py Wed Dec 16 14:25:35 2009 +0100 +++ b/VariablePanel.py Wed Dec 16 14:36:44 2009 +0100 @@ -654,6 +654,7 @@ 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") @@ -661,8 +662,8 @@ row_class = self.Table.GetValueByName(row, "Class") self.AddButton.Enable(not self.PouIsUsed or self.Filter not in ["Interface", "Input", "Output", "InOut"]) self.DeleteButton.Enable(table_length > 0 and row_edit and row_class not in ["Input", "Output", "InOut"]) - self.UpButton.Enable(table_length > 0 and self.Filter == "All" and row_class not in ["Input", "Output", "InOut"]) - self.DownButton.Enable(table_length > 0 and self.Filter == "All" and row_class not in ["Input", "Output", "InOut"]) + self.UpButton.Enable(table_length > 0 and row > 0 and self.Filter == "All" and row_class not in ["Input", "Output", "InOut"]) + self.DownButton.Enable(table_length > 0 and row < table_length - 1 and self.Filter == "All" and row_class not in ["Input", "Output", "InOut"]) def OnAddButton(self, event): new_row = self.DefaultValue.copy()