-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX: Adding missing file that was not under version control.
- Loading branch information
Hugo Slepicka
committed
Apr 29, 2020
1 parent
7129162
commit 8e38735
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from qtpy import QtWidgets, QtGui, QtCore | ||
|
||
|
||
def install_connection_inspector(parent, keys=None): | ||
""" | ||
Install a QShortcut at the application which opens the PyDM Connection | ||
Inspector | ||
Parameters | ||
---------- | ||
parent : QWidget | ||
A shortcut is "listened for" by Qt's event loop when the shortcut's | ||
parent widget is receiving events. | ||
keys : QKeySequence, optional | ||
Default value is `Alt+C` | ||
""" | ||
from pydm.connection_inspector import ConnectionInspector | ||
|
||
def show_inspector(): | ||
c = ConnectionInspector(parent=parent) | ||
c.show() | ||
|
||
parent = parent or QtWidgets.QApplication.desktop() | ||
|
||
if keys is None: | ||
keys = QtGui.QKeySequence(QtCore.Qt.ALT + QtCore.Qt.Key_C) | ||
shortcut = QtWidgets.QShortcut(keys, parent); | ||
shortcut.setContext(QtCore.Qt.ApplicationShortcut) | ||
shortcut.activated.connect(show_inspector) |