Sha256: 8a63665c845371df2f990684acad621aaedb4e280803d3dee646eb7baf467843

Contents?: true

Size: 789 Bytes

Versions: 12

Compression:

Stored size: 789 Bytes

Contents

require 'green_shoes'

Shoes.app do
  stack margin_left: 10 do
    title "Downloading Astronomy Picture of the Day",  size: 16
    status = para "One moment..."
    msg = para '0%'
    dl = download "http://antwrp.gsfc.nasa.gov/apod/image/1009/venusmoon_pascual_big.jpg",
      save: "venusmoon_pascual_big.jpg" do
      status.text = strong(fg("Okay, is downloaded.", orangered))
      image("venusmoon_pascual_big.jpg", width: 580, height: 380).move 10, 100
    end

    pg = progress left: 10, top: 100, width: width - 20
    a = animate do
      if dl.started?
        pg.fraction = dl.progress.to_f / dl.content_length
        msg.text = "%2d%" % (pg.fraction * 100)
      end
      if dl.finished?
        pg.hide
        a.stop
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
green_shoes-1.1.374 samples/sample43.rb
green_shoes-1.1.373 samples/sample43.rb
green_shoes-1.1.367 samples/sample43.rb
green_shoes-1.1.366 samples/sample43.rb
green_shoes-1.1.365 samples/sample43.rb
green_shoes-1.1.364 samples/sample43.rb
green_shoes-1.1.363 samples/sample43.rb
green_shoes-1.1.362 samples/sample43.rb
green_shoes-1.1.358 samples/sample43.rb
green_shoes-1.1.357 samples/sample43.rb
green_shoes-1.1.354 samples/sample43.rb
green_shoes-1.1.348 samples/sample43.rb