whirled_peas 0.4.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (214) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -0
  3. data/CHANGELOG.md +38 -0
  4. data/README.md +450 -103
  5. data/Rakefile +28 -3
  6. data/examples/intro.rb +52 -0
  7. data/examples/scrolling.rb +53 -0
  8. data/lib/whirled_peas.rb +4 -8
  9. data/lib/whirled_peas/command_line.rb +44 -55
  10. data/lib/whirled_peas/errors.rb +2 -0
  11. data/lib/whirled_peas/frame.rb +0 -1
  12. data/lib/whirled_peas/frame/consumer.rb +30 -0
  13. data/lib/whirled_peas/frame/debug_consumer.rb +30 -0
  14. data/lib/whirled_peas/frame/event_loop.rb +28 -29
  15. data/lib/whirled_peas/frame/producer.rb +11 -5
  16. data/lib/whirled_peas/graphics.rb +19 -0
  17. data/lib/whirled_peas/graphics/box_painter.rb +101 -0
  18. data/lib/whirled_peas/graphics/canvas.rb +118 -0
  19. data/lib/whirled_peas/graphics/composer.rb +80 -0
  20. data/lib/whirled_peas/graphics/container_coords.rb +72 -0
  21. data/lib/whirled_peas/graphics/container_dimensions.rb +93 -0
  22. data/lib/whirled_peas/graphics/container_painter.rb +272 -0
  23. data/lib/whirled_peas/graphics/debugger.rb +52 -0
  24. data/lib/whirled_peas/graphics/grid_painter.rb +69 -0
  25. data/lib/whirled_peas/graphics/mock_screen.rb +26 -0
  26. data/lib/whirled_peas/graphics/painter.rb +23 -0
  27. data/lib/whirled_peas/graphics/renderer.rb +26 -0
  28. data/lib/whirled_peas/graphics/screen.rb +70 -0
  29. data/lib/whirled_peas/graphics/text_dimensions.rb +15 -0
  30. data/lib/whirled_peas/graphics/text_painter.rb +40 -0
  31. data/lib/whirled_peas/settings.rb +5 -0
  32. data/lib/whirled_peas/settings/alignment.rb +24 -0
  33. data/lib/whirled_peas/settings/bg_color.rb +24 -0
  34. data/lib/whirled_peas/settings/border.rb +101 -0
  35. data/lib/whirled_peas/settings/box_settings.rb +8 -0
  36. data/lib/whirled_peas/settings/color.rb +68 -0
  37. data/lib/whirled_peas/settings/container_settings.rb +223 -0
  38. data/lib/whirled_peas/settings/debugger.rb +96 -0
  39. data/lib/whirled_peas/settings/display_flow.rb +27 -0
  40. data/lib/whirled_peas/settings/element_settings.rb +61 -0
  41. data/lib/whirled_peas/settings/grid_settings.rb +19 -0
  42. data/lib/whirled_peas/settings/margin.rb +8 -0
  43. data/lib/whirled_peas/settings/padding.rb +8 -0
  44. data/lib/whirled_peas/settings/position.rb +15 -0
  45. data/lib/whirled_peas/settings/scrollbar.rb +15 -0
  46. data/lib/whirled_peas/settings/sizing.rb +19 -0
  47. data/lib/whirled_peas/settings/spacing.rb +58 -0
  48. data/lib/whirled_peas/settings/text_color.rb +21 -0
  49. data/lib/whirled_peas/settings/text_settings.rb +15 -0
  50. data/lib/whirled_peas/settings/vert_alignment.rb +24 -0
  51. data/lib/whirled_peas/utils/ansi.rb +6 -56
  52. data/lib/whirled_peas/utils/formatted_string.rb +64 -0
  53. data/lib/whirled_peas/utils/title_font.rb +1 -1
  54. data/lib/whirled_peas/version.rb +1 -1
  55. data/screen_test/elements/box.frame +1 -0
  56. data/screen_test/elements/box.rb +20 -0
  57. data/screen_test/elements/grid.frame +1 -0
  58. data/screen_test/elements/grid.rb +13 -0
  59. data/screen_test/elements/screen_overflow_x.frame +1 -0
  60. data/screen_test/elements/screen_overflow_x.rb +9 -0
  61. data/screen_test/elements/screen_overflow_y.frame +1 -0
  62. data/screen_test/elements/screen_overflow_y.rb +9 -0
  63. data/screen_test/elements/text.frame +1 -0
  64. data/screen_test/elements/text.rb +9 -0
  65. data/screen_test/elements/text_multiline.frame +1 -0
  66. data/screen_test/elements/text_multiline.rb +9 -0
  67. data/screen_test/settings/align/box_around.frame +1 -0
  68. data/screen_test/settings/align/box_around.rb +16 -0
  69. data/screen_test/settings/align/box_between.frame +1 -0
  70. data/screen_test/settings/align/box_between.rb +16 -0
  71. data/screen_test/settings/align/box_center.frame +1 -0
  72. data/screen_test/settings/align/box_center.rb +21 -0
  73. data/screen_test/settings/align/box_default.frame +1 -0
  74. data/screen_test/settings/align/box_default.rb +20 -0
  75. data/screen_test/settings/align/box_evenly.frame +1 -0
  76. data/screen_test/settings/align/box_evenly.rb +16 -0
  77. data/screen_test/settings/align/box_left.frame +1 -0
  78. data/screen_test/settings/align/box_left.rb +21 -0
  79. data/screen_test/settings/align/box_right.frame +1 -0
  80. data/screen_test/settings/align/box_right.rb +21 -0
  81. data/screen_test/settings/align/children_center.frame +1 -0
  82. data/screen_test/settings/align/children_center.rb +15 -0
  83. data/screen_test/settings/align/children_left.frame +1 -0
  84. data/screen_test/settings/align/children_left.rb +15 -0
  85. data/screen_test/settings/align/children_right.frame +1 -0
  86. data/screen_test/settings/align/children_right.rb +15 -0
  87. data/screen_test/settings/align/grid_center.frame +1 -0
  88. data/screen_test/settings/align/grid_center.rb +18 -0
  89. data/screen_test/settings/align/grid_default.frame +1 -0
  90. data/screen_test/settings/align/grid_default.rb +17 -0
  91. data/screen_test/settings/align/grid_left.frame +1 -0
  92. data/screen_test/settings/align/grid_left.rb +18 -0
  93. data/screen_test/settings/align/grid_right.frame +1 -0
  94. data/screen_test/settings/align/grid_right.rb +18 -0
  95. data/screen_test/settings/ansi/bold.frame +1 -0
  96. data/screen_test/settings/ansi/bold.rb +14 -0
  97. data/screen_test/settings/ansi/color.frame +1 -0
  98. data/screen_test/settings/ansi/color.rb +37 -0
  99. data/screen_test/settings/ansi/underline.frame +1 -0
  100. data/screen_test/settings/ansi/underline.rb +14 -0
  101. data/screen_test/settings/border.frame +1 -0
  102. data/screen_test/settings/border.rb +13 -0
  103. data/screen_test/settings/flow/box_b2t.frame +1 -0
  104. data/screen_test/settings/flow/box_b2t.rb +26 -0
  105. data/screen_test/settings/flow/box_l2r.frame +1 -0
  106. data/screen_test/settings/flow/box_l2r.rb +26 -0
  107. data/screen_test/settings/flow/box_r2l.frame +1 -0
  108. data/screen_test/settings/flow/box_r2l.rb +26 -0
  109. data/screen_test/settings/flow/box_t2b.frame +1 -0
  110. data/screen_test/settings/flow/box_t2b.rb +26 -0
  111. data/screen_test/settings/flow/grid_b2t.frame +1 -0
  112. data/screen_test/settings/flow/grid_b2t.rb +14 -0
  113. data/screen_test/settings/flow/grid_l2r.frame +1 -0
  114. data/screen_test/settings/flow/grid_l2r.rb +14 -0
  115. data/screen_test/settings/flow/grid_r2l.frame +1 -0
  116. data/screen_test/settings/flow/grid_r2l.rb +14 -0
  117. data/screen_test/settings/flow/grid_t2b.frame +1 -0
  118. data/screen_test/settings/flow/grid_t2b.rb +14 -0
  119. data/screen_test/settings/height/box.frame +1 -0
  120. data/screen_test/settings/height/box.rb +13 -0
  121. data/screen_test/settings/height/box_border_sizing.frame +1 -0
  122. data/screen_test/settings/height/box_border_sizing.rb +15 -0
  123. data/screen_test/settings/height/grid.frame +1 -0
  124. data/screen_test/settings/height/grid.rb +14 -0
  125. data/screen_test/settings/height/overflow_box.frame +1 -0
  126. data/screen_test/settings/height/overflow_box.rb +13 -0
  127. data/screen_test/settings/height/overflow_box_l2r.frame +1 -0
  128. data/screen_test/settings/height/overflow_box_l2r.rb +17 -0
  129. data/screen_test/settings/height/overflow_box_t2b.frame +1 -0
  130. data/screen_test/settings/height/overflow_box_t2b.rb +16 -0
  131. data/screen_test/settings/height/overflow_grid.frame +1 -0
  132. data/screen_test/settings/height/overflow_grid.rb +16 -0
  133. data/screen_test/settings/margin.frame +1 -0
  134. data/screen_test/settings/margin.rb +16 -0
  135. data/screen_test/settings/padding.frame +1 -0
  136. data/screen_test/settings/padding.rb +13 -0
  137. data/screen_test/settings/position/box_left.frame +1 -0
  138. data/screen_test/settings/position/box_left.rb +17 -0
  139. data/screen_test/settings/position/box_left_negative.frame +1 -0
  140. data/screen_test/settings/position/box_left_negative.rb +17 -0
  141. data/screen_test/settings/position/box_top.frame +1 -0
  142. data/screen_test/settings/position/box_top.rb +17 -0
  143. data/screen_test/settings/position/box_top_negative.frame +1 -0
  144. data/screen_test/settings/position/box_top_negative.rb +17 -0
  145. data/screen_test/settings/position/grid_left.frame +1 -0
  146. data/screen_test/settings/position/grid_left.rb +18 -0
  147. data/screen_test/settings/position/grid_left_negative.frame +1 -0
  148. data/screen_test/settings/position/grid_left_negative.rb +18 -0
  149. data/screen_test/settings/position/grid_top.frame +1 -0
  150. data/screen_test/settings/position/grid_top.rb +18 -0
  151. data/screen_test/settings/position/grid_top_negative.frame +1 -0
  152. data/screen_test/settings/position/grid_top_negative.rb +18 -0
  153. data/screen_test/settings/scroll/horiz_box.frame +1 -0
  154. data/screen_test/settings/scroll/horiz_box.rb +17 -0
  155. data/screen_test/settings/scroll/horiz_box_align_center.rb +18 -0
  156. data/screen_test/settings/scroll/horiz_box_align_right.rb +18 -0
  157. data/screen_test/settings/scroll/vert_box.frame +1 -0
  158. data/screen_test/settings/scroll/vert_box.rb +20 -0
  159. data/screen_test/settings/title_font.frame +1 -0
  160. data/screen_test/settings/title_font.rb +12 -0
  161. data/screen_test/settings/valign/box_around.frame +1 -0
  162. data/screen_test/settings/valign/box_around.rb +17 -0
  163. data/screen_test/settings/valign/box_between.frame +1 -0
  164. data/screen_test/settings/valign/box_between.rb +17 -0
  165. data/screen_test/settings/valign/box_bottom.frame +1 -0
  166. data/screen_test/settings/valign/box_bottom.rb +17 -0
  167. data/screen_test/settings/valign/box_default.frame +1 -0
  168. data/screen_test/settings/valign/box_default.rb +16 -0
  169. data/screen_test/settings/valign/box_evenly.frame +1 -0
  170. data/screen_test/settings/valign/box_evenly.rb +17 -0
  171. data/screen_test/settings/valign/box_middle.frame +1 -0
  172. data/screen_test/settings/valign/box_middle.rb +17 -0
  173. data/screen_test/settings/valign/box_top.frame +1 -0
  174. data/screen_test/settings/valign/box_top.rb +17 -0
  175. data/screen_test/settings/valign/grid_bottom.frame +1 -0
  176. data/screen_test/settings/valign/grid_bottom.rb +15 -0
  177. data/screen_test/settings/valign/grid_default.frame +1 -0
  178. data/screen_test/settings/valign/grid_default.rb +14 -0
  179. data/screen_test/settings/valign/grid_middle.frame +1 -0
  180. data/screen_test/settings/valign/grid_middle.rb +15 -0
  181. data/screen_test/settings/valign/grid_top.frame +1 -0
  182. data/screen_test/settings/valign/grid_top.rb +15 -0
  183. data/screen_test/settings/width/box_border_sizing.frame +1 -0
  184. data/screen_test/settings/width/box_border_sizing.rb +15 -0
  185. data/screen_test/settings/width/box_content.frame +1 -0
  186. data/screen_test/settings/width/box_content.rb +15 -0
  187. data/screen_test/settings/width/box_default.frame +1 -0
  188. data/screen_test/settings/width/box_default.rb +14 -0
  189. data/screen_test/settings/width/grid.frame +1 -0
  190. data/screen_test/settings/width/grid.rb +14 -0
  191. data/screen_test/settings/width/overflow_align_center.frame +1 -0
  192. data/screen_test/settings/width/overflow_align_center.rb +14 -0
  193. data/screen_test/settings/width/overflow_align_right.frame +1 -0
  194. data/screen_test/settings/width/overflow_align_right.rb +14 -0
  195. data/screen_test/settings/width/overflow_box.frame +1 -0
  196. data/screen_test/settings/width/overflow_box.rb +13 -0
  197. data/screen_test/settings/width/overflow_box_l2r.frame +1 -0
  198. data/screen_test/settings/width/overflow_box_l2r.rb +16 -0
  199. data/screen_test/settings/width/overflow_box_t2b.frame +1 -0
  200. data/screen_test/settings/width/overflow_box_t2b.rb +17 -0
  201. data/screen_test/settings/width/overflow_grid.frame +1 -0
  202. data/screen_test/settings/width/overflow_grid.rb +14 -0
  203. data/tools/whirled_peas/tools/screen_tester.rb +233 -0
  204. metadata +191 -12
  205. data/bin/title_fonts +0 -6
  206. data/lib/whirled_peas/frame/print_consumer.rb +0 -33
  207. data/lib/whirled_peas/template.rb +0 -5
  208. data/lib/whirled_peas/template/element.rb +0 -230
  209. data/lib/whirled_peas/template/settings.rb +0 -530
  210. data/lib/whirled_peas/ui.rb +0 -5
  211. data/lib/whirled_peas/ui/canvas.rb +0 -68
  212. data/lib/whirled_peas/ui/painter.rb +0 -287
  213. data/lib/whirled_peas/ui/screen.rb +0 -63
  214. data/lib/whirled_peas/utils/color.rb +0 -101
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whirled_peas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Collier
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-22 00:00:00.000000000 Z
11
+ date: 2021-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline
@@ -71,29 +71,208 @@ files:
71
71
  - Rakefile
72
72
  - bin/console
73
73
  - bin/setup
74
- - bin/title_fonts
74
+ - examples/intro.rb
75
+ - examples/scrolling.rb
75
76
  - exe/whirled_peas
76
77
  - lib/whirled_peas.rb
77
78
  - lib/whirled_peas/command_line.rb
78
79
  - lib/whirled_peas/config.rb
79
80
  - lib/whirled_peas/errors.rb
80
81
  - lib/whirled_peas/frame.rb
82
+ - lib/whirled_peas/frame/consumer.rb
83
+ - lib/whirled_peas/frame/debug_consumer.rb
81
84
  - lib/whirled_peas/frame/event_loop.rb
82
- - lib/whirled_peas/frame/print_consumer.rb
83
85
  - lib/whirled_peas/frame/producer.rb
86
+ - lib/whirled_peas/graphics.rb
87
+ - lib/whirled_peas/graphics/box_painter.rb
88
+ - lib/whirled_peas/graphics/canvas.rb
89
+ - lib/whirled_peas/graphics/composer.rb
90
+ - lib/whirled_peas/graphics/container_coords.rb
91
+ - lib/whirled_peas/graphics/container_dimensions.rb
92
+ - lib/whirled_peas/graphics/container_painter.rb
93
+ - lib/whirled_peas/graphics/debugger.rb
94
+ - lib/whirled_peas/graphics/grid_painter.rb
95
+ - lib/whirled_peas/graphics/mock_screen.rb
96
+ - lib/whirled_peas/graphics/painter.rb
97
+ - lib/whirled_peas/graphics/renderer.rb
98
+ - lib/whirled_peas/graphics/screen.rb
99
+ - lib/whirled_peas/graphics/text_dimensions.rb
100
+ - lib/whirled_peas/graphics/text_painter.rb
84
101
  - lib/whirled_peas/null_logger.rb
85
- - lib/whirled_peas/template.rb
86
- - lib/whirled_peas/template/element.rb
87
- - lib/whirled_peas/template/settings.rb
88
- - lib/whirled_peas/ui.rb
89
- - lib/whirled_peas/ui/canvas.rb
90
- - lib/whirled_peas/ui/painter.rb
91
- - lib/whirled_peas/ui/screen.rb
102
+ - lib/whirled_peas/settings.rb
103
+ - lib/whirled_peas/settings/alignment.rb
104
+ - lib/whirled_peas/settings/bg_color.rb
105
+ - lib/whirled_peas/settings/border.rb
106
+ - lib/whirled_peas/settings/box_settings.rb
107
+ - lib/whirled_peas/settings/color.rb
108
+ - lib/whirled_peas/settings/container_settings.rb
109
+ - lib/whirled_peas/settings/debugger.rb
110
+ - lib/whirled_peas/settings/display_flow.rb
111
+ - lib/whirled_peas/settings/element_settings.rb
112
+ - lib/whirled_peas/settings/grid_settings.rb
113
+ - lib/whirled_peas/settings/margin.rb
114
+ - lib/whirled_peas/settings/padding.rb
115
+ - lib/whirled_peas/settings/position.rb
116
+ - lib/whirled_peas/settings/scrollbar.rb
117
+ - lib/whirled_peas/settings/sizing.rb
118
+ - lib/whirled_peas/settings/spacing.rb
119
+ - lib/whirled_peas/settings/text_color.rb
120
+ - lib/whirled_peas/settings/text_settings.rb
121
+ - lib/whirled_peas/settings/vert_alignment.rb
92
122
  - lib/whirled_peas/utils.rb
93
123
  - lib/whirled_peas/utils/ansi.rb
94
- - lib/whirled_peas/utils/color.rb
124
+ - lib/whirled_peas/utils/formatted_string.rb
95
125
  - lib/whirled_peas/utils/title_font.rb
96
126
  - lib/whirled_peas/version.rb
127
+ - screen_test/elements/box.frame
128
+ - screen_test/elements/box.rb
129
+ - screen_test/elements/grid.frame
130
+ - screen_test/elements/grid.rb
131
+ - screen_test/elements/screen_overflow_x.frame
132
+ - screen_test/elements/screen_overflow_x.rb
133
+ - screen_test/elements/screen_overflow_y.frame
134
+ - screen_test/elements/screen_overflow_y.rb
135
+ - screen_test/elements/text.frame
136
+ - screen_test/elements/text.rb
137
+ - screen_test/elements/text_multiline.frame
138
+ - screen_test/elements/text_multiline.rb
139
+ - screen_test/settings/align/box_around.frame
140
+ - screen_test/settings/align/box_around.rb
141
+ - screen_test/settings/align/box_between.frame
142
+ - screen_test/settings/align/box_between.rb
143
+ - screen_test/settings/align/box_center.frame
144
+ - screen_test/settings/align/box_center.rb
145
+ - screen_test/settings/align/box_default.frame
146
+ - screen_test/settings/align/box_default.rb
147
+ - screen_test/settings/align/box_evenly.frame
148
+ - screen_test/settings/align/box_evenly.rb
149
+ - screen_test/settings/align/box_left.frame
150
+ - screen_test/settings/align/box_left.rb
151
+ - screen_test/settings/align/box_right.frame
152
+ - screen_test/settings/align/box_right.rb
153
+ - screen_test/settings/align/children_center.frame
154
+ - screen_test/settings/align/children_center.rb
155
+ - screen_test/settings/align/children_left.frame
156
+ - screen_test/settings/align/children_left.rb
157
+ - screen_test/settings/align/children_right.frame
158
+ - screen_test/settings/align/children_right.rb
159
+ - screen_test/settings/align/grid_center.frame
160
+ - screen_test/settings/align/grid_center.rb
161
+ - screen_test/settings/align/grid_default.frame
162
+ - screen_test/settings/align/grid_default.rb
163
+ - screen_test/settings/align/grid_left.frame
164
+ - screen_test/settings/align/grid_left.rb
165
+ - screen_test/settings/align/grid_right.frame
166
+ - screen_test/settings/align/grid_right.rb
167
+ - screen_test/settings/ansi/bold.frame
168
+ - screen_test/settings/ansi/bold.rb
169
+ - screen_test/settings/ansi/color.frame
170
+ - screen_test/settings/ansi/color.rb
171
+ - screen_test/settings/ansi/underline.frame
172
+ - screen_test/settings/ansi/underline.rb
173
+ - screen_test/settings/border.frame
174
+ - screen_test/settings/border.rb
175
+ - screen_test/settings/flow/box_b2t.frame
176
+ - screen_test/settings/flow/box_b2t.rb
177
+ - screen_test/settings/flow/box_l2r.frame
178
+ - screen_test/settings/flow/box_l2r.rb
179
+ - screen_test/settings/flow/box_r2l.frame
180
+ - screen_test/settings/flow/box_r2l.rb
181
+ - screen_test/settings/flow/box_t2b.frame
182
+ - screen_test/settings/flow/box_t2b.rb
183
+ - screen_test/settings/flow/grid_b2t.frame
184
+ - screen_test/settings/flow/grid_b2t.rb
185
+ - screen_test/settings/flow/grid_l2r.frame
186
+ - screen_test/settings/flow/grid_l2r.rb
187
+ - screen_test/settings/flow/grid_r2l.frame
188
+ - screen_test/settings/flow/grid_r2l.rb
189
+ - screen_test/settings/flow/grid_t2b.frame
190
+ - screen_test/settings/flow/grid_t2b.rb
191
+ - screen_test/settings/height/box.frame
192
+ - screen_test/settings/height/box.rb
193
+ - screen_test/settings/height/box_border_sizing.frame
194
+ - screen_test/settings/height/box_border_sizing.rb
195
+ - screen_test/settings/height/grid.frame
196
+ - screen_test/settings/height/grid.rb
197
+ - screen_test/settings/height/overflow_box.frame
198
+ - screen_test/settings/height/overflow_box.rb
199
+ - screen_test/settings/height/overflow_box_l2r.frame
200
+ - screen_test/settings/height/overflow_box_l2r.rb
201
+ - screen_test/settings/height/overflow_box_t2b.frame
202
+ - screen_test/settings/height/overflow_box_t2b.rb
203
+ - screen_test/settings/height/overflow_grid.frame
204
+ - screen_test/settings/height/overflow_grid.rb
205
+ - screen_test/settings/margin.frame
206
+ - screen_test/settings/margin.rb
207
+ - screen_test/settings/padding.frame
208
+ - screen_test/settings/padding.rb
209
+ - screen_test/settings/position/box_left.frame
210
+ - screen_test/settings/position/box_left.rb
211
+ - screen_test/settings/position/box_left_negative.frame
212
+ - screen_test/settings/position/box_left_negative.rb
213
+ - screen_test/settings/position/box_top.frame
214
+ - screen_test/settings/position/box_top.rb
215
+ - screen_test/settings/position/box_top_negative.frame
216
+ - screen_test/settings/position/box_top_negative.rb
217
+ - screen_test/settings/position/grid_left.frame
218
+ - screen_test/settings/position/grid_left.rb
219
+ - screen_test/settings/position/grid_left_negative.frame
220
+ - screen_test/settings/position/grid_left_negative.rb
221
+ - screen_test/settings/position/grid_top.frame
222
+ - screen_test/settings/position/grid_top.rb
223
+ - screen_test/settings/position/grid_top_negative.frame
224
+ - screen_test/settings/position/grid_top_negative.rb
225
+ - screen_test/settings/scroll/horiz_box.frame
226
+ - screen_test/settings/scroll/horiz_box.rb
227
+ - screen_test/settings/scroll/horiz_box_align_center.rb
228
+ - screen_test/settings/scroll/horiz_box_align_right.rb
229
+ - screen_test/settings/scroll/vert_box.frame
230
+ - screen_test/settings/scroll/vert_box.rb
231
+ - screen_test/settings/title_font.frame
232
+ - screen_test/settings/title_font.rb
233
+ - screen_test/settings/valign/box_around.frame
234
+ - screen_test/settings/valign/box_around.rb
235
+ - screen_test/settings/valign/box_between.frame
236
+ - screen_test/settings/valign/box_between.rb
237
+ - screen_test/settings/valign/box_bottom.frame
238
+ - screen_test/settings/valign/box_bottom.rb
239
+ - screen_test/settings/valign/box_default.frame
240
+ - screen_test/settings/valign/box_default.rb
241
+ - screen_test/settings/valign/box_evenly.frame
242
+ - screen_test/settings/valign/box_evenly.rb
243
+ - screen_test/settings/valign/box_middle.frame
244
+ - screen_test/settings/valign/box_middle.rb
245
+ - screen_test/settings/valign/box_top.frame
246
+ - screen_test/settings/valign/box_top.rb
247
+ - screen_test/settings/valign/grid_bottom.frame
248
+ - screen_test/settings/valign/grid_bottom.rb
249
+ - screen_test/settings/valign/grid_default.frame
250
+ - screen_test/settings/valign/grid_default.rb
251
+ - screen_test/settings/valign/grid_middle.frame
252
+ - screen_test/settings/valign/grid_middle.rb
253
+ - screen_test/settings/valign/grid_top.frame
254
+ - screen_test/settings/valign/grid_top.rb
255
+ - screen_test/settings/width/box_border_sizing.frame
256
+ - screen_test/settings/width/box_border_sizing.rb
257
+ - screen_test/settings/width/box_content.frame
258
+ - screen_test/settings/width/box_content.rb
259
+ - screen_test/settings/width/box_default.frame
260
+ - screen_test/settings/width/box_default.rb
261
+ - screen_test/settings/width/grid.frame
262
+ - screen_test/settings/width/grid.rb
263
+ - screen_test/settings/width/overflow_align_center.frame
264
+ - screen_test/settings/width/overflow_align_center.rb
265
+ - screen_test/settings/width/overflow_align_right.frame
266
+ - screen_test/settings/width/overflow_align_right.rb
267
+ - screen_test/settings/width/overflow_box.frame
268
+ - screen_test/settings/width/overflow_box.rb
269
+ - screen_test/settings/width/overflow_box_l2r.frame
270
+ - screen_test/settings/width/overflow_box_l2r.rb
271
+ - screen_test/settings/width/overflow_box_t2b.frame
272
+ - screen_test/settings/width/overflow_box_t2b.rb
273
+ - screen_test/settings/width/overflow_grid.frame
274
+ - screen_test/settings/width/overflow_grid.rb
275
+ - tools/whirled_peas/tools/screen_tester.rb
97
276
  - whirled_peas.gemspec
98
277
  homepage: https://github.com/tcollier/whirled_peas
99
278
  licenses:
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'bundler/setup'
4
- require 'whirled_peas'
5
-
6
- WhirledPeas.print_title_fonts
@@ -1,33 +0,0 @@
1
- require_relative '../null_logger'
2
-
3
- module WhirledPeas
4
- module Frame
5
- class PrintConsumer
6
- LOGGER_ID = 'EVENT LOOP'
7
-
8
- def initialize(logger=NullLogger.new)
9
- @logger = logger
10
- end
11
-
12
- def enqueue(name, duration, args)
13
- if name == Frame::EOF
14
- puts "EOF frame detected"
15
- else
16
- displayed_for = duration ? "#{duration} second(s)" : '1 frame'
17
- args_str = args.empty? ? '' : " (#{args.inspect})"
18
- puts "Frame '#{name}' displayed for #{displayed_for}#{args_str}"
19
- end
20
- end
21
-
22
- def start
23
- end
24
-
25
- def stop
26
- end
27
-
28
- private
29
-
30
- attr_reader :logger
31
- end
32
- end
33
- end
@@ -1,5 +0,0 @@
1
- module WhirledPeas
2
- module Template
3
- end
4
- private_constant :Template
5
- end
@@ -1,230 +0,0 @@
1
- require_relative '../utils/title_font'
2
-
3
- require_relative 'settings'
4
-
5
- module WhirledPeas
6
- module UI
7
- STRINGALBE_CLASSES = [FalseClass, Float, Integer, NilClass, String, Symbol, TrueClass]
8
-
9
- class Element
10
- attr_accessor :preferred_width, :preferred_height
11
- attr_reader :name, :settings
12
-
13
- def initialize(name, settings)
14
- @name = name
15
- @settings = settings
16
- end
17
- end
18
- private_constant :Element
19
-
20
- class TextElement < Element
21
- attr_reader :lines
22
-
23
- def initialize(name, settings)
24
- super(name, TextSettings.merge(settings))
25
- end
26
-
27
- def lines=(val)
28
- unless STRINGALBE_CLASSES.include?(val.class)
29
- raise ArgmentError, "Unsupported type for TextElement: #{val.class}"
30
- end
31
- if settings.title_font
32
- @lines = Utils::TitleFont.to_s(val.to_s, settings.title_font).split("\n")
33
- else
34
- @lines = [val.to_s]
35
- end
36
- @preferred_width = settings.width || @lines.first.length
37
- @preferred_height = @lines.length
38
- end
39
-
40
- def inspect(indent='')
41
- dims = unless preferred_width.nil?
42
- "#{indent + ' '}- Dimensions: #{preferred_width}x#{preferred_height}"
43
- end
44
- [
45
- "#{indent}+ #{name} [#{self.class.name}]",
46
- dims,
47
- "#{indent + ' '}- Settings",
48
- settings.inspect(indent + ' ')
49
- ].compact.join("\n")
50
- end
51
- end
52
-
53
- class ComposableElement < Element
54
- class << self
55
- def next_name
56
- @counter ||= 0
57
- @counter += 1
58
- "Element-#{@counter}"
59
- end
60
- end
61
-
62
- def initialize(name, settings)
63
- super
64
- end
65
-
66
- def children
67
- @children ||= []
68
- end
69
-
70
- def add_text(name=self.class.next_name, &block)
71
- element = TextElement.new(name, settings)
72
- element.lines = yield nil, element.settings
73
- children << element
74
- end
75
-
76
- def add_box(name=self.class.next_name, &block)
77
- element = BoxElement.new(name, settings)
78
- value = yield element, element.settings
79
- children << element
80
- if element.children.empty? && STRINGALBE_CLASSES.include?(value.class)
81
- element.add_text { value.to_s }
82
- end
83
- end
84
-
85
- def add_grid(name=self.class.next_name, &block)
86
- element = GridElement.new(name, settings)
87
- values = yield element, element.settings
88
- children << element
89
- if element.children.empty? && values.is_a?(Array)
90
- values.each { |v| element.add_text { v.to_s } }
91
- end
92
- end
93
-
94
- def inspect(indent='')
95
- kids = children.map { |c| c.inspect(indent + ' ') }.join("\n")
96
- dims = unless preferred_width.nil?
97
- "#{indent + ' '}- Dimensions: #{preferred_width}x#{preferred_height}"
98
- end
99
- [
100
- "#{indent}+ #{name} [#{self.class.name}]",
101
- dims,
102
- "#{indent + ' '}- Settings",
103
- settings.inspect(indent + ' '),
104
- "#{indent + ' '}- Children",
105
- kids
106
- ].compact.join("\n")
107
- end
108
-
109
- private
110
-
111
- def margin_width
112
- settings.margin.left + settings.margin.right
113
- end
114
-
115
- def margin_height
116
- settings.margin.top + settings.margin.bottom
117
- end
118
-
119
- def outer_border_width
120
- (settings.border.left? ? 1 : 0) + (settings.border.right? ? 1 : 0)
121
- end
122
-
123
- def outer_border_height
124
- (settings.border.top? ? 1 : 0) + (settings.border.bottom? ? 1 : 0)
125
- end
126
-
127
- def inner_border_width
128
- settings.border.inner_vert? ? 1 : 0
129
- end
130
-
131
- def inner_border_height
132
- settings.border.inner_horiz? ? 1 : 0
133
- end
134
-
135
- def padding_width
136
- settings.padding.left + settings.padding.right
137
- end
138
-
139
- def padding_height
140
- settings.padding.top + settings.padding.bottom
141
- end
142
- end
143
-
144
- class Template < ComposableElement
145
- def initialize(settings=TemplateSettings.new)
146
- super('TEMPLATE', settings)
147
- end
148
- end
149
-
150
- class BoxElement < ComposableElement
151
- attr_writer :content_width, :content_height
152
-
153
- def initialize(name, settings)
154
- super(name, BoxSettings.merge(settings))
155
- end
156
-
157
- def self.from_template(template, width, height)
158
- box = new(template.name, template.settings)
159
- template.children.each { |c| box.children << c }
160
- box.content_width = box.preferred_width = width
161
- box.content_height = box.preferred_height = height
162
- box
163
- end
164
-
165
- def content_width
166
- @content_width ||= begin
167
- child_widths = children.map(&:preferred_width)
168
- width = settings.horizontal_flow? ? child_widths.sum : (child_widths.max || 0)
169
- [width, *settings.width].max
170
- end
171
- end
172
-
173
- def preferred_width
174
- @preferred_width ||=
175
- margin_width + outer_border_width + padding_width + content_width
176
- end
177
-
178
- def content_height
179
- @content_height ||= begin
180
- child_heights = children.map(&:preferred_height)
181
- settings.vertical_flow? ? child_heights.sum : (child_heights.max || 0)
182
- end
183
- end
184
-
185
- def preferred_height
186
- @preferred_height ||=
187
- margin_height + outer_border_height + padding_height + content_height
188
- end
189
- end
190
-
191
- class GridElement < ComposableElement
192
- def initialize(name, settings)
193
- super(name, GridSettings.merge(settings))
194
- end
195
-
196
- def col_width
197
- return @col_width if @col_width
198
- @col_width = 0
199
- children.each do |child|
200
- @col_width = child.preferred_width if child.preferred_width > @col_width
201
- end
202
- @col_width
203
- end
204
-
205
- def row_height
206
- return @row_height if @row_height
207
- @row_height = 0
208
- children.each do |child|
209
- @row_height = child.preferred_height if child.preferred_height > @row_height
210
- end
211
- @row_height
212
- end
213
-
214
- def preferred_width
215
- margin_width +
216
- outer_border_width +
217
- settings.num_cols * (padding_width + col_width) +
218
- (settings.num_cols - 1) * inner_border_width
219
- end
220
-
221
- def preferred_height
222
- num_rows = (children.length / settings.num_cols).ceil
223
- margin_height +
224
- outer_border_height +
225
- num_rows * (padding_height + row_height) +
226
- (num_rows - 1) * inner_border_height
227
- end
228
- end
229
- end
230
- end