##// END OF EJS Templates
reorganise menu...
Matthias BUSSONNIER -
Show More
@@ -620,8 +620,7 b' class ConsoleWidget(LoggingConfigurable, QtGui.QWidget):'
620
620
621 # Remove any trailing newline, which confuses the GUI and forces the
621 # Remove any trailing newline, which confuses the GUI and forces the
622 # user to backspace.
622 # user to backspace.
623 if not text:
623 text = QtGui.QApplication.clipboard().text(mode).rstrip()
624 text = QtGui.QApplication.clipboard().text(mode).rstrip()
625 self._insert_plain_text_into_buffer(cursor, dedent(text))
624 self._insert_plain_text_into_buffer(cursor, dedent(text))
626
625
627 def print_(self, printer = None):
626 def print_(self, printer = None):
@@ -872,17 +871,17 b' class ConsoleWidget(LoggingConfigurable, QtGui.QWidget):'
872 """
871 """
873 menu = QtGui.QMenu(self)
872 menu = QtGui.QMenu(self)
874
873
875 cut_action = menu.addAction('Cut', self.cut)
874 self.cut_action = menu.addAction('Cut', self.cut)
876 cut_action.setEnabled(self.can_cut())
875 self.cut_action.setEnabled(self.can_cut())
877 cut_action.setShortcut(QtGui.QKeySequence.Cut)
876 self.cut_action.setShortcut(QtGui.QKeySequence.Cut)
878
877
879 copy_action = menu.addAction('Copy', self.copy)
878 self.copy_action = menu.addAction('Copy', self.copy)
880 copy_action.setEnabled(self.can_copy())
879 self.copy_action.setEnabled(self.can_copy())
881 copy_action.setShortcut(QtGui.QKeySequence.Copy)
880 self.copy_action.setShortcut(QtGui.QKeySequence.Copy)
882
881
883 paste_action = menu.addAction('Paste', self.paste)
882 self.paste_action = menu.addAction('Paste', self.paste)
884 paste_action.setEnabled(self.can_paste())
883 self.paste_action.setEnabled(self.can_paste())
885 paste_action.setShortcut(QtGui.QKeySequence.Paste)
884 self.paste_action.setShortcut(QtGui.QKeySequence.Paste)
886
885
887 menu.addSeparator()
886 menu.addSeparator()
888 menu.addAction(self.select_all_action)
887 menu.addAction(self.select_all_action)
@@ -204,9 +204,6 b' class HistoryConsoleWidget(ConsoleWidget):'
204 """
204 """
205 return self._history[-n:]
205 return self._history[-n:]
206
206
207 def history_magic(self):
208 self.execute("%history")
209
210 def _request_update_session_history_length(self):
207 def _request_update_session_history_length(self):
211 msg_id = self.kernel_manager.shell_channel.execute('',
208 msg_id = self.kernel_manager.shell_channel.execute('',
212 silent=True,
209 silent=True,
@@ -326,7 +326,6 b' class MainWindow(QtGui.QMainWindow):'
326 #create menu in the order they should appear in the menu bar
326 #create menu in the order they should appear in the menu bar
327 self.file_menu = self.menuBar().addMenu("&File")
327 self.file_menu = self.menuBar().addMenu("&File")
328 self.edit_menu = self.menuBar().addMenu("&Edit")
328 self.edit_menu = self.menuBar().addMenu("&Edit")
329 self.font_menu = self.menuBar().addMenu("F&ont")
330 self.window_menu = self.menuBar().addMenu("&Window")
329 self.window_menu = self.menuBar().addMenu("&Window")
331 self.magic_menu = self.menuBar().addMenu("&Magic")
330 self.magic_menu = self.menuBar().addMenu("&Magic")
332 self.all_magic_menu = self.magic_menu.addMenu("&All Magic")
331 self.all_magic_menu = self.magic_menu.addMenu("&All Magic")
@@ -362,6 +361,29 b' class MainWindow(QtGui.QMainWindow):'
362 )
361 )
363 self.file_menu.addAction(self.select_all_action)
362 self.file_menu.addAction(self.select_all_action)
364
363
364 self.paste_action = QtGui.QAction("&Paste",
365 self,
366 shortcut=QtGui.QKeySequence.Paste,
367 triggered=self.paste_active_frontend
368 )
369 self.edit_menu.addAction(self.paste_action)
370
371 self.copy_action = QtGui.QAction("&Copy",
372 self,
373 shortcut=QtGui.QKeySequence.Copy,
374 triggered=self.copy_active_frontend
375 )
376 self.edit_menu.addAction(self.copy_action)
377
378 self.cut_action = QtGui.QAction("&Cut",
379 self,
380 shortcut=QtGui.QKeySequence.Cut,
381 triggered=self.cut_active_frontend
382 )
383 self.edit_menu.addAction(self.cut_action)
384
385 self.edit_menu.addSeparator()
386
365 self.undo_action = QtGui.QAction("&Undo",
387 self.undo_action = QtGui.QAction("&Undo",
366 self,
388 self,
367 shortcut="Ctrl+Z",
389 shortcut="Ctrl+Z",
@@ -377,26 +399,30 b' class MainWindow(QtGui.QMainWindow):'
377 triggered=self.redo_active_frontend)
399 triggered=self.redo_active_frontend)
378 self.edit_menu.addAction(self.redo_action)
400 self.edit_menu.addAction(self.redo_action)
379
401
402 self.window_menu.addSeparator()
403
380 self.increase_font_size = QtGui.QAction("&Increase Font Size",
404 self.increase_font_size = QtGui.QAction("&Increase Font Size",
381 self,
405 self,
382 shortcut="Ctrl++",
406 shortcut="Ctrl++",
383 triggered=self.increase_font_size_active_frontend
407 triggered=self.increase_font_size_active_frontend
384 )
408 )
385 self.font_menu.addAction(self.increase_font_size)
409 self.window_menu.addAction(self.increase_font_size)
386
410
387 self.decrease_font_size = QtGui.QAction("&Decrease Font Size",
411 self.decrease_font_size = QtGui.QAction("&Decrease Font Size",
388 self,
412 self,
389 shortcut="Ctrl+-",
413 shortcut="Ctrl+-",
390 triggered=self.decrease_font_size_active_frontend
414 triggered=self.decrease_font_size_active_frontend
391 )
415 )
392 self.font_menu.addAction(self.decrease_font_size)
416 self.window_menu.addAction(self.decrease_font_size)
393
417
394 self.reset_font_size = QtGui.QAction("&Reset Font Size",
418 self.reset_font_size = QtGui.QAction("&Reset Font Size",
395 self,
419 self,
396 shortcut="Ctrl+0",
420 shortcut="Ctrl+0",
397 triggered=self.reset_font_size_active_frontend
421 triggered=self.reset_font_size_active_frontend
398 )
422 )
399 self.font_menu.addAction(self.reset_font_size)
423 self.window_menu.addAction(self.reset_font_size)
424
425 self.window_menu.addSeparator()
400
426
401 self.reset_action = QtGui.QAction("&Reset",
427 self.reset_action = QtGui.QAction("&Reset",
402 self,
428 self,
@@ -416,11 +442,12 b' class MainWindow(QtGui.QMainWindow):'
416 triggered=self.save_magic_active_frontend)
442 triggered=self.save_magic_active_frontend)
417 self.magic_menu.addAction(self.save_action)
443 self.magic_menu.addAction(self.save_action)
418
444
419 self.clear_action = QtGui.QAction("&Clear",
445 self.clear_action = QtGui.QAction("&Clear Screen",
420 self,
446 self,
447 shortcut='Ctrl+L',
421 statusTip="Clear the console",
448 statusTip="Clear the console",
422 triggered=self.clear_magic_active_frontend)
449 triggered=self.clear_magic_active_frontend)
423 self.magic_menu.addAction(self.clear_action)
450 self.window_menu.addAction(self.clear_action)
424
451
425 self.who_action = QtGui.QAction("&Who",
452 self.who_action = QtGui.QAction("&Who",
426 self,
453 self,
@@ -482,6 +509,14 b' class MainWindow(QtGui.QMainWindow):'
482 )
509 )
483 self.all_magic_menu.addAction(xaction)
510 self.all_magic_menu.addAction(xaction)
484
511
512 def cut_active_frontend(self):
513 self.active_frontend.cut_action.trigger()
514
515 def copy_active_frontend(self):
516 self.active_frontend.copy_action.trigger()
517
518 def paste_active_frontend(self):
519 self.active_frontend.paste_action.trigger()
485
520
486 def undo_active_frontend(self):
521 def undo_active_frontend(self):
487 self.active_frontend.undo()
522 self.active_frontend.undo()
@@ -493,7 +528,7 b' class MainWindow(QtGui.QMainWindow):'
493 self.active_frontend.execute("%reset")
528 self.active_frontend.execute("%reset")
494
529
495 def history_magic_active_frontend(self):
530 def history_magic_active_frontend(self):
496 self.active_frontend.history_magic()
531 self.active_frontend.execute("%history")
497
532
498 def save_magic_active_frontend(self):
533 def save_magic_active_frontend(self):
499 self.active_frontend.save_magic()
534 self.active_frontend.save_magic()
@@ -608,7 +643,7 b' aliases.update(qt_aliases)'
608 class IPythonQtConsoleApp(BaseIPythonApplication):
643 class IPythonQtConsoleApp(BaseIPythonApplication):
609 name = 'ipython-qtconsole'
644 name = 'ipython-qtconsole'
610 default_config_file_name='ipython_config.py'
645 default_config_file_name='ipython_config.py'
611
646
612 description = """
647 description = """
613 The IPython QtConsole.
648 The IPython QtConsole.
614
649
@@ -1012,11 +1047,14 b' class IPythonQtConsoleApp(BaseIPythonApplication):'
1012 statusTip="Toggle between Fullscreen and Normal Size",
1047 statusTip="Toggle between Fullscreen and Normal Size",
1013 triggered=self.toggleFullScreen)
1048 triggered=self.toggleFullScreen)
1014
1049
1050
1051
1015 self.tabAndNewKernelAct =QtGui.QAction("Tab with &New kernel",
1052 self.tabAndNewKernelAct =QtGui.QAction("Tab with &New kernel",
1016 self.window,
1053 self.window,
1017 shortcut="Ctrl+T",
1054 shortcut="Ctrl+T",
1018 triggered=self.create_tab_with_new_frontend)
1055 triggered=self.create_tab_with_new_frontend)
1019 self.window.window_menu.addAction(self.tabAndNewKernelAct)
1056 self.window.window_menu.addAction(self.tabAndNewKernelAct)
1057
1020 self.tabSameKernalAct =QtGui.QAction("Tab with Sa&me kernel",
1058 self.tabSameKernalAct =QtGui.QAction("Tab with Sa&me kernel",
1021 self.window,
1059 self.window,
1022 shortcut="Ctrl+Shift+T",
1060 shortcut="Ctrl+Shift+T",
@@ -1059,6 +1097,22 b' class IPythonQtConsoleApp(BaseIPythonApplication):'
1059 # that it can still be triggerd by shortcut
1097 # that it can still be triggerd by shortcut
1060 self.window.addAction(self.fullScreenAct)
1098 self.window.addAction(self.fullScreenAct)
1061
1099
1100 # Don't activate toggleMenubar on mac, doen't work,
1101 # as toolbar always here
1102 self.toggle_menu_bar_act = QtGui.QAction("&Toggle Menu Bar",
1103 self.window,
1104 shortcut="Ctrl+Meta+H",
1105 statusTip="Toggle menubar betwin visible and not",
1106 triggered=self.toggle_menu_bar)
1107 self.window_menu.addAction(self.toggle_menu_bar_act)
1108
1109 def toggle_menu_bar(self):
1110 menu_bar = self.window.menuBar();
1111 if not menu_bar.isVisible():
1112 menu_bar.setVisible(False)
1113 else:
1114 menu_bar.setVisible(True)
1115
1062 def toggleMinimized(self):
1116 def toggleMinimized(self):
1063 if not self.window.isMinimized():
1117 if not self.window.isMinimized():
1064 self.window.showMinimized()
1118 self.window.showMinimized()
General Comments 0
You need to be logged in to leave comments. Login now