Sha256: 562c0f986867e42183988e52cc5c9f9e3a694802d1de5743e394aafa35e7490f

Contents?: true

Size: 1.44 KB

Versions: 9

Compression:

Stored size: 1.44 KB

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
      @url.text ='http://walkabout.mvmanila.com/public/share/Ytm-2.exe'
      st_time = 0
      end_time = 0
      totalsz = 0
      button "Download", :width => 120 do
        st_time = Time.now
        @list.append do
          stack do
            background "#eee".."#ccd"
            stack :margin => 10 do
              dld = nil
              para @url.text, " [", link("cancel") { @dld.abort }, "]", :margin => 0
              d = inscription "Beginning transfer.", :margin => 0
              p = progress :width => 1.0, :height => 14
              @dld = download @url.text, :save => File.basename(@url.text),
                :pause => 0.02,
                :progress => proc { |dl| 
                  d.text = "Transferred #{dl.transferred} of #{dl.length} bytes (#{dl.percent.to_s[0..6]}%)"
                  p.fraction = dl.percent
                 },
                :finish => proc { |dl|
                     end_time = Time.now
                     secs = (end_time.to_i - st_time.to_i)
                     kb = dl.length < 1024 ? 1: dl.length / 1024
                     d.text = "Download completed KB/s: #{kb/secs} seconds:#{secs}"
                  }
              para "Should appear after button press"
            end
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 6 versions & 2 rubygems

Version Path
scarpe-0.4.0 examples/legacy/not_checked/shoes3-tests/curl/downloader.rb
scarpe-0.3.0 examples/legacy/not_checked/shoes3-tests/curl/downloader.rb
scarpe-0.2.2 examples/legacy/not_checked/shoes3-tests/curl/downloader.rb
lacci-0.2.1 examples/legacy/not_checked/simple/downloader.rb
lacci-0.2.1 examples/legacy/not_checked/shoes3-tests/curl/downloader.rb
scarpe-0.2.1 examples/legacy/not_checked/shoes3-tests/curl/downloader.rb
scarpe-0.2.1 examples/legacy/not_checked/simple/downloader.rb
scarpe-0.2.0 examples/legacy/not_checked/simple/downloader.rb
scarpe-0.2.0 examples/legacy/not_checked/shoes3-tests/curl/downloader.rb