def copy(self): doc = self.app.current_doc if doc.canvas.mode == modes.TEXT_EDIT_MODE: text = doc.canvas.controller.get_selected() wal.set_text_to_clipboard(text) else: self.app.current_doc.api.copy_selected()