15 |
15 |
16 import os |
16 import os |
17 import re |
17 import re |
18 import collections |
18 import collections |
19 |
19 |
20 from PyQt5.QtCore import pyqtSlot, qVersion, Qt, QDate, QProcess, QTimer, \ |
20 from PyQt5.QtCore import pyqtSlot, Qt, QDate, QProcess, QTimer, QRegExp, \ |
21 QRegExp, QSize, QPoint, QFileInfo |
21 QSize, QPoint, QFileInfo |
22 from PyQt5.QtGui import QCursor, QColor, QPixmap, QPainter, QPen, QBrush, \ |
22 from PyQt5.QtGui import QCursor, QColor, QPixmap, QPainter, QPen, QBrush, \ |
23 QIcon, QTextCursor |
23 QIcon, QTextCursor |
24 from PyQt5.QtWidgets import QWidget, QDialogButtonBox, QHeaderView, \ |
24 from PyQt5.QtWidgets import QWidget, QDialogButtonBox, QHeaderView, \ |
25 QTreeWidgetItem, QApplication, QLineEdit, QMenu, QInputDialog, QToolTip |
25 QTreeWidgetItem, QApplication, QLineEdit, QMenu, QInputDialog, QToolTip |
26 |
26 |
33 from .HgDiffGenerator import HgDiffGenerator |
33 from .HgDiffGenerator import HgDiffGenerator |
34 |
34 |
35 import UI.PixmapCache |
35 import UI.PixmapCache |
36 import Preferences |
36 import Preferences |
37 import Utilities |
37 import Utilities |
|
38 from Globals import qVersionTuple |
38 |
39 |
39 COLORNAMES = ["blue", "darkgreen", "red", "green", "darkblue", "purple", |
40 COLORNAMES = ["blue", "darkgreen", "red", "green", "darkblue", "purple", |
40 "cyan", "olive", "magenta", "darkred", "darkmagenta", |
41 "cyan", "olive", "magenta", "darkred", "darkmagenta", |
41 "darkcyan", "gray", "yellow"] |
42 "darkcyan", "gray", "yellow"] |
42 COLORS = [str(QColor(x).name()) for x in COLORNAMES] |
43 COLORS = [str(QColor(x).name()) for x in COLORNAMES] |
241 """ |
242 """ |
242 Private method to initialize the actions menu. |
243 Private method to initialize the actions menu. |
243 """ |
244 """ |
244 self.__actionsMenu = QMenu() |
245 self.__actionsMenu = QMenu() |
245 self.__actionsMenu.setTearOffEnabled(True) |
246 self.__actionsMenu.setTearOffEnabled(True) |
246 if qVersion() >= "5.1.0": |
247 if qVersionTuple() >= (5, 1, 0): |
247 self.__actionsMenu.setToolTipsVisible(True) |
248 self.__actionsMenu.setToolTipsVisible(True) |
248 else: |
249 else: |
249 self.__actionsMenu.hovered.connect(self.__actionsMenuHovered) |
250 self.__actionsMenu.hovered.connect(self.__actionsMenuHovered) |
250 |
251 |
251 self.__graftAct = self.__actionsMenu.addAction( |
252 self.__graftAct = self.__actionsMenu.addAction( |