540 |
540 |
541 def closeEvent(self, e): |
541 def closeEvent(self, e): |
542 """ |
542 """ |
543 Protected slot implementing a close event handler. |
543 Protected slot implementing a close event handler. |
544 |
544 |
545 @param e close event (QCloseEvent) |
545 @param e close event |
|
546 @type QCloseEvent |
546 """ |
547 """ |
547 if self.__hgClient.isExecuting(): |
548 if self.__hgClient.isExecuting(): |
548 self.__hgClient.cancel() |
549 self.__hgClient.cancel() |
549 |
550 |
550 self.vcs.getPlugin().setPreferences("LogBrowserGeometry", self.saveGeometry()) |
551 self.vcs.getPlugin().setPreferences("LogBrowserGeometry", self.saveGeometry()) |
658 |
659 |
659 def __branchColor(self, branchName): |
660 def __branchColor(self, branchName): |
660 """ |
661 """ |
661 Private method to calculate a color for a given branch name. |
662 Private method to calculate a color for a given branch name. |
662 |
663 |
663 @param branchName name of the branch (string) |
664 @param branchName name of the branch |
664 @return name of the color to use (string) |
665 @type str |
|
666 @return name of the color to use |
|
667 @rtype str |
665 """ |
668 """ |
666 if branchName not in self.__branchColors: |
669 if branchName not in self.__branchColors: |
667 self.__branchColors[branchName] = self.__getColor(len(self.__branchColors)) |
670 self.__branchColors[branchName] = self.__getColor(len(self.__branchColors)) |
668 return self.__branchColors[branchName] |
671 return self.__branchColors[branchName] |
669 |
672 |
670 def __generateEdges(self, rev, parents): |
673 def __generateEdges(self, rev, parents): |
671 """ |
674 """ |
672 Private method to generate edge info for the give data. |
675 Private method to generate edge info for the give data. |
673 |
676 |
674 @param rev revision to calculate edge info for (integer) |
677 @param rev revision to calculate edge info for |
675 @param parents list of parent revisions (list of integers) |
678 @type int |
|
679 @param parents list of parent revisions |
|
680 @type list of int |
676 @return tuple containing the column and color index for |
681 @return tuple containing the column and color index for |
677 the given node and a list of tuples indicating the edges |
682 the given node and a list of tuples indicating the edges |
678 between the given node and its parents |
683 between the given node and its parents |
679 (integer, integer, [(integer, integer, integer), ...]) |
684 @rtype tuple of (int, int, [(int, int, int), ...]) |
680 """ |
685 """ |
681 if rev not in self.__revs: |
686 if rev not in self.__revs: |
682 # new head |
687 # new head |
683 self.__revs.append(rev) |
688 self.__revs.append(rev) |
684 self.__revColors[rev] = self.__revColor |
689 self.__revColors[rev] = self.__revColor |
750 |
755 |
751 def col2x(col, radius): |
756 def col2x(col, radius): |
752 """ |
757 """ |
753 Local function to calculate a x-position for a column. |
758 Local function to calculate a x-position for a column. |
754 |
759 |
755 @param col column number (integer) |
760 @param col column number |
756 @param radius radius of the indicator circle (integer) |
761 @type int |
|
762 @param radius radius of the indicator circle |
|
763 @type int |
757 """ |
764 """ |
758 return int(1.2 * radius) * col + radius // 2 + 3 |
765 return int(1.2 * radius) * col + radius // 2 + 3 |
759 |
766 |
760 textColor = self.logTree.palette().color(QPalette.ColorRole.Text) |
767 textColor = self.logTree.palette().color(QPalette.ColorRole.Text) |
761 |
768 |
1086 |
1095 |
1087 def __getLogEntries(self, startRev=None, noEntries=0): |
1096 def __getLogEntries(self, startRev=None, noEntries=0): |
1088 """ |
1097 """ |
1089 Private method to retrieve log entries from the repository. |
1098 Private method to retrieve log entries from the repository. |
1090 |
1099 |
1091 @param startRev revision number to start from (integer, string) |
1100 @param startRev revision number to start from |
1092 @param noEntries number of entries to get (0 = default) (int) |
1101 @type int or str |
|
1102 @param noEntries number of entries to get (0 = default) |
|
1103 @type int |
1093 """ |
1104 """ |
1094 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(False) |
1105 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(False) |
1095 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setEnabled(True) |
1106 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setEnabled(True) |
1096 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setDefault(True) |
1107 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setDefault(True) |
1097 QApplication.processEvents() |
1108 QApplication.processEvents() |
1242 |
1253 |
1243 def __modifyForLargeFiles(self, filename): |
1254 def __modifyForLargeFiles(self, filename): |
1244 """ |
1255 """ |
1245 Private method to convert the displayed file name for a large file. |
1256 Private method to convert the displayed file name for a large file. |
1246 |
1257 |
1247 @param filename file name to be processed (string) |
1258 @param filename file name to be processed |
1248 @return processed file name (string) |
1259 @type str |
|
1260 @return processed file name |
|
1261 @rtype str |
1249 """ |
1262 """ |
1250 if filename.startswith((self.LargefilesCacheL, self.LargefilesCacheW)): |
1263 if filename.startswith((self.LargefilesCacheL, self.LargefilesCacheW)): |
1251 return self.tr("{0} (large file)").format( |
1264 return self.tr("{0} (large file)").format( |
1252 self.PathSeparatorRe.split(filename, 1)[1] |
1265 self.PathSeparatorRe.split(filename, 1)[1] |
1253 ) |
1266 ) |
1464 |
1477 |
1465 def __showError(self, out): |
1478 def __showError(self, out): |
1466 """ |
1479 """ |
1467 Private slot to show some error. |
1480 Private slot to show some error. |
1468 |
1481 |
1469 @param out error to be shown (string) |
1482 @param out error to be shown |
|
1483 @type str |
1470 """ |
1484 """ |
1471 self.errorGroup.show() |
1485 self.errorGroup.show() |
1472 self.errors.insertPlainText(out) |
1486 self.errors.insertPlainText(out) |
1473 self.errors.ensureCursorVisible() |
1487 self.errors.ensureCursorVisible() |
1474 |
1488 |
1475 def on_buttonBox_clicked(self, button): |
1489 def on_buttonBox_clicked(self, button): |
1476 """ |
1490 """ |
1477 Private slot called by a button of the button box clicked. |
1491 Private slot called by a button of the button box clicked. |
1478 |
1492 |
1479 @param button button that was clicked (QAbstractButton) |
1493 @param button button that was clicked |
|
1494 @type QAbstractButton |
1480 """ |
1495 """ |
1481 if button == self.buttonBox.button(QDialogButtonBox.StandardButton.Close): |
1496 if button == self.buttonBox.button(QDialogButtonBox.StandardButton.Close): |
1482 self.close() |
1497 self.close() |
1483 elif button == self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel): |
1498 elif button == self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel): |
1484 self.cancelled = True |
1499 self.cancelled = True |
1868 @pyqtSlot(QTreeWidgetItem, QTreeWidgetItem) |
1883 @pyqtSlot(QTreeWidgetItem, QTreeWidgetItem) |
1869 def on_logTree_currentItemChanged(self, current, previous): |
1884 def on_logTree_currentItemChanged(self, current, previous): |
1870 """ |
1885 """ |
1871 Private slot called, when the current item of the log tree changes. |
1886 Private slot called, when the current item of the log tree changes. |
1872 |
1887 |
1873 @param current reference to the new current item (QTreeWidgetItem) |
1888 @param current reference to the new current item |
1874 @param previous reference to the old current item (QTreeWidgetItem) |
1889 @type QTreeWidgetItem |
|
1890 @param previous reference to the old current item |
|
1891 @type QTreeWidgetItem |
1875 """ |
1892 """ |
1876 self.__updateToolMenuActions() |
1893 self.__updateToolMenuActions() |
1877 |
1894 |
1878 # Highlight the current entry using a bold font |
1895 # Highlight the current entry using a bold font |
1879 for col in range(self.logTree.columnCount()): |
1896 for col in range(self.logTree.columnCount()): |
1941 @pyqtSlot(QDate) |
1958 @pyqtSlot(QDate) |
1942 def on_fromDate_dateChanged(self, date): |
1959 def on_fromDate_dateChanged(self, date): |
1943 """ |
1960 """ |
1944 Private slot called, when the from date changes. |
1961 Private slot called, when the from date changes. |
1945 |
1962 |
1946 @param date new date (QDate) |
1963 @param date new date |
|
1964 @type QDate |
1947 """ |
1965 """ |
1948 if self.__actionMode() == "filter": |
1966 if self.__actionMode() == "filter": |
1949 self.__filterLogs() |
1967 self.__filterLogs() |
1950 |
1968 |
1951 @pyqtSlot(QDate) |
1969 @pyqtSlot(QDate) |
1952 def on_toDate_dateChanged(self, date): |
1970 def on_toDate_dateChanged(self, date): |
1953 """ |
1971 """ |
1954 Private slot called, when the from date changes. |
1972 Private slot called, when the from date changes. |
1955 |
1973 |
1956 @param date new date (QDate) |
1974 @param date new date |
|
1975 @type QDate |
1957 """ |
1976 """ |
1958 if self.__actionMode() == "filter": |
1977 if self.__actionMode() == "filter": |
1959 self.__filterLogs() |
1978 self.__filterLogs() |
1960 |
1979 |
1961 @pyqtSlot(int) |
1980 @pyqtSlot(int) |
1983 @pyqtSlot(str) |
2002 @pyqtSlot(str) |
1984 def on_rxEdit_textChanged(self, txt): |
2003 def on_rxEdit_textChanged(self, txt): |
1985 """ |
2004 """ |
1986 Private slot called, when a filter expression is entered. |
2005 Private slot called, when a filter expression is entered. |
1987 |
2006 |
1988 @param txt filter expression (string) |
2007 @param txt filter expression |
|
2008 @type str |
1989 """ |
2009 """ |
1990 if self.__actionMode() == "filter": |
2010 if self.__actionMode() == "filter": |
1991 self.__filterLogs() |
2011 self.__filterLogs() |
1992 elif self.__actionMode() == "find": |
2012 elif self.__actionMode() == "find": |
1993 self.__findItem(self.__findBackwards, interactive=True) |
2013 self.__findItem(self.__findBackwards, interactive=True) |
2051 def __prepareFieldSearch(self): |
2071 def __prepareFieldSearch(self): |
2052 """ |
2072 """ |
2053 Private slot to prepare the filed search data. |
2073 Private slot to prepare the filed search data. |
2054 |
2074 |
2055 @return tuple of field index, search expression and flag indicating |
2075 @return tuple of field index, search expression and flag indicating |
2056 that the field index is a data role (integer, string, boolean) |
2076 that the field index is a data role |
|
2077 @rtype tuple of (int, str, bool) |
2057 """ |
2078 """ |
2058 indexIsRole = False |
2079 indexIsRole = False |
2059 txt = self.fieldCombo.itemData(self.fieldCombo.currentIndex()) |
2080 txt = self.fieldCombo.itemData(self.fieldCombo.currentIndex()) |
2060 if txt == "author": |
2081 if txt == "author": |
2061 fieldIndex = self.AuthorColumn |
2082 fieldIndex = self.AuthorColumn |
2084 @pyqtSlot(bool) |
2105 @pyqtSlot(bool) |
2085 def on_stopCheckBox_clicked(self, checked): |
2106 def on_stopCheckBox_clicked(self, checked): |
2086 """ |
2107 """ |
2087 Private slot called, when the stop on copy/move checkbox is clicked. |
2108 Private slot called, when the stop on copy/move checkbox is clicked. |
2088 |
2109 |
2089 @param checked flag indicating the state of the check box (boolean) |
2110 @param checked flag indicating the state of the check box |
|
2111 @type bool |
2090 """ |
2112 """ |
2091 self.vcs.getPlugin().setPreferences( |
2113 self.vcs.getPlugin().setPreferences( |
2092 "StopLogOnCopy", self.stopCheckBox.isChecked() |
2114 "StopLogOnCopy", self.stopCheckBox.isChecked() |
2093 ) |
2115 ) |
2094 self.nextButton.setEnabled(True) |
2116 self.nextButton.setEnabled(True) |
2590 |
2612 |
2591 def __actionMode(self): |
2613 def __actionMode(self): |
2592 """ |
2614 """ |
2593 Private method to get the selected action mode. |
2615 Private method to get the selected action mode. |
2594 |
2616 |
2595 @return selected action mode (string, one of filter or find) |
2617 @return selected action mode (one of 'filter' or 'find') |
|
2618 @rtype str |
2596 """ |
2619 """ |
2597 return self.modeComboBox.itemData(self.modeComboBox.currentIndex()) |
2620 return self.modeComboBox.itemData(self.modeComboBox.currentIndex()) |
2598 |
2621 |
2599 @pyqtSlot(int) |
2622 @pyqtSlot(int) |
2600 def on_modeComboBox_currentIndexChanged(self, index): |
2623 def on_modeComboBox_currentIndexChanged(self, index): |
2601 """ |
2624 """ |
2602 Private slot to react on mode changes. |
2625 Private slot to react on mode changes. |
2603 |
2626 |
2604 @param index index of the selected entry (integer) |
2627 @param index index of the selected entry |
|
2628 @type int |
2605 """ |
2629 """ |
2606 mode = self.modeComboBox.itemData(index) |
2630 mode = self.modeComboBox.itemData(index) |
2607 findMode = mode == "find" |
2631 findMode = mode == "find" |
2608 filterMode = mode == "filter" |
2632 filterMode = mode == "filter" |
2609 |
2633 |
2636 |
2660 |
2637 def __findItem(self, backwards=False, interactive=False): |
2661 def __findItem(self, backwards=False, interactive=False): |
2638 """ |
2662 """ |
2639 Private slot to find an item matching the entered criteria. |
2663 Private slot to find an item matching the entered criteria. |
2640 |
2664 |
2641 @param backwards flag indicating to search backwards (boolean) |
2665 @param backwards flag indicating to search backwards |
2642 @param interactive flag indicating an interactive search (boolean) |
2666 @type bool |
|
2667 @param interactive flag indicating an interactive search |
|
2668 @type bool |
2643 """ |
2669 """ |
2644 self.__findBackwards = backwards |
2670 self.__findBackwards = backwards |
2645 |
2671 |
2646 fieldIndex, searchRx, indexIsRole = self.__prepareFieldSearch() |
2672 fieldIndex, searchRx, indexIsRole = self.__prepareFieldSearch() |
2647 currentIndex = self.logTree.indexOfTopLevelItem(self.logTree.currentItem()) |
2673 currentIndex = self.logTree.indexOfTopLevelItem(self.logTree.currentItem()) |
2808 @pyqtSlot(QTreeWidgetItem, QTreeWidgetItem) |
2834 @pyqtSlot(QTreeWidgetItem, QTreeWidgetItem) |
2809 def on_filesTree_currentItemChanged(self, current, previous): |
2835 def on_filesTree_currentItemChanged(self, current, previous): |
2810 """ |
2836 """ |
2811 Private slot called, when the current item of the files tree changes. |
2837 Private slot called, when the current item of the files tree changes. |
2812 |
2838 |
2813 @param current reference to the new current item (QTreeWidgetItem) |
2839 @param current reference to the new current item |
2814 @param previous reference to the old current item (QTreeWidgetItem) |
2840 @type QTreeWidgetItem |
|
2841 @param previous reference to the old current item |
|
2842 @type QTreeWidgetItem |
2815 """ |
2843 """ |
2816 if current: |
2844 if current: |
2817 para = current.data(0, self.__diffFileLineRole) |
2845 para = current.data(0, self.__diffFileLineRole) |
2818 if para is not None: |
2846 if para is not None: |
2819 if para == 0: |
2847 if para == 0: |