Skip to content

Instantly share code, notes, and snippets.

@lwu
Created August 26, 2008 03:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lwu/7199 to your computer and use it in GitHub Desktop.
Save lwu/7199 to your computer and use it in GitHub Desktop.
DebugShoes, a quick sketch of a class that adds informative debug interactions to a Shoes app
# Shoes got you down? DebugShoes won't fail silently on ya...
#
class DebugShoes < Shoes
def self.app(*args, &blk)
super(*args) do
begin
self.instance_eval(&blk)
rescue => e
error(e) # log the error and inform the user!
@err_bar = flow :width => 1.0, :height => 32, :top => self.height-32, :left => 0 do
background lightgrey
stack :width => self.width-100
stack :width => 20, :margin => 4 do image "#{DIR}/static/icon-error.png" end;
stack :width => 80 do para(link("#{Shoes.log.length} Errors!", :stroke => red) { Shoes.show_log }) end;
end
end
end
end
end
# Note use of DebugShoes rather than ol' Shoes!
#
DebugShoes.app :width=>640, :width=>480 do
flow do
stack :width=>100, :margin=>15 do
background lightblue
end
stack :width => 300, :margin=>15 do
@e = edit_box "Would that I..."
end
end
lightgray # d'oh, spellbot fail
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment