Code

Extensions. UI consistency fixes and UI improvements (new help tabs when needed,...
authorJazzyNico <nicoduf@yahoo.fr>
Fri, 3 Sep 2010 20:13:47 +0000 (22:13 +0200)
committerJazzyNico <nicoduf@yahoo.fr>
Fri, 3 Sep 2010 20:13:47 +0000 (22:13 +0200)
share/extensions/color_custom.inx
share/extensions/color_custom.py
share/extensions/color_randomize.inx
share/extensions/color_replace.inx
src/extension/internal/bluredge.cpp

index 78fd504aad0a794c4757830578c964fe4c5fa8e2..bb37f62ff4cfb1051ae9b2046dfd0c86247ad2bc 100644 (file)
@@ -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>
index f2f8719db45ad137706b34134695c8d5ba62faa2..a90102d0f4094e4d5d58cb3eafbecad6388f7294 100644 (file)
@@ -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()
index 82691f0f46c432446035695c9118a028b54111d8..8584722fa1239b1a180ba46784f67452a17c147b 100644 (file)
@@ -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>
index f62b2a4e523f141567af0bc43de21a985a543876..289c4424d0339ad94dda4a7bd891231b84dbde41 100644 (file)
@@ -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>
index e32012070ae6082549d8fc6d9eae1cc530a58105..a82c7ba7778559c215a171f4c359f0d3efde46a4 100644 (file)
@@ -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"