Ejemplo n.º 1
0
 def rename_note(self, old_name, new_name):
     print('Rename Note:', old_name, 'to', new_name)
     data_access = DataAccess(engine)
     if not data_access.has_note(new_name):
         note = data_access.get_note_by_title(old_name)
         note.title = new_name
         data_access.save_note(note)
     else:
         self.editItem(self.currentItem())
Ejemplo n.º 2
0
 def dropEvent(self, event: QDropEvent):
     if self.dropIndicatorPosition() == 0:
         print('Note:', self.currentItem().text(0))
         print('Notebook:', self.itemAt(event.pos()).text(0))
         notebook_name = self.itemAt(event.pos()).text(0)
         note_title = self.currentItem().text(0)
         data_access = DataAccess(engine)
         if data_access.has_notebook(
                 notebook_name) and data_access.has_note(note_title):
             notebook = data_access.get_notebook_by_name(notebook_name)
             note = data_access.get_note_by_title(note_title)
             data_access.move_note_to_notebook(note, notebook)
             super().dropEvent(event)