8 |
8 |
9 This extension is necessary in order to support alternate keyboard |
9 This extension is necessary in order to support alternate keyboard |
10 shortcuts. |
10 shortcuts. |
11 """ |
11 """ |
12 |
12 |
|
13 from PyQt6.QtCore import QCoreApplication |
13 from PyQt6.QtGui import QAction, QActionGroup, QIcon, QKeySequence |
14 from PyQt6.QtGui import QAction, QActionGroup, QIcon, QKeySequence |
14 |
|
15 from eric7.EricWidgets.EricApplication import ericApp |
|
16 |
15 |
17 |
16 |
18 class ArgumentsError(RuntimeError): |
17 class ArgumentsError(RuntimeError): |
19 """ |
18 """ |
20 Class implementing an exception, which is raised, if the wrong number of |
19 Class implementing an exception, which is raised, if the wrong number of |
193 """ |
192 """ |
194 Private slot to add the primary keyboard accelerator to the tooltip. |
193 Private slot to add the primary keyboard accelerator to the tooltip. |
195 """ |
194 """ |
196 shortcut = self.shortcut().toString(QKeySequence.SequenceFormat.NativeText) |
195 shortcut = self.shortcut().toString(QKeySequence.SequenceFormat.NativeText) |
197 if shortcut: |
196 if shortcut: |
198 if ericApp().isLeftToRight(): |
197 if QCoreApplication.instance().isLeftToRight(): |
199 fmt = "{0} ({1})" |
198 fmt = "{0} ({1})" |
200 else: |
199 else: |
201 fmt = "({1}) {0}" |
200 fmt = "({1}) {0}" |
202 self.setToolTip(fmt.format(self.iconText(), shortcut)) |
201 self.setToolTip(fmt.format(self.iconText(), shortcut)) |
203 |
202 |