[SVN] RFC: async window support for tm_dialog

Chris Thomas chris at cjack.com
Tue Nov 28 02:03:17 UTC 2006


This patch extends the dialog server with (partial) support for  
allowing scripts to interact more directly with nibs. You can  
instantiate a nib without blocking, and later update the binding values.

Three new options to tm_dialog:

  -a, --async-window           Displays the window and returns a  
reference token for it
                               in the output property list.
  -x, --close-winow <token>    Close and release an async window.
  -t, --update-window <token>  Update an async window with new  
parameter values.
                               Use the --parameters argument (or  
stdin) to specify the
                               updated parameters.

• This is sufficient for implementing progress dialogs and other  
'broadcast' information. For two-way usage, there is no way to  
actually retrieve the parameter values from an async window. You would  
generally want to retrieve parameter values on a user action, and  
there isn't a way to perform a callback yet. Perhaps export a new  
IBAction from the File Owner that dumps the parameters to stdout?

• The token persists until the window is closed. It's not reused until  
the counter wraps (at 2^31, probably not an issue).

• There's a possibility that windows not attached to a process could  
be orphaned, which would require users to kill the window on the  
command line (if the window doesn't have a close box). If a script is  
handling errors properly, this shouldn't be a problem. You can already  
get into this situation now with CocoaDialog and suchlike, but the  
remedy is slightly different in that you will need to use tm_dialog to  
kill the window rather than killing an external process.

Comments? Code review? Break anything?

Chris


-------------- next part --------------
A non-text attachment was scrubbed...
Name: TMDialogAsync.patch
Type: application/octet-stream
Size: 14580 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate-dev/attachments/20061127/b796a65c/attachment.patch>


More information about the textmate-dev mailing list