eric6/Plugins/VcsPlugins/vcsMercurial/HgStatusDialog.py

branch
without_py2_and_pyqt4
changeset 7201
6b42677d7043
parent 7192
a22eee00b052
child 7229
53054eb5b15a
equal deleted inserted replaced
7200:ebab8ba287e6 7201:6b42677d7043
11 from __future__ import unicode_literals 11 from __future__ import unicode_literals
12 12
13 import os 13 import os
14 14
15 from PyQt5.QtCore import pyqtSlot, Qt, QProcess, QTimer, QSize 15 from PyQt5.QtCore import pyqtSlot, Qt, QProcess, QTimer, QSize
16 from PyQt5.QtGui import QTextCursor, QCursor 16 from PyQt5.QtGui import QTextCursor
17 from PyQt5.QtWidgets import QWidget, QDialogButtonBox, QMenu, QHeaderView, \ 17 from PyQt5.QtWidgets import QWidget, QDialogButtonBox, QMenu, QHeaderView, \
18 QTreeWidgetItem, QLineEdit, QToolTip 18 QTreeWidgetItem, QLineEdit
19 19
20 from E5Gui.E5Application import e5App 20 from E5Gui.E5Application import e5App
21 from E5Gui import E5MessageBox 21 from E5Gui import E5MessageBox
22 22
23 from .Ui_HgStatusDialog import Ui_HgStatusDialog 23 from .Ui_HgStatusDialog import Ui_HgStatusDialog
25 from .HgDiffHighlighter import HgDiffHighlighter 25 from .HgDiffHighlighter import HgDiffHighlighter
26 from .HgDiffGenerator import HgDiffGenerator 26 from .HgDiffGenerator import HgDiffGenerator
27 27
28 import Preferences 28 import Preferences
29 import UI.PixmapCache 29 import UI.PixmapCache
30 from Globals import qVersionTuple, strToQByteArray 30 from Globals import strToQByteArray
31 31
32 32
33 class HgStatusDialog(QWidget, Ui_HgStatusDialog): 33 class HgStatusDialog(QWidget, Ui_HgStatusDialog):
34 """ 34 """
35 Class implementing a dialog to show the output of the hg status command 35 Class implementing a dialog to show the output of the hg status command
124 """ 124 """
125 Private method to initialize the actions menu. 125 Private method to initialize the actions menu.
126 """ 126 """
127 self.__actionsMenu = QMenu() 127 self.__actionsMenu = QMenu()
128 self.__actionsMenu.setTearOffEnabled(True) 128 self.__actionsMenu.setTearOffEnabled(True)
129 if qVersionTuple() >= (5, 1, 0): 129 self.__actionsMenu.setToolTipsVisible(True)
130 self.__actionsMenu.setToolTipsVisible(True)
131 else:
132 self.__actionsMenu.hovered.connect(self.__actionsMenuHovered)
133 self.__actionsMenu.aboutToShow.connect(self.__showActionsMenu) 130 self.__actionsMenu.aboutToShow.connect(self.__showActionsMenu)
134 131
135 self.__commitAct = self.__actionsMenu.addAction( 132 self.__commitAct = self.__actionsMenu.addAction(
136 self.tr("Commit"), self.__commit) 133 self.tr("Commit"), self.__commit)
137 self.__commitAct.setToolTip(self.tr("Commit the selected changes")) 134 self.__commitAct.setToolTip(self.tr("Commit the selected changes"))
206 "Adjusts the width of all columns to their contents")) 203 "Adjusts the width of all columns to their contents"))
207 204
208 self.actionsButton.setIcon( 205 self.actionsButton.setIcon(
209 UI.PixmapCache.getIcon("actionsToolButton.png")) 206 UI.PixmapCache.getIcon("actionsToolButton.png"))
210 self.actionsButton.setMenu(self.__actionsMenu) 207 self.actionsButton.setMenu(self.__actionsMenu)
211
212 def __actionsMenuHovered(self, action):
213 """
214 Private slot to show the tooltip for an action menu entry.
215
216 @param action action to show tooltip for
217 @type QAction
218 """
219 QToolTip.showText(
220 QCursor.pos(), action.toolTip(),
221 self.__actionsMenu, self.__actionsMenu.actionGeometry(action))
222 208
223 def closeEvent(self, e): 209 def closeEvent(self, e):
224 """ 210 """
225 Protected slot implementing a close event handler. 211 Protected slot implementing a close event handler.
226 212

eric ide

mercurial