HEX
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.4.25
System: Windows NT DESKTOP-4TAV2RJ 10.0 build 19045 (Windows 10) AMD64
User: fred (0)
PHP: 8.4.25
Disabled: NONE
Upload Files
File: C:/Users/fred/anaconda3/Lib/site-packages/intake/interface/catalog/search.py
# -----------------------------------------------------------------------------
# Copyright (c) 2012 - 2019, Anaconda, Inc. and Intake contributors
# All rights reserved.
#
# The full license is in the LICENSE file, distributed with this software.
# -----------------------------------------------------------------------------
import panel as pn


class Search:
    """Search panel for searching a list of catalogs

    Parameters
    ----------
    done_callback: function with cats as input
        function that is called when new cats have been generated
        via the search functionality
    """

    def __init__(self, done_callback: callable):
        self.done_callback = done_callback
        self.tinput = pn.widgets.TextInput()
        ok = pn.widgets.Button(name="OK")
        ok.on_click(self.go)
        label = pn.widgets.StaticText(value="Search")
        self.panel = pn.Row(label, self.tinput, ok)

    def go(self, *_):
        if self.tinput.value:
            self.done_callback(self.tinput.value)