##// END OF EJS Templates
Create Keyboard Accelerator for MenuBar
Matthias BUSSONNIER -
Show More
@@ -324,11 +324,11 b' class MainWindow(QtGui.QMainWindow):'
324 # menu bar, or give them an option to remove it
324 # menu bar, or give them an option to remove it
325 def initMenuBar(self):
325 def initMenuBar(self):
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.fileMenu = self.menuBar().addMenu("File")
327 self.fileMenu = self.menuBar().addMenu("&File")
328 self.editMenu = self.menuBar().addMenu("Edit")
328 self.editMenu = self.menuBar().addMenu("&Edit")
329 self.fontMenu = self.menuBar().addMenu("Font")
329 self.fontMenu = self.menuBar().addMenu("F&ont")
330 self.windowMenu = self.menuBar().addMenu("Window")
330 self.windowMenu = self.menuBar().addMenu("&Window")
331 self.magicMenu = self.menuBar().addMenu("Magic")
331 self.magicMenu = self.menuBar().addMenu("&Magic")
332
332
333 # please keep the Help menu in Mac Os even if empty. It will
333 # please keep the Help menu in Mac Os even if empty. It will
334 # automatically contain a search field to search inside menus and
334 # automatically contain a search field to search inside menus and
@@ -336,13 +336,13 b' class MainWindow(QtGui.QMainWindow):'
336 # a QAction.MenuRole like HelpMenuRole otherwise it will loose
336 # a QAction.MenuRole like HelpMenuRole otherwise it will loose
337 # this search field fonctionnality
337 # this search field fonctionnality
338
338
339 self.helpMenu = self.menuBar().addMenu("Help")
339 self.helpMenu = self.menuBar().addMenu("&Help")
340
340
341 # sould wrap every line of the following block into a try/except,
341 # sould wrap every line of the following block into a try/except,
342 # as we are not sure of instanciating a _frontend which support all
342 # as we are not sure of instanciating a _frontend which support all
343 # theses actions, but there might be a better way
343 # theses actions, but there might be a better way
344 try:
344 try:
345 self.print_action = QtGui.QAction("Print",
345 self.print_action = QtGui.QAction("&Print",
346 self,
346 self,
347 shortcut="Ctrl+P",
347 shortcut="Ctrl+P",
348 triggered=self.print_action_active_frontend)
348 triggered=self.print_action_active_frontend)
@@ -351,7 +351,7 b' class MainWindow(QtGui.QMainWindow):'
351 self.log.error("trying to add unexisting action (print), skipping")
351 self.log.error("trying to add unexisting action (print), skipping")
352
352
353 try:
353 try:
354 self.export_action=QtGui.QAction("Export",
354 self.export_action=QtGui.QAction("E&xport",
355 self,
355 self,
356 shortcut="Ctrl+S",
356 shortcut="Ctrl+S",
357 triggered=self.export_action_active_frontend
357 triggered=self.export_action_active_frontend
@@ -361,7 +361,7 b' class MainWindow(QtGui.QMainWindow):'
361 self.log.error("trying to add unexisting action (Export), skipping")
361 self.log.error("trying to add unexisting action (Export), skipping")
362
362
363 try:
363 try:
364 self.select_all_action = QtGui.QAction("Select All",
364 self.select_all_action = QtGui.QAction("Select &All",
365 self,
365 self,
366 shortcut="Ctrl+A",
366 shortcut="Ctrl+A",
367 triggered=self.select_all_active_frontend
367 triggered=self.select_all_active_frontend
@@ -371,7 +371,7 b' class MainWindow(QtGui.QMainWindow):'
371 self.log.error("trying to add unexisting action (select all), skipping")
371 self.log.error("trying to add unexisting action (select all), skipping")
372
372
373 try:
373 try:
374 self.undo_action = QtGui.QAction("Undo",
374 self.undo_action = QtGui.QAction("&Undo",
375 self,
375 self,
376 shortcut="Ctrl+Z",
376 shortcut="Ctrl+Z",
377 statusTip="Undo last action if possible",
377 statusTip="Undo last action if possible",
@@ -382,7 +382,7 b' class MainWindow(QtGui.QMainWindow):'
382 self.log.error("trying to add unexisting action (undo), skipping")
382 self.log.error("trying to add unexisting action (undo), skipping")
383
383
384 try:
384 try:
385 self.redo_action = QtGui.QAction("Redo",
385 self.redo_action = QtGui.QAction("&Redo",
386 self,
386 self,
387 shortcut="Ctrl+Shift+Z",
387 shortcut="Ctrl+Shift+Z",
388 statusTip="Redo last action if possible",
388 statusTip="Redo last action if possible",
@@ -392,7 +392,7 b' class MainWindow(QtGui.QMainWindow):'
392 self.log.error("trying to add unexisting action (redo), skipping")
392 self.log.error("trying to add unexisting action (redo), skipping")
393
393
394 try:
394 try:
395 self.increase_font_size = QtGui.QAction("Increase Font Size",
395 self.increase_font_size = QtGui.QAction("&Increase Font Size",
396 self,
396 self,
397 shortcut="Ctrl++",
397 shortcut="Ctrl++",
398 triggered=self.increase_font_size_active_frontend
398 triggered=self.increase_font_size_active_frontend
@@ -402,7 +402,7 b' class MainWindow(QtGui.QMainWindow):'
402 self.log.error("trying to add unexisting action (increase font size), skipping")
402 self.log.error("trying to add unexisting action (increase font size), skipping")
403
403
404 try:
404 try:
405 self.decrease_font_size = QtGui.QAction("Decrease Font Size",
405 self.decrease_font_size = QtGui.QAction("&Decrease Font Size",
406 self,
406 self,
407 shortcut="Ctrl+-",
407 shortcut="Ctrl+-",
408 triggered=self.decrease_font_size_active_frontend
408 triggered=self.decrease_font_size_active_frontend
@@ -412,7 +412,7 b' class MainWindow(QtGui.QMainWindow):'
412 self.log.error("trying to add unexisting action (decrease font size), skipping")
412 self.log.error("trying to add unexisting action (decrease font size), skipping")
413
413
414 try:
414 try:
415 self.reset_font_size = QtGui.QAction("Reset Font Size",
415 self.reset_font_size = QtGui.QAction("&Reset Font Size",
416 self,
416 self,
417 shortcut="Ctrl+0",
417 shortcut="Ctrl+0",
418 triggered=self.reset_font_size_active_frontend
418 triggered=self.reset_font_size_active_frontend
@@ -422,7 +422,7 b' class MainWindow(QtGui.QMainWindow):'
422 self.log.error("trying to add unexisting action (reset font size), skipping")
422 self.log.error("trying to add unexisting action (reset font size), skipping")
423
423
424 try:
424 try:
425 self.reset_action = QtGui.QAction("Reset",
425 self.reset_action = QtGui.QAction("&Reset",
426 self,
426 self,
427 statusTip="Clear all varible from workspace",
427 statusTip="Clear all varible from workspace",
428 triggered=self.reset_magic_active_frontend)
428 triggered=self.reset_magic_active_frontend)
@@ -431,7 +431,7 b' class MainWindow(QtGui.QMainWindow):'
431 self.log.error("trying to add unexisting action (reset), skipping")
431 self.log.error("trying to add unexisting action (reset), skipping")
432
432
433 try:
433 try:
434 self.history_action = QtGui.QAction("History",
434 self.history_action = QtGui.QAction("&History",
435 self,
435 self,
436 statusTip="show command history",
436 statusTip="show command history",
437 triggered=self.history_magic_active_frontend)
437 triggered=self.history_magic_active_frontend)
@@ -440,7 +440,7 b' class MainWindow(QtGui.QMainWindow):'
440 self.log.error("trying to add unexisting action (history), skipping")
440 self.log.error("trying to add unexisting action (history), skipping")
441
441
442 try:
442 try:
443 self.save_action = QtGui.QAction("Export History ",
443 self.save_action = QtGui.QAction("E&xport History ",
444 self,
444 self,
445 statusTip="Export History as Python File",
445 statusTip="Export History as Python File",
446 triggered=self.save_magic_active_frontend)
446 triggered=self.save_magic_active_frontend)
@@ -449,7 +449,7 b' class MainWindow(QtGui.QMainWindow):'
449 self.log.error("trying to add unexisting action (save), skipping")
449 self.log.error("trying to add unexisting action (save), skipping")
450
450
451 try:
451 try:
452 self.clear_action = QtGui.QAction("Clear",
452 self.clear_action = QtGui.QAction("&Clear",
453 self,
453 self,
454 statusTip="Clear the console",
454 statusTip="Clear the console",
455 triggered=self.clear_magic_active_frontend)
455 triggered=self.clear_magic_active_frontend)
@@ -458,7 +458,7 b' class MainWindow(QtGui.QMainWindow):'
458 self.log.error("trying to add unexisting action, skipping")
458 self.log.error("trying to add unexisting action, skipping")
459
459
460 try:
460 try:
461 self.who_action = QtGui.QAction("Who",
461 self.who_action = QtGui.QAction("&Who",
462 self,
462 self,
463 statusTip="List interactive variable",
463 statusTip="List interactive variable",
464 triggered=self.who_magic_active_frontend)
464 triggered=self.who_magic_active_frontend)
@@ -467,7 +467,7 b' class MainWindow(QtGui.QMainWindow):'
467 self.log.error("trying to add unexisting action (who), skipping")
467 self.log.error("trying to add unexisting action (who), skipping")
468
468
469 try:
469 try:
470 self.who_ls_action = QtGui.QAction("Who ls",
470 self.who_ls_action = QtGui.QAction("Wh&o ls",
471 self,
471 self,
472 statusTip="Return a list of interactive variable",
472 statusTip="Return a list of interactive variable",
473 triggered=self.who_ls_magic_active_frontend)
473 triggered=self.who_ls_magic_active_frontend)
@@ -476,7 +476,7 b' class MainWindow(QtGui.QMainWindow):'
476 self.log.error("trying to add unexisting action (who_ls), skipping")
476 self.log.error("trying to add unexisting action (who_ls), skipping")
477
477
478 try:
478 try:
479 self.whos_action = QtGui.QAction("Whos",
479 self.whos_action = QtGui.QAction("Who&s",
480 self,
480 self,
481 statusTip="List interactive variable with detail",
481 statusTip="List interactive variable with detail",
482 triggered=self.whos_magic_active_frontend)
482 triggered=self.whos_magic_active_frontend)
@@ -987,18 +987,18 b' class IPythonQtConsoleApp(BaseIPythonApplication):'
987 statusTip="Cahange to next tab",
987 statusTip="Cahange to next tab",
988 triggered=self.window.nextTab)
988 triggered=self.window.nextTab)
989
989
990 self.fullScreenAct = QtGui.QAction("Full Screen",
990 self.fullScreenAct = QtGui.QAction("&Full Screen",
991 self.window,
991 self.window,
992 shortcut="Ctrl+Meta+Space",
992 shortcut="Ctrl+Meta+Space",
993 statusTip="Toggle between Fullscreen and Normal Size",
993 statusTip="Toggle between Fullscreen and Normal Size",
994 triggered=self.toggleFullScreen)
994 triggered=self.toggleFullScreen)
995
995
996 self.tabAndNewKernelAct =QtGui.QAction("Tab with New kernel",
996 self.tabAndNewKernelAct =QtGui.QAction("Tab with &New kernel",
997 self.window,
997 self.window,
998 shortcut="Ctrl+T",
998 shortcut="Ctrl+T",
999 triggered=self.createTabWithNewFrontend)
999 triggered=self.createTabWithNewFrontend)
1000 self.window.windowMenu.addAction(self.tabAndNewKernelAct)
1000 self.window.windowMenu.addAction(self.tabAndNewKernelAct)
1001 self.tabSameKernalAct =QtGui.QAction("Tab with Same kernel",
1001 self.tabSameKernalAct =QtGui.QAction("Tab with Sa&me kernel",
1002 self.window,
1002 self.window,
1003 shortcut="Ctrl+Shift+T",
1003 shortcut="Ctrl+Shift+T",
1004 triggered=self.createTabAttachedToCurrentTabKernel)
1004 triggered=self.createTabAttachedToCurrentTabKernel)
@@ -1009,18 +1009,18 b' class IPythonQtConsoleApp(BaseIPythonApplication):'
1009 # know the shortcut or if the windows manager assign it in
1009 # know the shortcut or if the windows manager assign it in
1010 # other platform.
1010 # other platform.
1011 if sys.platform == 'darwin':
1011 if sys.platform == 'darwin':
1012 self.minimizeAct = QtGui.QAction("Minimize",
1012 self.minimizeAct = QtGui.QAction("Mini&mize",
1013 self.window,
1013 self.window,
1014 shortcut="Ctrl+m",
1014 shortcut="Ctrl+m",
1015 statusTip="Minimize the window/Restore Normal Size",
1015 statusTip="Minimize the window/Restore Normal Size",
1016 triggered=self.toggleMinimized)
1016 triggered=self.toggleMinimized)
1017 self.maximizeAct = QtGui.QAction("Maximize",
1017 self.maximizeAct = QtGui.QAction("Ma&ximize",
1018 self.window,
1018 self.window,
1019 shortcut="Ctrl+Shift+M",
1019 shortcut="Ctrl+Shift+M",
1020 statusTip="Maximize the window/Restore Normal Size",
1020 statusTip="Maximize the window/Restore Normal Size",
1021 triggered=self.toggleMaximized)
1021 triggered=self.toggleMaximized)
1022
1022
1023 self.onlineHelpAct = QtGui.QAction("Open Online Help",
1023 self.onlineHelpAct = QtGui.QAction("Open Online &Help",
1024 self.window,
1024 self.window,
1025 triggered=self._open_online_help)
1025 triggered=self._open_online_help)
1026
1026
General Comments 0
You need to be logged in to leave comments. Login now