Hi Hans, I'm close to finishing a revision of my tooltips patch. To properly loadbang a canvas tip
I need something like a <<Loaded>> event, but one that tells me when the a pd patch window has
finally finished being drawn by Tk. <<Loaded>> seems to trigger once the procedure for creating
a new canvas has finished (technically right before, I guess), but it doesn't tell me when Tk has
actually finished drawing the window and setting all the window dimensions that are query-able
through winfo.
I think I could use <Configure>, but it will trigger multiple times-- I just want one event that tells me
"Ok, everything that needed to get drawn as a result of creating this patch window is done drawing."
(tcl/tk wiki warns against "update idletasks" which can cause subtle bugs.)
-Jonathan
That's a tricky one. I think that <<Loaded>> should be sent when the patch is all done, so the current situation is a bug. Since the drawing commands come from 'pd', 'pd' would have to trigger the <<Loaded>> event. I forget how its triggered now.
Definitely avoid 'update', I recently refactored my pdwindow.tcl code to switch from 'update' to 'after idle'.
.hc
On Nov 17, 2011, at 4:01 PM, Jonathan Wilkes wrote:
Hi Hans, I'm close to finishing a revision of my tooltips patch. To properly loadbang a canvas tip
I need something like a <<Loaded>> event, but one that tells me when the a pd patch window has
finally finished being drawn by Tk. <<Loaded>> seems to trigger once the procedure for creating
a new canvas has finished (technically right before, I guess), but it doesn't tell me when Tk has
actually finished drawing the window and setting all the window dimensions that are query-able
through winfo.
I think I could use <Configure>, but it will trigger multiple times-- I just want one event that tells me
"Ok, everything that needed to get drawn as a result of creating this patch window is done drawing."
(tcl/tk wiki warns against "update idletasks" which can cause subtle bugs.)
-Jonathan
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
"[W]e have invented the technology to eliminate scarcity, but we are deliberately throwing it away to benefit those who profit from scarcity." -John Gilmore
----- Original Message -----
From: Hans-Christoph Steiner hans@at.or.at To: Jonathan Wilkes jancsika@yahoo.com Cc: "pd-list@iem.at" pd-list@iem.at Sent: Thursday, November 17, 2011 6:20 PM Subject: Re: [PD] <<Loaded>> event
That's a tricky one. I think that <<Loaded>> should be sent when the patch is all done, so the current situation is a bug.
Ah, ok.
Since the drawing commands come from 'pd', 'pd' would have to trigger the <<Loaded>> event. I forget how its triggered now.
It's triggered in the last line of ::pdtk_canvas::finished_loading_file in pdtk_canvas.tcl. That proc is called by ::pd_bindings::map in pd_bindings.tcl, where it is preceded by: pdsend "$mytoplevel map 1"
Maybe that line above needs to be the last line of the proc, and when pd is done mapping it should make a call to ::pdtk_canvas::finished_loading_file? I'm still not solid on the back and forth between gui and pd, so I'm not sure if that would help or not.
Definitely avoid 'update', I recently refactored my pdwindow.tcl code to switch from 'update' to 'after idle'.
I think 'after idle' can also be problematic.
.hc
On Nov 17, 2011, at 4:01 PM, Jonathan Wilkes wrote:
Hi Hans, I'm close to finishing a revision of my tooltips patch. To
properly loadbang a canvas tip
I need something like a <<Loaded>> event, but one that tells me
when the a pd patch window has
finally finished being drawn by Tk. <<Loaded>> seems to
trigger once the procedure for creating
a new canvas has finished (technically right before, I guess), but it
doesn't tell me when Tk has
actually finished drawing the window and setting all the window dimensions
that are query-able
through winfo.
I think I could use <Configure>, but it will trigger multiple times--
I just want one event that tells me
"Ok, everything that needed to get drawn as a result of creating this
patch window is done drawing."
(tcl/tk wiki warns against "update idletasks" which can cause
subtle bugs.)
-Jonathan
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list
"[W]e have invented the technology to eliminate scarcity, but we are deliberately throwing it away to benefit those who profit from scarcity." -John Gilmore
On Nov 17, 2011, at 6:51 PM, Jonathan Wilkes wrote:
----- Original Message -----
From: Hans-Christoph Steiner hans@at.or.at To: Jonathan Wilkes jancsika@yahoo.com Cc: "pd-list@iem.at" pd-list@iem.at Sent: Thursday, November 17, 2011 6:20 PM Subject: Re: [PD] <<Loaded>> event
That's a tricky one. I think that <<Loaded>> should be sent when the patch is all done, so the current situation is a bug.
Ah, ok.
Since the drawing commands come from 'pd', 'pd' would have to trigger the <<Loaded>> event. I forget how its triggered now.
It's triggered in the last line of ::pdtk_canvas::finished_loading_file in pdtk_canvas.tcl. That proc is called by ::pd_bindings::map in pd_bindings.tcl, where it is preceded by: pdsend "$mytoplevel map 1"
Maybe that line above needs to be the last line of the proc, and when pd is done mapping it should make a call to ::pdtk_canvas::finished_loading_file?
I'm still not solid on the back and forth between gui and pd, so I'm not sure if that would help or not.
It'll need to be somewhere else entirely, I think. "map" is the concept of the window being mapped to the screen. As you seem to have discovered, the window is mapped to the screen, then pd sends all its draw commands to it. So ::pdtk_canvas::finished_loading_file should be called once Pd is done sending draw commands.
Definitely avoid 'update', I recently refactored my pdwindow.tcl code to switch from 'update' to 'after idle'.
I think 'after idle' can also be problematic.
I haven't had any problems so far, and it seems to have improved the performance of the Pd window even more than the update code, though not as drastic a change as the rearchitecting had.
.hc
If you are not part of the solution, you are part of the problem.
----- Original Message -----
From: Hans-Christoph Steiner hans@at.or.at To: Jonathan Wilkes jancsika@yahoo.com Cc: "pd-list@iem.at" pd-list@iem.at Sent: Thursday, November 17, 2011 10:32 PM Subject: Re: [PD] <<Loaded>> event
On Nov 17, 2011, at 6:51 PM, Jonathan Wilkes wrote:
----- Original Message -----
From: Hans-Christoph Steiner hans@at.or.at To: Jonathan Wilkes jancsika@yahoo.com Cc: "pd-list@iem.at" pd-list@iem.at Sent: Thursday, November 17, 2011 6:20 PM Subject: Re: [PD] <<Loaded>> event
That's a tricky one. I think that <<Loaded>> should be
sent
when the patch is all done, so the current situation is a bug.
Ah, ok.
Since the drawing commands come from 'pd', 'pd' would have to
trigger the
<<Loaded>> event. I forget how its triggered now.
It's triggered in the last line of ::pdtk_canvas::finished_loading_file
in
pdtk_canvas.tcl. That proc is called by ::pd_bindings::map in pd_bindings.tcl, where it is preceded by: pdsend "$mytoplevel map 1"
Maybe that line above needs to be the last line of the proc, and when pd is done mapping it should make a call to
::pdtk_canvas::finished_loading_file?
I'm still not solid on the back and forth between gui and pd, so
I'm not sure
if that would help or not.
It'll need to be somewhere else entirely, I think. "map" is the concept of the window being mapped to the screen. As you seem to have discovered, the window is mapped to the screen, then pd sends all its draw commands to it. So ::pdtk_canvas::finished_loading_file should be called once Pd is done sending draw commands.
Right-- that's why I was thinking it should go on the pd side in canvas_map, after the last sys_vgui call.
-Jonathan
Definitely avoid 'update', I recently refactored my
pdwindow.tcl code to
switch from 'update' to 'after idle'.
I think 'after idle' can also be problematic.
I haven't had any problems so far, and it seems to have improved the performance of the Pd window even more than the update code, though not as drastic a change as the rearchitecting had.
.hc
If you are not part of the solution, you are part of the problem.
On Nov 17, 2011, at 10:47 PM, Jonathan Wilkes wrote:
----- Original Message -----
From: Hans-Christoph Steiner hans@at.or.at To: Jonathan Wilkes jancsika@yahoo.com Cc: "pd-list@iem.at" pd-list@iem.at Sent: Thursday, November 17, 2011 10:32 PM Subject: Re: [PD] <<Loaded>> event
On Nov 17, 2011, at 6:51 PM, Jonathan Wilkes wrote:
----- Original Message -----
From: Hans-Christoph Steiner hans@at.or.at To: Jonathan Wilkes jancsika@yahoo.com Cc: "pd-list@iem.at" pd-list@iem.at Sent: Thursday, November 17, 2011 6:20 PM Subject: Re: [PD] <<Loaded>> event
That's a tricky one. I think that <<Loaded>> should be
sent
when the patch is all done, so the current situation is a bug.
Ah, ok.
Since the drawing commands come from 'pd', 'pd' would have to
trigger the
<<Loaded>> event. I forget how its triggered now.
It's triggered in the last line of ::pdtk_canvas::finished_loading_file
in
pdtk_canvas.tcl. That proc is called by ::pd_bindings::map in pd_bindings.tcl, where it is preceded by: pdsend "$mytoplevel map 1"
Maybe that line above needs to be the last line of the proc, and when pd is done mapping it should make a call to
::pdtk_canvas::finished_loading_file?
I'm still not solid on the back and forth between gui and pd, so
I'm not sure
if that would help or not.
It'll need to be somewhere else entirely, I think. "map" is the concept of the window being mapped to the screen. As you seem to have discovered, the window is mapped to the screen, then pd sends all its draw commands to it. So ::pdtk_canvas::finished_loading_file should be called once Pd is done sending draw commands.
Right-- that's why I was thinking it should go on the pd side in canvas_map, after the last sys_vgui call.
The Pd side of map will probably give you more or less the same place. "map" just means the window is active, I don't think it means that Pd is done drawing. I think there needs to be a way to find when Pd has stopped parsing the .pd file and sending Tcl draw commands.
.hc
'You people have such restrictive dress for women,’ she said, hobbling away in three inch heels and panty hose to finish out another pink-collar temp pool day. - “Hijab Scene #2", by Mohja Kahf