Sha256: c23c7091b14821169d9a13d9968a94bf0793d25bc1a212dc6b4811e809953539
Contents?: true
Size: 787 Bytes
Versions: 2
Compression:
Stored size: 787 Bytes
Contents
require 'green_shoes' module Breaktime # The shoes GUI app for notifying the user about their imminent breaktime. # # They have 10 seconds to cancel the break. If they cancel the process exits # with EX_BREAK_CANCELLED, otherwise EX_OK. This is used by calling processes # to determine what to do. Shoes.app :height => 60, :width => 380, :title => 'Take a break!' do seconds = 10 str = "Take a break! You have %d seconds to cancel." background white flow :margin => 4 do @sent = para str % seconds button "Cancel" do exit Breaktime::EX_BREAK_CANCELLED end every 1 do |i| if i >= seconds exit Breaktime::EX_OK else @sent.text = str % (seconds - i) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
breaktime-0.1.3 | lib/breaktime/dialog.rb |
breaktime-0.1.2 | lib/breaktime/dialog.rb |