Make completer view click handler async
parent
4f4f9f66b4
commit
ac35e26d9a
piker/ui
|
@ -120,8 +120,6 @@ class CompleterView(QTreeView):
|
||||||
# TODO: size this based on DPI font
|
# TODO: size this based on DPI font
|
||||||
self.setIndentation(20)
|
self.setIndentation(20)
|
||||||
|
|
||||||
self.pressed.connect(self.on_pressed)
|
|
||||||
|
|
||||||
# self.setUniformRowHeights(True)
|
# self.setUniformRowHeights(True)
|
||||||
# self.setColumnWidth(0, 3)
|
# self.setColumnWidth(0, 3)
|
||||||
# self.setVerticalBarPolicy(Qt.ScrollBarAlwaysOff)
|
# self.setVerticalBarPolicy(Qt.ScrollBarAlwaysOff)
|
||||||
|
@ -138,12 +136,12 @@ class CompleterView(QTreeView):
|
||||||
|
|
||||||
self._font_size: int = 0 # pixels
|
self._font_size: int = 0 # pixels
|
||||||
|
|
||||||
def on_pressed(self, idx: QModelIndex) -> None:
|
async def on_pressed(self, idx: QModelIndex) -> None:
|
||||||
'''Mouse pressed on view handler.
|
'''Mouse pressed on view handler.
|
||||||
|
|
||||||
'''
|
'''
|
||||||
search = self.parent()
|
search = self.parent()
|
||||||
search.chart_current_item(clear_to_cache=False)
|
await search.chart_current_item(clear_to_cache=False)
|
||||||
search.focus()
|
search.focus()
|
||||||
|
|
||||||
def set_font_size(self, size: int = 18):
|
def set_font_size(self, size: int = 18):
|
||||||
|
@ -556,7 +554,7 @@ class SearchWidget(QtWidgets.QWidget):
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def chart_current_item(
|
async def chart_current_item(
|
||||||
self,
|
self,
|
||||||
clear_to_cache: bool = True,
|
clear_to_cache: bool = True,
|
||||||
|
|
||||||
|
@ -576,7 +574,7 @@ class SearchWidget(QtWidgets.QWidget):
|
||||||
|
|
||||||
log.info(f'Requesting symbol: {symbol}.{provider}')
|
log.info(f'Requesting symbol: {symbol}.{provider}')
|
||||||
|
|
||||||
chart.load_symbol(
|
await chart.load_symbol(
|
||||||
provider,
|
provider,
|
||||||
symbol,
|
symbol,
|
||||||
'info',
|
'info',
|
||||||
|
@ -826,7 +824,7 @@ async def handle_keyboard_input(
|
||||||
|
|
||||||
if key in (Qt.Key_Enter, Qt.Key_Return):
|
if key in (Qt.Key_Enter, Qt.Key_Return):
|
||||||
|
|
||||||
search.chart_current_item(clear_to_cache=True)
|
await search.chart_current_item(clear_to_cache=True)
|
||||||
_search_enabled = False
|
_search_enabled = False
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -896,7 +894,7 @@ async def handle_keyboard_input(
|
||||||
if parent_item and parent_item.text() == 'cache':
|
if parent_item and parent_item.text() == 'cache':
|
||||||
|
|
||||||
# if it's a cache item, switch and show it immediately
|
# if it's a cache item, switch and show it immediately
|
||||||
search.chart_current_item(clear_to_cache=False)
|
await search.chart_current_item(clear_to_cache=False)
|
||||||
|
|
||||||
elif not ctl:
|
elif not ctl:
|
||||||
# relay to completer task
|
# relay to completer task
|
||||||
|
|
Loading…
Reference in New Issue