コード例 #1
0
 def show_phrasebook(self):
     dl = PhraseBookDialog(self)
     newNotes = ""
     if dl.exec_():
         for phrase in dl.selectedPhrases:
             newNotes += phrase + "\n"
         self.text_edit.append(newNotes)
コード例 #2
0
 def show_phrasebook(self):
     dl = PhraseBookDialog(self)
     if dl.exec_():
         note = "\n".join(dl.selectedPhrases)
         current = self.text_edit.toPlainText()
         pos = self.text_edit.textCursor().position()
         before = current[:pos]
         after = current[pos:]
         new_notes = "\n".join([
             s for s in (before.strip("\n"), note.strip("\n"),
                         after.strip("\n")) if s
         ])
         self.text_edit.setText(new_notes)