<commit_before>from widgets.compat_textinput import CompatTextInput
from kivy_soil.kb_system.canvas import FocusBehaviorCanvas
from kivy.properties import StringProperty, BooleanProperty, ListProperty
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder


Builder.load_string('''
<FilterInputBox>:
    # orientation: 'horizontal'
    # canvas.before:
    #     Color:
    #         rgba: self.background_color
    #     Rectangle:
    #         pos: self.pos
    #         size: self.size
    CompatTextInput:
        id: filter_input
        size_hint: 1, 1
        background_color: root.background_color
        background_active: ''
        background_normal: ''
        background_disabled_normal: ''
        border: 0, 0, 0, 0
        markup: True
        foreground_color: root.text_color
        font_size: int(self.height * 0.45)
        multiline: False
        on_text_validate: root.filter_text = self.text
        hint_text: '' if self.focus else 'Filter'
''')


class FilterInputBox(BoxLayout):
    filter_text = StringProperty()
    is_focusable = BooleanProperty()
    background_color = ListProperty([0.2, 0.2, 0.2, 1])
    text_color = ListProperty([0.9, 0.9, 0.9, 1])

    def on_is_focusable(self, _, value):
        if value:
            self.ids.filter_input.is_focusable = True
        else:
            self.ids.filter_input.is_focusable = False

    def focus_input(self, *args):
        input_widget = self.ids.filter_input
        input_widget.focus = True
        input_widget.select_all()<commit_msg>Added media auto refresh when typing filter text<commit_after>from widgets.compat_textinput import CompatTextInput
from kivy_soil.kb_system.canvas import FocusBehaviorCanvas
from kivy.properties import StringProperty, BooleanProperty, ListProperty
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder
from kivy.clock import Clock


Builder.load_string('''
<FilterInputBox>:
    CompatTextInput:
        id: filter_input
        size_hint: 1, 1
        background_color: root.background_color
        background_active: ''
        background_normal: ''
        background_disabled_normal: ''
        border: 0, 0, 0, 0
        markup: True
        foreground_color: root.text_color
        font_size: int(self.height * 0.45)
        multiline: False
        on_text_validate: root.filter_text = self.text
        hint_text: '' if self.focus else 'Filter'
''')


class FilterInputBox(BoxLayout):
    filter_text = StringProperty()
    is_focusable = BooleanProperty()
    background_color = ListProperty([0.2, 0.2, 0.2, 1])
    text_color = ListProperty([0.9, 0.9, 0.9, 1])

    def on_ids(self, _, value):
        value.filter_input.bind(text=self.on_input_text)

    def on_input_text(self, _, value):
        Clock.unschedule(self.update_filter_text)
        Clock.schedule_once(self.update_filter_text, 0.5)

    def update_filter_text(self, *args):
        self.filter_text = self.ids.filter_input.text

    def on_is_focusable(self, _, value):
        if value:
            self.ids.filter_input.is_focusable = True
        else:
            self.ids.filter_input.is_focusable = False

    def focus_input(self, *args):
        input_widget = self.ids.filter_input
        input_widget.focus = True
        input_widget.select_all()
{'fraction_non_alphanumeric': 0.09118448954862163, 'fraction_numerical': 0.014541048167222055, 'mean_word_length': 2.8847058823529412, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7567037', 'n_tokens_mistral': 1055, 'n_tokens_neox': 1006, 'n_words': 218}