##// END OF EJS Templates
Create all_magic_menu. use webbrowser to open url
Matthias BUSSONNIER -
Show More
@@ -21,6 +21,8 b' import json'
21 21 import os
22 22 import signal
23 23 import sys
24 import webbrowser
25 from getpass import getpass
24 26
25 27 # System library imports
26 28 from IPython.external.qt import QtGui,QtCore
@@ -327,6 +329,7 b' class MainWindow(QtGui.QMainWindow):'
327 329 self.font_menu = self.menuBar().addMenu("F&ont")
328 330 self.window_menu = self.menuBar().addMenu("&Window")
329 331 self.magic_menu = self.menuBar().addMenu("&Magic")
332 self.all_magic_menu = self.magic_menu.addMenu("&All Magic")
330 333
331 334 # please keep the Help menu in Mac Os even if empty. It will
332 335 # automatically contain a search field to search inside menus and
@@ -437,18 +440,49 b' class MainWindow(QtGui.QMainWindow):'
437 440 triggered=self.whos_magic_active_frontend)
438 441 self.magic_menu.addAction(self.whos_action)
439 442
440 self.intro_active_frontend_action = QtGui.QAction("intro",
443 self.intro_active_frontend_action = QtGui.QAction("Intro",
441 444 self,
442 445 triggered=self.intro_active_frontend
443 446 )
444 447 self.help_menu.addAction(self.intro_active_frontend_action)
445 448
446 self.guiref_active_frontend_action = QtGui.QAction("guiref",
449 self.guiref_active_frontend_action = QtGui.QAction("Gui references",
447 450 self,
448 451 triggered=self.guiref_active_frontend
449 452 )
450 453 self.help_menu.addAction(self.guiref_active_frontend_action)
451 454
455 self.quickref_active_frontend_action = QtGui.QAction("Quick references",
456 self,
457 triggered=self.quickref_active_frontend
458 )
459 self.help_menu.addAction(self.quickref_active_frontend_action)
460
461 magiclist=["%alias", "%autocall", "%automagic", "%bookmark", "%cd", "%clear",
462 "%colors", "%debug", "%dhist", "%dirs", "%doctest_mode", "%ed", "%edit", "%env", "%gui",
463 "%guiref", "%hist", "%history", "%install_default_config", "%install_profiles",
464 "%less", "%load_ext", "%loadpy", "%logoff", "%logon", "%logstart", "%logstate",
465 "%logstop", "%lsmagic", "%macro", "%magic", "%man", "%more", "%notebook", "%page",
466 "%pastebin", "%pdb", "%pdef", "%pdoc", "%pfile", "%pinfo", "%pinfo2", "%popd", "%pprint",
467 "%precision", "%profile", "%prun", "%psearch", "%psource", "%pushd", "%pwd", "%pycat",
468 "%pylab", "%quickref", "%recall", "%rehashx", "%reload_ext", "%rep", "%rerun",
469 "%reset", "%reset_selective", "%run", "%save", "%sc", "%sx", "%tb", "%time", "%timeit",
470 "%unalias", "%unload_ext", "%who", "%who_ls", "%whos", "%xdel", "%xmode"]
471
472 def make_dynamic_magic(i):
473 def inner_dynamic_magic():
474 self.active_frontend.execute(i)
475 inner_dynamic_magic.__name__ = "dynamics_magic_%s" % i
476 return inner_dynamic_magic
477
478 for magic in magiclist:
479 xaction = QtGui.QAction(magic,
480 self,
481 triggered=make_dynamic_magic(magic)
482 )
483 self.all_magic_menu.addAction(xaction)
484
485
452 486 def undo_active_frontend(self):
453 487 self.active_frontend.undo()
454 488
@@ -499,6 +533,9 b' class MainWindow(QtGui.QMainWindow):'
499 533
500 534 def intro_active_frontend(self):
501 535 self.active_frontend.execute("?")
536
537 def quickref_active_frontend(self):
538 self.active_frontend.execute("%quickref")
502 539 #---------------------------------------------------------------------------
503 540 # QWidget interface
504 541 #---------------------------------------------------------------------------
@@ -1029,10 +1066,8 b' class IPythonQtConsoleApp(BaseIPythonApplication):'
1029 1066 self.window.showNormal()
1030 1067
1031 1068 def _open_online_help(self):
1032 QtGui.QDesktopServices.openUrl(
1033 QtCore.QUrl("http://ipython.org/documentation.html",
1034 QtCore.QUrl.TolerantMode)
1035 )
1069 filename="http://ipython.org/ipython-doc/stable/index.html"
1070 webbrowser.open(filename, new=1, autoraise=True)
1036 1071
1037 1072 def toggleMaximized(self):
1038 1073 if not self.window.isMaximized():
General Comments 0
You need to be logged in to leave comments. Login now