##// END OF EJS Templates
qtconsole : allow copy with shortcut in pager...
Matthias BUSSONNIER -
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 if self.layout().currentWidget() == self._page_control :
445 self._page_control.copy()
446 elif self.layout().currentWidget() == self._control :
444 self._control.copy()
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 if self.layout().currentWidget() == self._page_control :
178 self._page_control.copy()
179 elif self.layout().currentWidget() == self._control :
177 text = self._control.textCursor().selection().toPlainText()
180 text = self._control.textCursor().selection().toPlainText()
178 if text:
181 if text:
179 lines = map(transform_classic_prompt, text.splitlines())
182 lines = map(transform_classic_prompt, text.splitlines())
180 text = '\n'.join(lines)
183 text = '\n'.join(lines)
181 QtGui.QApplication.clipboard().setText(text)
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 if self.layout().currentWidget() == self._page_control :
271 self._page_control.copy()
272 elif self.layout().currentWidget() == self._control :
270 text = self._control.textCursor().selection().toPlainText()
273 text = self._control.textCursor().selection().toPlainText()
271 if text:
274 if text:
272 lines = map(transform_ipy_prompt, text.splitlines())
275 lines = map(transform_ipy_prompt, text.splitlines())
273 text = '\n'.join(lines)
276 text = '\n'.join(lines)
274 QtGui.QApplication.clipboard().setText(text)
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,7 +795,6 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 if widget.can_copy():
799 widget.copy()
798 widget.copy()
800
799
801 def copy_raw_active_frontend(self):
800 def copy_raw_active_frontend(self):
General Comments 0
You need to be logged in to leave comments. Login now