-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
module Shoes::LogWindow | ||
def self.setup(app) | ||
app.stack do | ||
app.flow do | ||
app.background app.black | ||
app.stack do | ||
app.tagline "Shoes Console", :stroke => app.white | ||
end | ||
app.button "Clear", :margin => 6, :width => 80, :height => 40 do | ||
Shoes.log.clear | ||
end | ||
end | ||
@log, @hash = app.stack, nil | ||
#update | ||
app.every(0.2) do | ||
#update | ||
end | ||
end | ||
end | ||
|
||
def self.update | ||
if @hash != Shoes.log.hash | ||
@hash = Shoes.log.hash | ||
@log.clear do | ||
i = 0 | ||
Shoes.log.each do |typ, msg, at, mid, rbf, rbl| | ||
stack do | ||
background "#f1f5e1" if i % 2 == 0 | ||
inscription strong(typ.to_s.capitalize, :stroke => "#05C"), " in ", | ||
flow do | ||
stack :margin => 4, :width => -20 do | ||
s = msg.to_s | ||
s << "\n#{msg.backtrace.join("\n")}" if msg.kind_of?(Exception) | ||
para s, :margin => 4, :margin_top => 0 | ||
end | ||
end | ||
end | ||
i += 1 | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
Shoes.app do | ||
Shoes::LogWindow.setup(app) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters