Editing of code in acire

Bug #514124 reported by Compintuit
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Acire
Fix Released
Undecided
Ed S

Bug Description

One of the best ways to learn is to experiment, and while I applaud acire for showing us code in a great UI, it would be even nicer if we could edit th shown code, and have it run when we hit execute. Saving it and autoloading it would also be a great feature.

Related branches

Revision history for this message
Ed S (edgar-b-dsouza) wrote :

Hi, I'm working on this. I guess "saving" means a 'Save As' button or File menu option to save the modified code in a path+filename of your choosing - but could you please clarify what you mean by "autoloading it"?

Changed in acire:
assignee: nobody → Ed S (edgar-b-dsouza)
Ed S (edgar-b-dsouza)
Changed in acire:
status: New → In Progress
Revision history for this message
Ed S (edgar-b-dsouza) wrote :

Enabled running of code that is edited in the Acire editor - if you wish, you could get a copy of the https://code.launchpad.net/~edgar-b-dsouza/acire/run_modified_code feature branch and try it out. As of this moment, it is pending review for merging into trunk.

I'm working on the Save As button, almost finished. Would appreciate that clarification about autoloading soon, thanks :-)

Revision history for this message
Ed S (edgar-b-dsouza) wrote :

Updating with info the bug reporter sent via email (relevant info, so I hope this isn't seen as breaching netiquette :-) ) :

Bug reporter said: "meant loading it back into acire, having it appear perhaps in a custom item of the drop-down menu. That will allow for further editing right in acire, with other scripts handy for looking at. Though, if you feel that is best served as done by an IDE, I understand, and feel free not to include this feature."

Currently, I'm thinking on these lines:
- User has to save modified snippet in a specific folder to have Acire load it
- this would probably best be a per-user config folder (like ~/.acire/) with a personal/customized snippets store in there.
(updating original snippet store from PPA pkg installation or bzr branch of lp:python-snippets is not good - either location would be overwritten - on PPA package update, or on a bzr pull to refresh the branch.)

It will take more work to enable this per-user config and snippets store, but after that is done:
- idea: add the user-modded snippets into the list (treeview) based on their categories, but use a different icon to show "user-modded" status.
- Bug reporter's idea of having a new item in the categories combo/drop-down menu for user-customized snippets seems a good one, will have to see if it interferes too much with the categories, otherwise can put this in.

Ideas/comments, please?

Ed S (edgar-b-dsouza)
Changed in acire:
status: In Progress → Fix Committed
Revision history for this message
Ed S (edgar-b-dsouza) wrote :

Update:
http://bazaar.launchpad.net/~jonobacon/acire/trunk/revision/19 is where Jono has merged the Save As button, plus a few other small changes like code for the Copy button, shortcut F5 for the Execute button. You can get it by running bzr branch lp:acire on your system, since the PPA will probably not have this till Jono preps and makes a new release.

So as of now, status concerning this bug report is:
- edit the shown code, and have it run when we hit execute:
==> Done, Acire now sets the editor component's modified flag to False after loading the snippet, and checks it while running the snippet. If modified (you, as the user, have edited the code of the snippet) then it saves it in a temp file and runs the temp file instead of the original snippet. (BTW: the F5 shortcut for Execute lets you edit, run, edit again, run again, without having to pick up the mouse.)
This feature leaves behind a bunch of temp files in /tmp (one for every time you execute a modified snippet. These files' names are in the pattern [originalfilename]-tempID.py - e.g. for the snippet argv.py, temp file names are like: argv-i9x4dp.py, argv-veWkZK.py. Although these files should be cleaned up, I haven't yet thought of how/where in the code to do it. However, as-is, this is somewhat of a feature too :-P since if you accidentally click a different snippet in the middle of editing one snippet... or if Acire crashes (which hasn't happened to me even once, BTW!) then your changes, till the last Execute, are in the latest-timestamp file in /tmp. The files will be cleared on a restart of your computer, or by a cron job that deletes old files from /tmp.

- Saving it and autoloading it would also be a great feature.
==> Partly done - Save As button provides a FileChooser dialog so you can choose where, and with what name, to save the (modified) snippet. PyGTK 2.4 and above are required for this dialog - however, I had no need to install anything new in Karmic, so Karmic and later should be able to handle this without issues. Acire is anyway not supported on earlier versions, IIRC.

Autoloading, however, looks like it will be tackled only some time down the line (see previous comment), and should, logically, be a separate feature request/bug report since it is a significant amount of work. I plan to look at how Quickly does config (couchdb?) and if that can be added to Acire, but that should take me some time. If that succeeds, then we can have a user-configurable "personal snippet store" folder as one of the options, and I can then add code to look in that location and load snippets on startup.

So, since that is not going to happen too soon... I've marked this bug as "Fix Committed" since what could be done in a reasonable timeframe has been merged to trunk already.

Thanks,
Ed.

Jono Bacon (jonobacon)
Changed in acire:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.