diff --git a/netpyne_ui/netpyne_geppetto.py b/netpyne_ui/netpyne_geppetto.py index 84d572a9..5e41e847 100644 --- a/netpyne_ui/netpyne_geppetto.py +++ b/netpyne_ui/netpyne_geppetto.py @@ -12,7 +12,7 @@ import threading import time import traceback - +import re from netpyne import specs, sim, analysis from netpyne.specs.utils import validateFunction @@ -211,11 +211,12 @@ def rename(self, path, oldValue,newValue): command = 'sim.rename('+path+',"'+oldValue+'","'+newValue+'")' logging.debug('renaming '+command) eval(command) - for model, synched_component in list(GeppettoJupyterGUISync.synched_models.items()): - if model != '' and oldValue in model: + if model != '' and oldValue in model and path in model: # + logging.debug("Rename funct model is " + model) GeppettoJupyterGUISync.synched_models.pop(model) - newModel = model.replace(oldValue,newValue) + newModel = re.sub("(['])(?:(?=(\\?))\2.)*?\1", lambda x:x.group(0).replace(oldValue,newValue, 1), model) + logging.debug("Rename funct newModel is " + newModel) GeppettoJupyterGUISync.synched_models[newModel]=synched_component def getPlotSettings(self, plot):