Code

webslicer effects now extends a commom WebSlicer_Effect class
[inkscape.git] / share / extensions / webslicer_export.py
1 #!/usr/bin/env python
2 '''
3 Copyright (C) 2010 Aurelio A. Heckert, aurium (a) gmail dot com
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18 '''
20 import webslicer_effect
21 import inkex
22 import gettext
23 import os.path
24 import commands
26 _ = gettext.gettext
28 class WebSlicer_Export(webslicer_effect.WebSlicer_Effect):
30     def __init__(self):
31         webslicer_effect.WebSlicer_Effect.__init__(self)
32         self.OptionParser.add_option("--with-code",
33                                      action="store", type="string",
34                                      dest="with_code",
35                                      help="")
36         self.OptionParser.add_option("--dir",
37                                      action="store", type="string",
38                                      dest="dir",
39                                      help="")
41     def effect(self):
42         if is_empty( self.options.dir ):
43             inkex.errormsg(_('You must to give a directory to export the slices.'))
44             return
45         if not os.path.exists( self.options.dir ):
46             inkex.errormsg(_('The directory "%s" does not exists.') % self.options.dir)
47             return
48         (status, output) = commands.getstatusoutput("inkscape -e ...")
49         inkex.errormsg( status )
50         inkex.errormsg( output )
53 if __name__ == '__main__':
54     e = WebSlicer_Export()
55     e.affect()