Mercurial > code > home > repos > light9
annotate lib/goocanvas_compat.py @ 1859:f066d6e874db
2to3 with these fixers: all idioms set_literal
Ignore-this: cbd28518218c2f0ddce8c4f92d3b8b33
author | drewp@bigasterisk.com |
---|---|
date | Wed, 22 May 2019 00:08:22 +0000 |
parents | 2d2be076754f |
children |
rev | line source |
---|---|
1058
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
1 from gi.repository import GooCanvas |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
2 |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
3 def Points(pts): |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
4 cp = GooCanvas.CanvasPoints.new(len(pts)) |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
5 for i, (x, y) in enumerate(pts): |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
6 cp.set_point(i, x, y) |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
7 return cp |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
8 |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
9 def polyline_new_line(parent, x0=None, y0=None, x1=None, y1=None, points=None, **props): |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
10 p = GooCanvas.CanvasPolyline() |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
11 p.set_property('parent', parent) |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
12 if x0 is not None or points is not None: |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
13 pts = points or Points([(x0, y0), (x1, y1)]) |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
14 p.set_property('points', pts) |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
15 for k, v in props.items(): |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
16 p.set_property(k, v) |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
17 return p |