gimpusers.com logo
German version English version

Not logged in

Sign up! | Lost password?

Latest discussion

  1. gimp-developer | yesterday 11:30 PM
    GIMP distributing sRGB profiles: license issues?
  2. gimp-user | yesterday 10:47 PM
    Bug in the Gradient tool ?
  3. gimp-user | yesterday 10:24 PM
    ?? Status of remembering Layers setting for Canvas Resizing -- in most recent version
  4. gimp-developer | yesterday 10:18 PM
    GIMP color-management spec and further discussion
  5. gimp-developer | yesterday 09:36 PM
    More on tagging

External news

Poll

Would you like to be able to use your Google/Yahoo/MSN (OpenID) login on gimpusers, too?

Definately! I would enjoy the possibility to use my OpenID on different websites!

I don't have a special need for OpenID but I think it could be useful

Doesn't matter to me

Never, OpenID is a pain regarding privacy and personal data protection!

No. (please post a comment)

See results

Stats

gimpusers.com RSS feed

GIMP Forums » For GIMP developers

Autosave Plugin

Jump to message:

  1. Autosave Plugin — yahvuu, 07 Jul 2009 06:06 PM

As a registered user, you can subscribe forum threads in order to get notified when replies are posted. Just log in at the right top of the page if you already have an account, otherwise you can register for free.

Permalink:4A537292.7010309@gmail.com
Date:07 Jul 2009 06:06 PM
From:yahvuu
Subject:Autosave Plugin
Hi all,

periodical autosave is long standing demand (bug 138373).
While in my regard this is headed in a totally wrong direction [1],
there's nothing wrong with having a plugin that works this way.

Somewhat suprisingly, i couldn't find such a plugin, so here's some
dirty PyGIMP which at first glance seems to do the job. Perhaps someone
gets inspired to create something worth uploading to the registry.

Usage:
- start GIMP from a terminal (so the script's messages become visible)
- toolbox: File->Activate Autosave (activate only once)

Every 30 minutes the script saves backups of all opened images to a temp folder.
The backup files won't be deleted when GIMP exits, so some manual clean-up will
be required from time to time.


have fun,
peter


[1] http://bugzilla.gnome.org/show_bug.cgi?id=138373#c25


#!/usr/bin/env python


import tempfile, os
from time import *
from gimpfu import *


def autosave():
backupInterval = 30*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",
"2009",
"<Toolbox>/File/Activate Autosave",
"RGB*, GRAY*",
[],
[],
autosave)

main()


_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
↑Back to thread overview

Adobe® Photoshop® is a registered trademark of Adobe Systems, Inc. Linux is a trademark of Linus Torvalds. Ubuntu and Canonical are registered trademarks of Canonical Ltd. | Clock times are shown as CET / CEST | Imprint / Privacy policy | powered by bitfire it services