fix Magic menu in qtconsole, split in groups #1782

merged 1 commit into from Jun 6, 2012


None yet

3 participants

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.


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.


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 commented May 29, 2012

... removed .

@minrk minrk commented on an outdated diff Jun 2, 2012
@@ -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 Jun 2, 2012 Member

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.

@Carreau Carreau fix magic menu in qtconsole
Rearrange magics in menu, organize as submenu based on class of magic
Carreau commented Jun 2, 2012

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

Carreau commented Jun 4, 2012

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

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