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