RessourceEditor.py
changeset 672 d751b1c609b3
parent 658 89d20745b061
child 684 f10449b18dbe
--- a/RessourceEditor.py	Mon Apr 23 11:16:40 2012 +0200
+++ b/RessourceEditor.py	Fri Apr 27 01:55:45 2012 +0200
@@ -406,13 +406,14 @@
         setattr(self.InstancesGrid, "_MoveRow", _MoveInstance)
         
         def _RefreshInstanceButtons():
-            rows = self.InstancesTable.GetNumberRows()
-            row = self.InstancesGrid.GetGridCursorRow()
-            self.DeleteInstanceButton.Enable(rows > 0)
-            self.UpInstanceButton.Enable(row > 0 and 
-                self.InstancesTable.GetValueByName(row, "Task") == self.InstancesTable.GetValueByName(row - 1, "Task"))
-            self.DownInstanceButton.Enable(0 <= row < rows - 1 and 
-                self.InstancesTable.GetValueByName(row, "Task") == self.InstancesTable.GetValueByName(row + 1, "Task"))
+            if self:
+                rows = self.InstancesTable.GetNumberRows()
+                row = self.InstancesGrid.GetGridCursorRow()
+                self.DeleteInstanceButton.Enable(rows > 0)
+                self.UpInstanceButton.Enable(row > 0 and 
+                    self.InstancesTable.GetValueByName(row, "Task") == self.InstancesTable.GetValueByName(row - 1, "Task"))
+                self.DownInstanceButton.Enable(0 <= row < rows - 1 and 
+                    self.InstancesTable.GetValueByName(row, "Task") == self.InstancesTable.GetValueByName(row + 1, "Task"))
         setattr(self.InstancesGrid, "RefreshButtons", _RefreshInstanceButtons)
         
         self.InstancesGrid.SetRowLabelSize(0)