annotate lib/goocanvas_compat.py @ 2068:4d248fb66d0c

patch 2019 music path for testing 2022 code
author drewp@bigasterisk.com
date Sat, 21 May 2022 15:56:07 -0700
parents 2d2be076754f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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