changeset 1058:2d2be076754f

forgot to add goocanvas code Ignore-this: 6b9f96d08ecea4c47c5f91dab124f04
author Drew Perttula <drewp@bigasterisk.com>
date Mon, 02 Jun 2014 00:10:33 +0000
parents 2448ebc38a6f
children 7f5a9958095b
files lib/goocanvas_compat.py
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/goocanvas_compat.py	Mon Jun 02 00:10:33 2014 +0000
@@ -0,0 +1,17 @@
+from gi.repository import GooCanvas
+
+def Points(pts):
+    cp = GooCanvas.CanvasPoints.new(len(pts))
+    for i, (x, y) in enumerate(pts):
+        cp.set_point(i, x, y)
+    return cp
+
+def polyline_new_line(parent, x0=None, y0=None, x1=None, y1=None, points=None, **props):
+    p = GooCanvas.CanvasPolyline()
+    p.set_property('parent', parent)
+    if x0 is not None or points is not None:
+        pts = points or Points([(x0, y0), (x1, y1)])
+        p.set_property('points', pts)
+    for k, v in props.items():
+        p.set_property(k, v)
+    return p