# Path: sen/exceptions.py
# class NotifyError(Exception):
#     """
#     There was an error, we should notify user.
#     """


import logging
import threading
import urwid
from sen.exceptions import NotifyError



logger = logging.getLogger(__name__)


class WidgetBase(urwid.ListBox):
    """
    common class for widgets
    """

    def __init__(self, ui, *args, **kwargs):
        self.ui = ui
        self.search_string = None
        self.filter_query = ""
        super().__init__(*args, **kwargs)
        self.ro_content = self.body[:]  # unfiltered content of a widget
        self.body_change_lock = threading.Lock()

    def set_body(self, widgets):
        with self.body_change_lock:
            self.body[:] = widgets

    def reload_widget(self):
        # this is the easiest way to refresh body
        with self.body_change_lock:
            self.body[:] = self.body

    def _search(self, reverse_search=False):
        if self.search_string is None:

# Path: sen/exceptions.py
# class NotifyError(Exception):
#     """
#     There was an error, we should notify user.
#     """


# Path: sen/tui/widgets/list/base.py
import logging
import threading
import urwid
from sen.exceptions import NotifyError




logger = logging.getLogger(__name__)


class WidgetBase(urwid.ListBox):
    """
    common class for widgets
    """

    def __init__(self, ui, *args, **kwargs):
        self.ui = ui
        self.search_string = None
        self.filter_query = ""
        super().__init__(*args, **kwargs)
        self.ro_content = self.body[:]  # unfiltered content of a widget
        self.body_change_lock = threading.Lock()

    def set_body(self, widgets):
        with self.body_change_lock:
            self.body[:] = widgets

    def reload_widget(self):
        # this is the easiest way to refresh body
        with self.body_change_lock:
            self.body[:] = self.body

    def _search(self, reverse_search=False):
        if self.search_string is None:

            raise NotifyError("No search pattern specified.")