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 ( |
2111 @type int |
2112 @type int |
2112 """ |
2113 """ |
2113 self.diffEdit.clear() |
2114 self.diffEdit.clear() |
2114 self.diffLabel.setText(self.tr("Differences")) |
2115 self.diffLabel.setText(self.tr("Differences")) |
2115 self.diffSelectLabel.clear() |
2116 self.diffSelectLabel.clear() |
2116 try: |
2117 with contextlib.suppress(AttributeError): |
2117 self.diffHighlighter.regenerateRules() |
2118 self.diffHighlighter.regenerateRules() |
2118 except AttributeError: |
|
2119 # backward compatibility |
|
2120 pass |
|
2121 |
2119 |
2122 selectedItems = self.logTree.selectedItems() |
2120 selectedItems = self.logTree.selectedItems() |
2123 if len(selectedItems) == 1: |
2121 if len(selectedItems) == 1: |
2124 currentItem = selectedItems[0] |
2122 currentItem = selectedItems[0] |
2125 commit2 = currentItem.text(self.CommitIdColumn) |
2123 commit2 = currentItem.text(self.CommitIdColumn) |
2261 @type str |
2259 @type str |
2262 """ |
2260 """ |
2263 if ":" in link: |
2261 if ":" in link: |
2264 scheme, parent = link.split(":", 1) |
2262 scheme, parent = link.split(":", 1) |
2265 if scheme == "diff": |
2263 if scheme == "diff": |
2266 try: |
2264 with contextlib.suppress(ValueError): |
2267 parent = int(parent) |
2265 parent = int(parent) |
2268 self.__generateDiffs(parent) |
2266 self.__generateDiffs(parent) |
2269 except ValueError: |
|
2270 # ignore silently |
|
2271 pass |
|
2272 |
2267 |
2273 @pyqtSlot(str) |
2268 @pyqtSlot(str) |
2274 def on_saveLabel_linkActivated(self, link): |
2269 def on_saveLabel_linkActivated(self, link): |
2275 """ |
2270 """ |
2276 Private slot to handle the selection of the save link. |
2271 Private slot to handle the selection of the save link. |