Skip to content

Commit

Permalink
FIX: Adding missing file that was not under version control.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Slepicka committed Apr 29, 2020
1 parent 7129162 commit 8e38735
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions pydm/utilities/shortcuts.py
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)

0 comments on commit 8e38735

Please sign in to comment.