forked from M-Labs/artiq
scanwidget: shortcuts (4a21946)
This commit is contained in:
parent
fb31782b6f
commit
ec5c2b6699
|
@ -155,7 +155,7 @@ class _RangeScan(LayoutWidget):
|
||||||
spinbox.setSuffix(" " + procdesc["unit"])
|
spinbox.setSuffix(" " + procdesc["unit"])
|
||||||
|
|
||||||
self.scanner = scanner = ScanWidget()
|
self.scanner = scanner = ScanWidget()
|
||||||
scanner.setMinimumSize(150, 0)
|
scanner.setFocusPolicy(QtCore.Qt.StrongFocus)
|
||||||
scanner.setSizePolicy(QtWidgets.QSizePolicy(
|
scanner.setSizePolicy(QtWidgets.QSizePolicy(
|
||||||
QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed))
|
QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed))
|
||||||
self.addWidget(scanner, 0, 0, -1, 1)
|
self.addWidget(scanner, 0, 0, -1, 1)
|
||||||
|
|
|
@ -22,13 +22,17 @@ class ScanWidget(QtWidgets.QWidget):
|
||||||
|
|
||||||
self.ticker = Ticker()
|
self.ticker = Ticker()
|
||||||
|
|
||||||
self.menu = QtWidgets.QMenu(self)
|
self.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
||||||
action = QtWidgets.QAction("&View Range", self)
|
action = QtWidgets.QAction("V&iew range", self)
|
||||||
|
action.setShortcut(QtGui.QKeySequence("CTRL+i"))
|
||||||
|
action.setShortcutContext(QtCore.Qt.WidgetShortcut)
|
||||||
action.triggered.connect(self.viewRange)
|
action.triggered.connect(self.viewRange)
|
||||||
self.menu.addAction(action)
|
self.addAction(action)
|
||||||
action = QtWidgets.QAction("&Snap Range", self)
|
action = QtWidgets.QAction("Sna&p range", self)
|
||||||
|
action.setShortcut(QtGui.QKeySequence("CTRL+p"))
|
||||||
|
action.setShortcutContext(QtCore.Qt.WidgetShortcut)
|
||||||
action.triggered.connect(self.snapRange)
|
action.triggered.connect(self.snapRange)
|
||||||
self.menu.addAction(action)
|
self.addAction(action)
|
||||||
|
|
||||||
qfm = QtGui.QFontMetrics(self.font())
|
qfm = QtGui.QFontMetrics(self.font())
|
||||||
self._labelSize = QtCore.QSize(
|
self._labelSize = QtCore.QSize(
|
||||||
|
@ -39,9 +43,6 @@ class ScanWidget(QtWidgets.QWidget):
|
||||||
self._axisView = None
|
self._axisView = None
|
||||||
self._offset, self._drag = None, None
|
self._offset, self._drag = None, None
|
||||||
|
|
||||||
def contextMenuEvent(self, ev):
|
|
||||||
self.menu.popup(ev.globalPos())
|
|
||||||
|
|
||||||
def sizeHint(self):
|
def sizeHint(self):
|
||||||
return self.minimumSizeHint()
|
return self.minimumSizeHint()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue