How to easily edit a template ?

Asked by Tony Byrne on 2010-09-08

I find it difficult to edit a template.

 I currently create an application from my template, cycle through edit, design, run until my application looks like an useful start point then view the differences. I now edit the template by cutting and pasting from the application back to the template. What keeps happening is that the application name "leaks" into the template.

 I looked into the code base and noticed that quicklyutils.file_from_template(template_dir, template_file, target_dir, substitutions=[], rename = True)
 has an argument <rename> that seems might help prevent this perhaps by creating a runnable application with template names like "camel_case_name" preserved, which can be copied into the template as is.

Question information

English Edit question
Quickly Edit question
No assignee Edit question
Solved by:
Didier Roche
Last query:
Last reply:
Didier Roche (didrocks) said : #1

Hey Tony, thanks for using Quickly.

There is a way way easier answer:
quickly quickly <origin_template> <destination_template_name>
This will create the new template in ~quickly-templates/

And then, you can edit it there. It will then appear in every command, shell completion, and such…

quickly help quickly for more info :)

Tony Byrne (tony-badwolf) said : #2

Thanks for the quick(ly) reply, it doesn't quite reach my problem.

Imagine you create your project, that needs a text box, so you add handlers to the project's menu
on_menu_edit_cut(self,widget, data=None)
on_menu_edit_copy(self,widget, data=None)
on_menu_edit_paste(self,widget, data=None)

Then define some key bindings
Alt E P

Then add a bunch of code.

Then a month later you need a new project, and it has a text box. Is there an easy way to re-use your existing code to formulate a template ?

The current quickly quickly old-template new-template followed by template edits leads to a work flow that is more like C that python.

quickly quickly old-template new-template
Edit new-template (like edit new-template.c)
quickly create new-template foo-project (like cc new-template.c -o foo-project)
test foo-project, discover bug or missing feature.
Delete foo-project (like build clean)
Then repeat
edit new-template
quickly create new-template foo-project
test foo-project
delete foo-project
until template seems complete.

You add a bunch of code to foo-project to complete it.

Then begin bar-project from new-template, but it needs a bug fix you placed into foo-project 3 weeks after you stopped editing new-template.

Best Didier Roche (didrocks) said : #3

No, there is no way to do what you want (creating a project from another project). That will be sweet to add, but hard to achieve regarding python and packaging conversion which both conflict.

You are more than welcome to hop into #quickly on freenode and try working on that!

Tony Byrne (tony-badwolf) said : #4

Thanks Didier Roche, that solved my question.