15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/whirled_peas/command/themes.rb', line 15
def start
super
require config_file unless config_file.nil?
theme_names = Settings::ThemeLibrary.theme_names
theme_names.each.with_index do |name, index|
template = WhirledPeas.template(name) do |composer, settings|
settings.full_border
settings.flow = :t2b
composer.add_text do |_, settings|
settings.title_font = :theme
name
end
composer.add_text do
name == Settings::ThemeLibrary.default_name ? ' (default)' : ''
end
composer.add_graph do |_, settings|
settings.height = 12
20.times.map { |i| Math.sqrt(i) }
end
end
Utils::Ansi.with_screen do |width, height|
strokes = Graphics::Renderer.new(
template,
80,
30
).paint
Device::Screen.new.handle_rendered_frames(
[Device::RenderedFrame.new(strokes, 0)]
)
end
if index < theme_names.length - 1
print 'See next theme? [Y/q] '
STDOUT.flush
break if gets.chomp == 'q'
end
end
rescue LoadError => e
puts e
puts e.backtrace.join("\n")
exit(1)
end
|