Show More
@@ -1773,6 +1773,32 b' class ConsoleWidget(LoggingConfigurable, QtGui.QWidget):' | |||||
1773 | else: |
|
1773 | else: | |
1774 | self._append_plain_text(text) |
|
1774 | self._append_plain_text(text) | |
1775 |
|
1775 | |||
|
1776 | def _set_paging(self, paging): | |||
|
1777 | """ | |||
|
1778 | Change the pager to `paging` style. | |||
|
1779 | ||||
|
1780 | XXX: currently, this is limited to switching between 'hsplit' and | |||
|
1781 | 'vsplit'. | |||
|
1782 | ||||
|
1783 | Parameters: | |||
|
1784 | ----------- | |||
|
1785 | paging : string | |||
|
1786 | Either "hsplit", "vsplit", or "inside" | |||
|
1787 | """ | |||
|
1788 | if self._splitter is None: | |||
|
1789 | raise NotImplementedError("""can only switch if --paging=hsplit or | |||
|
1790 | --paging=vsplit is used.""") | |||
|
1791 | if paging == 'hsplit': | |||
|
1792 | self._splitter.setOrientation(QtCore.Qt.Horizontal) | |||
|
1793 | elif paging == 'vsplit': | |||
|
1794 | self._splitter.setOrientation(QtCore.Qt.Vertical) | |||
|
1795 | elif paging == 'inside': | |||
|
1796 | raise NotImplementedError("""switching to 'inside' paging not | |||
|
1797 | supported yet.""") | |||
|
1798 | else: | |||
|
1799 | raise ValueError("unknown paging method '%s'" % paging) | |||
|
1800 | self.paging = paging | |||
|
1801 | ||||
1776 | def _prompt_finished(self): |
|
1802 | def _prompt_finished(self): | |
1777 | """ Called immediately after a prompt is finished, i.e. when some input |
|
1803 | """ Called immediately after a prompt is finished, i.e. when some input | |
1778 | will be processed and a new prompt displayed. |
|
1804 | will be processed and a new prompt displayed. |
@@ -528,7 +528,25 b' class MainWindow(QtGui.QMainWindow):' | |||||
528 | statusTip="Clear the console", |
|
528 | statusTip="Clear the console", | |
529 | triggered=self.clear_magic_active_frontend) |
|
529 | triggered=self.clear_magic_active_frontend) | |
530 | self.add_menu_action(self.view_menu, self.clear_action) |
|
530 | self.add_menu_action(self.view_menu, self.clear_action) | |
531 |
|
531 | |||
|
532 | self.pager_menu = self.view_menu.addMenu("&Pager") | |||
|
533 | ||||
|
534 | hsplit_action = QtGui.QAction(".. &Horizontal Split", | |||
|
535 | self, | |||
|
536 | triggered=lambda: self.set_paging_active_frontend('hsplit')) | |||
|
537 | ||||
|
538 | vsplit_action = QtGui.QAction(" : &Vertical Split", | |||
|
539 | self, | |||
|
540 | triggered=lambda: self.set_paging_active_frontend('vsplit')) | |||
|
541 | ||||
|
542 | inside_action = QtGui.QAction(" &Inside Pager", | |||
|
543 | self, | |||
|
544 | triggered=lambda: self.set_paging_active_frontend('inside')) | |||
|
545 | ||||
|
546 | self.pager_menu.addAction(hsplit_action) | |||
|
547 | self.pager_menu.addAction(vsplit_action) | |||
|
548 | self.pager_menu.addAction(inside_action) | |||
|
549 | ||||
532 | def init_kernel_menu(self): |
|
550 | def init_kernel_menu(self): | |
533 | self.kernel_menu = self.menuBar().addMenu("&Kernel") |
|
551 | self.kernel_menu = self.menuBar().addMenu("&Kernel") | |
534 | # Qt on OSX maps Ctrl to Cmd, and Meta to Ctrl |
|
552 | # Qt on OSX maps Ctrl to Cmd, and Meta to Ctrl | |
@@ -829,6 +847,9 b' class MainWindow(QtGui.QMainWindow):' | |||||
829 | self.maximizeAct.setEnabled(True) |
|
847 | self.maximizeAct.setEnabled(True) | |
830 | self.minimizeAct.setEnabled(True) |
|
848 | self.minimizeAct.setEnabled(True) | |
831 |
|
849 | |||
|
850 | def set_paging_active_frontend(self, paging): | |||
|
851 | self.active_frontend._set_paging(paging) | |||
|
852 | ||||
832 | def close_active_frontend(self): |
|
853 | def close_active_frontend(self): | |
833 | self.close_tab(self.active_frontend) |
|
854 | self.close_tab(self.active_frontend) | |
834 |
|
855 |
General Comments 0
You need to be logged in to leave comments.
Login now