def searchfilter_toggle(self, _widget, initial_text=""): if self.filterbox_visible: ui.hide(self.filterbox) self.filterbox_visible = False self.edit_style_orig = self.libsearchfilter_get_style() self.filterpattern.set_text("") self.searchfilter_stop_loop() elif self.connected(): self.playlist_pos_before_filter = \ self.current.get_visible_rect().height self.filterbox_visible = True self.filterpattern.handler_block(self.filter_changed_handler) self.filterpattern.set_text(initial_text) self.filterpattern.handler_unblock(self.filter_changed_handler) self.prevtodo = 'foo' ui.show(self.filterbox) # extra thread for background search work, synchronized # with a condition and its internal mutex self.filterbox_cond = threading.Condition() self.filterbox_cmd_buf = initial_text qsearch_thread = threading.Thread(target=self.searchfilter_loop) qsearch_thread.daemon = True qsearch_thread.start() GLib.idle_add(self.filter_entry_grab_focus, self.filterpattern) self.current.set_headers_clickable(not self.filterbox_visible)
def searchfilter_toggle(self, _widget, initial_text=""): if self.filterbox_visible: ui.hide(self.filterbox) self.filterbox_visible = False self.filterpattern.set_text("") self.view.set_model(self.store) elif self.connected(): self.playlist_pos_before_filter = \ self.view.get_visible_rect().height self.filterbox_visible = True with self.filterpattern.handler_block(self.filter_changed_handler): self.filterpattern.set_text(initial_text) ui.show(self.filterbox) self.filterpattern.grab_focus() self.view.set_headers_clickable(not self.filterbox_visible)