|
12 | 12 | # pylint: disable=R0201
|
13 | 13 |
|
14 | 14 | from spyderlib.qt.QtGui import (QTabWidget, QMenu, QDrag, QApplication,
|
15 |
| - QTabBar, QShortcut, QKeySequence, QWidget, |
16 |
| - QHBoxLayout) |
| 15 | + QTabBar, QWidget, QHBoxLayout) |
17 | 16 | from spyderlib.qt.QtCore import SIGNAL, Qt, QPoint, QMimeData, QByteArray
|
18 | 17 |
|
19 |
| -import os |
20 | 18 | import os.path as osp
|
21 | 19 |
|
22 | 20 | # Local imports
|
23 | 21 | from spyderlib.baseconfig import _
|
| 22 | +from spyderlib.guiconfig import new_shortcut |
24 | 23 | from spyderlib.utils.misc import get_common_path
|
25 | 24 | from spyderlib.utils.qthelpers import (add_actions, create_toolbutton,
|
26 | 25 | create_action, get_icon)
|
@@ -265,16 +264,13 @@ def __init__(self, parent, actions=None, menu=None,
|
265 | 264 | self.connect(tab_bar, SIGNAL('move_tab(QString,int,int)'),
|
266 | 265 | self.move_tab_from_another_tabwidget)
|
267 | 266 | self.setTabBar(tab_bar)
|
268 |
| - def newsc(keystr, triggered): |
269 |
| - sc = QShortcut(QKeySequence(keystr), parent, triggered) |
270 |
| - sc.setContext(Qt.WidgetWithChildrenShortcut) |
271 |
| - return sc |
272 |
| - tabsc = newsc("Ctrl+Tab", lambda: self.tab_navigate(1)) |
273 |
| - tabshiftsc = newsc("Shift+Ctrl+Tab", lambda: self.tab_navigate(-1)) |
274 |
| - closesc1 = newsc("Ctrl+W", lambda: self.emit(SIGNAL("close_tab(int)"), |
275 |
| - self.currentIndex())) |
276 |
| - closesc2 = newsc("Ctrl+F4", lambda: self.emit(SIGNAL("close_tab(int)"), |
277 |
| - self.currentIndex())) |
| 267 | + |
| 268 | + new_shortcut("Ctrl+Tab", parent, lambda: self.tab_navigate(1)) |
| 269 | + new_shortcut("Shift+Ctrl+Tab", parent, lambda: self.tab_navigate(-1)) |
| 270 | + new_shortcut("Ctrl+W", parent, lambda: self.emit(SIGNAL("close_tab(int)"), |
| 271 | + self.currentIndex())) |
| 272 | + new_shortcut("Ctrl+F4", parent, lambda: self.emit(SIGNAL("close_tab(int)"), |
| 273 | + self.currentIndex())) |
278 | 274 |
|
279 | 275 | def tab_navigate(self, delta=1):
|
280 | 276 | """Ctrl+Tab"""
|
|
0 commit comments