New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature renameRoutine #1136
Feature renameRoutine #1136
Conversation
Has functions that change name of routine to a user specified name. Changes notebook, namespace and routines dictionary. ISSUE Will not compile script if component added after renaming. This is despite there being no reference in the sublist or any dictionary. Interestingly, if the name is changed for the second time with the same name - makeValid is invoked and e.g. fooBar_2 is returned. There is no visible reference to fooBar in self.user. The error message returned when script compilation fails is: File "/psychopy/psychopy/app/builder/components/_base.py", line 326, in getPosInRoutine routine = self.exp.routines[self.parentName] KeyError: 'hello_world' I have also included a context menu entry but this is not active yet.
Added __setitem__ to get rid of the old name from the component params list - this does not fix the previous commit error!
pop() used instead of del and components.parentName now changed
Thanks Jon and Jeremy - I had played around with pop() a few times but it seemed not to work - so I must have used it incorrectly. I have now pepped it and the menu version is fine. I'll work on the context menu later (I'll need to add a little more code so rename only appears when routine is selected rather than the loop as well). |
Added Rename to context menu. This only appears when a routine is selected. Could add loop renaming function if requested, but doesn’t seem important currently.
Hi Jon and Jeremy, I have now implemented a rename option in the context menu which will only appear when a routine is selected. Above, I am told that there are conflicts - but when I run git status nothing shows up so I'm not sure where the problem is! Also - I am not sure why I edited init so I'd be happy to revert it, if I run git revert(7fc1039) will this undo everything, or just the files, like init which haven't been changed since this commit. Many thanks Oli |
To revert the |
Added setitem to get rid of the old name from the component params
list - this does not fix the previous commit error!