1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
DiaCanvas2 Python bindings
There are two ways to build the Python bindings:
1. './configure && make && make install' from the package's root directory
2. build the C library and build the Python bindings with setup.py.
Some changes in the API wrt the Python wrapper:
dia_canvas_item_connect -> DiaCanvasItem.connect_handle
dia_canvas_item_disconnect -> DiaCanvasItem.disconnect_handle
dia_shape_text_cursor_from_pos (shape, pos, *cursor): in
-> shape.Text.cursor_from_pos (shape, pos): (in, cursor)
dia_handle_get_pos_[iw] (handle, *x, *y)
-> dia_handle_get_pos_[iw] (handle): (x, y)
dia_canvas_snap_to_grid (canvas, *x, *y)
-> dia_canvas_snap_to_grid (canvas, x, y): (x, y)
dia_rectangle_add_point(rect, point)
-> dia_rectangle_add_point(rect, point): new_rect
dia_distance_line_point(line_start, line_end, point, line_width,
style, *point_on_line): distance
-> dia_distance_line_point(line_start, line_end, point, line_width,
style): (distance, point_on_line)
dia_intersection_line_line(s1, e1, s2, e2, *intersect): bool
-> dia_intersection_line_line(s1, e1, s2, e2): intersect (or None)
New method:
DiaCanvasItem.set(name=value, ...) for setting multiple properties at once.
DiaCanvasItem.set_bounds(bounds) for setting item bounds (or extents).
The methods defined in DiaCanvasItemClass are overridable. You can define them
as 'on_<signal_name>' in your DiaCanvasItem deriviate. You have to call
diacanvas.set_callbacks() once on the class you inherit from an item
of the DiaCanvasItem (call it once!).
Changes:
handle_motion (Item, Handle, *wx, *wy, mask)
-> on_handle_motion (Item, Handle, wx, wy, mask): (new_wx, new_wy)
glue (Item, handle, *wx, *wy): double
-> on_glue (Item, Handle, wx, wy): (double, new_wx, new_wy)
get_shape_iter (Item, Iter): boolean
shape_next (Item, Iter): boolean
shape_value (Item, Iter): DiaShape*
-> Those functions are replaced by a generator function on_shape_iter()
Creating Groupable Canvas Items
-------------------------------
Read the SGML/HTML documentation is doc/ref.
TODO:
-----
. check for memory leaks.
|