~ubuntu-branches/ubuntu/utopic/inkscape/utopic-proposed

« back to all changes in this revision

Viewing changes to inkscape-0.47pre1/share/extensions/color_replace.py

  • Committer: Bazaar Package Importer
  • Author(s): Bryce Harrington
  • Date: 2009-07-02 17:09:45 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20090702170945-nn6d6zswovbwju1t
Tags: 0.47~pre1-0ubuntu1
* New upstream release.
  - Don't constrain maximization on small resolution devices (pre0)
    (LP: #348842)
  - Fixes segfault on startup (pre0)
    (LP: #391149)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import coloreffect
 
2
 
 
3
import inkex
 
4
 
 
5
class C(coloreffect.ColorEffect):
 
6
  def __init__(self):
 
7
    coloreffect.ColorEffect.__init__(self)
 
8
    self.OptionParser.add_option("-f", "--from_color", action="store", type="string", dest="from_color", default="000000", help="Replace color")
 
9
    self.OptionParser.add_option("-t", "--to_color", action="store", type="string", dest="to_color", default="000000", help="By color")
 
10
 
 
11
  def colmod(self,r,g,b):
 
12
    this_color = '%02x%02x%02x' % (r, g, b)
 
13
 
 
14
    fr = self.options.from_color.strip('"').replace('#', '').lower()
 
15
    to = self.options.to_color.strip('"').replace('#', '').lower()
 
16
       
 
17
    #inkex.debug(this_color+"|"+fr+"|"+to)
 
18
    if this_color == fr:
 
19
      return to
 
20
    else:
 
21
      return this_color
 
22
 
 
23
c = C()
 
24
c.affect()