Plugins/VcsPlugins/vcsSubversion/SvnLogBrowserDialog.py

changeset 5449
7679d1d3671a
parent 5389
9b1c800daff3
child 5450
a5d5e757efcf
equal deleted inserted replaced
5448:1a86766ed19a 5449:7679d1d3671a
24 from E5Gui import E5MessageBox 24 from E5Gui import E5MessageBox
25 25
26 from .Ui_SvnLogBrowserDialog import Ui_SvnLogBrowserDialog 26 from .Ui_SvnLogBrowserDialog import Ui_SvnLogBrowserDialog
27 27
28 import Preferences 28 import Preferences
29 import UI.PixmapCache
29 30
30 31
31 class SvnLogBrowserDialog(QWidget, Ui_SvnLogBrowserDialog): 32 class SvnLogBrowserDialog(QWidget, Ui_SvnLogBrowserDialog):
32 """ 33 """
33 Class implementing a dialog to browse the log history. 34 Class implementing a dialog to browse the log history.
44 45
45 self.__position = QPoint() 46 self.__position = QPoint()
46 47
47 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) 48 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False)
48 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) 49 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True)
50
51 self.upButton.setIcon(UI.PixmapCache.getIcon("1uparrow.png"))
52 self.downButton.setIcon(UI.PixmapCache.getIcon("1downarrow.png"))
49 53
50 self.filesTree.headerItem().setText(self.filesTree.columnCount(), "") 54 self.filesTree.headerItem().setText(self.filesTree.columnCount(), "")
51 self.filesTree.header().setSortIndicator(0, Qt.AscendingOrder) 55 self.filesTree.header().setSortIndicator(0, Qt.AscendingOrder)
52 56
53 self.vcs = vcs 57 self.vcs = vcs
90 'D': self.tr('Deleted'), 94 'D': self.tr('Deleted'),
91 'M': self.tr('Modified'), 95 'M': self.tr('Modified'),
92 'R': self.tr('Replaced'), 96 'R': self.tr('Replaced'),
93 } 97 }
94 self.intercept = False 98 self.intercept = False
99
100 self.__logTreeNormalFont = self.logTree.font()
101 self.__logTreeNormalFont.setBold(False)
102 self.__logTreeBoldFont = self.logTree.font()
103 self.__logTreeBoldFont.setBold(True)
95 104
96 def __initData(self): 105 def __initData(self):
97 """ 106 """
98 Private method to (re-)initialize some data. 107 Private method to (re-)initialize some data.
99 """ 108 """
364 log["date"] = self.rx_rev.cap(3) 373 log["date"] = self.rx_rev.cap(3)
365 # number of lines is ignored 374 # number of lines is ignored
366 elif self.rx_rev2.exactMatch(s): 375 elif self.rx_rev2.exactMatch(s):
367 log["revision"] = self.rx_rev2.cap(1) 376 log["revision"] = self.rx_rev2.cap(1)
368 log["author"] = self.rx_rev2.cap(2) 377 log["author"] = self.rx_rev2.cap(2)
369 log["date"] = self.rx_rev2.cap(3) 378 log["date"] = " ".join(self.rx_rev2.cap(3).split()[:2])
370 # number of lines is ignored 379 # number of lines is ignored
371 elif self.rx_flags1.exactMatch(s): 380 elif self.rx_flags1.exactMatch(s):
372 changedPaths.append({ 381 changedPaths.append({
373 "action": 382 "action":
374 self.rx_flags1.cap(1).strip(), 383 self.rx_flags1.cap(1).strip(),
517 self.__resortFiles() 526 self.__resortFiles()
518 527
519 self.diffPreviousButton.setEnabled( 528 self.diffPreviousButton.setEnabled(
520 current != self.logTree.topLevelItem( 529 current != self.logTree.topLevelItem(
521 self.logTree.topLevelItemCount() - 1)) 530 self.logTree.topLevelItemCount() - 1))
531
532 # Highlight the current entry using a bold font
533 for col in range(self.logTree.columnCount()):
534 current and current.setFont(col, self.__logTreeBoldFont)
535 previous and previous.setFont(col, self.__logTreeNormalFont)
536
537 # set the state of the up and down buttons
538 self.upButton.setEnabled(
539 current is not None and
540 self.logTree.indexOfTopLevelItem(current) > 0)
541 self.downButton.setEnabled(
542 current is not None and
543 int(current.text(0)) > 1)
522 544
523 @pyqtSlot() 545 @pyqtSlot()
524 def on_logTree_itemSelectionChanged(self): 546 def on_logTree_itemSelectionChanged(self):
525 """ 547 """
526 Private slot called, when the selection has changed. 548 Private slot called, when the selection has changed.
654 self.vcs.getPlugin().setPreferences("StopLogOnCopy", 676 self.vcs.getPlugin().setPreferences("StopLogOnCopy",
655 self.stopCheckBox.isChecked()) 677 self.stopCheckBox.isChecked())
656 self.nextButton.setEnabled(True) 678 self.nextButton.setEnabled(True)
657 self.limitSpinBox.setEnabled(True) 679 self.limitSpinBox.setEnabled(True)
658 680
681 @pyqtSlot()
682 def on_upButton_clicked(self):
683 """
684 Private slot to move the current item up one entry.
685 """
686 itm = self.logTree.itemAbove(self.logTree.currentItem())
687 if itm:
688 self.logTree.setCurrentItem(itm)
689
690 @pyqtSlot()
691 def on_downButton_clicked(self):
692 """
693 Private slot to move the current item down one entry.
694 """
695 itm = self.logTree.itemBelow(self.logTree.currentItem())
696 if itm:
697 self.logTree.setCurrentItem(itm)
698 else:
699 # load the next bunch and try again
700 self.on_nextButton_clicked()
701 self.on_downButton_clicked()
702
659 def on_passwordCheckBox_toggled(self, isOn): 703 def on_passwordCheckBox_toggled(self, isOn):
660 """ 704 """
661 Private slot to handle the password checkbox toggled. 705 Private slot to handle the password checkbox toggled.
662 706
663 @param isOn flag indicating the status of the check box (boolean) 707 @param isOn flag indicating the status of the check box (boolean)

eric ide

mercurial