Sha256: eba0e115ba36bf39ea27b02f8ffb108f23e153132d261bbdbabb3edee0bfca61

Contents?: true

Size: 799 Bytes

Versions: 3

Compression:

Stored size: 799 Bytes

Contents

require 'purple_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"

    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?
        status.text = "Okay, is downloaded."
        status.style stroke: orangered
        image("venusmoon_pascual_big.jpg", width: 580, height: 380).move 10, 100
        pg.hide
        a.stop
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
purple_shoes-0.0.126 samples/sample43.rb
purple_shoes-0.0.115 samples/sample43.rb
purple_shoes-0.0.101 samples/sample43.rb