def move_notebook(self, notebook_id): with NotebookChoiceDialog(self) as dlg: if dlg.ShowModal() == wx.ID_OK: notebook = Notebook.find(notebook_id) source_id, target_id = notebook.move( dlg.get_selected_notebook_id()) if source_id != target_id: self.nav_panel.note_tree.move_notebook_to( target_id, notebook)
def delete_notebook(self, notebook_id): notebook = Notebook.find(notebook_id) caption = _("notebook.delete_dialog_title", v1=notebook.name) message = _("notebook.delete_dialog_message") with GenericMessageDialog(message, caption) as dlg: if dlg.ShowModal() == wx.ID_OK: self.nav_panel.note_tree.delete_selected_notebook() self.list_panel.empty() self.detail_panel.remove_note() self.todo_panel.empty() notebook.delete_instance()
def edit_notebook(self, notebook_id): notebook = Notebook.find(notebook_id) old_name = notebook.name with NotebookFormDialog(self, notebook) as dlg: if dlg.ShowModal() == wx.ID_OK: notebook.update_instance(name=dlg.get_name(), description=dlg.get_description()) self.list_panel.update_header_title(dlg.get_name()) if old_name != notebook.name: self.nav_panel.note_tree.update_selected_notebook( notebook.name)
def list_note(self, notebook_id): notebook = Notebook.find(notebook_id) query = notebook.notes.order_by(Note.updated_at.desc()) notes = [n for n in query] self.list_panel.add_notes(notes, notebook) self._display_note_list(notes)