diff --git a/IPython/frontend/qt/console/mainwindow.py b/IPython/frontend/qt/console/mainwindow.py index 2d73355f67d..cfbe8bb4fd1 100644 --- a/IPython/frontend/qt/console/mainwindow.py +++ b/IPython/frontend/qt/console/mainwindow.py @@ -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']