~inkscape.dev/inkscape/trunk

« back to all changes in this revision

Viewing changes to share/extensions/embedimage.py

  • Committer: pjrm
  • Date: 2008-05-23 12:49:19 UTC
  • Revision ID: pjrm@users.sourceforge.net-20080523124919-bfrcgaggp79uviuy
share/extensions/*.py: Use gettext for (many) error messages.
share/extensions/inkex.py: (errormsg): New function.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
'''
19
19
 
20
20
import inkex, os, base64
 
21
import gettext
 
22
_ = gettext.gettext
21
23
 
22
24
class Embedder(inkex.Effect):
23
25
    def __init__(self):
74
76
                if (absref != None):
75
77
                    path=absref
76
78
            if (not os.path.isfile(path)):
77
 
                inkex.debug('No xlink:href or sodipodi:absref attributes found, or they do not point to an existing file! Unable to embed image.')
 
79
                inkex.errormsg(_('No xlink:href or sodipodi:absref attributes found, or they do not point to an existing file! Unable to embed image.'))
78
80
            
79
81
            if (os.path.isfile(path)):
80
82
                file = open(path,"rb").read()
97
99
                    if (absref != None):
98
100
                        del node.attrib[inkex.addNS('absref',u'sodipodi')]
99
101
                else:
100
 
                    inkex.debug("%s is not of type image/png, image/jpeg, image/bmp, image/gif or image/x-icon" % path)
 
102
                    inkex.errormsg(_("%s is not of type image/png, image/jpeg, image/bmp, image/gif or image/x-icon") % path)
101
103
            else:
102
 
                inkex.debug("Sorry we could not locate %s" % path)
 
104
                inkex.errormsg(_("Sorry we could not locate %s") % path)
103
105
 
104
106
if __name__ == '__main__':
105
107
    e = Embedder()