whirled_peas 0.7.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +25 -0
- data/README.md +467 -120
- data/Rakefile +1 -20
- data/bin/easing +33 -0
- data/bin/reset_cursor +11 -0
- data/bin/screen_test +68 -0
- data/examples/graph.rb +54 -0
- data/examples/intro.rb +3 -3
- data/examples/scrolling.rb +5 -4
- data/lib/data/themes.yaml +13 -0
- data/lib/whirled_peas.rb +12 -6
- data/lib/whirled_peas/animator.rb +5 -0
- data/lib/whirled_peas/animator/debug_consumer.rb +17 -0
- data/lib/whirled_peas/animator/easing.rb +72 -0
- data/lib/whirled_peas/animator/frame.rb +5 -0
- data/lib/whirled_peas/animator/frameset.rb +33 -0
- data/lib/whirled_peas/animator/producer.rb +35 -0
- data/lib/whirled_peas/animator/renderer_consumer.rb +31 -0
- data/lib/whirled_peas/command.rb +5 -0
- data/lib/whirled_peas/command/base.rb +86 -0
- data/lib/whirled_peas/command/config_command.rb +43 -0
- data/lib/whirled_peas/command/debug.rb +21 -0
- data/lib/whirled_peas/command/fonts.rb +22 -0
- data/lib/whirled_peas/command/frame_command.rb +34 -0
- data/lib/whirled_peas/command/frames.rb +24 -0
- data/lib/whirled_peas/command/help.rb +38 -0
- data/lib/whirled_peas/command/play.rb +111 -0
- data/lib/whirled_peas/command/record.rb +57 -0
- data/lib/whirled_peas/command/still.rb +29 -0
- data/lib/whirled_peas/command/themes.rb +76 -0
- data/lib/whirled_peas/command_line.rb +24 -212
- data/lib/whirled_peas/config.rb +56 -6
- data/lib/whirled_peas/device.rb +5 -0
- data/lib/whirled_peas/device/null_device.rb +8 -0
- data/lib/whirled_peas/device/output_file.rb +19 -0
- data/lib/whirled_peas/device/screen.rb +26 -0
- data/lib/whirled_peas/graphics/composer.rb +23 -2
- data/lib/whirled_peas/graphics/container_painter.rb +91 -0
- data/lib/whirled_peas/graphics/content_dimensions.rb +19 -0
- data/lib/whirled_peas/graphics/content_painter.rb +20 -0
- data/lib/whirled_peas/graphics/graph_dimensions.rb +12 -0
- data/lib/whirled_peas/graphics/graph_painter.rb +97 -0
- data/lib/whirled_peas/graphics/grid_painter.rb +1 -4
- data/lib/whirled_peas/graphics/painter.rb +10 -0
- data/lib/whirled_peas/graphics/renderer.rb +8 -2
- data/lib/whirled_peas/graphics/text_painter.rb +7 -11
- data/lib/whirled_peas/settings/border.rb +25 -4
- data/lib/whirled_peas/settings/container_settings.rb +2 -4
- data/lib/whirled_peas/settings/element_settings.rb +12 -3
- data/lib/whirled_peas/settings/graph_settings.rb +21 -0
- data/lib/whirled_peas/settings/grid_settings.rb +7 -0
- data/lib/whirled_peas/settings/text_settings.rb +1 -0
- data/lib/whirled_peas/settings/theme.rb +40 -0
- data/lib/whirled_peas/settings/theme_library.rb +63 -0
- data/lib/whirled_peas/utils/ansi.rb +13 -0
- data/lib/whirled_peas/utils/file_handler.rb +57 -0
- data/lib/whirled_peas/version.rb +1 -1
- data/screen_test/elements/box.frame +1 -1
- data/screen_test/elements/box.rb +1 -1
- data/screen_test/elements/graph.frame +1 -0
- data/screen_test/elements/graph.rb +12 -0
- data/screen_test/elements/grid.frame +1 -1
- data/screen_test/elements/grid.rb +1 -1
- data/screen_test/elements/screen_overflow_x.frame +1 -1
- data/screen_test/elements/screen_overflow_x.rb +1 -1
- data/screen_test/elements/screen_overflow_y.frame +1 -1
- data/screen_test/elements/screen_overflow_y.rb +1 -1
- data/screen_test/elements/text.frame +1 -1
- data/screen_test/elements/text.rb +1 -1
- data/screen_test/elements/text_multiline.frame +1 -1
- data/screen_test/elements/text_multiline.rb +1 -1
- data/screen_test/elements/theme.frame +1 -0
- data/screen_test/elements/theme.rb +26 -0
- data/screen_test/settings/align/box_around.frame +1 -1
- data/screen_test/settings/align/box_around.rb +1 -1
- data/screen_test/settings/align/box_between.frame +1 -1
- data/screen_test/settings/align/box_between.rb +1 -1
- data/screen_test/settings/align/box_center.frame +1 -1
- data/screen_test/settings/align/box_center.rb +1 -1
- data/screen_test/settings/align/box_default.frame +1 -1
- data/screen_test/settings/align/box_default.rb +1 -1
- data/screen_test/settings/align/box_evenly.frame +1 -1
- data/screen_test/settings/align/box_evenly.rb +1 -1
- data/screen_test/settings/align/box_left.frame +1 -1
- data/screen_test/settings/align/box_left.rb +1 -1
- data/screen_test/settings/align/box_right.frame +1 -1
- data/screen_test/settings/align/box_right.rb +1 -1
- data/screen_test/settings/align/children_center.frame +1 -1
- data/screen_test/settings/align/children_center.rb +1 -1
- data/screen_test/settings/align/children_left.frame +1 -1
- data/screen_test/settings/align/children_left.rb +1 -1
- data/screen_test/settings/align/children_right.frame +1 -1
- data/screen_test/settings/align/children_right.rb +1 -1
- data/screen_test/settings/align/grid_center.frame +1 -1
- data/screen_test/settings/align/grid_center.rb +1 -1
- data/screen_test/settings/align/grid_default.frame +1 -1
- data/screen_test/settings/align/grid_default.rb +1 -1
- data/screen_test/settings/align/grid_left.frame +1 -1
- data/screen_test/settings/align/grid_left.rb +1 -1
- data/screen_test/settings/align/grid_right.frame +1 -1
- data/screen_test/settings/align/grid_right.rb +1 -1
- data/screen_test/settings/ansi/bold.frame +1 -1
- data/screen_test/settings/ansi/bold.rb +1 -1
- data/screen_test/settings/ansi/color.frame +1 -1
- data/screen_test/settings/ansi/color.rb +1 -1
- data/screen_test/settings/ansi/underline.frame +1 -1
- data/screen_test/settings/ansi/underline.rb +1 -1
- data/screen_test/settings/border.frame +1 -1
- data/screen_test/settings/border.rb +1 -1
- data/screen_test/settings/flow/box_b2t.frame +1 -1
- data/screen_test/settings/flow/box_b2t.rb +1 -1
- data/screen_test/settings/flow/box_l2r.frame +1 -1
- data/screen_test/settings/flow/box_l2r.rb +1 -1
- data/screen_test/settings/flow/box_r2l.frame +1 -1
- data/screen_test/settings/flow/box_r2l.rb +1 -1
- data/screen_test/settings/flow/box_t2b.frame +1 -1
- data/screen_test/settings/flow/box_t2b.rb +1 -1
- data/screen_test/settings/flow/grid_b2t.frame +1 -1
- data/screen_test/settings/flow/grid_b2t.rb +2 -2
- data/screen_test/settings/flow/grid_l2r.frame +1 -1
- data/screen_test/settings/flow/grid_l2r.rb +2 -2
- data/screen_test/settings/flow/grid_r2l.frame +1 -1
- data/screen_test/settings/flow/grid_r2l.rb +2 -2
- data/screen_test/settings/flow/grid_t2b.frame +1 -1
- data/screen_test/settings/flow/grid_t2b.rb +2 -2
- data/screen_test/settings/height/box.frame +1 -1
- data/screen_test/settings/height/box.rb +1 -1
- data/screen_test/settings/height/box_border_sizing.frame +1 -1
- data/screen_test/settings/height/box_border_sizing.rb +1 -1
- data/screen_test/settings/height/grid.frame +1 -1
- data/screen_test/settings/height/grid.rb +1 -1
- data/screen_test/settings/height/overflow_box.frame +1 -1
- data/screen_test/settings/height/overflow_box.rb +1 -1
- data/screen_test/settings/height/overflow_box_l2r.frame +1 -1
- data/screen_test/settings/height/overflow_box_l2r.rb +1 -1
- data/screen_test/settings/height/overflow_box_t2b.frame +1 -1
- data/screen_test/settings/height/overflow_box_t2b.rb +1 -1
- data/screen_test/settings/height/overflow_grid.frame +1 -1
- data/screen_test/settings/height/overflow_grid.rb +1 -1
- data/screen_test/settings/margin.frame +1 -1
- data/screen_test/settings/margin.rb +1 -1
- data/screen_test/settings/padding.frame +1 -1
- data/screen_test/settings/padding.rb +1 -1
- data/screen_test/settings/position/box_left.frame +1 -1
- data/screen_test/settings/position/box_left.rb +1 -1
- data/screen_test/settings/position/box_left_negative.frame +1 -1
- data/screen_test/settings/position/box_left_negative.rb +1 -1
- data/screen_test/settings/position/box_top.frame +1 -1
- data/screen_test/settings/position/box_top.rb +1 -1
- data/screen_test/settings/position/box_top_negative.frame +1 -1
- data/screen_test/settings/position/box_top_negative.rb +1 -1
- data/screen_test/settings/position/grid_left.frame +1 -1
- data/screen_test/settings/position/grid_left.rb +1 -1
- data/screen_test/settings/position/grid_left_negative.frame +1 -1
- data/screen_test/settings/position/grid_left_negative.rb +1 -1
- data/screen_test/settings/position/grid_top.frame +1 -1
- data/screen_test/settings/position/grid_top.rb +1 -1
- data/screen_test/settings/position/grid_top_negative.frame +1 -1
- data/screen_test/settings/position/grid_top_negative.rb +1 -1
- data/screen_test/settings/scroll/horiz_box.frame +1 -1
- data/screen_test/settings/scroll/horiz_box.rb +1 -1
- data/screen_test/settings/scroll/horiz_box_align_center.rb +1 -1
- data/screen_test/settings/scroll/horiz_box_align_right.rb +1 -1
- data/screen_test/settings/scroll/vert_box.frame +1 -1
- data/screen_test/settings/scroll/vert_box.rb +1 -1
- data/screen_test/settings/title_font.frame +1 -1
- data/screen_test/settings/title_font.rb +1 -1
- data/screen_test/settings/valign/box_around.frame +1 -1
- data/screen_test/settings/valign/box_around.rb +1 -1
- data/screen_test/settings/valign/box_between.frame +1 -1
- data/screen_test/settings/valign/box_between.rb +1 -1
- data/screen_test/settings/valign/box_bottom.frame +1 -1
- data/screen_test/settings/valign/box_bottom.rb +1 -1
- data/screen_test/settings/valign/box_default.frame +1 -1
- data/screen_test/settings/valign/box_default.rb +1 -1
- data/screen_test/settings/valign/box_evenly.frame +1 -1
- data/screen_test/settings/valign/box_evenly.rb +1 -1
- data/screen_test/settings/valign/box_middle.frame +1 -1
- data/screen_test/settings/valign/box_middle.rb +1 -1
- data/screen_test/settings/valign/box_top.frame +1 -1
- data/screen_test/settings/valign/box_top.rb +1 -1
- data/screen_test/settings/valign/grid_bottom.frame +1 -1
- data/screen_test/settings/valign/grid_bottom.rb +1 -1
- data/screen_test/settings/valign/grid_default.frame +1 -1
- data/screen_test/settings/valign/grid_default.rb +1 -1
- data/screen_test/settings/valign/grid_middle.frame +1 -1
- data/screen_test/settings/valign/grid_middle.rb +1 -1
- data/screen_test/settings/valign/grid_top.frame +1 -1
- data/screen_test/settings/valign/grid_top.rb +1 -1
- data/screen_test/settings/width/box_border_sizing.frame +1 -1
- data/screen_test/settings/width/box_border_sizing.rb +1 -1
- data/screen_test/settings/width/box_content.frame +1 -1
- data/screen_test/settings/width/box_content.rb +1 -1
- data/screen_test/settings/width/box_default.frame +1 -1
- data/screen_test/settings/width/box_default.rb +1 -1
- data/screen_test/settings/width/grid.frame +1 -1
- data/screen_test/settings/width/grid.rb +1 -1
- data/screen_test/settings/width/overflow_align_center.frame +1 -1
- data/screen_test/settings/width/overflow_align_center.rb +1 -1
- data/screen_test/settings/width/overflow_align_right.frame +1 -1
- data/screen_test/settings/width/overflow_align_right.rb +1 -1
- data/screen_test/settings/width/overflow_box.frame +1 -1
- data/screen_test/settings/width/overflow_box.rb +1 -1
- data/screen_test/settings/width/overflow_box_l2r.frame +1 -1
- data/screen_test/settings/width/overflow_box_l2r.rb +1 -1
- data/screen_test/settings/width/overflow_box_t2b.frame +1 -1
- data/screen_test/settings/width/overflow_box_t2b.rb +1 -1
- data/screen_test/settings/width/overflow_grid.frame +1 -1
- data/screen_test/settings/width/overflow_grid.rb +1 -1
- data/tools/whirled_peas/tools/screen_tester.rb +131 -65
- metadata +42 -9
- data/lib/whirled_peas/frame.rb +0 -6
- data/lib/whirled_peas/frame/consumer.rb +0 -30
- data/lib/whirled_peas/frame/debug_consumer.rb +0 -30
- data/lib/whirled_peas/frame/event_loop.rb +0 -90
- data/lib/whirled_peas/frame/producer.rb +0 -67
- data/lib/whirled_peas/graphics/screen.rb +0 -70
- data/lib/whirled_peas/graphics/text_dimensions.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c1c4b2f603c535f98d7578741059e0d949ccff4e315fc88c36c13fc2fa58de5
|
4
|
+
data.tar.gz: a9c92f62d2dcb7c7c1983bf6e6e8fa66bb5a92abcec0ae689ca4efc342083625
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e746107b95a5176d89792606a76935c84c3686452b2abf99c5383df676263684a096130c18cf07080fbc9ede4dc61b9ae220efe4fd8313e933c230e73d8b1b0
|
7
|
+
data.tar.gz: d5dca0db34f358072134a94ae8b5765abd60d45f18de7496dc0c410cd665c2e9ef91ef33989d00317caef1fd472c210e892af13d8a65bc3126ea37b201dc1b43
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,30 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v0.10.0 - 2021-01-29
|
4
|
+
|
5
|
+
- [3063a2b](https://github.com/tcollier/whirled_peas/tree/3063a2becb7680b5e320a1733b3da933e6c65210): Add built-in and user-defined themes
|
6
|
+
|
7
|
+
## v0.9.1 - 2021-01-29
|
8
|
+
|
9
|
+
- [c35b134](https://github.com/tcollier/whirled_peas/tree/c35b134e1340b8b5f1d1fb0e6e56dc2a99b52e94): Improve graph plots
|
10
|
+
|
11
|
+
## v0.9.0 - 2021-01-29
|
12
|
+
|
13
|
+
BREAKING: `Frameset#add_frame` signature changed
|
14
|
+
|
15
|
+
- [1c28947](https://github.com/tcollier/whirled_peas/tree/1c28947980eedce034d2596732ee4860717904c5): Add graph support
|
16
|
+
|
17
|
+
## v0.8.0 - 2021-01-29
|
18
|
+
|
19
|
+
BREAKING: `Producer` now responds to `#add_frame` instead of `#send_frame`
|
20
|
+
|
21
|
+
- [67fdc17](https://github.com/tcollier/whirled_peas/tree/67fdc172434cb97f31ca20a674f28aefec6babb3): Add easing functions for frame transitions
|
22
|
+
- [b888f2e](https://github.com/tcollier/whirled_peas/tree/b888f2e7a3b7c3341300326b417641cc8cf2e89b): Add record and playback functionality to command line tool
|
23
|
+
|
24
|
+
## v0.7.1 - 2021-01-27
|
25
|
+
|
26
|
+
- [b98781d](https://github.com/tcollier/whirled_peas/tree/b98781de23a24b596955f25cfc48936c0cc1efac): Fix num_cols bug for vertical grid flow
|
27
|
+
|
3
28
|
## v0.7.0 - 2021-01-27
|
4
29
|
|
5
30
|
BREAKING: the settings for the template now fills the full screen and disallows margin.
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
╚══╝╚══╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═╝╚══════╝╚══════╝╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚══════╝
|
19
19
|
```
|
20
20
|
|
21
|
-
Easily create terminal-based graphics to
|
21
|
+
Easily create terminal-based graphics to visualize the execution of your code. Whirled Peas offers templating inspired by HTML and CSS and provides a lightweight tie-in for your code to produce visual animations with these templates.
|
22
22
|
|
23
23
|
## Installation
|
24
24
|
|
@@ -40,9 +40,8 @@ Or install it yourself as:
|
|
40
40
|
|
41
41
|
A Whirled Peas application consists of the following pieces
|
42
42
|
|
43
|
-
- The
|
44
|
-
- The main template factory (required) - builds templates to convert frame events from the
|
45
|
-
- A loading screen template factory (optional) - builds templates to display while content is loading
|
43
|
+
- The application (required) - the code that is to be visualized, it emits lightweight frame events through a producer
|
44
|
+
- The main template factory (required) - builds templates to convert frame events from the application into terminal graphics
|
46
45
|
|
47
46
|
These pieces are configured as following
|
48
47
|
|
@@ -62,15 +61,15 @@ class TemplateFactory
|
|
62
61
|
end
|
63
62
|
end
|
64
63
|
|
65
|
-
class
|
64
|
+
class Application
|
66
65
|
def start(producer)
|
67
|
-
producer.
|
66
|
+
producer.add_frame('starting', args: { name: 'World' })
|
68
67
|
# ...
|
69
68
|
end
|
70
69
|
end
|
71
70
|
|
72
71
|
WhirledPeas.configure do |config|
|
73
|
-
config.
|
72
|
+
config.application = Application.new
|
74
73
|
config.template_factory = TemplateFactory.new
|
75
74
|
end
|
76
75
|
```
|
@@ -78,54 +77,64 @@ end
|
|
78
77
|
Then the visualizer is started on the command line with
|
79
78
|
|
80
79
|
```
|
81
|
-
$ whirled_peas
|
80
|
+
$ whirled_peas play visualize.rb
|
82
81
|
```
|
83
82
|
|
84
|
-
|
83
|
+
### Application
|
85
84
|
|
86
|
-
|
87
|
-
class LoadingTemplateFactory
|
88
|
-
def build
|
89
|
-
WhirledPeas.template do |composer|
|
90
|
-
composer.add_box('Loading') do |_, settings|
|
91
|
-
settings.set_margin(top: 15)
|
92
|
-
settings.align = :center
|
93
|
-
settings.full_border(color: :blue, style: :double)
|
94
|
-
"Loading..."
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
85
|
+
The application is code to be visualized that integrates with Whirled Peas by providing the signature below
|
99
86
|
|
100
|
-
|
101
|
-
|
102
|
-
|
87
|
+
```ruby
|
88
|
+
# Start the application and pass frame events to the producer to be rendered
|
89
|
+
# by the UI
|
90
|
+
#
|
91
|
+
# @param producer [Producer] frame producer that sends events to the UI
|
92
|
+
def start(producer)
|
93
|
+
# application code here
|
103
94
|
end
|
104
95
|
```
|
105
96
|
|
106
|
-
|
107
|
-
|
108
|
-
The driver is the application code to be visualized. This is typically a lightweight wrapper around an existing application that conforms to the signature below.
|
97
|
+
The producer provides the following methods
|
109
98
|
|
110
99
|
```ruby
|
111
|
-
#
|
100
|
+
# Add a frame to be displayed
|
112
101
|
#
|
113
|
-
# @param
|
114
|
-
|
115
|
-
|
102
|
+
# @param name [String] (required) application defined name for the frame. The
|
103
|
+
# template factory will be provided this name
|
104
|
+
# @param duration [Number] (optional) time in seconds this frame should be
|
105
|
+
# displayed for (defaults to 1 frame)
|
106
|
+
# @param args [Hash<Symbol, Object>] (optional) key/value pairs to send as
|
107
|
+
# arguments to the template factory
|
108
|
+
def add_frame(name, duration:, args:)
|
109
|
+
end
|
110
|
+
|
111
|
+
# Create and yield a frameset instance that allows applications to add multiple
|
112
|
+
# frames to play over the given duration. Adding frames to the yielded frameset
|
113
|
+
# will result in playback that is eased by the given `easing` and `effect`
|
114
|
+
# arguments (default is `:linear` easing)
|
115
|
+
#
|
116
|
+
# @param duration [Number] (required) total duration for which all frames in
|
117
|
+
# frameset will be displayed
|
118
|
+
# @param easing [Symbol] (optional) easing function to be used to transition
|
119
|
+
# through all frames (defaults to `:linear`)
|
120
|
+
# @param effect [Symbol] (optional) how to apply the easing function (defaults
|
121
|
+
# to `:in_out`, also available are `:in` and `:out`)
|
122
|
+
# @yield [Frameset] instance that provides `#add_frame(name, args:)`
|
123
|
+
def frameset(duration, easing:, effect:, &block)
|
116
124
|
end
|
117
125
|
```
|
118
126
|
|
119
|
-
|
127
|
+
A frameset instance provides one method
|
120
128
|
|
121
129
|
```ruby
|
122
|
-
#
|
130
|
+
# Add a frame to be displayed, the duration will be determine by the number of
|
131
|
+
# frames in the frameset along with the duration and easing of the frameset
|
123
132
|
#
|
124
|
-
# @param name [String] application defined name for the frame. The
|
125
|
-
#
|
126
|
-
# @param args [Hash<Symbol, Object>] key
|
127
|
-
|
128
|
-
|
133
|
+
# @param name [String] (required) application defined name for the frame. The
|
134
|
+
# template factory will be provided this name
|
135
|
+
# @param args [Hash<Symbol, Object>] (optional) key/value pairs to send as
|
136
|
+
# arguments to the template factory
|
137
|
+
def add_frame(name, args:)
|
129
138
|
end
|
130
139
|
```
|
131
140
|
|
@@ -136,39 +145,35 @@ end
|
|
136
145
|
Simple application that loads a set of numbers and looks for a pair that adds up to 1,000
|
137
146
|
|
138
147
|
```ruby
|
139
|
-
class
|
148
|
+
class Application
|
140
149
|
def start(producer)
|
141
150
|
numbers = File.readlines('/path/to/numbers.txt').map(&:to_i)
|
142
|
-
producer.
|
151
|
+
producer.add_frame('load-numbers', duration: 3, args: { numbers: numbers })
|
143
152
|
numbers.sort!
|
144
|
-
producer.
|
153
|
+
producer.add_frame('sort-numbers', duration: 3, args: { numbers: numbers })
|
145
154
|
low = 0
|
146
155
|
high = numbers.length - 1
|
147
156
|
while low < high
|
148
157
|
sum = numbers[low] + numbers[high]
|
149
158
|
if sum == 1000
|
150
|
-
producer.
|
159
|
+
producer.add_frame('found-pair', duration: 5, args: { low: low, high: high, sum: sum })
|
151
160
|
return
|
152
161
|
elsif sum < 1000
|
153
|
-
producer.
|
162
|
+
producer.add_frame('too-low', args: { low: low, high: high, sum: sum })
|
154
163
|
low += 1
|
155
164
|
else
|
156
|
-
producer.
|
165
|
+
producer.add_frame('too-high', args: { low: low, high: high, sum: sum })
|
157
166
|
high -= 1
|
158
167
|
end
|
159
168
|
end
|
160
|
-
producer.
|
169
|
+
producer.add_frame('no-solution', duration: 5)
|
161
170
|
end
|
162
171
|
end
|
163
172
|
```
|
164
173
|
|
165
174
|
### Template Factory
|
166
175
|
|
167
|
-
To render the frame events sent by the
|
168
|
-
|
169
|
-
#### Loading Template Factory
|
170
|
-
|
171
|
-
`WhirledPeas.configure` takes an optional template factory to build a loading screen. This instance must implement `#build` (taking no arguments). The template returned by that method will be painted while the event loop is waiting for frames. The factory method will be called once per refresh cycle, so it's possible to implement animation.
|
176
|
+
To render the frame events sent by the application, the application requires a template factory. This factory will be called for each frame event, with the frame name and the arguments supplied by the application. A template factory can be an instance of ruby class and thus can maintain state. Whirled Peas provides a few basic building blocks to make simple, yet elegant terminal-based UIs.
|
172
177
|
|
173
178
|
#### Building Blocks
|
174
179
|
|
@@ -182,6 +187,7 @@ A template is created with `WhirledPeas.template`, which yields a `Composer` obj
|
|
182
187
|
A `Composer` provides the following methods to add child elements, each of these takes an optional string argument that is set as the name of the element (which can be useful when debugging).
|
183
188
|
|
184
189
|
- `add_box` - yields a `Composer` for a `Box` and a `BoxSettings`, which will be added to the parent's children
|
190
|
+
- `add_graph` - yields a `nil` and a `GraphSettings`, which will be added to the parent's children, the block should return an array of numbers
|
185
191
|
- `add_grid` - yields a `Composer` for a `Grid` and a `GridSettings`, which will be added to the parent's children
|
186
192
|
- `add_text` - yields `nil` and a `TextSettings`, which will be added to the parent's children
|
187
193
|
|
@@ -241,28 +247,45 @@ end
|
|
241
247
|
|
242
248
|
#### Settings
|
243
249
|
|
244
|
-
Each element type has an associated settings type, which provide a custom set of options to format the output. Child settings will inherit from the parent, where applicable
|
245
|
-
|
246
|
-
|
247
|
-
|
|
248
|
-
|
|
249
|
-
| `
|
250
|
-
| `bg_color` | Background color (see [Colors](#colors)) | |
|
251
|
-
| `bold` | `true` makes the font bold | `false` |
|
252
|
-
| `border` | Set the border for the lements | none |
|
253
|
-
| `color` | Foreground text color (see [Colors](#colors)) | |
|
254
|
-
| `flow` | Flow to display child elements (see [Display Flow](#display-flow)) | `:l2r` |
|
255
|
-
| `height` | Override the calculated height of an element's content area | |
|
256
|
-
| `margin` | Set the (left, top, right, bottom) margin of the element | `0` |
|
257
|
-
| `num_cols` | Number of columns in the grid (must be set!) | | `Grid`
|
258
|
-
| `padding` | Set the (left, top, right, bottom) padding of the element | `0` |
|
259
|
-
| `position` | Set the (left, top) position of the element relative to parent content area | `0` |
|
260
|
-
| `scrollbar` | Display a scroll bar for vertical or horizontal scrolling | | `Box`
|
261
|
-
| `sizing` | Sizing model (`:content` or `:border`) used in conjunction with `width`/`
|
262
|
-
| `title_font` | Font used for "large" text (see [Large Text](#large-text), ignores `underline`) | | `Text`
|
263
|
-
| `underline` | `true` underlines the font | `false` |
|
264
|
-
| `width` | Override the calculated width of an element's content area | |
|
265
|
-
| `valign` | Justifies the content in the vertical direction | `:top` |
|
250
|
+
Each element type has an associated settings type, which provide a custom set of options to format the output. Child settings will inherit from the parent, where applicable. The table below lists all settings along with which element types the settings can be applied to (`Grid` and `Box` are containers)
|
251
|
+
|
252
|
+
| Setting | Description | Default | Availability | Inherited |
|
253
|
+
| ------------ | -------------------------------------------------------------------------------- | ---------- | ------------ | -------------------- |
|
254
|
+
| `align` | Justifies the content in the horizontal direction | `:left` | containers | No |
|
255
|
+
| `axis_color` | Color used to paint the axes of the graph (see [Colors](#colors)) | | `Graph` | No |
|
256
|
+
| `bg_color` | Background color (see [Colors](#colors)) | | all | Yes |
|
257
|
+
| `bold` | `true` makes the font bold | `false` | all | Yes |
|
258
|
+
| `border` | Set the border for the lements | none | containers, | Only style and color |
|
259
|
+
| `color` | Foreground text color (see [Colors](#colors)) | | all | Yes |
|
260
|
+
| `flow` | Flow to display child elements (see [Display Flow](#display-flow)) | `:l2r` | containers | No |
|
261
|
+
| `height` | Override the calculated height of an element's content area | | all | No |
|
262
|
+
| `margin` | Set the (left, top, right, bottom) margin of the element | `0` | containers | No |
|
263
|
+
| `num_cols` | Number of columns in the grid (must be set!) | | `Grid` | No |
|
264
|
+
| `padding` | Set the (left, top, right, bottom) padding of the element | `0` | containers | No |
|
265
|
+
| `position` | Set the (left, top) position of the element relative to parent content area | `0` | containers | No |
|
266
|
+
| `scrollbar` | Display a scroll bar for vertical or horizontal scrolling | | `Box` | No |
|
267
|
+
| `sizing` | Sizing model (`:content` or `:border`) used in conjunction with `width`/`height` | `:content` | `Box` | No |
|
268
|
+
| `title_font` | Font used for "large" text (see [Large Text](#large-text), ignores `underline`) | | `Text` | No |
|
269
|
+
| `underline` | `true` underlines the font | `false` | all | Yes |
|
270
|
+
| `width` | Override the calculated width of an element's content area | | all | No |
|
271
|
+
| `valign` | Justifies the content in the vertical direction | `:top` | containers | No |
|
272
|
+
|
273
|
+
##### Themes
|
274
|
+
|
275
|
+
The template builder (`WhirledPeas.template`) takes an optional `theme` argument. You can provide the name of a predefined theme (run `whirled_peas themes` to see a list with samples) or define you own with the following
|
276
|
+
You can define your own theme
|
277
|
+
|
278
|
+
```ruby
|
279
|
+
WhirledPeas.define_theme(:my_theme) do |theme|
|
280
|
+
theme.bg_color = :bright_white
|
281
|
+
theme.color = :blue
|
282
|
+
theme.border_color = :bright_green
|
283
|
+
theme.axis_color = :bright_red
|
284
|
+
theme.title_font = :default
|
285
|
+
end
|
286
|
+
```
|
287
|
+
|
288
|
+
Theme settings will be used as default settings throughout the template, however theme settings can be overridden on any element.
|
266
289
|
|
267
290
|
##### Alignment
|
268
291
|
|
@@ -531,6 +554,8 @@ Scroll settings dictate whether the scrollbar will be shown when child content i
|
|
531
554
|
- `scrollbar.horiz=(flag)` - show/hide the horizontal scrollbar
|
532
555
|
- `scrollbar.vert=(flag)` - show/hide the vertical scrollbar
|
533
556
|
|
557
|
+
Note: there is a know bug with scrollbars and `center`/`right` alignments. Using `left` alignment is the supported workaround
|
558
|
+
|
534
559
|
##### Border
|
535
560
|
|
536
561
|
The border settings consist of 6 boolean values (border are either width 1 or not shown), the 4 obvious values (`left`, `top`, `right`, and `bottom`) along with 2 other values for inner borders (`inner_horiz` and `inner_vert`) in a grid. A border also has a foreground color (defaults to `:white`) and a style. The background color is determined by the `bg_color` of the element. Border values can be set with
|
@@ -543,8 +568,8 @@ The border settings consist of 6 boolean values (border are either width 1 or no
|
|
543
568
|
- `border.bottom=(flag)` - show/hide bottom border
|
544
569
|
- `border.inner_horiz=(flag)` - show/hide inner horizontal border (dividing grid rows)
|
545
570
|
- `border.inner_vert=(flag)` - show/hide inner vertical border (dividing grid columns)
|
546
|
-
- `border.color=(
|
547
|
-
- `border.style=(
|
571
|
+
- `border.color=(text_color)` - set the border color
|
572
|
+
- `border.style=(style)` - set the border style
|
548
573
|
|
549
574
|
Available border styles are
|
550
575
|
|
@@ -696,7 +721,265 @@ $ whirled_peas title_fonts
|
|
696
721
|
|
697
722
|
Note: when using a title font with WhirledPeas for the first time on a system, the gem loads all fonts to check which ones are available. This can be a slow process and may cause a noticeable delay when running a visualization. Running the command above will cache the results and thus when a WhirledPeas visualization is run, there will be no lag from loading fonts.
|
698
723
|
|
699
|
-
|
724
|
+
#### Easing
|
725
|
+
|
726
|
+
The play duration of a frame within a frameset is determined by the easing function and effect along with the frames relative position within the frameset. The three effects are
|
727
|
+
|
728
|
+
- `:in` - apply easing only to the start of the frameset
|
729
|
+
- `:out` - apply easing only to the end of the frameset
|
730
|
+
- `:in_out` - apply easing to the start and end of the frameset
|
731
|
+
|
732
|
+
The available easing functions are
|
733
|
+
|
734
|
+
- `:bezier`
|
735
|
+
|
736
|
+
```
|
737
|
+
# bezier (in)
|
738
|
+
┃ ▄▀
|
739
|
+
┃ ▄▄▀
|
740
|
+
┃ ▄▀
|
741
|
+
┃ ▄▀▀
|
742
|
+
┃ ▄▄▀
|
743
|
+
┃ ▄▄▀
|
744
|
+
┃ ▄▄▀
|
745
|
+
┃ ▄▀
|
746
|
+
┃ ▄▄▀▀
|
747
|
+
┃ ▄▄▀
|
748
|
+
┃ ▄▀▀
|
749
|
+
┃ ▄▄▀▀
|
750
|
+
┃ ▄▄▀▀▀
|
751
|
+
┃ ▄▄▄▀▀▀
|
752
|
+
┃▄▄▄▄▄▄▄▄▄▄▀▀▀
|
753
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
754
|
+
```
|
755
|
+
|
756
|
+
```
|
757
|
+
# bezier (out)
|
758
|
+
┃ ▄▄▄▀▀▀▀▀▀▀▀▀
|
759
|
+
┃ ▄▄▄▀▀▀
|
760
|
+
┃ ▄▄▄▀▀
|
761
|
+
┃ ▄▄▀▀
|
762
|
+
┃ ▄▄▀
|
763
|
+
┃ ▄▀▀
|
764
|
+
┃ ▄▄▀▀
|
765
|
+
┃ ▄▀
|
766
|
+
┃ ▄▀▀
|
767
|
+
┃ ▄▀▀
|
768
|
+
┃ ▄▀▀
|
769
|
+
┃ ▄▄▀
|
770
|
+
┃ ▄▀
|
771
|
+
┃ ▄▀▀
|
772
|
+
┃▄▄▀
|
773
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
774
|
+
```
|
775
|
+
|
776
|
+
```
|
777
|
+
# bezier (in_out)
|
778
|
+
┃ ▄▄▄▀▀▀▀▀▀
|
779
|
+
┃ ▄▄▀▀
|
780
|
+
┃ ▄▀▀
|
781
|
+
┃ ▄▀▀
|
782
|
+
┃ ▄▀▀
|
783
|
+
┃ ▄▀▀
|
784
|
+
┃ ▄▄▀
|
785
|
+
┃ ▄▀
|
786
|
+
┃ ▄▀▀
|
787
|
+
┃ ▄▄▀
|
788
|
+
┃ ▄▄▀
|
789
|
+
┃ ▄▄▀
|
790
|
+
┃ ▄▄▀
|
791
|
+
┃ ▄▄▀▀
|
792
|
+
┃▄▄▄▄▄▄▄▀▀▀
|
793
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
794
|
+
```
|
795
|
+
|
796
|
+
`:linear`
|
797
|
+
|
798
|
+
```
|
799
|
+
# linear (in)
|
800
|
+
┃ ▄▄▀
|
801
|
+
┃ ▄▄▀▀
|
802
|
+
┃ ▄▄▀▀
|
803
|
+
┃ ▄▄▀▀
|
804
|
+
┃ ▄▄▀▀
|
805
|
+
┃ ▄▄▀▀
|
806
|
+
┃ ▄▄▀▀
|
807
|
+
┃ ▄▄▀▀
|
808
|
+
┃ ▄▄▀▀
|
809
|
+
┃ ▄▄▀▀
|
810
|
+
┃ ▄▄▀▀
|
811
|
+
┃ ▄▄▀▀
|
812
|
+
┃ ▄▄▀▀
|
813
|
+
┃ ▄▄▀▀
|
814
|
+
┃▄▄▀▀
|
815
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
816
|
+
```
|
817
|
+
|
818
|
+
```
|
819
|
+
# linear (out)
|
820
|
+
┃ ▄▄▀
|
821
|
+
┃ ▄▄▀▀
|
822
|
+
┃ ▄▄▀▀
|
823
|
+
┃ ▄▄▀▀
|
824
|
+
┃ ▄▄▀▀
|
825
|
+
┃ ▄▄▀▀
|
826
|
+
┃ ▄▄▀▀
|
827
|
+
┃ ▄▄▀▀
|
828
|
+
┃ ▄▄▀▀
|
829
|
+
┃ ▄▄▀▀
|
830
|
+
┃ ▄▄▀▀
|
831
|
+
┃ ▄▄▀▀
|
832
|
+
┃ ▄▄▀▀
|
833
|
+
┃ ▄▄▀▀
|
834
|
+
┃▄▄▀▀
|
835
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
836
|
+
```
|
837
|
+
|
838
|
+
```
|
839
|
+
# linear (in_out)
|
840
|
+
┃ ▄▄▀
|
841
|
+
┃ ▄▄▀▀
|
842
|
+
┃ ▄▄▀▀
|
843
|
+
┃ ▄▄▀▀
|
844
|
+
┃ ▄▄▀▀
|
845
|
+
┃ ▄▄▀▀
|
846
|
+
┃ ▄▄▀▀
|
847
|
+
┃ ▄▄▀▀
|
848
|
+
┃ ▄▄▀▀
|
849
|
+
┃ ▄▄▀▀
|
850
|
+
┃ ▄▄▀▀
|
851
|
+
┃ ▄▄▀▀
|
852
|
+
┃ ▄▄▀▀
|
853
|
+
┃ ▄▄▀▀
|
854
|
+
┃▄▄▀▀
|
855
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
856
|
+
```
|
857
|
+
|
858
|
+
`:parametric`
|
859
|
+
|
860
|
+
```
|
861
|
+
# parametric (in)
|
862
|
+
┃ ▄
|
863
|
+
┃ ▄▀
|
864
|
+
┃ ▄▀
|
865
|
+
┃ ▄▄▀
|
866
|
+
┃ ▄▀
|
867
|
+
┃ ▄▀
|
868
|
+
┃ ▄▀
|
869
|
+
┃ ▄▄▀
|
870
|
+
┃ ▄▀
|
871
|
+
┃ ▄▀▀
|
872
|
+
┃ ▄▀▀
|
873
|
+
┃ ▄▄▀▀
|
874
|
+
┃ ▄▄▄▀▀
|
875
|
+
┃ ▄▄▄▄▀▀
|
876
|
+
┃▄▄▄▄▄▄▄▄▄▄▄▄▄▄▀▀▀▀▀
|
877
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
878
|
+
```
|
879
|
+
|
880
|
+
```
|
881
|
+
# parametric (out)
|
882
|
+
┃ ▄▄▄▄▄▀▀▀▀▀▀▀▀▀▀▀▀▀
|
883
|
+
┃ ▄▄▀▀▀▀
|
884
|
+
┃ ▄▄▀▀▀
|
885
|
+
┃ ▄▄▀▀
|
886
|
+
┃ ▄▄▀
|
887
|
+
┃ ▄▄▀
|
888
|
+
┃ ▄▀
|
889
|
+
┃ ▄▀▀
|
890
|
+
┃ ▄▀
|
891
|
+
┃ ▄▀
|
892
|
+
┃ ▄▀
|
893
|
+
┃ ▄▀▀
|
894
|
+
┃ ▄▀
|
895
|
+
┃ ▄▀
|
896
|
+
┃▄▀
|
897
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
898
|
+
```
|
899
|
+
|
900
|
+
```
|
901
|
+
# parametric (in_out)
|
902
|
+
┃ ▄▄▄▀▀▀▀▀▀▀▀▀
|
903
|
+
┃ ▄▄▀▀
|
904
|
+
┃ ▄▀▀
|
905
|
+
┃ ▄▄▀
|
906
|
+
┃ ▄▀
|
907
|
+
┃ ▄▀
|
908
|
+
┃ ▄▀
|
909
|
+
┃ ▄▀
|
910
|
+
┃ ▄▀
|
911
|
+
┃ ▄▀
|
912
|
+
┃ ▄▀
|
913
|
+
┃ ▄▀▀
|
914
|
+
┃ ▄▄▀
|
915
|
+
┃ ▄▄▀▀
|
916
|
+
┃▄▄▄▄▄▄▄▄▄▄▀▀▀
|
917
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
918
|
+
```
|
919
|
+
|
920
|
+
`:quadratic`
|
921
|
+
|
922
|
+
```
|
923
|
+
# quadratic (in)
|
924
|
+
┃ ▄▄
|
925
|
+
┃ ▄▀
|
926
|
+
┃ ▄▀
|
927
|
+
┃ ▄▀
|
928
|
+
┃ ▄▀
|
929
|
+
┃ ▄▀▀
|
930
|
+
┃ ▄▀
|
931
|
+
┃ ▄▀▀
|
932
|
+
┃ ▄▀▀
|
933
|
+
┃ ▄▀▀
|
934
|
+
┃ ▄▄▀▀
|
935
|
+
┃ ▄▄▀▀
|
936
|
+
┃ ▄▄▄▀▀
|
937
|
+
┃ ▄▄▄▀▀▀
|
938
|
+
┃▄▄▄▄▄▄▄▄▄▄▄▀▀▀▀▀
|
939
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
940
|
+
```
|
941
|
+
|
942
|
+
```
|
943
|
+
# quadratic (out)
|
944
|
+
┃ ▄▄▄▄▄▀▀▀▀▀▀▀▀▀▀
|
945
|
+
┃ ▄▄▄▀▀▀
|
946
|
+
┃ ▄▄▀▀▀
|
947
|
+
┃ ▄▄▀▀
|
948
|
+
┃ ▄▄▀▀
|
949
|
+
┃ ▄▄▀
|
950
|
+
┃ ▄▄▀
|
951
|
+
┃ ▄▄▀
|
952
|
+
┃ ▄▀
|
953
|
+
┃ ▄▄▀
|
954
|
+
┃ ▄▀
|
955
|
+
┃ ▄▀
|
956
|
+
┃ ▄▀
|
957
|
+
┃ ▄▀
|
958
|
+
┃▄▀▀
|
959
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
960
|
+
```
|
961
|
+
|
962
|
+
```
|
963
|
+
# quadratic (in_out)
|
964
|
+
┃ ▄▄▄▀▀▀▀▀▀▀
|
965
|
+
┃ ▄▄▀▀▀
|
966
|
+
┃ ▄▀▀
|
967
|
+
┃ ▄▀▀
|
968
|
+
┃ ▄▄▀
|
969
|
+
┃ ▄▀
|
970
|
+
┃ ▄▀
|
971
|
+
┃ ▄▀
|
972
|
+
┃ ▄▀
|
973
|
+
┃ ▄▀
|
974
|
+
┃ ▄▀▀
|
975
|
+
┃ ▄▄▀
|
976
|
+
┃ ▄▄▀
|
977
|
+
┃ ▄▄▄▀▀
|
978
|
+
┃▄▄▄▄▄▄▄▄▀▀▀
|
979
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
980
|
+
```
|
981
|
+
|
982
|
+
### Full template example
|
700
983
|
|
701
984
|
```ruby
|
702
985
|
class TemplateFactory
|
@@ -744,64 +1027,120 @@ class TemplateFactory
|
|
744
1027
|
end
|
745
1028
|
```
|
746
1029
|
|
747
|
-
###
|
1030
|
+
### Full usage
|
1031
|
+
|
1032
|
+
```
|
1033
|
+
Usage: whirled_peas <command> [command options]
|
1034
|
+
|
1035
|
+
Available commands:
|
748
1036
|
|
749
|
-
|
1037
|
+
debug Print template tree for specified frame
|
1038
|
+
fonts List installed title fonts with sample text
|
1039
|
+
frames Print out list of frames generated by application
|
1040
|
+
help Show detailed help for a command
|
1041
|
+
play Play an animation from an application or prerecorded file
|
1042
|
+
record Record animation to a file
|
1043
|
+
still Show the specified still frame
|
1044
|
+
themes List all themes with sample template rendered in the theme
|
1045
|
+
```
|
750
1046
|
|
751
|
-
####
|
1047
|
+
#### `debug`
|
752
1048
|
|
753
|
-
|
1049
|
+
Print the template tree for specified frame.
|
754
1050
|
|
755
1051
|
```
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
1052
|
+
# Usage: whirled_peas debug <config file> <frame> [args as a JSON string]
|
1053
|
+
% whirled_peas debug my_app.rb greeting '{"name":"World"}'
|
1054
|
+
* WhirledPeas::Graphics::BoxPainter(TEMPLATE)
|
1055
|
+
- Dimensions(outer=140x27, content=120x15, grid=1x1)
|
1056
|
+
- Settings
|
1057
|
+
WhirledPeas::Settings::BoxSettings
|
1058
|
+
padding: Padding(left: 10, top: 6, right: 10, bottom: 6)
|
1059
|
+
align: :center
|
1060
|
+
width: 120
|
1061
|
+
flow: :t2b
|
1062
|
+
bold: true
|
1063
|
+
bg_color: BgColor(code=107, bright=true)
|
1064
|
+
- Children
|
1065
|
+
* WhirledPeas::Graphics::BoxPainter(Element-1)
|
1066
|
+
- Dimensions(outer=64x6, content=64x6, grid=1x1)
|
761
1067
|
```
|
762
1068
|
|
763
|
-
####
|
1069
|
+
#### `fonts`
|
764
1070
|
|
765
|
-
|
1071
|
+
List all installed title fonts with sample text.
|
766
1072
|
|
767
1073
|
```
|
768
|
-
|
1074
|
+
# Usage: whirled_peas fonts
|
769
1075
|
```
|
770
1076
|
|
771
|
-
|
1077
|
+
#### `frames`
|
1078
|
+
|
1079
|
+
Print out list of frames generated by application.
|
772
1080
|
|
773
1081
|
```
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
<default>
|
779
|
-
- Children
|
780
|
-
+ TitleContainer [WhirledPeas::Graphics::BoxPainter]
|
1082
|
+
# Usage: whirled_peas frames <config file>
|
1083
|
+
% whirled_peas frames my_app.rb
|
1084
|
+
Frame 'intro' displayed for 3 second(s) '{"title":"Foo"}'
|
1085
|
+
Frame 'greet' displayed for 0.3 second(s)
|
781
1086
|
...
|
782
1087
|
```
|
783
1088
|
|
784
|
-
|
1089
|
+
#### `help`
|
1090
|
+
|
1091
|
+
Print out command-specific help message
|
785
1092
|
|
786
|
-
|
1093
|
+
```
|
1094
|
+
Usage: whirled_peas help <command>
|
1095
|
+
```
|
787
1096
|
|
788
|
-
|
1097
|
+
#### `play`
|
1098
|
+
|
1099
|
+
Play an animation from an application or prerecorded file
|
789
1100
|
|
790
1101
|
```
|
791
|
-
|
1102
|
+
# Usage: whirled_peas play <config/wpz file>
|
1103
|
+
|
1104
|
+
# Play animation directly from app
|
1105
|
+
% whirled_peas play my_app.rb
|
1106
|
+
# Animation plays
|
1107
|
+
|
1108
|
+
# Play animation from previously recorded file
|
1109
|
+
% whirled_peas play my_animation.wpz
|
1110
|
+
# Animation plays
|
792
1111
|
```
|
793
1112
|
|
794
|
-
|
1113
|
+
#### `record`
|
1114
|
+
|
1115
|
+
Record animation to a file
|
795
1116
|
|
796
1117
|
```
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
1118
|
+
# Usage: whirled_peas record <config file> <output file>
|
1119
|
+
% whirled_peas record my_app.rb my_animation.wpz
|
1120
|
+
# Record animation to my_animation.wpz
|
1121
|
+
```
|
1122
|
+
|
1123
|
+
#### `still`
|
1124
|
+
|
1125
|
+
Show the specified still frame
|
1126
|
+
|
1127
|
+
```
|
1128
|
+
# Usage: whirled_peas still <config file> <frame> [args as a JSON string]
|
1129
|
+
% whirled_peas still my_app.rb greeting '{"name":"World"}'
|
1130
|
+
# Still frame is displayed
|
1131
|
+
```
|
1132
|
+
|
1133
|
+
#### `themes`
|
1134
|
+
|
1135
|
+
List all themes and display a small sample screen in each. Running this with no extra command line arguments will display all the built-in themes. Adding the path to a Whirled Peas configuration file will inlcude any themes defined in that configuration.
|
1136
|
+
|
1137
|
+
```
|
1138
|
+
# Usage: whirled_peas themes [config file]
|
1139
|
+
% whirled_peas themes
|
1140
|
+
# Display all system themes
|
1141
|
+
|
1142
|
+
% whirled_peas themes my_app.rb
|
1143
|
+
# Display app-defined themes and all system themes
|
805
1144
|
```
|
806
1145
|
|
807
1146
|
## Development
|
@@ -812,23 +1151,31 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
812
1151
|
|
813
1152
|
### Testing
|
814
1153
|
|
815
|
-
In addition to standard RSpec tests, WhirledPeas has custom tests for rendered templates. These files live in `screen_test
|
1154
|
+
In addition to standard RSpec tests, WhirledPeas has custom tests for rendered templates. These files live in `screen_test/`. Each ruby file is expected to define a class named `TemplateFactory` that responds to `#build(name, args)` returning a template (the standard template factory role). Each file should also be accompanied by a `.frame` file with the same base name. This file will contain the output of the rendered screen and is considered the correct output when running tests.
|
816
1155
|
|
817
1156
|
Note: viewing `.frame` files with `cat` works better than most other text editors.
|
818
1157
|
|
819
|
-
|
1158
|
+
```
|
1159
|
+
|
1160
|
+
Usage: screen_test [file] [options]
|
1161
|
+
|
1162
|
+
If not file or options are provide, all tests are run
|
820
1163
|
|
821
|
-
|
822
|
-
|
823
|
-
-
|
824
|
-
-
|
825
|
-
|
826
|
-
|
827
|
-
|
1164
|
+
If no file is provided, the supported options are
|
1165
|
+
--help print this usage statement and exit
|
1166
|
+
--view-pending interactively display and optionally save rendered output for each pending test
|
1167
|
+
--view-failed interactively display and optionally save rendered output for each faiing test
|
1168
|
+
|
1169
|
+
If a screen test file is provided as the first argument, the supported options are
|
1170
|
+
--run run screen test for given file
|
1171
|
+
--view interactively display and optionally save the file's test output
|
1172
|
+
--template print out template tree for the test template
|
1173
|
+
--debug render the test template without displying it, printing out debug information
|
1174
|
+
```
|
828
1175
|
|
829
1176
|
## Contributing
|
830
1177
|
|
831
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
1178
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/tcollier/whirled_peas. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/tcollier/whirled_peas/blob/master/CODE_OF_CONDUCT.md).
|
832
1179
|
|
833
1180
|
## License
|
834
1181
|
|
@@ -836,4 +1183,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
836
1183
|
|
837
1184
|
## Code of Conduct
|
838
1185
|
|
839
|
-
Everyone interacting in the WhirledPeas project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
1186
|
+
Everyone interacting in the WhirledPeas project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/tcollier/whirled_peas/blob/master/CODE_OF_CONDUCT.md).
|