Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py

changeset 5449
7679d1d3671a
parent 5448
1a86766ed19a
child 5450
a5d5e757efcf
--- a/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py	Sat Jan 28 12:39:43 2017 +0100
+++ b/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py	Sat Jan 28 14:22:00 2017 +0100
@@ -82,6 +82,9 @@
         self.filesTree.headerItem().setText(self.filesTree.columnCount(), "")
         self.filesTree.header().setSortIndicator(0, Qt.AscendingOrder)
         
+        self.upButton.setIcon(UI.PixmapCache.getIcon("1uparrow.png"))
+        self.downButton.setIcon(UI.PixmapCache.getIcon("1downarrow.png"))
+        
         self.refreshButton = self.buttonBox.addButton(
             self.tr("&Refresh"), QDialogButtonBox.ActionRole)
         self.refreshButton.setToolTip(
@@ -1394,6 +1397,14 @@
         for col in range(self.logTree.columnCount()):
             current and current.setFont(col, self.__logTreeBoldFont)
             previous and previous.setFont(col, self.__logTreeNormalFont)
+        
+        # set the state of the up and down buttons
+        self.upButton.setEnabled(
+            current is not None and 
+            self.logTree.indexOfTopLevelItem(current) > 0)
+        self.downButton.setEnabled(
+            current is not None and
+            int(current.text(self.RevisionColumn).split(":")[0]) > 0)
     
     @pyqtSlot()
     def on_logTree_itemSelectionChanged(self):
@@ -1407,6 +1418,28 @@
         self.__updateToolMenuActions()
     
     @pyqtSlot()
+    def on_upButton_clicked(self):
+        """
+        Private slot to move the current item up one entry.
+        """
+        itm = self.logTree.itemAbove(self.logTree.currentItem())
+        if itm:
+            self.logTree.setCurrentItem(itm)
+    
+    @pyqtSlot()
+    def on_downButton_clicked(self):
+        """
+        Private slot to move the current item down one entry.
+        """
+        itm = self.logTree.itemBelow(self.logTree.currentItem())
+        if itm:
+            self.logTree.setCurrentItem(itm)
+        else:
+            # load the next bunch and try again
+            self.on_nextButton_clicked()
+            self.on_downButton_clicked()
+    
+    @pyqtSlot()
     def on_nextButton_clicked(self):
         """
         Private slot to handle the Next button.

eric ide

mercurial