Esempio n. 1
0
 def on_note_delete(self, note_id):
     res = self.list_panel.delete_note(note_id)
     Note.find(note_id).delete_instance()
     if res:
         self.show_note(res)
     else:
         self.todo_panel.empty()
         self.detail_panel.remove_note()
         if self.detail_panel.IsShown():
             self.detail_panel.Hide()
     self.nav_panel.note_tree.update_selected_notebook_count(-1)
Esempio n. 2
0
    def show_note(self, note_param):
        if isinstance(note_param, int):
            note_id = note_param
            note = Note.find(note_id)
        elif isinstance(note_param, Note):
            note = note_param
            note_id = note.id
        else:
            raise ('Unknown note_param')

        self.list_panel.highlight_note(note_id)
        self.detail_panel.add_note(note, self.list_panel.header_panel.query)
        self.todo_panel.add_todos(note.id, note.todos.all())

        self.current_note = note
        pub.sendMessage('on.note.show', note=note)
Esempio n. 3
0
 def on_note_move(self, note_id):
     with NotebookChoiceDialog(self) as dlg:
         if dlg.ShowModal() == wx.ID_OK:
             target_notebook_id = dlg.get_selected_notebook_id()
             if target_notebook_id is None:
                 return
             source_id, target_id = Note.find(note_id).move(
                 target_notebook_id)
             if source_id != target_id:
                 res = self.list_panel.delete_note(note_id)
                 if res:
                     self.show_note(res)
                 else:
                     self.todo_panel.empty()
                     self.detail_panel.remove_note()
                 self.nav_panel.note_tree.update_notebook_count(
                     source_id, -1)
                 self.nav_panel.note_tree.update_notebook_count(
                     target_id, 1)
Esempio n. 4
0
 def on_todo_change(self, note_id):
     note = Note.find(note_id)
     self.on_note_show(note)
Esempio n. 5
0
 def save_note(self, note_id, note_detail):
     note = Note.find(note_id)
     note.update(note_detail)
     self.detail_panel.update_timestamps()
     self.list_panel.update_selected_note(note)
Esempio n. 6
0
 def on_note_copy(self, note_id):
     copied_note = Note.find(note_id).copy()
     self.list_panel.add_new_note(copied_note)
     self.show_note(copied_note)
     self.nav_panel.note_tree.update_selected_notebook_count(1)