def open(self, note): old_note_window = self.opened_notes.get(note.id, None) if old_note_window and not getattr(old_note_window, "closed", True): editor = self.opened_notes[note.id] editor.activateWindow() else: editor = Editor(self.app, note) editor.show() self.opened_notes[note.id] = editor return editor
def open(self, note, search_term=""): old_note_window = self.opened_notes.get(note.id, None) if old_note_window and not getattr(old_note_window, "closed", True): editor = self.opened_notes[note.id] editor.activateWindow() else: editor = Editor(note) editor.show() self.opened_notes[note.id] = editor if search_term: editor.findbar.set_search_term(search_term) editor.findbar.show() return editor
def open(self, note, search_term=''): old_note_window = self.opened_notes.get(note.id, None) if old_note_window and not getattr(old_note_window, 'closed', True): editor = self.opened_notes[note.id] editor.activateWindow() else: editor = Editor(self.app, note) editor.show() self.opened_notes[note.id] = editor if search_term: editor.findbar.set_search_term(search_term) editor.findbar.show() return editor
def test_open_note_links(self): """Test open note links""" guid = 'guid' note = Note( id=123, ) self.app.open = MagicMock() self.service.get_note_by_guid = MagicMock( return_value=note.struct, ) link = "evernote:///view/123/123/{guid}/123/".format( guid=guid, ) self.editor = Editor(self.note) self.editor.note_edit.link_clicked(QUrl(link)) self.assertEqual( self.service.get_note_by_guid.call_args[0][0], guid, ) self.assertEqual( self.app.open.call_args[0][0].id, note.id, ) del self.app.open
def test_not_broken_note_links(self): """Test content nochange""" content = '<a href="evernote:///view/123/123/123/">note link</a>' self.note.content = content self.editor = Editor(self.note) self.assertEqual( self.editor.note_edit.content, content, )
def test_content_changing(self): """Test content changing""" self.editor = Editor(self.note) for prev, current in CHANGING_CONTENTS: self.editor.note_edit.content = prev self.assertEqual( self.editor.note_edit.content, current, )
def test_content_nochange(self): """Test content nochange""" self.editor = Editor(self.note) self.assertEqual( self.editor.note_edit.content, "New note content", ) for content in CONTENTS: self.editor.note_edit.content = content self.assertEqual( self.editor.note_edit.content, content, )
def test_title_nochange(self): """Test title nochange""" self.editor = Editor(self.note) self.assertEqual( self.editor.note_edit.title, "New note", ) for title in TITLES: self.editor.note_edit.title = title self.assertEqual( self.editor.note_edit.title, title, )
def open(self, note, search_term=''): old_note_window = self.opened_notes.get(note.id, None) if old_note_window and not getattr(old_note_window, 'closed', True): editor = self.opened_notes[note.id] # hide and show for bringing to front editor.hide() editor.show() else: editor = Editor(note) editor.show() self.opened_notes[note.id] = editor if search_term: editor.findbar.set_search_term(search_term) editor.findbar.show() editor.raise_() editor.activateWindow() return editor