def unload_ipython_extension(ipython): plugin = get_core_plugin() plugin._unregister_extensions() util.__ecli_core__ = None util.__ipython__ = None return True
def load_ipython_extension(ipython): core = get_core_plugin() if core is None: logger.error('ECLI core not loaded') return try: core.unregister_extension('ECLIcas') except: pass instance = core.register_extension(ECLIcas, globals_=globals()) if instance is not None: instance._register_callbacks()
def gui_config(remove_prefixes=['_']): shell = get_core_plugin().shell datasets = [] all_items = {} for configurable in sorted(shell.configurables, key=lambda c: c.__class__.__name__): items = {} conf_name = configurable.__class__.__name__ for name, trait in configurable.traits().items(): skip = False for prefix in remove_prefixes: if name.startswith(prefix): skip = True break if not skip: mapped = map_trait(configurable, name, trait) if mapped is not None: item_key = '%s.%s' % (conf_name, name) items[item_key] = mapped all_items[item_key] = mapped if items: ds_class = type(conf_name, (dt.DataSet,), items) datasets.append(ds_class()) app = guidata.qapplication() # <-- this already checks if one exists group = DataSetGroup(datasets, title='ECLI Configuration') group.edit() #for ds in datasets: # print('------------- %s ---------------' % (ds.__class__.__name__, )) # print(ds) # print() # print() for key, item in all_items.items(): print(key, item) #return datasets return all_items
def __init__(self, shell, config, init_traits=True): super(ECLIPlugin, self).__init__(shell=shell, config=config) if not hasattr(self, '_cb_dict'): self._cb_dict = dict() # To be flagged as configurable (and thus show up in %config), this instance # should be added to the shell's configurables list. if hasattr(shell, 'configurables'): shell.configurables.append(self) # Insert the exported objects into the user namespace (these will be available # on the command-line) for name, obj in self.EXPORTS.iteritems(): shell.user_ns[name] = obj self.core = get_core_plugin() if init_traits: self.update_all_traits() self.core.add_callback(self.core.CB_CONFIG_LOADED, self.config_loaded)
def wrapped(usermagics, args): cmd = '"%s" %s' % (exe_, args) logger.info('Executing: %s' % (cmd, )) shell = get_core_plugin().shell shell.system(cmd)
def unload_ipython_extension(ipython): core = get_core_plugin() core.unregister_extension('ECLIcas') pcaspy.asCaStop()