##// END OF EJS Templates
qtconsole : allow copy with shortcut in pager...
Matthias BUSSONNIER -
Show More
@@ -441,7 +441,12 class ConsoleWidget(LoggingConfigurable, QtGui.QWidget):
441 441 def copy(self):
442 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 451 def cut(self):
447 452 """ Copy the currently selected text to the clipboard and delete it
@@ -174,11 +174,16 class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):
174 174 def copy(self):
175 175 """ Copy the currently selected text to the clipboard, removing prompts.
176 176 """
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)
177 if self.layout().currentWidget() == self._page_control :
178 self._page_control.copy()
179 elif self.layout().currentWidget() == self._control :
180 text = self._control.textCursor().selection().toPlainText()
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 189 # 'ConsoleWidget' abstract interface
@@ -267,11 +267,17 class IPythonWidget(FrontendWidget):
267 267 """ Copy the currently selected text to the clipboard, removing prompts
268 268 if possible.
269 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)
270 if self.layout().currentWidget() == self._page_control :
271 self._page_control.copy()
272 elif self.layout().currentWidget() == self._control :
273 text = self._control.textCursor().selection().toPlainText()
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 283 # 'FrontendWidget' public interface
@@ -795,8 +795,7 class MainWindow(QtGui.QMainWindow):
795 795
796 796 def copy_active_frontend(self):
797 797 widget = self.active_frontend
798 if widget.can_copy():
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