16 from PyQt5.QtCore import pyqtSlot, Qt, QDate, QProcess, QTimer, QRegExp, \ |
16 from PyQt5.QtCore import pyqtSlot, Qt, QDate, QProcess, QTimer, QRegExp, \ |
17 QSize, QPoint, QFileInfo |
17 QSize, QPoint, QFileInfo |
18 from PyQt5.QtGui import QCursor, QColor, QPixmap, QPainter, QPen, QBrush, \ |
18 from PyQt5.QtGui import QCursor, QColor, QPixmap, QPainter, QPen, QBrush, \ |
19 QIcon, QTextCursor |
19 QIcon, QTextCursor |
20 from PyQt5.QtWidgets import QWidget, QDialogButtonBox, QHeaderView, \ |
20 from PyQt5.QtWidgets import QWidget, QDialogButtonBox, QHeaderView, \ |
21 QTreeWidgetItem, QApplication, QLineEdit, QMenu, QInputDialog, QToolTip |
21 QTreeWidgetItem, QApplication, QLineEdit, QMenu, QInputDialog |
22 |
22 |
23 from E5Gui.E5Application import e5App |
23 from E5Gui.E5Application import e5App |
24 from E5Gui import E5MessageBox, E5FileDialog |
24 from E5Gui import E5MessageBox, E5FileDialog |
25 |
25 |
26 from .Ui_HgLogBrowserDialog import Ui_HgLogBrowserDialog |
26 from .Ui_HgLogBrowserDialog import Ui_HgLogBrowserDialog |
29 from .HgDiffGenerator import HgDiffGenerator |
29 from .HgDiffGenerator import HgDiffGenerator |
30 |
30 |
31 import UI.PixmapCache |
31 import UI.PixmapCache |
32 import Preferences |
32 import Preferences |
33 import Utilities |
33 import Utilities |
34 from Globals import qVersionTuple, strToQByteArray |
34 from Globals import strToQByteArray |
35 |
35 |
36 COLORNAMES = ["blue", "darkgreen", "red", "green", "darkblue", "purple", |
36 COLORNAMES = ["blue", "darkgreen", "red", "green", "darkblue", "purple", |
37 "cyan", "olive", "magenta", "darkred", "darkmagenta", |
37 "cyan", "olive", "magenta", "darkred", "darkmagenta", |
38 "darkcyan", "gray", "yellow"] |
38 "darkcyan", "gray", "yellow"] |
39 COLORS = [str(QColor(x).name()) for x in COLORNAMES] |
39 COLORS = [str(QColor(x).name()) for x in COLORNAMES] |
256 """ |
256 """ |
257 Private method to initialize the actions menu. |
257 Private method to initialize the actions menu. |
258 """ |
258 """ |
259 self.__actionsMenu = QMenu() |
259 self.__actionsMenu = QMenu() |
260 self.__actionsMenu.setTearOffEnabled(True) |
260 self.__actionsMenu.setTearOffEnabled(True) |
261 if qVersionTuple() >= (5, 1, 0): |
261 self.__actionsMenu.setToolTipsVisible(True) |
262 self.__actionsMenu.setToolTipsVisible(True) |
|
263 else: |
|
264 self.__actionsMenu.hovered.connect(self.__actionsMenuHovered) |
|
265 |
262 |
266 self.__graftAct = self.__actionsMenu.addAction( |
263 self.__graftAct = self.__actionsMenu.addAction( |
267 UI.PixmapCache.getIcon("vcsGraft.png"), |
264 UI.PixmapCache.getIcon("vcsGraft.png"), |
268 self.tr("Copy Changesets"), self.__graftActTriggered) |
265 self.tr("Copy Changesets"), self.__graftActTriggered) |
269 self.__graftAct.setToolTip(self.tr( |
266 self.__graftAct.setToolTip(self.tr( |
395 lambda: self.__selectAllActTriggered(False)) |
392 lambda: self.__selectAllActTriggered(False)) |
396 |
393 |
397 self.actionsButton.setIcon( |
394 self.actionsButton.setIcon( |
398 UI.PixmapCache.getIcon("actionsToolButton.png")) |
395 UI.PixmapCache.getIcon("actionsToolButton.png")) |
399 self.actionsButton.setMenu(self.__actionsMenu) |
396 self.actionsButton.setMenu(self.__actionsMenu) |
400 |
|
401 def __actionsMenuHovered(self, action): |
|
402 """ |
|
403 Private slot to show the tooltip for an action menu entry. |
|
404 |
|
405 @param action action to show tooltip for |
|
406 @type QAction |
|
407 """ |
|
408 QToolTip.showText( |
|
409 QCursor.pos(), action.toolTip(), |
|
410 self.__actionsMenu, self.__actionsMenu.actionGeometry(action)) |
|
411 |
397 |
412 def __initData(self): |
398 def __initData(self): |
413 """ |
399 """ |
414 Private method to (re-)initialize some data. |
400 Private method to (re-)initialize some data. |
415 """ |
401 """ |