-
-
Save rbrito/e57c87d5376fd56113df058abf71bdf3 to your computer and use it in GitHub Desktop.
| #!/usr/bin/env python | |
| # Original (by yahvuu): http://www.gimpusers.com/forums/gimp-developer/11718-autosave-plugin | |
| import tempfile, os | |
| from time import * | |
| from gimpfu import * | |
| def autosave(image, layer): | |
| backupInterval = 10 * 60 | |
| backupFiles = {} | |
| print "Autosave activated" | |
| while 1: | |
| sleep(backupInterval) | |
| print ctime(time()) | |
| curImages = {} | |
| for k in gimp.image_list(): | |
| curImages[k.ID] = k | |
| curIDs = curImages.keys() | |
| oldIDs = backupFiles.keys() | |
| newIDs = [x for x in curIDs if x not in oldIDs]; delIDs = [x for x in oldIDs if x not in curIDs]; | |
| # create (empty) backup files for new images | |
| for id in newIDs: | |
| prefix = 'gimpbackup-ID' + str(id) + '-' | |
| fn = tempfile.mkstemp(prefix = prefix, suffix = '.xcf') | |
| os.close(fn[0]) | |
| backupFiles[id] = fn[1] | |
| # remove closed images' backups | |
| for id in delIDs: | |
| filename = backupFiles[id] | |
| del(backupFiles[id]) | |
| try: | |
| os.remove(filename) | |
| except: | |
| print "ERROR: ", sys.exc_info()[0] | |
| # backup images | |
| for id, filename in backupFiles.iteritems(): | |
| img = curImages[id] | |
| try: | |
| print "saving " + img.name + '-' + str(id) + ' to ' + filename | |
| pdb.gimp_xcf_save(1, img, img.active_drawable, filename, filename) | |
| except: | |
| print "ERROR: ", sys.exc_info()[0] | |
| register( | |
| "autosave", | |
| "Autosave dirty hack", | |
| "Periodically saves all opened images to a %temp% directory", | |
| "public domain", | |
| "public domain", | |
| "2016", | |
| "<Image>/File/Activate Autosave", | |
| "*", | |
| [], | |
| [], | |
| autosave) | |
| main() |
plugin not working on linux, i mean activate auto save option not showing even after installed in system as well as in home path.
plugin not working on linux, i mean activate auto save option not showing even after installed in system as well as in home path.
And also as much as i know only windows detect directories in %temp% way, linux use / as directory finder (~/ for home directory)
Just lost 30 mins of work due to a fucking crash. There's still this open issue which is literally older than me yet gimp devs refuse to add this? This is straight up fucking weird and makes no sense.
Nothing like having to manually make saves after making hours of tedious image editing!! I love forgetting to save!
So.. this plug-in DOES go in the /home/username/.gimp-2.8/plug-ins/ folder
You do not have to jump through hoops downloading obscure packages to figure out how to register it in Gimp. You do not have to do a bunch of top secret command crap in terminal. You do not have to hack it in to the system directory or install a system Python version. Once you have it in the proper folder, go to the file properties for the script and make it executable. That is all. God alone knows why.
If you still don't see it on the FIle menu the next time you open Gimp, close Gimp, go to the /home/username/.gimp-2.8/ folder and delete the pluginrc file. open Gimp again, and it will rediscover all of the add-ons.
Ta-Da!
bro ur on linux
This claims to work for 2.8 but I haven't been able to get it to show up after installing... Help?