Re: "layer.remove_object() doesn't apply to connection points"

At 27.09.2013 13:13, Bao Niu wrote:
Syndrome: If you have a "Database -- Table" on screen, and then add a
"Standard - BezierLine" connecting to one of the table's connection point,
you cannot use python's API to disconnect this two objects
To me this sounds like a bug in your code. Isn't it that you just don't know how to achieve this?
When using layer.remove(BezierLine),
Apparently you are assuming layer.remove() is also deleting the object, which it is not. Object destruction is triggered by the object's destroy() method, it includes breaking the remaining object connections. A weak spot is, that it's in the resposibility of the API user to not access the object after destruction.
and then
update_connections(table), the connection is still there
Are you expecting a display update from update_connections()?
The only way you
can disconnect the two is manually delete the BezierLine from the screen.
There is no way to do this programmatically.

In all you described so far you did not try to disconnect at all. You are just assuming that removing an object (from a layer) should also get rid of the connection. If you really want to disconnect there is Handle.connect(None) to do this. But of course that would not delete the object, but just break the connection.

This seems to be a bug. Is there any solution?

As I said, I think the bug is in your code/assumptions. If you want help debugging actually providing a minimal, but complete example for the issue you have would be helpful.

-------- Hans "at" Breuer "dot" Org -----------
Tell me what you need, and I'll tell you how to
get along without it.                -- Dilbert

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