accerciser r746 - in trunk: . src/lib/accerciser



Author: eitani
Date: Sun Apr  5 07:53:31 2009
New Revision: 746
URL: http://svn.gnome.org/viewvc/accerciser?rev=746&view=rev

Log:
    * src/lib/accerciser/prefs_dialog.py:
    * src/lib/accerciser/node.py: Updated highlight SVG to work with
    	newer rsvg (bug #576756).

Modified:
   trunk/ChangeLog
   trunk/src/lib/accerciser/node.py
   trunk/src/lib/accerciser/prefs_dialog.py

Modified: trunk/src/lib/accerciser/node.py
==============================================================================
--- trunk/src/lib/accerciser/node.py	(original)
+++ trunk/src/lib/accerciser/node.py	Sun Apr  5 07:53:31 2009
@@ -182,14 +182,17 @@
   Highlight box class. Uses compositing when available. When not, it does
   transparency client-side.
   '''
-  _svg = r"""
-<svg width="100%" height="100%" version="1.1"
-  xmlns="http://www.w3.org/2000/svg";>
-  <rect x="$x" y="$y" width="$width" height="$height"
-      style="fill:$fill;stroke-width:$stroke_width;stroke:$stroke;
-      fill-opacity:$fill_opacity;stroke-opacity:$stroke_opacity"
-      rx="2" ry="2"
-      />
+  _svg = """<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg";> 
+  <rect
+       style="fill:$fill;fill-opacity:$fill_opacity;fill-rule:evenodd;stroke:$stroke;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:$stroke_opacity"
+       id="highlight"
+       width="$width"
+       height="$height"
+       x="$x"
+       y="$y"
+       rx="2"
+       ry="2" />
 </svg>
 """
   def __init__(self, x, y, w, h, 
@@ -246,7 +249,6 @@
     else:
       self.destroy()
     
-
   def _onExpose(self, widget, event):
     svgh = rsvg.Handle()
     try:
@@ -274,3 +276,10 @@
 
     svgh.render_cairo( cr )
     del svgh
+
+if __name__ == "__main__":
+    hl = _HighLight(200, 200, 200, 200, '#ff0000', 
+                    0.5, '#ff0000', 0.996108949416, 8.0, 0)
+    hl.highlight(2000)
+    gtk.main()
+

Modified: trunk/src/lib/accerciser/prefs_dialog.py
==============================================================================
--- trunk/src/lib/accerciser/prefs_dialog.py	(original)
+++ trunk/src/lib/accerciser/prefs_dialog.py	Sun Apr  5 07:53:31 2009
@@ -87,13 +87,11 @@
     controls[0].set_increments(0.01, 0.1)
     controls[0].connect('value-changed', self._onDurationChanged)
     labels[1] = gtk.Label(_('Border color:'))
-    controls[1] = self._ColorButton(
-      self.gconf_cl.get_string('/apps/accerciser/highlight_border'))
+    controls[1] = self._ColorButton(node.BORDER_COLOR, node.BORDER_ALPHA)
     controls[1].connect('color-set', self._onColorSet, 'highlight_border')
     controls[1].set_tooltip_text(_('The border color of the highlight box'))
     labels[2] = gtk.Label(_('Fill color:'))
-    controls[2] = self._ColorButton(
-      self.gconf_cl.get_string('/apps/accerciser/highlight_fill'))
+    controls[2] = self._ColorButton(node.FILL_COLOR, node.FILL_ALPHA)
     controls[2].connect('color-set', self._onColorSet, 'highlight_fill')
     controls[2].set_tooltip_text(_('The fill color of the highlight box'))
 
@@ -144,10 +142,10 @@
     '''
     ColorButton derivative with useful methods for us.
     '''
-    def __init__(self, color_string):
-      gtk.ColorButton.__init__(self, gtk.gdk.color_parse(color_string[:-2]))
+    def __init__(self, color, alpha):
+      gtk.ColorButton.__init__(self, gtk.gdk.color_parse(color))
       self.set_use_alpha(True)
-      self.set_alpha(int(color_string[-2:], 16) << 8)
+      self.set_alpha(int(alpha*0xffff))
                                
     def get_rgba_string(self):
       '''



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]