From 307afb19350984945692dfed62bab4e0465aad7e Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Thu, 20 May 2021 14:29:37 -0400 Subject: [PATCH] Clean some key handling --- piker/ui/_interaction.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/piker/ui/_interaction.py b/piker/ui/_interaction.py index 821a7a3a..9c407f3c 100644 --- a/piker/ui/_interaction.py +++ b/piker/ui/_interaction.py @@ -694,7 +694,7 @@ class ChartView(ViewBox): ev.accept() self.mode.submit_exec() - def keyReleaseEvent(self, ev): + def keyReleaseEvent(self, ev: QtCore.QEvent): """ Key release to normally to trigger release of input mode @@ -713,6 +713,10 @@ class ChartView(ViewBox): # if self.state['mouseMode'] == ViewBox.RectMode: self.setMouseMode(ViewBox.PanMode) + # ctlalt = False + # if (QtCore.Qt.AltModifier | QtCore.Qt.ControlModifier) == mods: + # ctlalt = True + # if self.state['mouseMode'] == ViewBox.RectMode: # if key == QtCore.Qt.Key_Space: if mods == QtCore.Qt.ControlModifier or key == QtCore.Qt.Key_Control: @@ -749,19 +753,20 @@ class ChartView(ViewBox): ctrl = False if mods == QtCore.Qt.ControlModifier: ctrl = True - - if mods == QtCore.Qt.ControlModifier: self.mode._exec_mode = 'live' self._key_active = True - # alt - if mods == QtCore.Qt.AltModifier: - pass + # ctrl + alt + # ctlalt = False + # if (QtCore.Qt.AltModifier | QtCore.Qt.ControlModifier) == mods: + # ctlalt = True # ctlr-/ for "lookup", "search" -> open search tree - if ctrl and (key == QtCore.Qt.Key_L or key == QtCore.Qt.Key_Space): - + if ctrl and key in { + QtCore.Qt.Key_L, + QtCore.Qt.Key_Space, + }: search = self._chart._lc.chart_space.search search.focus()