~valavanisalex/ubuntu/oneiric/inkscape/inkscape_0.48.1-2ubuntu4

« back to all changes in this revision

Viewing changes to share/extensions/chardataeffect.py

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook, Kees Cook, Ted Gould
  • Date: 2008-02-10 14:20:16 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20080210142016-vcnb2zqyhszu0xvb
Tags: 0.46~pre1-0ubuntu1
[ Kees Cook ]
* debian/control:
  - add libgtkspell-dev build-dep to gain GtkSpell features (LP: #183547).
  - update Standards version (no changes needed).
  - add Vcs and Homepage fields.
  - switch to new python-lxml dep.
* debian/{control,rules}: switch from dpatch to quilt for more sanity.
* debian/patches/20_fix_glib_and_gxx43_ftbfs.patch:
  - merged against upstream fixes.
  - added additional fixes for newly written code.
* debian/rules: enable parallel building.

[ Ted Gould ]
* Updating POTFILES.in to make it so things build correctly.
* debian/control:
  - add ImageMagick++ and libboost-dev to build-deps

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python 
 
2
'''
 
3
Copyright (C) 2006 Jos Hirth, kaioa.com
 
4
Copyright (C) 2007 bulia byak
 
5
Copyright (C) 2007 Aaron C. Spike
 
6
 
 
7
This program is free software; you can redistribute it and/or modify
 
8
it under the terms of the GNU General Public License as published by
 
9
the Free Software Foundation; either version 2 of the License, or
 
10
(at your option) any later version.
 
11
 
 
12
This program is distributed in the hope that it will be useful,
 
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
GNU General Public License for more details.
 
16
 
 
17
You should have received a copy of the GNU General Public License
 
18
along with this program; if not, write to the Free Software
 
19
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
20
'''
 
21
import sys, optparse, inkex
 
22
 
 
23
class CharDataEffect(inkex.Effect):
 
24
  def __init__(self):
 
25
    inkex.Effect.__init__(self)
 
26
    self.visited = []
 
27
 
 
28
  newline = True
 
29
  newpar = True
 
30
 
 
31
  def effect(self):
 
32
    if len(self.selected)==0:
 
33
      self.recurse(self.document.getroot())
 
34
    else:
 
35
      for id,node in self.selected.iteritems():
 
36
        self.recurse(node)
 
37
 
 
38
  def recurse(self,node):
 
39
    istext = (node.tag == '{http://www.w3.org/2000/svg}flowPara' or node.tag == '{http://www.w3.org/2000/svg}flowDiv' or node.tag == '{http://www.w3.org/2000/svg}text')
 
40
    if node.get('{http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd}role') == 'line':
 
41
      self.newline = True
 
42
    elif istext:
 
43
      self.newline = True
 
44
      self.newpar = True
 
45
 
 
46
    if node.text != None:
 
47
      node.text = self.process_chardata(node.text, self.newline, self.newpar)
 
48
      self.newline = False
 
49
      self.newpar = False
 
50
 
 
51
    for child in node:
 
52
      self.recurse(child)
 
53
 
 
54
    if node.tail != None:
 
55
      node.tail = self.process_chardata(node.tail, self.newline, self.newpar)
 
56
 
 
57
  def process_chardata(self,text, line, par):
 
58
    pass
 
59