Am 23.07.2008 10:41, Andrew M. Botros schrieb:
Dear Hans, I am afraid i didn't understand much from your last e-mail, could you please elaborate it more. One other thing, let me rephrase my question @ the very beginning, How can I know the objects connected to a Standard - Line?
So lets try once more ;)There are two specialized objects involved in building a connection. One is a Handle, the other one is a ConnectionPoint. In an existing connection between two DiaObject the Handle belongs to the first ("connected to") and the ConnectionPoint belongs to second ("connected by").
The "Standard - Line" DiaObject is special because it is one of only few objects which can be "connected to" (has Handles) and also "connected by" (has a ConnectionPoint). Thus I still have problems understanding your question. Note: there is an important difference between the active and the passive form.
I hope you now have understood the difference I'm (and Dia's source is) making between handle->connected_to and "connected by" (connectionpoint->connected). The former is a 0 or 1 relation, the latter is 0..n.
Attached an example diagram and a PyDia script illustrating the issue. Hans
Thank You. On Tue, Jul 22, 2008 at 10:34 PM, Hans Breuer <hans breuer org> wrote:Am 22.07.2008 16:49, Andrew M. Botros schrieb:what does "handle->connected_to->connected" exactly contain??? because when i connect a standard line to a standard box for example, and i check the handles of the standard line, here is what i get Handle num 0 Handle num 1 Connected to: Standard - Line Sorry, why do you think *connected_to* does not give you "Connected to"??In fact handle->connected_to is of type ConnectionPoint. ConnectionPoint::object gives you the object owning the connection point, see lib/connectionpoint.h . ConnectionPoint::connected is of type GList* and gives you a list of all object connected to that cp. which means handle number 0 is not connected to anything, and handlenumber 1 is connected to a "Standard - Line" !!!!!!! Which means you are running in circles no matter how many exclamationmarks you put therer ;-) isn't this a bit strange that the line is considered connected to itself?Sure it would be. But isn't it also a bit strange to look for bugselsewhere first? Hans -------- Hans "at" Breuer "dot" Org ----------- Tell me what you need, and I'll tell you how to get along without it. -- Dilbert _______________________________________________ Dia-list mailing list Dia-list gnome org http://mail.gnome.org/mailman/listinfo/dia-list FAQ at http://live.gnome.org/Dia/Faq Main page at http://live.gnome.org/Dia------------------------------------------------------------------------ _______________________________________________ Dia-list mailing list Dia-list gnome org http://mail.gnome.org/mailman/listinfo/dia-list FAQ at http://live.gnome.org/Dia/Faq Main page at http://live.gnome.org/Dia
-- -------- Hans "at" Breuer "dot" Org ----------- Tell me what you need, and I'll tell you how to get along without it. -- Dilbert
# a simple sample to show listing all connections between objects import dia def ListConnections (data, flags) : objs = data.active_layer.objects for o in objs : print o.type if len(o.handles) > 0 : print " ... connected to" for h in o.handles : # Handle cto = h.connected_to if cto : print "\t", cto.object.type if len(o.connections) > 0 : print " ... connected by" for c in o.connections: # ConnectionPoint for cpo in c.connected : print "\t", cpo.type dia.register_callback ("List Connections", "<Display>/Debug/Connections", ListConnections)
Attachment:
connected.dia
Description: application/dia