home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Narzedzia / Inkscape / Inkscape-0.48.2-1-win32.exe / share / extensions / text_replace.py < prev    next >
Text File  |  2011-07-08  |  658b  |  17 lines

  1. import chardataeffect, inkex, string
  2.  
  3. class C(chardataeffect.CharDataEffect):
  4.   def __init__(self):
  5.     chardataeffect.CharDataEffect.__init__(self)
  6.     self.OptionParser.add_option("-f", "--from_text", action="store", type="string", dest="from_text", default="", help="Replace")
  7.     self.OptionParser.add_option("-t", "--to_text", action="store", type="string", dest="to_text", default="", help="by")
  8.  
  9.   def process_chardata(self,text, line, par):
  10.     fr = self.options.from_text.strip('"').replace('\$','$')
  11.     to = self.options.to_text.strip('"').replace('\$','$')
  12.  
  13.     return (text.replace(unicode(fr,"utf-8"), unicode(to,"utf-8")))
  14.  
  15. c = C()
  16. c.affect()
  17.