Show More
@@ -441,7 +441,12 b' class ConsoleWidget(LoggingConfigurable, QtGui.QWidget):' | |||||
441 | def copy(self): |
|
441 | def copy(self): | |
442 | """ Copy the currently selected text to the clipboard. |
|
442 | """ Copy the currently selected text to the clipboard. | |
443 | """ |
|
443 | """ | |
444 | self._control.copy() |
|
444 | if self.layout().currentWidget() == self._page_control : | |
|
445 | self._page_control.copy() | |||
|
446 | elif self.layout().currentWidget() == self._control : | |||
|
447 | self._control.copy() | |||
|
448 | else : | |||
|
449 | self.log.debug("console widget: unknown copy target") | |||
445 |
|
450 | |||
446 | def cut(self): |
|
451 | def cut(self): | |
447 | """ Copy the currently selected text to the clipboard and delete it |
|
452 | """ Copy the currently selected text to the clipboard and delete it |
@@ -174,11 +174,16 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):' | |||||
174 | def copy(self): |
|
174 | def copy(self): | |
175 | """ Copy the currently selected text to the clipboard, removing prompts. |
|
175 | """ Copy the currently selected text to the clipboard, removing prompts. | |
176 | """ |
|
176 | """ | |
177 | text = self._control.textCursor().selection().toPlainText() |
|
177 | if self.layout().currentWidget() == self._page_control : | |
178 | if text: |
|
178 | self._page_control.copy() | |
179 | lines = map(transform_classic_prompt, text.splitlines()) |
|
179 | elif self.layout().currentWidget() == self._control : | |
180 | text = '\n'.join(lines) |
|
180 | text = self._control.textCursor().selection().toPlainText() | |
181 | QtGui.QApplication.clipboard().setText(text) |
|
181 | if text: | |
|
182 | lines = map(transform_classic_prompt, text.splitlines()) | |||
|
183 | text = '\n'.join(lines) | |||
|
184 | QtGui.QApplication.clipboard().setText(text) | |||
|
185 | else: | |||
|
186 | self.log.debug("frontend widget : unknown copy target") | |||
182 |
|
187 | |||
183 | #--------------------------------------------------------------------------- |
|
188 | #--------------------------------------------------------------------------- | |
184 | # 'ConsoleWidget' abstract interface |
|
189 | # 'ConsoleWidget' abstract interface |
@@ -267,11 +267,17 b' class IPythonWidget(FrontendWidget):' | |||||
267 | """ Copy the currently selected text to the clipboard, removing prompts |
|
267 | """ Copy the currently selected text to the clipboard, removing prompts | |
268 | if possible. |
|
268 | if possible. | |
269 | """ |
|
269 | """ | |
270 | text = self._control.textCursor().selection().toPlainText() |
|
270 | if self.layout().currentWidget() == self._page_control : | |
271 | if text: |
|
271 | self._page_control.copy() | |
272 | lines = map(transform_ipy_prompt, text.splitlines()) |
|
272 | elif self.layout().currentWidget() == self._control : | |
273 | text = '\n'.join(lines) |
|
273 | text = self._control.textCursor().selection().toPlainText() | |
274 | QtGui.QApplication.clipboard().setText(text) |
|
274 | if text: | |
|
275 | lines = map(transform_ipy_prompt, text.splitlines()) | |||
|
276 | text = '\n'.join(lines) | |||
|
277 | QtGui.QApplication.clipboard().setText(text) | |||
|
278 | else : | |||
|
279 | self.log.debug("ipython_widget : unknown copy taget") | |||
|
280 | ||||
275 |
|
281 | |||
276 | #--------------------------------------------------------------------------- |
|
282 | #--------------------------------------------------------------------------- | |
277 | # 'FrontendWidget' public interface |
|
283 | # 'FrontendWidget' public interface |
@@ -795,8 +795,7 b' class MainWindow(QtGui.QMainWindow):' | |||||
795 |
|
795 | |||
796 | def copy_active_frontend(self): |
|
796 | def copy_active_frontend(self): | |
797 | widget = self.active_frontend |
|
797 | widget = self.active_frontend | |
798 |
|
|
798 | widget.copy() | |
799 | widget.copy() |
|
|||
800 |
|
799 | |||
801 | def copy_raw_active_frontend(self): |
|
800 | def copy_raw_active_frontend(self): | |
802 | self.active_frontend._copy_raw_action.trigger() |
|
801 | self.active_frontend._copy_raw_action.trigger() |
General Comments 0
You need to be logged in to leave comments.
Login now