UI/CompareDialog.py

changeset 2836
289ad03f0e57
parent 2835
678978fe9ffd
child 2837
a96cb48e86a5
diff -r 678978fe9ffd -r 289ad03f0e57 UI/CompareDialog.py
--- a/UI/CompareDialog.py	Wed Jul 31 18:34:43 2013 +0200
+++ b/UI/CompareDialog.py	Wed Jul 31 20:01:58 2013 +0200
@@ -332,8 +332,10 @@
         self.vsb2.setValue(0)
         self.firstButton.setEnabled(False)
         self.upButton.setEnabled(False)
-        self.downButton.setEnabled(len(self.diffParas) > 0)
-        self.lastButton.setEnabled(len(self.diffParas) > 0)
+        self.downButton.setEnabled(len(self.diffParas) > 0 and 
+            (self.vsb1.isVisible() or self.vsb2.isVisible()))
+        self.lastButton.setEnabled(len(self.diffParas) > 0 and 
+            (self.vsb1.isVisible() or self.vsb2.isVisible()))
         
         self.totalLabel.setText(self.trUtf8('Total: {0}')\
                                     .format(added + deleted + changed))
@@ -345,9 +347,10 @@
         """
         Private slot to move the text display to the current diff position.
         """
-        value = (self.diffParas[self.currentDiffPos] - 1) * self.fontHeight
-        self.vsb1.setValue(value)
-        self.vsb2.setValue(value)
+        if 0<= self.currentDiffPos < len(self.diffParas):
+            value = (self.diffParas[self.currentDiffPos] - 1) * self.fontHeight
+            self.vsb1.setValue(value)
+            self.vsb2.setValue(value)
     
     def __scrollBarMoved(self, value):
         """

eric ide

mercurial