You are probably going to have to use a Thread. I.e. Loop through the downloads in a new Shoes thread and update a para external to that thread. Some examples of threading: http://thread.gmane.org/gmane.comp.lib.shoes/842/focus=846 And the progress bar I did here: http://github.com/i5m/shoeset/blob/master/shoeset.rb There could be another way aswell. Sure someone else will have some input. On 19 Mar 2010, at 19:10, Trans <transfire@gmail.com> wrote: > Hi, > > I'm running through a loop that downloads urls. Before each loop I > want to add a para to the stack so the user knows which file is being > downloaded. Code: > > button "Fetch", :width=>100, :left=>635 do > @client.list.each do |url| > @videos.append do > para(url, :stroke=>white) > end > @client.download_url(url) > end > end > > Problem is none the paras actually become visible until all the urls > are downloaded. Is there anyway to force the drawing. Or is there a > better way to go about this?
On Fri, Mar 19, 2010 at 4:08 PM, i5m <i5ivem@googlemail.com> wrote: > You are probably going to have to use a Thread. I.e. Loop through the > downloads in a new Shoes thread and update a para external to that > thread. > > Some examples of threading: > > http://thread.gmane.org/gmane.comp.lib.shoes/842/focus=846 Thanks. That did the trick. > And the progress bar I did here: http://github.com/i5m/shoeset/blob/master/shoeset.rb Awesome. I'll look this over too. ~trans
Hi Trans, Good question. Interesting! How about this one? ;-) Shoes.app do urls = %w[ http://www.google-logos.com/wp-content/logos/Antonio-Vivaldi-Birthday-2010.gif http://www.google-logos.com/wp-content/logos/Winter_Olympics_2010_Vancouver_1.jpg http://www.google-logos.com/wp-content/logos/ec_segar_birthday_popeye_the_sailor_2009.gif ] button "Fetch" do urls.each do |url| fname = File.basename(url) download url, :save => fname do stack do para url, :stroke => green image fname end end end end end Hope this helps, ashbb
On Sat, Mar 20, 2010 at 2:15 AM, Satoshi Asakawa <ashbbb@gmail.com> wrote: > Hi Trans, > > Good question. Interesting! How about this one? ;-) > > Shoes.app do > urls = > %w[http://www.google-logos.com/wp-content/logos/Antonio-Vivaldi-Birthday-2010.gif > > http://www.google-logos.com/wp-content/logos/Winter_Olympics_2010_Vancouver_1.jpg > > http://www.google-logos.com/wp-content/logos/ec_segar_birthday_popeye_the_sailor_2009.gif > ] > > button "Fetch" do > urls.each do |url| > fname = File.basename(url) > download url, :save => fname do > stack do > para url, :stroke => green > image fname > end > end > end > end > end Even better. Smart _why.
Ah, the download method. :) I remember now, _why put that in to get around explicitly threading it, so that we could just do it async, like as is done in Prototype, jQuery, and a bunch of other javascript libs. On Fri, Mar 19, 2010 at 11:15 PM, Satoshi Asakawa <ashbbb@gmail.com> wrote: > Hi Trans, > > Good question. Interesting! How about this one? ;-) > > Shoes.app do > urls = %w[ > http://www.google-logos.com/wp-content/logos/Antonio-Vivaldi-Birthday-2010.gif > > http://www.google-logos.com/wp-content/logos/Winter_Olympics_2010_Vancouver_1.jpg > > http://www.google-logos.com/wp-content/logos/ec_segar_birthday_popeye_the_sailor_2009.gif > ] > > button "Fetch" do > urls.each do |url| > fname = File.basename(url) > download url, :save => fname do > stack do > para url, :stroke => green > image fname > end > end > end > end > end > > > Hope this helps, > ashbb > -- ~devyn