Skip to content

fix Magic menu in qtconsole, split in groups #1782

Merged
merged 1 commit into from Jun 6, 2012

3 participants

@Carreau
IPython member
Carreau commented May 29, 2012

partially fixes #1774

alternative to #1776, that also reorganize magic in several menu.
Menu name is decided by inserting space in the CamelCasse name of the class of the magic.

screencap

Moreover, if there is a way to know if the magic have to take argument or not (%logstate vs %timeit),
I could tweak the menu to either execute, or to paste the magic at the beginning of the curent line.

@takluyver
IPython member

The ... on 'All magics' looks odd, because it has a submenu. Normally, ... implies that clicking on it will bring up some sort of dialog.

@Carreau
IPython member
Carreau commented May 29, 2012

... removed .

@minrk minrk commented on an outdated diff Jun 2, 2012
IPython/core/magic.py
@@ -322,6 +322,17 @@ def auto_status(self):
"""Return descriptive string with automagic status."""
return self._auto_status[self.auto_magic]
+ def lsmagic_info(self):
+ """return a json encode/decodable dict for frontend
+
+ mainly needed by qtconsole to build the Magics Menu
+ """
+ magic_list = []
+ for m_type, m_list in self.magics.iteritems() :
+ for m_name, mgc in m_list.iteritems():
+ magic_list.append({'name':m_name, 'type':m_type, 'class':mgc.im_class.__name__})
@minrk
IPython member
minrk added a note Jun 2, 2012

mgc may be just a function here, in which case this will raise AttributeError on im_class. To see this, simply run this block in the qtconsole on master, where %guiref is such a magic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Carreau Carreau fix magic menu in qtconsole
Rearrange magics in menu, organize as submenu based on class of magic
d5bcd72
@Carreau
IPython member
Carreau commented Jun 2, 2012

Thanks, fixed, rebased and squashed to have cleaner commits.

@Carreau
IPython member
Carreau commented Jun 4, 2012

Does anybody ave something agains me merging it ?
Otherwise i'll do so in 24h.

@Carreau
IPython member
Carreau commented Jun 6, 2012

merging then...

@Carreau Carreau merged commit 8b00a30 into ipython:master Jun 6, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.