Sha256: b6c39fdef83b8560ca6646fb7694df536e70bebb24291d52bc6215ea2108f338

Contents?: true

Size: 1.01 KB

Versions: 24

Compression:

Stored size: 1.01 KB

Contents

require '../lib/green_shoes'

Shoes.app height: 250, width: 198 do
  def do_calc
    @number = @previous.send(@op, @number)  if @op
    @op = nil
  end
  @previous, @number, @op = 0, 0, nil
  background rgb(235, 235, 210)
  flow margin: 5 do
    flow height: 240, width: 190, margin: [2, 5, 0, 0] do
      background "#996".."#333", :curve => 5
      number_field = para fg(strong(@number), white), margin: 8
      flow width: 218 do
        %w(7 8 9 / 4 5 6 * 1 2 3 - 0 Clr = +).each do |btn|
          button btn, width: 46, height: 46 do
            case btn
            when /[0-9]/
              @number = @number.to_i * 10 + btn.to_i
            when 'Clr'
              @previous, @number, @op = 0, 0, nil
            when '='
              do_calc
            else
              do_calc
              @previous, @number = @number, nil
              @op = btn
            end      
            number_field.replace fg(strong(@number), white)
          end
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
green_shoes-1.0.337 samples/sample46.rb
green_shoes-1.0.331 samples/sample46.rb
green_shoes-1.0.322 samples/sample46.rb
green_shoes-1.0.320 samples/sample46.rb
green_shoes-1.0.309 samples/sample46.rb
green_shoes-1.0.303 samples/sample46.rb
green_shoes-1.0.282 samples/sample46.rb
green_shoes-1.0.273 samples/sample46.rb
green_shoes-0.263.0 samples/sample46.rb
green_shoes-0.255.0 samples/sample46.rb
green_shoes-0.243.0 samples/sample46.rb
green_shoes-0.233.0 samples/sample46.rb
green_shoes-0.227.0 samples/sample46.rb
green_shoes-0.226.0 samples/sample46.rb
green_shoes-0.221.0 samples/sample46.rb
green_shoes-0.214.0 samples/sample46.rb
green_shoes-0.207.0 samples/sample46.rb
green_shoes-0.201.0 samples/sample46.rb
green_shoes-0.198.0 samples/sample46.rb
green_shoes-0.189.0 samples/sample46.rb