def __init__(self, notes_dir, editor, extension, extensions): self.editor = editor self.notebook = notebook.PlainTextNoteBook(notes_dir, extension, extensions) # Don't filter the note list when the text in the search box changes. self.suppress_filter = False # Don't change the focused note when normally it would change # (e.g. when the text in the search box changes) self.suppress_focus = False self._selected_note = None self.search_box = AutocompleteWidget(wrap="clip") self.list_box = NoteFilterListBox(on_changed=self.on_list_box_changed) urwid.connect_signal(self.search_box, "change", self.on_search_box_changed) super(MainFrame, self).__init__(header=urwid.LineBox(self.search_box), body=None, focus_part="body") # Add all the notes to the listbox. self.filter(self.search_box.edit_text)
def __init__( self, notes_dir, editor, extension, extensions, exclude=None, ): self.editor = editor self.notebook = notebook.PlainTextNoteBook( notes_dir, extension, extensions, exclude=exclude, ) self.suppress_filter = False self.suppress_focus = False self._selected_note = None self.search_box = AutocompleteWidget(wrap='clip') self.list_box = NoteFilterListBox(on_changed=self.on_list_box_changed) urwid.connect_signal( self.search_box, 'change', self.on_search_box_changed, ) super(MainFrame, self).__init__( header=urwid.LineBox(self.search_box), body=None, focus_part='body', ) self.filter(self.search_box.edit_text)