Show More
@@ -441,7 +441,7 b' class ConsoleWidget(LoggingConfigurable, QtGui.QWidget):' | |||
|
441 | 441 | def copy(self): |
|
442 | 442 | """ Copy the currently selected text to the clipboard. |
|
443 | 443 | """ |
|
444 |
self. |
|
|
444 | self.layout().currentWidget().copy() | |
|
445 | 445 | |
|
446 | 446 | def cut(self): |
|
447 | 447 | """ Copy the currently selected text to the clipboard and delete it |
@@ -107,6 +107,7 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):' | |||
|
107 | 107 | exit_requested = QtCore.Signal(object) |
|
108 | 108 | |
|
109 | 109 | # Protected class variables. |
|
110 | _transform_prompt = staticmethod(transform_classic_prompt) | |
|
110 | 111 | _CallTipRequest = namedtuple('_CallTipRequest', ['id', 'pos']) |
|
111 | 112 | _CompletionRequest = namedtuple('_CompletionRequest', ['id', 'pos']) |
|
112 | 113 | _ExecutionRequest = namedtuple('_ExecutionRequest', ['id', 'kind']) |
@@ -174,11 +175,16 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):' | |||
|
174 | 175 | def copy(self): |
|
175 | 176 | """ Copy the currently selected text to the clipboard, removing prompts. |
|
176 | 177 | """ |
|
177 | text = self._control.textCursor().selection().toPlainText() | |
|
178 | if text: | |
|
179 | lines = map(transform_classic_prompt, text.splitlines()) | |
|
180 | text = '\n'.join(lines) | |
|
181 | QtGui.QApplication.clipboard().setText(text) | |
|
178 | if self._page_control.hasFocus(): | |
|
179 | self._page_control.copy() | |
|
180 | elif self._control.hasFocus(): | |
|
181 | text = self._control.textCursor().selection().toPlainText() | |
|
182 | if text: | |
|
183 | lines = map(self._transform_prompt, text.splitlines()) | |
|
184 | text = '\n'.join(lines) | |
|
185 | QtGui.QApplication.clipboard().setText(text) | |
|
186 | else: | |
|
187 | self.log.debug("frontend widget : unknown copy target") | |
|
182 | 188 | |
|
183 | 189 | #--------------------------------------------------------------------------- |
|
184 | 190 | # 'ConsoleWidget' abstract interface |
@@ -365,7 +371,9 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):' | |||
|
365 | 371 | |
|
366 | 372 | """ |
|
367 | 373 | |
|
368 |
user_exp = msg['content'] |
|
|
374 | user_exp = msg['content'].get('user_expressions') | |
|
375 | if not user_exp: | |
|
376 | return | |
|
369 | 377 | for expression in user_exp: |
|
370 | 378 | if expression in self._callback_dict: |
|
371 | 379 | self._callback_dict.pop(expression)(user_exp[expression]) |
@@ -98,6 +98,7 b' class IPythonWidget(FrontendWidget):' | |||
|
98 | 98 | |
|
99 | 99 | # FrontendWidget protected class variables. |
|
100 | 100 | _input_splitter_class = IPythonInputSplitter |
|
101 | _transform_prompt = staticmethod(transform_ipy_prompt) | |
|
101 | 102 | |
|
102 | 103 | # IPythonWidget protected class variables. |
|
103 | 104 | _PromptBlock = namedtuple('_PromptBlock', ['block', 'length', 'number']) |
@@ -263,16 +264,6 b' class IPythonWidget(FrontendWidget):' | |||
|
263 | 264 | # 'ConsoleWidget' public interface |
|
264 | 265 | #--------------------------------------------------------------------------- |
|
265 | 266 | |
|
266 | def copy(self): | |
|
267 | """ Copy the currently selected text to the clipboard, removing prompts | |
|
268 | if possible. | |
|
269 | """ | |
|
270 | text = self._control.textCursor().selection().toPlainText() | |
|
271 | if text: | |
|
272 | lines = map(transform_ipy_prompt, text.splitlines()) | |
|
273 | text = '\n'.join(lines) | |
|
274 | QtGui.QApplication.clipboard().setText(text) | |
|
275 | ||
|
276 | 267 | #--------------------------------------------------------------------------- |
|
277 | 268 | # 'FrontendWidget' public interface |
|
278 | 269 | #--------------------------------------------------------------------------- |
@@ -795,8 +795,7 b' class MainWindow(QtGui.QMainWindow):' | |||
|
795 | 795 | |
|
796 | 796 | def copy_active_frontend(self): |
|
797 | 797 | widget = self.active_frontend |
|
798 |
|
|
|
799 | widget.copy() | |
|
798 | widget.copy() | |
|
800 | 799 | |
|
801 | 800 | def copy_raw_active_frontend(self): |
|
802 | 801 | self.active_frontend._copy_raw_action.trigger() |
General Comments 0
You need to be logged in to leave comments.
Login now