Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions IPython/frontend/qt/console/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,25 +615,29 @@ def inner_dynamic_magic():
inner_dynamic_magic.__name__ = "dynamics_magic_s"
return inner_dynamic_magic

def populate_all_magic_menu(self, listofmagic=None):
"""Clean "All Magics..." menu and repopulate it with `listofmagic`
def populate_all_magic_menu(self, user_exp_result=None):
"""Clean "All Magics..." menu and repopulate it with `user_exp_result`

Parameters
----------
listofmagic : string,
repr() of a list of strings, send back by the kernel
user_exp_result : dict,

user_Expression result that contain the
repr() of a list of strings, send back by the kernel under the data > plain/text
key. Cf IPython protocol for the structure of the dict.

Notes
-----
`listofmagic`is a repr() of list because it is fed with the result of
a 'user_expression'
"""
for k,v in self._magic_menu_dict.items():
v.clear()
self.all_magic_menu.clear()


mlist=ast.literal_eval(listofmagic)
if user_exp_result.get('status') != 'ok':
self.log.info("Something went wrong retriving the list of availlable magics")
return

mlist=ast.literal_eval(user_exp_result['data']['text/plain'])

for magic in mlist:
cell = (magic['type'] == 'cell')
name = magic['name']
Expand Down