8 """ |
8 """ |
9 |
9 |
10 import os |
10 import os |
11 import collections |
11 import collections |
12 import re |
12 import re |
|
13 import contextlib |
13 |
14 |
14 from PyQt5.QtCore import ( |
15 from PyQt5.QtCore import ( |
15 pyqtSlot, Qt, QDate, QProcess, QTimer, QSize, QPoint, QFileInfo |
16 pyqtSlot, Qt, QDate, QProcess, QTimer, QSize, QPoint, QFileInfo |
16 ) |
17 ) |
17 from PyQt5.QtGui import ( |
18 from PyQt5.QtGui import ( |
67 Constructor |
68 Constructor |
68 |
69 |
69 @param vcs reference to the vcs object |
70 @param vcs reference to the vcs object |
70 @param parent parent widget (QWidget) |
71 @param parent parent widget (QWidget) |
71 """ |
72 """ |
72 super(GitLogBrowserDialog, self).__init__(parent) |
73 super().__init__(parent) |
73 self.setupUi(self) |
74 self.setupUi(self) |
74 |
75 |
75 windowFlags = self.windowFlags() |
76 windowFlags = self.windowFlags() |
76 windowFlags |= Qt.WindowType.WindowContextHelpButtonHint |
77 windowFlags |= Qt.WindowType.WindowContextHelpButtonHint |
77 self.setWindowFlags(windowFlags) |
78 self.setWindowFlags(windowFlags) |
725 else: |
726 else: |
726 itm.setData(0, self.__parentsRole, parents) |
727 itm.setData(0, self.__parentsRole, parents) |
727 for parent in parents: |
728 for parent in parents: |
728 self.__childrenInfo[parent].append(commitId) |
729 self.__childrenInfo[parent].append(commitId) |
729 |
730 |
730 if self.logTree.topLevelItemCount() > 1: |
731 topedges = ( |
731 topedges = ( |
732 self.logTree.topLevelItem( |
732 self.logTree.topLevelItem( |
733 self.logTree.indexOfTopLevelItem(itm) - 1 |
733 self.logTree.indexOfTopLevelItem(itm) - 1) |
734 ).data(0, self.__edgesRole) |
734 .data(0, self.__edgesRole) |
735 if self.logTree.topLevelItemCount() > 1 else |
735 ) |
736 None |
736 else: |
737 ) |
737 topedges = None |
|
738 |
738 |
739 icon = self.__generateIcon(column, color, edges, topedges, |
739 icon = self.__generateIcon(column, color, edges, topedges, |
740 QColor("blue"), |
740 QColor("blue"), |
741 commitId == self.__projectRevision) |
741 commitId == self.__projectRevision) |
742 itm.setIcon(0, icon) |
742 itm.setIcon(0, icon) |
2111 @type int |
2111 @type int |
2112 """ |
2112 """ |
2113 self.diffEdit.clear() |
2113 self.diffEdit.clear() |
2114 self.diffLabel.setText(self.tr("Differences")) |
2114 self.diffLabel.setText(self.tr("Differences")) |
2115 self.diffSelectLabel.clear() |
2115 self.diffSelectLabel.clear() |
2116 try: |
2116 with contextlib.suppress(AttributeError): |
2117 self.diffHighlighter.regenerateRules() |
2117 self.diffHighlighter.regenerateRules() |
2118 except AttributeError: |
|
2119 # backward compatibility |
|
2120 pass |
|
2121 |
2118 |
2122 selectedItems = self.logTree.selectedItems() |
2119 selectedItems = self.logTree.selectedItems() |
2123 if len(selectedItems) == 1: |
2120 if len(selectedItems) == 1: |
2124 currentItem = selectedItems[0] |
2121 currentItem = selectedItems[0] |
2125 commit2 = currentItem.text(self.CommitIdColumn) |
2122 commit2 = currentItem.text(self.CommitIdColumn) |
2261 @type str |
2258 @type str |
2262 """ |
2259 """ |
2263 if ":" in link: |
2260 if ":" in link: |
2264 scheme, parent = link.split(":", 1) |
2261 scheme, parent = link.split(":", 1) |
2265 if scheme == "diff": |
2262 if scheme == "diff": |
2266 try: |
2263 with contextlib.suppress(ValueError): |
2267 parent = int(parent) |
2264 parent = int(parent) |
2268 self.__generateDiffs(parent) |
2265 self.__generateDiffs(parent) |
2269 except ValueError: |
|
2270 # ignore silently |
|
2271 pass |
|
2272 |
2266 |
2273 @pyqtSlot(str) |
2267 @pyqtSlot(str) |
2274 def on_saveLabel_linkActivated(self, link): |
2268 def on_saveLabel_linkActivated(self, link): |
2275 """ |
2269 """ |
2276 Private slot to handle the selection of the save link. |
2270 Private slot to handle the selection of the save link. |