summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Dufour <nicoduf@yahoo.fr>2010-09-03 20:13:47 +0000
committerJazzyNico <nicoduf@yahoo.fr>2010-09-03 20:13:47 +0000
commit55a276b0d0f6b7e1df5af20f1700bc1895bd2f34 (patch)
treed1b420571e03c793961eb92454185e676b8ecea9
parentExtensions. Tooltips are now translatable (Bug #629726). (diff)
downloadinkscape-55a276b0d0f6b7e1df5af20f1700bc1895bd2f34.tar.gz
inkscape-55a276b0d0f6b7e1df5af20f1700bc1895bd2f34.zip
Extensions. UI consistency fixes and UI improvements (new help tabs when needed, and new tooltips).
(bzr r9739)
-rw-r--r--share/extensions/color_custom.inx19
-rw-r--r--share/extensions/color_custom.py69
-rw-r--r--share/extensions/color_randomize.inx6
-rw-r--r--share/extensions/color_replace.inx4
-rw-r--r--src/extension/internal/bluredge.cpp4
5 files changed, 64 insertions, 38 deletions
diff --git a/share/extensions/color_custom.inx b/share/extensions/color_custom.inx
index 78fd504aa..bb37f62ff 100644
--- a/share/extensions/color_custom.inx
+++ b/share/extensions/color_custom.inx
@@ -5,9 +5,22 @@
<dependency type="executable" location="extensions">coloreffect.py</dependency>
<dependency type="executable" location="extensions">color_custom.py</dependency>
<dependency type="executable" location="extensions">simplestyle.py</dependency>
- <param name="r" type="string" _gui-text="Red Function">r</param>
- <param name="g" type="string" _gui-text="Green Function">g</param>
- <param name="b" type="string" _gui-text="Blue Function">b</param>
+ <param name="tab" type="notebook">
+ <page name="Options" _gui-text="Options">
+ <param name="r" type="string" _gui-text="Red Function:" _gui-description="Function applied to the red channel">r</param>
+ <param name="g" type="string" _gui-text="Green Function:" _gui-description="Function applied to the green channel">g</param>
+ <param name="b" type="string" _gui-text="Blue Function:" _gui-description="Function applied to the blue channel">b</param>
+ </page>
+ <page name="Help" _gui-text="Help">
+ <_param name="instructions" type="description" xml:space="preserve">Allows you to evaluate different functions for each channel.
+r, g and b are the normalized values of the red, green and blue channels. The resulting RGB values are automatically clamped.
+
+Example (half the red, swap green and blue):
+ Red Function: r*0.5
+ Green Function: b
+ Blue Function: g</_param>
+ </page>
+ </param>
<effect>
<object-type>all</object-type>
<effects-menu>
diff --git a/share/extensions/color_custom.py b/share/extensions/color_custom.py
index f2f8719db..a90102d0f 100644
--- a/share/extensions/color_custom.py
+++ b/share/extensions/color_custom.py
@@ -2,37 +2,50 @@
import coloreffect
class C(coloreffect.ColorEffect):
- def __init__(self):
- coloreffect.ColorEffect.__init__(self)
- self.OptionParser.add_option("--r", action="store", type="string", dest="rFunction", default="r",help="red channel function")
- self.OptionParser.add_option("--g", action="store", type="string", dest="gFunction", default="g",help="green channel function")
- self.OptionParser.add_option("--b", action="store", type="string", dest="bFunction", default="b",help="blue channel function")
+ def __init__(self):
+ coloreffect.ColorEffect.__init__(self)
+ self.OptionParser.add_option("--r",
+ action="store", type="string",
+ dest="rFunction", default="r",
+ help="red channel function")
+ self.OptionParser.add_option("--g",
+ action="store", type="string",
+ dest="gFunction", default="g",
+ help="green channel function")
+ self.OptionParser.add_option("--b",
+ action="store", type="string",
+ dest="bFunction", default="b",
+ help="blue channel function")
+ self.OptionParser.add_option("--tab",
+ action="store", type="string",
+ dest="tab",
+ help="The selected UI-tab when OK was pressed")
- def normalize(self, v):
- if v<0:
- return 0.0
- if v>1:
- return 1.0
- return v
+ def normalize(self, v):
+ if v<0:
+ return 0.0
+ if v>1:
+ return 1.0
+ return v
- def _hexstr(self,r,g,b):
- return '%02x%02x%02x' % (int(round(r*255)),int(round(g*255)),int(round(b*255)))
-
- def colmod(self,_r,_g,_b):
- r=float(_r)/255
- g=float(_g)/255
- b=float(_b)/255
-
- # add stuff to be accessible from within the custom color function here.
- safeenv = {'__builtins__':{},'r':r,'g':g,'b':b}
+ def _hexstr(self,r,g,b):
+ return '%02x%02x%02x' % (int(round(r*255)),int(round(g*255)),int(round(b*255)))
+
+ def colmod(self,_r,_g,_b):
+ r=float(_r)/255
+ g=float(_g)/255
+ b=float(_b)/255
+
+ # add stuff to be accessible from within the custom color function here.
+ safeenv = {'__builtins__':{},'r':r,'g':g,'b':b}
- try:
- r2=self.normalize(eval(self.options.rFunction,safeenv))
- g2=self.normalize(eval(self.options.gFunction,safeenv))
- b2=self.normalize(eval(self.options.bFunction,safeenv))
- except:
- return self._hexstr(1.0,0.0,0.0)
- return self._hexstr(r2,g2,b2)
+ try:
+ r2=self.normalize(eval(self.options.rFunction,safeenv))
+ g2=self.normalize(eval(self.options.gFunction,safeenv))
+ b2=self.normalize(eval(self.options.bFunction,safeenv))
+ except:
+ return self._hexstr(1.0,0.0,0.0)
+ return self._hexstr(r2,g2,b2)
c = C()
c.affect()
diff --git a/share/extensions/color_randomize.inx b/share/extensions/color_randomize.inx
index 82691f0f4..8584722fa 100644
--- a/share/extensions/color_randomize.inx
+++ b/share/extensions/color_randomize.inx
@@ -7,9 +7,9 @@
<dependency type="executable" location="extensions">simplestyle.py</dependency>
<param name="tab" type="notebook">
<page name="Options" _gui-text="Options">
- <param name="hue" type="boolean" _gui-text="Hue">true</param>
- <param name="saturation" type="boolean" _gui-text="Saturation">true</param>
- <param name="lightness" type="boolean" _gui-text="Lightness">true</param>
+ <param name="hue" type="boolean" _gui-text="Hue" _gui-description="Randomize hue">true</param>
+ <param name="saturation" type="boolean" _gui-text="Saturation" _gui-description="Randomize saturation">true</param>
+ <param name="lightness" type="boolean" _gui-text="Lightness" _gui-description="Randomize lightness">true</param>
</page>
<page name="Help" _gui-text="Help">
<_param name="instructions" type="description" xml:space="preserve">Converts to HSL, randomizes hue and/or saturation and/or lightness and converts it back to RGB.</_param>
diff --git a/share/extensions/color_replace.inx b/share/extensions/color_replace.inx
index f62b2a4e5..289c4424d 100644
--- a/share/extensions/color_replace.inx
+++ b/share/extensions/color_replace.inx
@@ -5,8 +5,8 @@
<dependency type="executable" location="extensions">coloreffect.py</dependency>
<dependency type="executable" location="extensions">color_replace.py</dependency>
<dependency type="executable" location="extensions">simplestyle.py</dependency>
- <param name="from_color" type="string" max_length="6" _gui-text="Replace color (RRGGBB hex):">000000</param>
- <param name="to_color" type="string" max_length="6" _gui-text="By color (RRGGBB hex):">000000</param>
+ <param name="from_color" type="string" max_length="6" _gui-text="Replace color (RRGGBB hex):" _gui-description="Color to replace">000000</param>
+ <param name="to_color" type="string" max_length="6" _gui-text="By color (RRGGBB hex):" _gui-description="New color">000000</param>
<effect>
<object-type>all</object-type>
<effects-menu>
diff --git a/src/extension/internal/bluredge.cpp b/src/extension/internal/bluredge.cpp
index e32012070..a82c7ba77 100644
--- a/src/extension/internal/bluredge.cpp
+++ b/src/extension/internal/bluredge.cpp
@@ -133,8 +133,8 @@ BlurEdge::init (void)
"<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
"<name>" N_("Inset/Outset Halo") "</name>\n"
"<id>org.inkscape.effect.bluredge</id>\n"
- "<param name=\"blur-width\" gui-text=\"" N_("Width") "\" gui-description=\"" N_("Width in px of the halo") "\" scope=\"document\" type=\"float\" min=\"1.0\" max=\"50.0\">1.0</param>\n"
- "<param name=\"num-steps\" gui-text=\"" N_("Number of steps") "\" gui-description=\"" N_("Number of inset/outset copies of the object to make") "\" scope=\"document\" type=\"int\" min=\"5\" max=\"100\">11</param>\n"
+ "<param name=\"blur-width\" gui-text=\"" N_("Width:") "\" gui-description=\"" N_("Width in px of the halo") "\" scope=\"document\" type=\"float\" min=\"1.0\" max=\"50.0\">1.0</param>\n"
+ "<param name=\"num-steps\" gui-text=\"" N_("Number of steps:") "\" gui-description=\"" N_("Number of inset/outset copies of the object to make") "\" scope=\"document\" type=\"int\" min=\"5\" max=\"100\">11</param>\n"
"<effect>\n"
"<object-type>all</object-type>\n"
"<effects-menu>\n"