From d2803c9e28a88490ed466ce383160c2d2dd4613c Mon Sep 17 00:00:00 2001 From: Ken Lauer Date: Mon, 28 Jun 2021 14:29:46 -0700 Subject: [PATCH 1/2] FIX: searching for happi devices was broken (SearchResults refactor) --- lucid/main_window.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lucid/main_window.py b/lucid/main_window.py index 66d785c..bb55c73 100644 --- a/lucid/main_window.py +++ b/lucid/main_window.py @@ -489,15 +489,12 @@ def _thread_screens_search(callback, *, general_search, category_search, ) -def _happi_dict_to_display(d): - name = d['name'] +def _happi_searchresult_to_display(search_result): + name = search_result['name'] @LucidMainWindow.in_dock(title=f'[happi] {name}') def wrapped(): - client = utils.get_happi_client() - # dictionary -> device container -> device -> display - happi_device = client.find_device(**d) - device = happi.loader.from_container(happi_device) + device = search_result.get() return utils.display_for_device(device) wrapped() @@ -535,7 +532,7 @@ def _thread_happi_search(callback, *, general_search, category_search, name=item['name'], item=item, reason=f'{key}: {value}', - callback=lambda ct=item: _happi_dict_to_display(ct), + callback=lambda ct=item: _happi_searchresult_to_display(ct), ) From b43d1b344b6f7130d93ac41c4bad873d7a6fa849 Mon Sep 17 00:00:00 2001 From: Ken Lauer Date: Mon, 28 Jun 2021 15:18:01 -0700 Subject: [PATCH 2/2] STY: unused happi import; apply isort --- lucid/main_window.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lucid/main_window.py b/lucid/main_window.py index bb55c73..4f5e2ba 100644 --- a/lucid/main_window.py +++ b/lucid/main_window.py @@ -2,16 +2,15 @@ import logging import pathlib -import happi import typhos +from pydm import exception from PyQtAds import QtAds -from qtpy import QtCore, QtWidgets, QtGui +from qtpy import QtCore, QtGui, QtWidgets from qtpy.QtCore import Qt, Signal -from qtpy.QtWidgets import QMainWindow, QStyle, QSizePolicy - -from pydm import exception +from qtpy.QtWidgets import QMainWindow, QSizePolicy, QStyle import lucid + from . import utils logger = logging.getLogger(__name__)