Sha256: 13f2609653f25ec6c70076d87cdfc0558573c6d1c346c62ac92c9a169abff1f1

Contents?: true

Size: 935 Bytes

Versions: 2

Compression:

Stored size: 935 Bytes

Contents

Shoes.app do
  background "#eee"
  @list = stack do
    para "Enter a URL to download:", margin: [10, 8, 10, 0]
    flow margin: 10 do
      @url = edit_line width: -120
      button "Download", width: 120 do
        @list.append do
          stack do
            background "#eee".."#ccd"
            stack margin: 10 do
              dl = nil
              para @url.text, " [", link("cancel") { dl.abort }, "]", margin: 0
              d = inscription "Beginning transfer.", margin: 0
              p = progress width: 1.0, height: 14
              dl = download @url.text, save: File.basename(@url.text),
                progress: proc { |dl|
                  d.text = "Transferred #{dl.transferred} of #{dl.length} bytes (#{dl.percent}%)"
                  p.fraction = dl.percent * 0.01 },
                finish: proc { |dl| d.text = "Download completed" }
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shoes-4.0.0.pre2 samples/simple-downloader.rb
shoes-4.0.0.pre1 samples/simple-downloader.rb